summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Smith <jake.smith@hdfgroup.org>2018-12-12 19:39:14 (GMT)
committerJacob Smith <jake.smith@hdfgroup.org>2018-12-12 23:26:08 (GMT)
commitea7332525010ef75e27ce5800cf65dd91ba43576 (patch)
tree19f440d677555c016dacc4a2cd28aaa80961e350 /src
parent496de6922fb13aa11a5c5efe56a3f8de157a77ad (diff)
parent6f52793adcd5a14aa63731e3c33c9737b5a04d16 (diff)
downloadhdf5-ea7332525010ef75e27ce5800cf65dd91ba43576.zip
hdf5-ea7332525010ef75e27ce5800cf65dd91ba43576.tar.gz
hdf5-ea7332525010ef75e27ce5800cf65dd91ba43576.tar.bz2
Merge branch 'develop' into dset_ohdr_minimize
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt285
-rw-r--r--src/H5.c26
-rw-r--r--src/H5A.c909
-rw-r--r--src/H5AC.c19
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5Adense.c174
-rw-r--r--src/H5Adeprec.c258
-rw-r--r--src/H5Aint.c579
-rw-r--r--src/H5Apkg.h30
-rw-r--r--src/H5Atest.c39
-rw-r--r--src/H5B.c4
-rw-r--r--src/H5B2.c2
-rw-r--r--src/H5B2hdr.c3
-rw-r--r--src/H5B2private.h3
-rw-r--r--src/H5Bdbg.c4
-rw-r--r--src/H5Bprivate.h1
-rw-r--r--src/H5C.c33
-rw-r--r--src/H5CX.c88
-rw-r--r--src/H5CXprivate.h2
-rw-r--r--src/H5Cimage.c14
-rw-r--r--src/H5Cquery.c8
-rw-r--r--src/H5Ctag.c2
-rw-r--r--src/H5Ctest.c5
-rw-r--r--src/H5D.c729
-rw-r--r--src/H5Dbtree.c9
-rw-r--r--src/H5Dbtree2.c2
-rw-r--r--src/H5Dchunk.c110
-rw-r--r--src/H5Ddbg.c32
-rw-r--r--src/H5Ddeprec.c230
-rw-r--r--src/H5Dfill.c2
-rw-r--r--src/H5Dint.c334
-rw-r--r--src/H5Dio.c139
-rw-r--r--src/H5Dlayout.c4
-rw-r--r--src/H5Dmpio.c21
-rw-r--r--src/H5Doh.c39
-rw-r--r--src/H5Dpkg.h34
-rw-r--r--src/H5Dprivate.h2
-rw-r--r--src/H5Dscatgath.c12
-rw-r--r--src/H5Dsingle.c8
-rw-r--r--src/H5Dtest.c21
-rw-r--r--src/H5Dvirtual.c23
-rw-r--r--src/H5E.c543
-rw-r--r--src/H5EApkg.h4
-rw-r--r--src/H5EAtest.c16
-rw-r--r--src/H5ESpublic.h (renamed from src/H5B2public.h)41
-rw-r--r--src/H5Edeprec.c138
-rw-r--r--src/H5Eint.c348
-rw-r--r--src/H5Epkg.h20
-rw-r--r--src/H5F.c1442
-rw-r--r--src/H5FApkg.h19
-rw-r--r--src/H5FAtest.c25
-rw-r--r--src/H5FD.c978
-rw-r--r--src/H5FDint.c167
-rw-r--r--src/H5FDlog.c16
-rw-r--r--src/H5FDmpi.c2
-rw-r--r--src/H5FDpkg.h9
-rw-r--r--src/H5FDprivate.h8
-rw-r--r--src/H5FDsec2.c16
-rw-r--r--src/H5FDspace.c16
-rw-r--r--src/H5FDtest.c11
-rw-r--r--src/H5FS.c68
-rw-r--r--src/H5FScache.c11
-rw-r--r--src/H5FSpkg.h20
-rw-r--r--src/H5FSprivate.h3
-rw-r--r--src/H5FSpublic.h52
-rw-r--r--src/H5FSsection.c297
-rw-r--r--src/H5FStest.c20
-rw-r--r--src/H5Fdeprec.c113
-rw-r--r--src/H5Fefc.c4
-rw-r--r--src/H5Fint.c1211
-rw-r--r--src/H5Fio.c6
-rw-r--r--src/H5Fmount.c37
-rw-r--r--src/H5Fmpi.c16
-rw-r--r--src/H5Fpkg.h79
-rw-r--r--src/H5Fprivate.h20
-rw-r--r--src/H5Fpublic.h3
-rw-r--r--src/H5Fquery.c16
-rw-r--r--src/H5Fsfile.c54
-rw-r--r--src/H5Fsuper.c115
-rw-r--r--src/H5Fsuper_cache.c1
-rw-r--r--src/H5Ftest.c148
-rw-r--r--src/H5G.c446
-rw-r--r--src/H5Gcompact.c99
-rw-r--r--src/H5Gdense.c82
-rw-r--r--src/H5Gdeprec.c1066
-rw-r--r--src/H5Gint.c327
-rw-r--r--src/H5Glink.c2
-rw-r--r--src/H5Gloc.c193
-rw-r--r--src/H5Gname.c70
-rw-r--r--src/H5Gobj.c3
-rw-r--r--src/H5Goh.c33
-rw-r--r--src/H5Gpkg.h40
-rw-r--r--src/H5Gprivate.h11
-rw-r--r--src/H5Gstab.c135
-rw-r--r--src/H5Gtest.c99
-rw-r--r--src/H5Gtraverse.c52
-rw-r--r--src/H5HF.c2
-rw-r--r--src/H5HFdbg.c15
-rw-r--r--src/H5HFhdr.c6
-rw-r--r--src/H5HFiblock.c348
-rw-r--r--src/H5HFman.c1
-rw-r--r--src/H5HFprivate.h15
-rw-r--r--src/H5HFpublic.h52
-rw-r--r--src/H5HFsection.c12
-rw-r--r--src/H5HFspace.c7
-rw-r--r--src/H5HG.c83
-rw-r--r--src/H5HGcache.c4
-rw-r--r--src/H5HGpkg.h2
-rw-r--r--src/H5HGprivate.h3
-rw-r--r--src/H5HLdbg.c46
-rw-r--r--src/H5HLprivate.h3
-rw-r--r--src/H5I.c438
-rw-r--r--src/H5Iprivate.h32
-rw-r--r--src/H5Ipublic.h7
-rw-r--r--src/H5Itest.c23
-rw-r--r--src/H5L.c1274
-rw-r--r--src/H5Lexternal.c110
-rw-r--r--src/H5Lprivate.h15
-rw-r--r--src/H5Lpublic.h4
-rw-r--r--src/H5MF.c3
-rw-r--r--src/H5MFprivate.h3
-rw-r--r--src/H5O.c531
-rw-r--r--src/H5Oalloc.c134
-rw-r--r--src/H5Oattr.c110
-rw-r--r--src/H5Oattribute.c326
-rw-r--r--src/H5Obogus.c2
-rw-r--r--src/H5Ocache.c22
-rw-r--r--src/H5Ochunk.c58
-rw-r--r--src/H5Ocont.c38
-rw-r--r--src/H5Ocopy.c145
-rw-r--r--src/H5Odbg.c125
-rw-r--r--src/H5Odeprec.c119
-rw-r--r--src/H5Odtype.c23
-rw-r--r--src/H5Ofill.c12
-rw-r--r--src/H5Oflush.c247
-rw-r--r--src/H5Oginfo.c4
-rw-r--r--src/H5Oint.c512
-rw-r--r--src/H5Olayout.c8
-rw-r--r--src/H5Olinfo.c12
-rw-r--r--src/H5Olink.c17
-rw-r--r--src/H5Omessage.c84
-rw-r--r--src/H5Omtime.c4
-rw-r--r--src/H5Opkg.h76
-rw-r--r--src/H5Oprivate.h23
-rw-r--r--src/H5Oshared.c107
-rw-r--r--src/H5Oshared.h24
-rw-r--r--src/H5Ostab.c44
-rw-r--r--src/H5Otest.c136
-rw-r--r--src/H5Ounknown.c6
-rw-r--r--src/H5P.c134
-rw-r--r--src/H5PBprivate.h6
-rw-r--r--src/H5PLint.c44
-rw-r--r--src/H5PLpath.c4
-rw-r--r--src/H5PLpkg.h6
-rw-r--r--src/H5PLplugin_cache.c4
-rw-r--r--src/H5PLprivate.h14
-rw-r--r--src/H5PLpublic.h4
-rw-r--r--src/H5Pacpl.c90
-rw-r--r--src/H5Pdapl.c16
-rw-r--r--src/H5Pdcpl.c66
-rw-r--r--src/H5Pdeprec.c4
-rw-r--r--src/H5Pdxpl.c46
-rw-r--r--src/H5Pencdec.c2
-rw-r--r--src/H5Pfapl.c711
-rw-r--r--src/H5Pfcpl.c31
-rw-r--r--src/H5Pfmpl.c2
-rw-r--r--src/H5Pgcpl.c22
-rw-r--r--src/H5Pint.c588
-rw-r--r--src/H5Plapl.c14
-rw-r--r--src/H5Plcpl.c75
-rw-r--r--src/H5Pocpl.c24
-rw-r--r--src/H5Pocpypl.c6
-rw-r--r--src/H5Ppkg.h48
-rw-r--r--src/H5Pprivate.h4
-rw-r--r--src/H5Ppublic.h3
-rw-r--r--src/H5Pstrcpl.c2
-rw-r--r--src/H5Ptest.c44
-rw-r--r--src/H5R.c133
-rw-r--r--src/H5RS.c4
-rw-r--r--src/H5RSprivate.h2
-rw-r--r--src/H5Rdeprec.c47
-rw-r--r--src/H5Rint.c51
-rw-r--r--src/H5Rpkg.h12
-rw-r--r--src/H5Rprivate.h6
-rw-r--r--src/H5S.c4
-rw-r--r--src/H5SM.c118
-rw-r--r--src/H5SMtest.c2
-rw-r--r--src/H5Sall.c10
-rw-r--r--src/H5Shyper.c8
-rw-r--r--src/H5Smpio.c18
-rw-r--r--src/H5Snone.c10
-rw-r--r--src/H5Spkg.h2
-rw-r--r--src/H5Spoint.c12
-rw-r--r--src/H5Sprivate.h2
-rw-r--r--src/H5Spublic.h1
-rw-r--r--src/H5Sselect.c58
-rw-r--r--src/H5T.c386
-rw-r--r--src/H5TS.c6
-rw-r--r--src/H5TSprivate.h1
-rw-r--r--src/H5Tcommit.c559
-rw-r--r--src/H5Tcompound.c10
-rw-r--r--src/H5Tconv.c73
-rw-r--r--src/H5Tdeprec.c77
-rw-r--r--src/H5Tenum.c2
-rw-r--r--src/H5Toh.c31
-rw-r--r--src/H5Torder.c12
-rw-r--r--src/H5Tpkg.h5
-rw-r--r--src/H5Tprecis.c2
-rw-r--r--src/H5Tprivate.h12
-rw-r--r--src/H5Tvlen.c30
-rw-r--r--src/H5VL.c522
-rw-r--r--src/H5VLcallback.c6535
-rw-r--r--src/H5VLint.c1114
-rw-r--r--src/H5VLmodule.h (renamed from src/H5HLpublic.h)36
-rw-r--r--src/H5VLnative.c3655
-rw-r--r--src/H5VLnative.h (renamed from src/H5HGpublic.h)26
-rw-r--r--src/H5VLpassthru.c2693
-rw-r--r--src/H5VLpassthru.h (renamed from src/H5Bpublic.h)41
-rw-r--r--src/H5VLpkg.h48
-rw-r--r--src/H5VLprivate.h185
-rw-r--r--src/H5VLpublic.h534
-rw-r--r--src/H5Z.c130
-rw-r--r--src/H5Zpublic.h2
-rw-r--r--src/H5detect.c961
-rw-r--r--src/H5err.txt7
-rw-r--r--src/H5make_libsettings.c252
-rw-r--r--src/H5private.h74
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5system.c10
-rw-r--r--src/H5trace.c525
-rw-r--r--src/Makefile.am16
-rw-r--r--src/hdf5.h5
232 files changed, 27969 insertions, 11595 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3c5526f..cd81ba5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -32,7 +32,6 @@ set (H5A_SOURCES
)
set (H5A_HDRS
- ${HDF5_SRC_DIR}/H5Apkg.h
${HDF5_SRC_DIR}/H5Apublic.h
)
IDE_GENERATED_PROPERTIES ("H5A" "${H5A_HDRS}" "${H5A_SOURCES}" )
@@ -46,7 +45,6 @@ set (H5AC_SOURCES
)
set (H5AC_HDRS
- ${HDF5_SRC_DIR}/H5ACpkg.h
${HDF5_SRC_DIR}/H5ACpublic.h
)
IDE_GENERATED_PROPERTIES ("H5AC" "${H5AC_HDRS}" "${H5AC_SOURCES}" )
@@ -57,8 +55,6 @@ set (H5B_SOURCES
${HDF5_SRC_DIR}/H5Bdbg.c
)
set (H5B_HDRS
- ${HDF5_SRC_DIR}/H5Bpkg.h
- ${HDF5_SRC_DIR}/H5Bpublic.h
)
IDE_GENERATED_PROPERTIES ("H5B" "${H5B_HDRS}" "${H5B_SOURCES}" )
@@ -75,8 +71,6 @@ set (H5B2_SOURCES
${HDF5_SRC_DIR}/H5B2test.c
)
set (H5B2_HDRS
- ${HDF5_SRC_DIR}/H5B2pkg.h
- ${HDF5_SRC_DIR}/H5B2public.h
)
IDE_GENERATED_PROPERTIES ("H5B2" "${H5B2_HDRS}" "${H5B2_SOURCES}" )
@@ -94,7 +88,6 @@ set (H5C_SOURCES
${HDF5_SRC_DIR}/H5Ctest.c
)
set (H5C_HDRS
- ${HDF5_SRC_DIR}/H5Cpkg.h
${HDF5_SRC_DIR}/H5Cpublic.h
)
IDE_GENERATED_PROPERTIES ("H5C" "${H5C_HDRS}" "${H5C_SOURCES}" )
@@ -143,7 +136,6 @@ set (H5D_SOURCES
)
set (H5D_HDRS
- ${HDF5_SRC_DIR}/H5Dpkg.h
${HDF5_SRC_DIR}/H5Dpublic.h
)
IDE_GENERATED_PROPERTIES ("H5D" "${H5D_HDRS}" "${H5D_SOURCES}" )
@@ -155,12 +147,8 @@ set (H5E_SOURCES
)
set (H5E_HDRS
- #${HDF5_SRC_DIR}/H5Edefin.h
- #${HDF5_SRC_DIR}/H5Einit.h
- ${HDF5_SRC_DIR}/H5Epkg.h
- #${HDF5_SRC_DIR}/H5Epubgen.h
+ ${HDF5_SRC_DIR}/H5Epubgen.h
${HDF5_SRC_DIR}/H5Epublic.h
- #${HDF5_SRC_DIR}/H5Eterm.h
)
IDE_GENERATED_PROPERTIES ("H5E" "${H5E_HDRS}" "${H5E_SOURCES}" )
@@ -179,11 +167,18 @@ set (H5EA_SOURCES
${HDF5_SRC_DIR}/H5EAtest.c
)
set (H5EA_HDRS
- ${HDF5_SRC_DIR}/H5EApkg.h
)
IDE_GENERATED_PROPERTIES ("H5EA" "${H5EA_HDRS}" "${H5EA_SOURCES}" )
+set (H5ES_SOURCES
+)
+set (H5ES_HDRS
+ ${HDF5_SRC_DIR}/H5ESpublic.h
+)
+IDE_GENERATED_PROPERTIES ("H5ES" "${H5ES_HDRS}" "${H5ES_SOURCES}" )
+
+
set (H5F_SOURCES
${HDF5_SRC_DIR}/H5F.c
${HDF5_SRC_DIR}/H5Faccum.c
@@ -205,7 +200,6 @@ set (H5F_SOURCES
)
set (H5F_HDRS
- ${HDF5_SRC_DIR}/H5Fpkg.h
${HDF5_SRC_DIR}/H5Fpublic.h
)
IDE_GENERATED_PROPERTIES ("H5F" "${H5F_HDRS}" "${H5F_SOURCES}" )
@@ -223,7 +217,6 @@ set (H5FA_SOURCES
${HDF5_SRC_DIR}/H5FAtest.c
)
set (H5FA_HDRS
- ${HDF5_SRC_DIR}/H5FApkg.h
)
IDE_GENERATED_PROPERTIES ("H5FA" "${H5FA_HDRS}" "${H5FA_SOURCES}" )
@@ -253,7 +246,6 @@ set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDmpi.h
${HDF5_SRC_DIR}/H5FDmpio.h
${HDF5_SRC_DIR}/H5FDmulti.h
- ${HDF5_SRC_DIR}/H5FDpkg.h
${HDF5_SRC_DIR}/H5FDpublic.h
${HDF5_SRC_DIR}/H5FDsec2.h
${HDF5_SRC_DIR}/H5FDstdio.h
@@ -289,8 +281,6 @@ set (H5FS_SOURCES
)
set (H5FS_HDRS
- ${HDF5_SRC_DIR}/H5FSpkg.h
- ${HDF5_SRC_DIR}/H5FSpublic.h
)
IDE_GENERATED_PROPERTIES ("H5FS" "${H5FS_HDRS}" "${H5FS_SOURCES}" )
@@ -316,7 +306,6 @@ set (H5G_SOURCES
)
set (H5G_HDRS
- ${HDF5_SRC_DIR}/H5Gpkg.h
${HDF5_SRC_DIR}/H5Gpublic.h
)
IDE_GENERATED_PROPERTIES ("H5G" "${H5G_HDRS}" "${H5G_SOURCES}" )
@@ -341,8 +330,6 @@ set (H5HF_SOURCES
)
set (H5HF_HDRS
- ${HDF5_SRC_DIR}/H5HFpkg.h
- ${HDF5_SRC_DIR}/H5HFpublic.h
)
IDE_GENERATED_PROPERTIES ("H5HF" "${H5HF_HDRS}" "${H5HF_SOURCES}" )
@@ -354,8 +341,6 @@ set (H5HG_SOURCES
)
set (H5HG_HDRS
- ${HDF5_SRC_DIR}/H5HGpkg.h
- ${HDF5_SRC_DIR}/H5HGpublic.h
)
IDE_GENERATED_PROPERTIES ("H5HG" "${H5HG_HDRS}" "${H5HG_SOURCES}" )
@@ -369,8 +354,6 @@ set (H5HL_SOURCES
)
set (H5HL_HDRS
- ${HDF5_SRC_DIR}/H5HLpkg.h
- ${HDF5_SRC_DIR}/H5HLpublic.h
)
IDE_GENERATED_PROPERTIES ("H5HL" "${H5HL_HDRS}" "${H5HL_SOURCES}" )
@@ -388,7 +371,6 @@ set (H5I_SOURCES
${HDF5_SRC_DIR}/H5Itest.c
)
set (H5I_HDRS
- ${HDF5_SRC_DIR}/H5Ipkg.h
${HDF5_SRC_DIR}/H5Ipublic.h
)
IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" )
@@ -399,7 +381,6 @@ set (H5L_SOURCES
${HDF5_SRC_DIR}/H5Lexternal.c
)
set (H5L_HDRS
- ${HDF5_SRC_DIR}/H5Lpkg.h
${HDF5_SRC_DIR}/H5Lpublic.h
)
IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" )
@@ -432,7 +413,6 @@ set (H5MP_SOURCES
)
set (H5MP_HDRS
- ${HDF5_SRC_DIR}/H5MPpkg.h
)
IDE_GENERATED_PROPERTIES ("H5MP" "${H5MP_HDRS}" "${H5MP_SOURCES}" )
@@ -477,9 +457,7 @@ set (H5O_SOURCES
)
set (H5O_HDRS
- ${HDF5_SRC_DIR}/H5Opkg.h
${HDF5_SRC_DIR}/H5Opublic.h
- ${HDF5_SRC_DIR}/H5Oshared.h
)
IDE_GENERATED_PROPERTIES ("H5O" "${H5O_HDRS}" "${H5O_SOURCES}" )
@@ -505,7 +483,6 @@ set (H5P_SOURCES
)
set (H5P_HDRS
- ${HDF5_SRC_DIR}/H5Ppkg.h
${HDF5_SRC_DIR}/H5Ppublic.h
)
IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SOURCES}" )
@@ -515,7 +492,6 @@ set (H5PB_SOURCES
)
set (H5PB_HDRS
- ${HDF5_SRC_DIR}/H5PBpkg.h
)
IDE_GENERATED_PROPERTIES ("H5PB" "${H5PB_HDRS}" "${H5PB_SOURCES}" )
@@ -528,7 +504,6 @@ set (H5PL_SOURCES
set (H5PL_HDRS
${HDF5_SRC_DIR}/H5PLextern.h
- ${HDF5_SRC_DIR}/H5PLpkg.h
${HDF5_SRC_DIR}/H5PLpublic.h
)
IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SOURCES}" )
@@ -540,7 +515,6 @@ set (H5R_SOURCES
${HDF5_SRC_DIR}/H5Rint.c
)
set (H5R_HDRS
- ${HDF5_SRC_DIR}/H5Rpkg.h
${HDF5_SRC_DIR}/H5Rpublic.h
)
IDE_GENERATED_PROPERTIES ("H5R" "${H5R_HDRS}" "${H5R_SOURCES}" )
@@ -567,7 +541,6 @@ set (H5S_SOURCES
)
set (H5S_HDRS
- ${HDF5_SRC_DIR}/H5Spkg.h
${HDF5_SRC_DIR}/H5Spublic.h
)
IDE_GENERATED_PROPERTIES ("H5S" "${H5S_HDRS}" "${H5S_SOURCES}" )
@@ -590,7 +563,6 @@ set (H5SM_SOURCES
)
set (H5SM_HDRS
- ${HDF5_SRC_DIR}/H5SMpkg.h
)
IDE_GENERATED_PROPERTIES ("H5SM" "${H5SM_HDRS}" "${H5SM_SOURCES}" )
@@ -630,7 +602,6 @@ set (H5T_SOURCES
)
set (H5T_HDRS
- ${HDF5_SRC_DIR}/H5Tpkg.h
${HDF5_SRC_DIR}/H5Tpublic.h
)
IDE_GENERATED_PROPERTIES ("H5T" "${H5T_HDRS}" "${H5T_SOURCES}" )
@@ -652,6 +623,20 @@ set (H5UC_HDRS
IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" )
+set (H5VL_SOURCES
+ ${HDF5_SRC_DIR}/H5VL.c
+ ${HDF5_SRC_DIR}/H5VLcallback.c
+ ${HDF5_SRC_DIR}/H5VLint.c
+ ${HDF5_SRC_DIR}/H5VLnative.c
+ ${HDF5_SRC_DIR}/H5VLpassthru.c
+)
+set (H5VL_HDRS
+ ${HDF5_SRC_DIR}/H5VLnative.h
+ ${HDF5_SRC_DIR}/H5VLpassthru.h
+ ${HDF5_SRC_DIR}/H5VLpublic.h
+)
+IDE_GENERATED_PROPERTIES ("H5VL" "${H5VL_HDRS}" "${H5VL_SOURCES}" )
+
set (H5VM_SOURCES
${HDF5_SRC_DIR}/H5VM.c
)
@@ -685,7 +670,6 @@ endif ()
set (H5Z_HDRS
- ${HDF5_SRC_DIR}/H5Zpkg.h
${HDF5_SRC_DIR}/H5Zpublic.h
)
IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" )
@@ -731,6 +715,7 @@ set (common_SRCS
${H5ST_SOURCES}
${H5T_SOURCES}
${H5TS_SOURCES}
+ ${H5VL_SOURCES}
${H5VM_SOURCES}
${H5WB_SOURCES}
${H5Z_SOURCES}
@@ -746,6 +731,7 @@ set (H5_PUBLIC_HEADERS
${H5D_HDRS}
${H5E_HDRS}
${H5EA_HDRS}
+ ${H5ES_HDRS}
${H5F_HDRS}
${H5FA_HDRS}
${H5FD_HDRS}
@@ -767,54 +753,132 @@ set (H5_PUBLIC_HEADERS
${H5S_HDRS}
${H5SM_HDRS}
${H5T_HDRS}
+ ${H5VL_HDRS}
${H5Z_HDRS}
)
set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5private.h
+
+ ${HDF5_SRC_DIR}/H5Apkg.h
${HDF5_SRC_DIR}/H5Aprivate.h
+
+ ${HDF5_SRC_DIR}/H5ACpkg.h
${HDF5_SRC_DIR}/H5ACprivate.h
- ${HDF5_SRC_DIR}/H5B2private.h
+
+ ${HDF5_SRC_DIR}/H5Bpkg.h
${HDF5_SRC_DIR}/H5Bprivate.h
+
+ ${HDF5_SRC_DIR}/H5B2pkg.h
+ ${HDF5_SRC_DIR}/H5B2private.h
+
+ ${HDF5_SRC_DIR}/H5Cpkg.h
${HDF5_SRC_DIR}/H5Cprivate.h
+
${HDF5_SRC_DIR}/H5CSprivate.h
+
${HDF5_SRC_DIR}/H5CXprivate.h
+
+ ${HDF5_SRC_DIR}/H5Dpkg.h
${HDF5_SRC_DIR}/H5Dprivate.h
+
+ ${HDF5_SRC_DIR}/H5Edefin.h
+ ${HDF5_SRC_DIR}/H5Einit.h
+ ${HDF5_SRC_DIR}/H5Epkg.h
${HDF5_SRC_DIR}/H5Eprivate.h
+ ${HDF5_SRC_DIR}/H5Eterm.h
+
+ ${HDF5_SRC_DIR}/H5EApkg.h
${HDF5_SRC_DIR}/H5EAprivate.h
+
+ ${HDF5_SRC_DIR}/H5Fpkg.h
+ ${HDF5_SRC_DIR}/H5Fprivate.h
+
+ ${HDF5_SRC_DIR}/H5FApkg.h
${HDF5_SRC_DIR}/H5FAprivate.h
+
+ ${HDF5_SRC_DIR}/H5FDpkg.h
${HDF5_SRC_DIR}/H5FDprivate.h
- ${HDF5_SRC_DIR}/H5Fprivate.h
+
${HDF5_SRC_DIR}/H5FLprivate.h
+
${HDF5_SRC_DIR}/H5FOprivate.h
- ${HDF5_SRC_DIR}/H5MFprivate.h
- ${HDF5_SRC_DIR}/H5MMprivate.h
- ${HDF5_SRC_DIR}/H5Cprivate.h
+
+ ${HDF5_SRC_DIR}/H5FSpkg.h
${HDF5_SRC_DIR}/H5FSprivate.h
+
+ ${HDF5_SRC_DIR}/H5Gpkg.h
${HDF5_SRC_DIR}/H5Gprivate.h
+
+ ${HDF5_SRC_DIR}/H5HFpkg.h
${HDF5_SRC_DIR}/H5HFprivate.h
+
+ ${HDF5_SRC_DIR}/H5HGpkg.h
${HDF5_SRC_DIR}/H5HGprivate.h
+
+ ${HDF5_SRC_DIR}/H5HLpkg.h
${HDF5_SRC_DIR}/H5HLprivate.h
+
${HDF5_SRC_DIR}/H5HPprivate.h
+
+ ${HDF5_SRC_DIR}/H5Ipkg.h
${HDF5_SRC_DIR}/H5Iprivate.h
+
+ ${HDF5_SRC_DIR}/H5Lpkg.h
${HDF5_SRC_DIR}/H5Lprivate.h
+
+ ${HDF5_SRC_DIR}/H5MFprivate.h
+
+ ${HDF5_SRC_DIR}/H5MMprivate.h
+
+ ${HDF5_SRC_DIR}/H5MPpkg.h
${HDF5_SRC_DIR}/H5MPprivate.h
+
+ ${HDF5_SRC_DIR}/H5Opkg.h
${HDF5_SRC_DIR}/H5Oprivate.h
+ ${HDF5_SRC_DIR}/H5Oshared.h
+
+ ${HDF5_SRC_DIR}/H5Ppkg.h
${HDF5_SRC_DIR}/H5Pprivate.h
+
${HDF5_SRC_DIR}/H5PBprivate.h
+ ${HDF5_SRC_DIR}/H5PBpkg.h
+
+ ${HDF5_SRC_DIR}/H5PLpkg.h
${HDF5_SRC_DIR}/H5PLprivate.h
- ${HDF5_SRC_DIR}/H5UCprivate.h
+
+ ${HDF5_SRC_DIR}/H5Rpkg.h
${HDF5_SRC_DIR}/H5Rprivate.h
+
${HDF5_SRC_DIR}/H5RSprivate.h
+
+ ${HDF5_SRC_DIR}/H5Spkg.h
+ ${HDF5_SRC_DIR}/H5Sprivate.h
+
${HDF5_SRC_DIR}/H5SLprivate.h
+
+ ${HDF5_SRC_DIR}/H5SMpkg.h
${HDF5_SRC_DIR}/H5SMprivate.h
- ${HDF5_SRC_DIR}/H5Sprivate.h
+
${HDF5_SRC_DIR}/H5STprivate.h
+
+ ${HDF5_SRC_DIR}/H5Tpkg.h
${HDF5_SRC_DIR}/H5Tprivate.h
+
${HDF5_SRC_DIR}/H5TSprivate.h
+
+ ${HDF5_SRC_DIR}/H5UCprivate.h
+
+ ${HDF5_SRC_DIR}/H5VLpkg.h
+ ${HDF5_SRC_DIR}/H5VLprivate.h
+
${HDF5_SRC_DIR}/H5VMprivate.h
+
${HDF5_SRC_DIR}/H5WBprivate.h
+
+ ${HDF5_SRC_DIR}/H5Zpkg.h
${HDF5_SRC_DIR}/H5Zprivate.h
+
${HDF5_SRC_DIR}/H5win32defs.h
)
@@ -827,6 +891,12 @@ set (H5_GENERATED_HEADERS
${HDF5_SRC_DIR}/H5overflow.h
)
+set (H5_PUBLIC_GENERATED_HEADERS
+ ${HDF5_SRC_DIR}/H5Epubgen.h
+ ${HDF5_SRC_DIR}/H5version.h
+ ${HDF5_SRC_DIR}/H5overflow.h
+)
+
option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON)
if (HDF5_GENERATE_HEADERS)
set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE)
@@ -853,38 +923,99 @@ endif ()
# Setup the H5detect utility which generates H5Tinit with platform
# specific type checks inside
#-----------------------------------------------------------------------------
-add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c)
-target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS})
-TARGET_C_PROPERTIES (H5detect STATIC)
-target_link_libraries (H5detect
- PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib>
- INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0">
-)
+if (HDF5_USE_PREGEN)
+ set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR})
+else ()
+ set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR})
+endif ()
-add_custom_command (
- OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c
- COMMAND $<TARGET_FILE:H5detect>
- ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c
- DEPENDS H5detect
-)
+if (BUILD_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared")
+endif ()
+
+if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
+ add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c)
+ target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS})
+ TARGET_C_PROPERTIES (H5detect STATIC)
+ target_link_libraries (H5detect
+ PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
+ )
+
+ if (HDF5_BATCH_H5DETECT)
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${HDF5_BATCH_H5DETECT_SCRIPT}.in.cmake
+ ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY
+ )
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ 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"
+ 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
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created
+ )
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
+ endif ()
+ else ()
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect>
+ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ DEPENDS H5detect
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ )
+ if (BUILD_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ )
+ 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)
+endif ()
add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
-target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS})
TARGET_C_PROPERTIES (H5make_libsettings STATIC)
target_link_libraries (H5make_libsettings
PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib>
- INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0">
+ PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
- COMMAND $<TARGET_FILE:H5make_libsettings>
- ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5make_libsettings>
+ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c
DEPENDS H5make_libsettings
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
)
+set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE)
+if (BUILD_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c"
+ DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c
+ )
+ set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE)
+endif ()
## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z"
#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z"
@@ -893,8 +1024,9 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
#-----------------------------------------------------------------------------
# Add H5Tinit source to build - generated by H5detect/CMake at configure time
#-----------------------------------------------------------------------------
-set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
+set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
+add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS})
add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
@@ -917,26 +1049,14 @@ target_link_libraries (${HDF5_LIB_TARGET}
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0)
set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries)
+add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET})
set (install_targets ${HDF5_LIB_TARGET})
if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared")
- add_custom_command (
- OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c
- COMMAND $<TARGET_FILE:H5detect>
- ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c
- DEPENDS H5detect
- WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared
- )
- add_custom_command (
- OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
- COMMAND $<TARGET_FILE:H5make_libsettings>
- ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
- DEPENDS H5make_libsettings
- WORKING_DIRECTORY ${HDF5_BINARY_DIR}
- )
- set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c)
+ set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c)
+
+ add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS})
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
@@ -961,6 +1081,7 @@ if (BUILD_SHARED_LIBS)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB")
set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries)
+ add_dependencies (${HDF5_LIBSH_TARGET} gen_${HDF5_LIBSH_TARGET})
set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET})
endif ()
@@ -972,7 +1093,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT)
install (
FILES
${H5_PUBLIC_HEADERS}
- ${H5_GENERATED_HEADERS}
+ ${H5_PUBLIC_GENERATED_HEADERS}
${HDF5_BINARY_DIR}/H5pubconf.h
DESTINATION
${HDF5_INSTALL_INCLUDE_DIR}
diff --git a/src/H5.c b/src/H5.c
index 1b13fea..bf4643c 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -138,7 +138,7 @@ H5_init_library(void)
if (mpi_initialized && !mpi_finalized) {
int key_val;
- if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN,
+ if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN,
(MPI_Comm_delete_attr_function *)H5_mpi_delete_cb,
&key_val, NULL)))
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code)
@@ -173,6 +173,7 @@ H5_init_library(void)
H5_debug_g.pkg[H5_PKG_S].name = "s";
H5_debug_g.pkg[H5_PKG_T].name = "t";
H5_debug_g.pkg[H5_PKG_V].name = "v";
+ H5_debug_g.pkg[H5_PKG_VL].name = "vl";
H5_debug_g.pkg[H5_PKG_Z].name = "z";
/*
@@ -213,6 +214,8 @@ H5_init_library(void)
*/
if(H5E_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface")
+ if(H5VL_init() < 0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
if(H5P_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface")
if(H5T_init() < 0)
@@ -262,7 +265,7 @@ H5_term_library(void)
/* Don't do anything if the library is already closed */
if(!(H5_INIT_GLOBAL))
- goto done;
+ goto done;
/* Indicate that the library is being shut down */
H5_TERM_GLOBAL = TRUE;
@@ -344,6 +347,7 @@ H5_term_library(void)
pending += DOWN(AC);
pending += DOWN(Z);
pending += DOWN(FD);
+ pending += DOWN(VL);
pending += DOWN(PL);
/* Don't shut down the error code until other APIs which use it are shut down */
if(pending == 0)
@@ -379,18 +383,18 @@ H5_term_library(void)
* down if any of the below code involves using the instrumentation code.
*/
if(H5_MPEinit_g) {
- int mpi_initialized;
- int mpi_finalized;
- int mpe_code;
+ int mpi_initialized;
+ int mpi_finalized;
+ int mpe_code;
- MPI_Initialized(&mpi_initialized);
- MPI_Finalized(&mpi_finalized);
+ MPI_Initialized(&mpi_initialized);
+ MPI_Finalized(&mpi_finalized);
if (mpi_initialized && !mpi_finalized) {
- mpe_code = MPE_Finish_log("h5log");
- HDassert(mpe_code >=0);
- } /* end if */
- H5_MPEinit_g = FALSE; /* turn it off no matter what */
+ mpe_code = MPE_Finish_log("h5log");
+ HDassert(mpe_code >=0);
+ } /* end if */
+ H5_MPEinit_g = FALSE; /* turn it off no matter what */
} /* end if */
#endif
diff --git a/src/H5A.c b/src/H5A.c
index 8e64eda..0d20912 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -16,22 +16,22 @@
/****************/
#include "H5Amodule.h" /* This source code file is part of the H5A module */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /* Suppress error about including H5Opkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspace functions */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspace functions */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -123,7 +123,7 @@ H5A__init_package(void)
* Create attribute ID type.
*/
if(H5I_register_type(H5I_ATTR_CLS) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Mark "top" of interface as initialized, too */
H5A_top_package_initialize_s = TRUE;
@@ -216,76 +216,98 @@ H5A_term_package(void)
/*--------------------------------------------------------------------------
- NAME
- H5Acreate2
- PURPOSE
- Creates an attribute on an object
- USAGE
- hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id,
- aapl_id)
- hid_t loc_id; IN: Object (dataset or group) to be attached to
- const char *attr_name; IN: Name of attribute to locate and open
- hid_t type_id; IN: ID of datatype for attribute
- hid_t space_id; IN: ID of dataspace for attribute
- hid_t acpl_id; IN: ID of creation property list (currently not used)
- hid_t aapl_id; IN: Attribute access property list
- RETURNS
- Non-negative on success/Negative on failure
-
- DESCRIPTION
- This function creates an attribute which is attached to the object
- specified with 'loc_id'. The name specified with 'attr_name' for
- each attribute for an object must be unique for that object. The 'type_id'
- and 'space_id' are created with the H5T and H5S interfaces respectively.
- The 'aapl_id' property list is currently unused, but will be used in the
- future for optional attribute access properties. The attribute ID returned
- from this function must be released with H5Aclose or resource leaks will
- develop.
-
---------------------------------------------------------------------------*/
+ * Function: H5Acreate2
+ *
+ * Purpose: Creates an attribute on an object
+ *
+ * Usage:
+ * hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id,
+ * aapl_id)
+ *
+ * Description: This function creates an attribute which is attached to the
+ * object specified with 'loc_id'. The name specified with
+ * 'attr_name' for each attribute for an object must be unique
+ * for that object. The 'type_id' and 'space_id' are created
+ * with the H5T and H5S interfaces respectively. The 'aapl_id'
+ * property list is currently unused, but will be used in the
+ * future for optional attribute access properties. The
+ * attribute ID returned from this function must be released
+ * with H5Aclose or resource leaks will develop.
+ *
+ * Parameters:
+ * hid_t loc_id; IN: Object (dataset or group) to be attached to
+ * const char *attr_name; IN: Name of attribute to locate and open
+ * hid_t type_id; IN: ID of datatype for attribute
+ * hid_t space_id; IN: ID of dataspace for attribute
+ * hid_t acpl_id; IN: ID of creation property list (currently not used)
+ * hid_t aapl_id; IN: Attribute access property list
+ *
+ * Return: Success: An ID for the created attribute
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
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)
{
- H5A_t *attr = NULL; /* Attribute created */
- H5G_loc_t loc; /* Object location */
- H5T_t *type; /* Datatype to use for attribute */
- H5S_t *space; /* Dataspace to use for attribute */
- hid_t ret_value; /* Return value */
+ void *attr = NULL; /* Attribute created */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file")
- if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type")
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
+ if(!attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL")
+ if(!*attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string")
+
+ /* Get correct property list */
+ if(H5P_DEFAULT == acpl_id)
+ acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Go do the real work for attaching the attribute to the object */
- if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")
+ /* Get the property list structure for the acpl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set creation properties */
+ if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
+ if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_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);
+
+ /* Create the attribute */
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0 && attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate2() */
@@ -308,7 +330,7 @@ done:
hid_t aapl_id; IN: Attribute access property list
hid_t lapl_id; IN: Link access property list
RETURNS
- Non-negative on success/Negative on failure
+ Non-negative on success/H5I_INVALID_HID on failure
DESCRIPTION
This function creates an attribute which is attached to the object
@@ -326,31 +348,27 @@ 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)
{
- H5A_t *attr = NULL; /* Attribute created */
- H5G_loc_t loc; /* Object location */
- H5T_t *type; /* Datatype to use for attribute */
- H5S_t *space; /* Dataspace to use for attribute */
- hid_t ret_value; /* Return value */
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id,
acpl_id, aapl_id, lapl_id);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type")
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name")
+
+ /* Get correct property list */
+ if(H5P_DEFAULT == acpl_id)
+ acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
@@ -358,22 +376,43 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
if(H5P_DEFAULT != lapl_id) {
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID")
H5CX_set_lapl(lapl_id);
- } /* end if */
+ }
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+
+ /* Set creation properties */
+ if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
+ if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
+
+ /* 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 = obj_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Create the attribute on the object */
- if(NULL == (attr = H5A__create_by_name(&loc, obj_name, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")
+ /* Create the attribute */
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0 && attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate_by_name() */
@@ -390,7 +429,7 @@ done:
const char *attr_name; IN: Name of attribute to locate and open
hid_t aapl_id; IN: Attribute access property list
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -401,38 +440,47 @@ done:
hid_t
H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, attr_name, aapl_id);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
+ if(!attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Read in attribute from object header */
- if(NULL == (attr = H5A__open(&loc, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name)
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Open the attribute */
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name)
/* Register the attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0)
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen() */
@@ -451,7 +499,7 @@ done:
hid_t aapl_id; IN: Attribute access property list
hid_t lapl_id; IN: Link access property list
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -463,49 +511,61 @@ 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)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*s*sii", loc_id, obj_name, attr_name, aapl_id, lapl_id);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* Set lapl_id and add to context */
if(H5P_DEFAULT != lapl_id) {
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID")
H5CX_set_lapl(lapl_id);
- } /* end if */
+ }
+ else
+ lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Fill in location struct fields */
+ 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 location object */
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+ /* Open the attribute */
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0)
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
-} /* H5Aopen_by_name() */
+} /* end H5Aopen_by_name() */
/*--------------------------------------------------------------------------
@@ -524,7 +584,7 @@ done:
hid_t aapl_id; IN: Attribute access property list
hid_t lapl_id; IN: Link access property list
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -536,49 +596,64 @@ 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)
{
- H5A_t *attr = NULL; /* Attribute opened */
- H5G_loc_t loc; /* Object location */
- hid_t ret_value; /* Return value */
+ void *attr = NULL; /* Attribute opened */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE7("i", "i*sIiIohii", loc_id, obj_name, idx_type, order, n, aapl_id,
lapl_id);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* Set lapl_id and add to context */
if(H5P_DEFAULT != lapl_id) {
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID")
H5CX_set_lapl(lapl_id);
- } /* end if */
-
- /* Open the attribute in the object header */
- if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
+ }
+ else
+ lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Fill in location struct parameters */
+ 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 location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Open the attribute */
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(ret_value < 0)
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_by_idx() */
@@ -603,27 +678,26 @@ done:
herr_t
H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
{
- H5A_t *attr; /* Attribute object for ID */
- H5T_t *mem_type; /* Memory datatype */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Attribute object for ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ii*x", attr_id, dtype_id, buf);
- /* check arguments */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ /* Check arguments */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ if(H5I_DATATYPE != H5I_get_type(dtype_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if(NULL == buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(attr_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Go write the actual data to the attribute */
- if((ret_value = H5A__write(attr, mem_type, buf)) < 0)
+ /* Write the attribute data */
+ if((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
done:
@@ -650,23 +724,22 @@ done:
herr_t
H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
{
- H5A_t *attr; /* Attribute object for ID */
- H5T_t *mem_type; /* Memory datatype */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Attribute object for ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ii*x", attr_id, dtype_id, buf);
- /* check arguments */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ /* Check arguments */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ if(H5I_DATATYPE != H5I_get_type(dtype_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if(NULL == buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
- /* Go write the actual data to the attribute */
- if((ret_value = H5A__read(attr, mem_type, buf)) < 0)
+ /* Read the attribute data */
+ if((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
done:
@@ -683,7 +756,7 @@ done:
hid_t H5Aget_space (attr_id)
hid_t attr_id; IN: Attribute to get dataspace of
RETURNS
- A dataspace ID on success, negative on failure
+ A dataspace ID on success, H5I_INVALID_HID on failure
DESCRIPTION
This function retrieves a copy of the dataspace for an attribute.
@@ -693,18 +766,20 @@ done:
hid_t
H5Aget_space(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
- hid_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
- /* check arguments */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ /* Check arguments */
+ 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")
+
+ /* Get the dataspace */
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute")
- if((ret_value = H5A_get_space(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
@@ -719,7 +794,7 @@ done:
hid_t H5Aget_type (attr_id)
hid_t attr_id; IN: Attribute to get datatype of
RETURNS
- A datatype ID on success, negative on failure
+ A datatype ID on success, H5I_INVALID_HID on failure
DESCRIPTION
This function retrieves a copy of the datatype for an attribute.
@@ -729,18 +804,19 @@ done:
hid_t
H5Aget_type(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
- hid_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
- /* check arguments */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ /* Check arguments */
+ 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")
- if((ret_value = H5A__get_type(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute")
+ /* Get the datatype */
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute")
done:
FUNC_LEAVE_API(ret_value)
@@ -757,7 +833,7 @@ done:
hid_t attr_id; IN: Attribute to get name of
RETURNS
This function returns the ID of a copy of the attribute's creation
- property list, or negative on failure.
+ property list, or H5I_INVALID_HID on failure.
ERRORS
@@ -769,20 +845,21 @@ done:
hid_t
H5Aget_create_plist(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
- hid_t ret_value;
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1);
- /* Get attribute and default attribute creation property list*/
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ /* Check arguments */
+ 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")
- if((ret_value = H5A__get_create_plist(attr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr")
+ /* Get the acpl */
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute")
done:
FUNC_LEAVE_API(ret_value)
@@ -813,21 +890,26 @@ done:
ssize_t
H5Aget_name(hid_t attr_id, size_t buf_size, char *buf)
{
- H5A_t *my_attr; /* Attribute object for ID */
- ssize_t ret_value;
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value = -1;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf);
/* check arguments */
- if(NULL == (my_attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute")
if(!buf && buf_size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
+ 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);
- /* Call private function in turn */
- if(0 > (ret_value = H5A__get_name(my_attr, buf_size, buf)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
+ /* 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)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name")
done:
FUNC_LEAVE_API(ret_value)
@@ -856,8 +938,8 @@ 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)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute object for name */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -866,39 +948,35 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Check args */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ 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(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+ /* Get the object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- /* Get the length of the name */
- ret_value = (ssize_t)HDstrlen(attr->shared->name);
+ 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);
- /* Copy the name into the user's buffer, if given */
- if(name) {
- HDstrncpy(name, attr->shared->name, MIN((size_t)(ret_value + 1), size));
- if((size_t)ret_value >= size)
- name[size - 1]='\0';
- } /* end if */
+ /* 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)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name")
done:
- /* Release resources */
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_name_by_idx() */
@@ -923,18 +1001,19 @@ done:
hsize_t
H5Aget_storage_size(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
+ H5VL_object_t *vol_obj;
hsize_t ret_value; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", attr_id);
- /* Check args */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ /* Check arguments */
+ 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 return value */
- ret_value = attr->shared->data_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")
done:
FUNC_LEAVE_API(ret_value)
@@ -957,19 +1036,23 @@ done:
herr_t
H5Aget_info(hid_t attr_id, H5A_info_t *ainfo)
{
- H5A_t *attr; /* Attribute object for name */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", attr_id, ainfo);
- /* Check args */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ /* Check arguments */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(attr_id);
+
/* Get the attribute information */
- if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
FUNC_LEAVE_API(ret_value)
@@ -993,8 +1076,8 @@ herr_t
H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
H5A_info_t *ainfo, hid_t lapl_id)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute object for name */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1002,13 +1085,11 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* Check args */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
if(NULL == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
@@ -1016,19 +1097,20 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
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")
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+ 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")
/* Get the attribute information */
- if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo, attr_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
- /* Release resources */
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_info_by_name() */
@@ -1051,8 +1133,8 @@ 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, hid_t lapl_id)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute object for name */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1061,15 +1143,13 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Check args */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(NULL == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
@@ -1077,30 +1157,33 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
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")
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+ 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")
/* Get the attribute information */
- if(H5A__get_info(attr, ainfo) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
+ if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
- /* Release resources */
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_info_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5Arename
+ * Function: H5Arename
*
* Purpose: Rename an attribute
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* October 23, 2002
@@ -1117,23 +1200,28 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
/* check arguments */
if(!old_name || !new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_name, new_name)) {
- H5G_loc_t loc; /* Object location */
-
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
- /* Set up collective metadata if appropriate */
- if(H5CX_set_loc(loc_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Call private attribute rename routine */
- if(H5A__rename(&loc, old_name, new_name) < 0)
+ /* Rename the attribute */
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
@@ -1143,12 +1231,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Arename_by_name
+ * Function: H5Arename_by_name
*
* Purpose: Rename an attribute
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* February 20, 2007
@@ -1167,27 +1254,34 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(!old_attr_name || !*old_attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name")
if(!new_attr_name || !*new_attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_attr_name, new_attr_name)) {
- H5G_loc_t loc; /* Object location */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
/* Verify access property list and set up collective metadata if appropriate */
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")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ 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 location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Call private attribute rename routine */
- if(H5A__rename_by_name(loc, obj_name, old_attr_name, new_attr_name) < 0)
+ /* Rename the attribute */
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
@@ -1241,6 +1335,8 @@ herr_t
H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx, H5A_operator2_t op, void *op_data)
{
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1248,14 +1344,21 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ 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)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
- /* Call attribute iteration routine */
- if((ret_value = H5A__iterate(loc_id, idx_type, order, idx, op, op_data)) < 0)
+ /* get the loc object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Iterate over attributes */
+ if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
@@ -1311,8 +1414,9 @@ 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)
{
- H5G_loc_t loc; /* Object location */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op,
@@ -1320,23 +1424,30 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* 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(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ 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(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call attribute iteration by name routine */
- if((ret_value = H5A__iterate_by_name(&loc, obj_name, idx_type, order, idx, op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
+ 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")
+
+ /* Iterate over attributes */
+ if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0)
+ HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
done:
FUNC_LEAVE_API(ret_value)
@@ -1360,26 +1471,35 @@ done:
herr_t
H5Adelete(hid_t loc_id, const char *name)
{
- H5G_loc_t loc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Delete the attribute from the location */
- if(H5A__delete(&loc, name) < 0)
+ /* 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")
+
+ /* Delete the attribute */
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1407,28 +1527,37 @@ herr_t
H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Object location */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(!attr_name || !*attr_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
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")
- /* Delete the attribute from the location */
- if(H5A__delete_by_name(&loc, obj_name, attr_name) < 0)
+ /* Fill in location struct fields */
+ 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")
+
+ /* Delete the attribute */
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1464,7 +1593,8 @@ 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)
{
- H5G_loc_t loc; /* Object location */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1472,22 +1602,32 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* 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(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ 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(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Delete the attribute from the location */
- if(H5A__delete_by_idx(&loc, obj_name, idx_type, order, n) < 0)
+ 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")
+
+ /* Delete the attribute through the VOL */
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1495,21 +1635,17 @@ done:
} /* H5Adelete_by_idx() */
-/*--------------------------------------------------------------------------
- NAME
- H5Aclose
- PURPOSE
- Close an attribute ID
- USAGE
- herr_t H5Aclose (attr_id)
- hid_t attr_id; IN: Attribute to release access to
- RETURNS
- Non-negative on success/Negative on failure
-
- DESCRIPTION
- This function releases an attribute from use. Further use of the
- attribute ID will result in undefined behavior.
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Aclose
+ *
+ * Purpose: Closes access to an attribute and releases resources used by
+ * it. It is illegal to subsequently use that same dataset
+ * ID in calls to other attribute functions.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Aclose(hid_t attr_id)
{
@@ -1518,7 +1654,7 @@ H5Aclose(hid_t attr_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", attr_id);
- /* check arguments */
+ /* Check arguments */
if(NULL == H5I_object_verify(attr_id, H5I_ATTR))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
@@ -1548,22 +1684,28 @@ done:
htri_t
H5Aexists(hid_t obj_id, const char *attr_name)
{
- H5G_loc_t loc; /* Object location */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "i*s", obj_id, attr_name);
- /* check arguments */
- if (H5I_ATTR == H5I_get_type(obj_id))
+ /* Check arguments */
+ if(H5I_ATTR == H5I_get_type(obj_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if (H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if (!attr_name || !*attr_name)
+ if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ /* get the object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
/* Check if the attribute exists */
- if((ret_value = H5A__exists(&loc, attr_name)) < 0)
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
@@ -1588,27 +1730,36 @@ htri_t
H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Object location */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id);
/* check arguments */
- if (H5I_ATTR == H5I_get_type(loc_id))
+ if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if (H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if (!obj_name || !*obj_name)
+ if(!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if (!attr_name || !*attr_name)
+ if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
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")
- if ((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0)
+ /* get the object */
+ 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_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);
+
+ /* Check existence of attribute */
+ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
diff --git a/src/H5AC.c b/src/H5AC.c
index 989ee10..9894e39 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -2620,7 +2620,7 @@ done:
*
* Purpose: Sets the metadata tag property in the provided property list.
*
- * Return: SUCCEED on success, FAIL otherwise.
+ * Return: void
*
* Programmer: Mike McGreevy
* December 1, 2009
@@ -2773,7 +2773,7 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag
HDassert(f->shared);
/* Call cache level function to expunge entries with specified tag and type id */
- if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags)<0)
+ if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries")
done:
@@ -2924,16 +2924,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5AC_set_ring
+ * Function: H5AC_set_ring
*
- * Purpose: Routine to set the ring on a DXPL (for passing through
- * to the metadata cache).
+ * Purpose: Routine to set the ring on a DXPL (for passing through
+ * to the metadata cache).
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: void
*
- * Programmer: Quincey Koziol
- * Tuesday, September 8, 2015
+ * Programmer: Quincey Koziol
+ * Tuesday, September 8, 2015
*
*-------------------------------------------------------------------------
*/
@@ -2942,6 +2941,8 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Note: orig_ring can be NULL so don't check it with HDassert() */
+
/* Get the current ring value and return that (if orig_ring is NOT null) */
if(orig_ring)
*orig_ring = H5CX_get_ring();
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 99cc0e9..0e8620d 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -435,7 +435,7 @@ H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr,
/* Tag & Ring routines */
H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag);
H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag);
-H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hbool_t match_global);
+H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global);
H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag);
H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f);
H5_DLL herr_t H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked);
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 3701022..5bed82d 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -164,11 +164,11 @@ typedef struct H5A_bt2_ud_rmbi_t {
/*-------------------------------------------------------------------------
- * Function: H5A__dense_create
+ * Function: H5A__dense_create
*
- * Purpose: Creates dense attribute storage structures for an object
+ * Purpose: Creates dense attribute storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -188,9 +188,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
@@ -286,11 +284,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_fnd_cb
+ * Function: H5A__dense_fnd_cb
*
- * Purpose: Callback when an attribute is located in an index
+ * Purpose: Callback when an attribute is located in an index
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -305,9 +303,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
FUNC_ENTER_STATIC_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(attr);
HDassert(user_attr);
@@ -320,11 +316,11 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
/*-------------------------------------------------------------------------
- * Function: H5A__dense_open
+ * Function: H5A__dense_open
*
- * Purpose: Open an attribute in dense storage structures for an object
+ * Purpose: Open an attribute in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -345,9 +341,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name);
@@ -411,11 +405,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_insert
+ * Function: H5A__dense_insert
*
- * Purpose: Insert an attribute into dense storage structures for an object
+ * Purpose: Insert an attribute into dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -439,9 +433,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(attr);
@@ -570,13 +562,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_write_bt2_cb2
+ * Function: H5A__dense_write_bt2_cb2
*
- * Purpose: v2 B-tree 'modify' callback to update the record for a creation
- * order index
+ * Purpose: v2 B-tree 'modify' callback to update the record for a creation
+ * order index
*
- * Return: Success: 0
- * Failure: 1
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, February 20, 2007
@@ -591,9 +582,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
FUNC_ENTER_STATIC_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(record);
HDassert(new_heap_id);
@@ -608,12 +597,11 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
/*-------------------------------------------------------------------------
- * Function: H5A__dense_write_bt2_cb
+ * Function: H5A__dense_write_bt2_cb
*
- * Purpose: v2 B-tree 'modify' callback to update the data for an attribute
+ * Purpose: v2 B-tree 'modify' callback to update the data for an attribute
*
- * Return: Success: 0
- * Failure: 1
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -632,9 +620,7 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
FUNC_ENTER_STATIC
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(record);
HDassert(op_data);
@@ -722,11 +708,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_write
+ * Function: H5A__dense_write
*
- * Purpose: Modify an attribute in dense storage structures for an object
+ * Purpose: Modify an attribute in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -747,9 +733,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(H5F_addr_defined(ainfo->fheap_addr));
@@ -820,12 +804,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_copy_fh_cb
+ * Function: H5A__dense_copy_fh_cb
*
- * Purpose: Callback for fractal heap operator, to make copy of attribute
+ * Purpose: Callback for fractal heap operator, to make copy of attribute
* for calling routine
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -864,11 +848,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_rename
+ * Function: H5A__dense_rename
*
- * Purpose: Rename an attribute in dense storage structures for an object
+ * Purpose: Rename an attribute in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -892,9 +876,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(old_name);
@@ -996,7 +978,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
} /* end if */
else if(shared_mesg < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
+ HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
/* Delete old attribute from dense storage */
if(H5A__dense_remove(f, ainfo, old_name) < 0)
@@ -1018,11 +1000,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_iterate_bt2_cb
+ * Function: H5A__dense_iterate_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage iterator
+ * Purpose: v2 B-tree callback for dense attribute storage iterator
*
- * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP
+ * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1030,7 +1012,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static int
H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
{
const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
@@ -1114,11 +1096,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_iterate
+ * Function: H5A__dense_iterate
*
- * Purpose: Iterate over attributes in dense storage structures for an object
+ * Purpose: Iterate over attributes in dense storage structures for an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1140,9 +1122,7 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo,
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(H5F_addr_defined(ainfo->fheap_addr));
@@ -1251,11 +1231,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove_bt2_cb
+ * Function: H5A__dense_remove_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage record removal
+ * Purpose: v2 B-tree callback for dense attribute storage record removal
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1315,11 +1295,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove
+ * Function: H5A__dense_remove
*
- * Purpose: Remove an attribute from the dense storage of an object
+ * Purpose: Remove an attribute from the dense storage of an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1340,9 +1320,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name && *name);
@@ -1398,18 +1376,18 @@ done:
if(bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
if(attr_copy)
- H5O__msg_free_real(H5O_MSG_ATTR, attr_copy);
+ H5O_msg_free_real(H5O_MSG_ATTR, attr_copy);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_remove() */
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove_by_idx_bt2_cb
+ * Function: H5A__dense_remove_by_idx_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage record removal by index
+ * Purpose: v2 B-tree callback for dense attribute storage record removal by index
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1530,12 +1508,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_remove_by_idx
+ * Function: H5A__dense_remove_by_idx
*
- * Purpose: Remove an attribute from the dense storage of an object,
- * according to the order within an index
+ * Purpose: Remove an attribute from the dense storage of an object,
+ * according to the order within an index
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1556,9 +1534,7 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
@@ -1660,12 +1636,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_exists
+ * Function: H5A__dense_exists
*
- * Purpose: Check if an attribute exists in dense storage structures for
+ * Purpose: Check if an attribute exists in dense storage structures for
* an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1685,9 +1661,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
HDassert(name);
@@ -1749,11 +1723,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_delete_bt2_cb
+ * Function: H5A__dense_delete_bt2_cb
*
- * Purpose: v2 B-tree callback for dense attribute storage deletion
+ * Purpose: v2 B-tree callback for dense attribute storage deletion
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1806,18 +1780,18 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata)
done:
/* Release resources */
if(attr)
- H5O__msg_free_real(H5O_MSG_ATTR, attr);
+ H5O_msg_free_real(H5O_MSG_ATTR, attr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_delete_bt2_cb() */
/*-------------------------------------------------------------------------
- * Function: H5A__dense_delete
+ * Function: H5A__dense_delete
*
- * Purpose: Delete all dense storage structures for attributes on an object
+ * Purpose: Delete all dense storage structures for attributes on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1834,9 +1808,7 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo)
FUNC_ENTER_PACKAGE
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(ainfo);
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 9b592b0..b43e41d 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -36,13 +36,14 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Opkg.h" /* Object headers */
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual object layer */
/****************/
@@ -95,7 +96,7 @@
hid_t space_id; IN: ID of dataspace for attribute
hid_t acpl_id; IN: ID of creation property list (currently not used)
RETURNS
- Non-negative on success/Negative on failure
+ Non-negative on success/H5I_INVALID_HID on failure
DESCRIPTION
This function creates an attribute which is attached to the object
@@ -111,50 +112,65 @@
--------------------------------------------------------------------------*/
hid_t
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
- hid_t acpl_id)
+ hid_t acpl_id)
{
- H5A_t *attr = NULL; /* Attribute created */
- H5G_loc_t loc; /* Object location */
- H5T_t *type; /* Datatype to use for attribute */
- H5S_t *space; /* Dataspace to use for attribute */
- hid_t ret_value; /* Return value */
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_id);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type")
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read")
- /* Go do the real work for attaching the attribute to the dataset */
- if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")
+ /* Get correct property list */
+ if(H5P_DEFAULT == acpl_id)
+ acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+
+ /* Set creation properties */
+ if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
+ if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Create the attribute */
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
- /* Cleanup on failure */
- if(ret_value < 0 && attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ /* Clean up on failure */
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
-} /* H5Acreate1() */
+} /* end H5Acreate1() */
/*--------------------------------------------------------------------------
@@ -167,7 +183,7 @@ done:
hid_t loc_id; IN: Object (dataset or group) to be attached to
const char *name; IN: Name of attribute to locate and open
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -182,34 +198,41 @@ done:
hid_t
H5Aopen_name(hid_t loc_id, const char *name)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
- /* check arguments */
+ /* Check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
- /* Open the attribute on the object header */
- if(NULL == (attr = H5A__open_by_name(&loc, ".", name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name)
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Open the attribute */
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
- /* Cleanup on failure */
- if(ret_value < 0)
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ /* Clean up on failure */
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_name() */
@@ -225,7 +248,7 @@ done:
hid_t loc_id; IN: Object that attribute is attached to
unsigned idx; IN: Index (0-based) attribute to open
RETURNS
- ID of attribute on success, negative on failure
+ ID of attribute on success, H5I_INVALID_HID on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
@@ -240,32 +263,44 @@ done:
hid_t
H5Aopen_idx(hid_t loc_id, unsigned idx)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute opened */
- hid_t ret_value;
+ void *attr = NULL; /* attr token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "iIu", loc_id, idx);
- /* 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(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* Open the attribute in the object header */
- if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
+
+ /* Set location parameters */
+ 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_CRT_ORDER;
+ loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
+ loc_params.loc_data.loc_by_idx.n = (hsize_t)idx;
+ loc_params.loc_data.loc_by_idx.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, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Open the attribute */
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
- /* Cleanup on failure */
- if(ret_value < 0)
- if(attr && H5A__close(attr) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ /* Clean up on failure */
+ if(H5I_INVALID_HID == ret_value)
+ if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_idx() */
@@ -292,56 +327,26 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5O_loc_t *loc; /* Object location for attribute */
- void *obj;
- int ret_value;
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5O_info_t oinfo;
+ int ret_value = -1;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", loc_id);
- /* check arguments */
- if(H5I_BADID == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID")
- if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(NULL == (obj = H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom")
- switch(H5I_get_type (loc_id)) {
- case H5I_DATASET:
- if(NULL == (loc = H5D_oloc((H5D_t*)obj)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
- break;
-
- case H5I_DATATYPE:
- if(NULL == (loc = H5T_oloc((H5T_t*)obj)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed")
- break;
-
- case H5I_GROUP:
- if(NULL == (loc = H5G_oloc((H5G_t*)obj)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
- break;
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_FILE:
- case H5I_DATASPACE:
- case H5I_ATTR:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target")
- } /*lint !e788 All appropriate cases are covered */
-
- /* Look up the # of attributes for the object */
- if((ret_value = H5A__get_num_attrs(loc)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+
+ /* Get the number of attributes for the object */
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 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);
done:
FUNC_LEAVE_API(ret_value)
@@ -388,18 +393,23 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ herr_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5_ITER_ERROR)
H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data);
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute")
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
/* Call attribute iteration routine */
- if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
+ if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0)
+ HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 55560c7..6502fa4 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -42,6 +42,7 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -87,9 +88,6 @@ typedef struct {
/* Local Prototypes */
/********************/
-static H5A_t *H5A__create_common(const H5G_loc_t *loc, const char *name,
- const H5T_t *type, const H5S_t *space, hid_t acpl_id);
-static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata);
@@ -127,7 +125,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
/*-------------------------------------------------------------------------
- * Function: H5A__create_common
+ * Function: H5A__create
*
* Purpose: This is the guts of creating an attribute.
*
@@ -138,8 +136,8 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
*
*-------------------------------------------------------------------------
*/
-static H5A_t *
-H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type,
+H5A_t *
+H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
const H5S_t *space, hid_t acpl_id)
{
H5A_t *attr = NULL; /* Attribute created */
@@ -148,11 +146,11 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type,
htri_t exists; /* Whether attribute exists */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC_TAG(loc->oloc->addr)
+ FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr)
/* Check args */
HDassert(loc);
- HDassert(name);
+ HDassert(attr_name);
HDassert(type);
HDassert(space);
@@ -161,7 +159,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type,
* name, but it's going to be hard to unwind all the special cases on
* failure, so just check first, for now - QAK)
*/
- if((exists = H5O__attr_exists(loc->oloc, name)) < 0)
+ if((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes")
else if(exists > 0)
HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists")
@@ -196,7 +194,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type,
} /* end else */
/* Copy the attribute name */
- attr->shared->name = H5MM_xstrdup(name);
+ attr->shared->name = H5MM_xstrdup(attr_name);
/* Copy datatype */
if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL)))
@@ -234,15 +232,15 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type,
* SOHM table
*/
if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed")
if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed")
/* Check whether datatype is committed & increment ref count
* (to maintain ref. count incr/decr similarity with "shared message"
* type of datatype sharing)
*/
- if(H5T_committed(attr->shared->dt))
+ if(H5T_is_named(attr->shared->dt))
/* Increment the reference count on the shared datatype */
if(H5T_link(attr->shared->dt, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count")
@@ -285,45 +283,6 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* H5A__create_common() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5A__create
- *
- * Purpose: Entry point for creating attribute on an object
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Attribute structure on success, NULL on Failure.
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5A_t *
-H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
- const H5S_t *space, hid_t acpl_id)
-{
- H5A_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check args */
- HDassert(loc);
- HDassert(name);
- HDassert(type);
- HDassert(space);
-
- /* Go do the real work for attaching the attribute to the object */
- if(NULL == (ret_value = H5A__create_common(loc, name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, NULL, "unable to create attribute")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* H5A__create() */
@@ -350,7 +309,7 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -368,8 +327,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
loc_found = TRUE;
/* Go do the real work for attaching the attribute to the object */
- if(NULL == (attr = H5A__create_common(&obj_loc, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
+ if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
/* Set return value */
ret_value = attr;
@@ -384,7 +343,7 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__create_by_name() */
@@ -406,12 +365,12 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -446,15 +405,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__open
- *
- * Purpose: Open an attribute in an object header
+ * Function: H5A__open
*
- * Note: This routine is needed so that there's a non-API routine for
- * creating attributes that can set up VOL / SWMR info
- * (which need a DXPL).
+ * Purpose: Open an attribute in an object header
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 9, 2017
@@ -467,7 +422,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name)
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -490,7 +445,7 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open() */
@@ -517,7 +472,7 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -554,16 +509,16 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5A__open_by_name
+ * Function: H5A__open_by_name
*
- * Purpose: Open an attribute in an object header, according to it's name
+ * Purpose: Open an attribute in an object header, according to it's name
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 11, 2006
@@ -580,7 +535,7 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -618,7 +573,7 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open_by_name() */
@@ -652,7 +607,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
size_t buf_size; /* desired buffer size */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr)
HDassert(attr);
HDassert(mem_type);
@@ -721,7 +676,7 @@ done:
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5A__read() */
@@ -756,7 +711,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
size_t buf_size; /* desired buffer size */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr)
HDassert(attr);
HDassert(mem_type);
@@ -835,7 +790,7 @@ done:
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5A__write() */
@@ -939,7 +894,7 @@ H5A__get_type(H5A_t *attr)
H5T_t *dt = NULL;
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(attr);
@@ -963,14 +918,25 @@ H5A__get_type(H5A_t *attr)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype")
/* Atomize */
- if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
+ if (H5T_is_named(dt)) {
+ /* If this is a committed datatype, we need to recreate the
+ * two level IDs, where the VOL object is a copy of the
+ * returned datatype
+ */
+ if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ }
+ else {
+ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
+ }
done:
- if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0))
- HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
+ if(H5I_INVALID_HID == ret_value)
+ if(dt && H5T_close(dt) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_type() */
@@ -1062,21 +1028,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__copy
+ * Function: H5A__copy
*
- * Purpose: Copies attribute OLD_ATTR.
+ * Purpose: Copies attribute OLD_ATTR.
*
- * Return: Success: Pointer to a new copy of the OLD_ATTR argument.
+ * Return: Success: Pointer to a new copy of the OLD_ATTR argument.
*
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modification:Raymond Lu
- * 4 June 2008
- * Changed some attribute information to be shared.
- *
*-------------------------------------------------------------------------
*/
H5A_t *
@@ -1129,18 +1091,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__free
+ * Function: H5A__free
*
- * Purpose: Frees all memory associated with an attribute, but does not
+ * Purpose: Frees all memory associated with an attribute, but does not
* free the H5A_t structure (which should be done in H5T_close).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, November 15, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1159,12 +1119,12 @@ H5A__free(H5A_t *attr)
}
if(attr->shared->dt) {
if(H5T_close_real(attr->shared->dt) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
attr->shared->dt = NULL;
}
if(attr->shared->ds) {
if(H5S_close(attr->shared->ds) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
attr->shared->ds = NULL;
}
if(attr->shared->data)
@@ -1176,43 +1136,43 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__close_cb
- *
- * Purpose: Frees an attribute and all associated memory.
+ * Function: H5A__close_cb
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Called when the ref count reaches zero on the attribute's ID
*
- * Programmer: Quincey Koziol
- * Sunday, February 18, 1997
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5A__close_cb(H5A_t *attr)
+H5A__close_cb(H5VL_object_t *attr_vol_obj)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
- HDassert(attr);
- HDassert(attr->shared);
+ HDassert(attr_vol_obj);
+
+ /* Close the attribute */
+ if((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
- /* Call the actual close routine */
- if(H5A__close(attr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute")
+ /* Free the VOL object */
+ if(H5VL_free_object(attr_vol_obj) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__close_cb() */
/*-------------------------------------------------------------------------
- * Function: H5A__close
+ * Function: H5A__close
*
- * Purpose: Frees an attribute and all associated memory.
+ * Purpose: Frees an attribute and all associated memory.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, December 8, 1997
@@ -1355,45 +1315,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__exists
- *
- * Purpose: Private version of H5Aexists
- *
- * Note: This routine is needed so that there's a non-API routine for
- * detecting attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: TRUE/FALSE
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5A__exists(const H5G_loc_t *loc, const char *name)
-{
- htri_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check if the attribute exists */
- if((ret_value = H5O__attr_exists(loc->oloc, name)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__exists() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5A__exists_by_name
+ * Function: H5A__exists_by_name
*
- * Purpose: Private version of H5Aexists_by_name
+ * Purpose: Private version of H5Aexists_by_name
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: TRUE/FALSE/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 1, 2007
@@ -1409,7 +1335,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name)
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -1430,7 +1356,7 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__exists_by_name() */
@@ -1501,11 +1427,10 @@ done:
* Purpose: Builds a table containing a sorted list of attributes for
* an object
*
- * Note: Used for building table of attributes in non-native iteration
+ * Note: Used for building table of attributes in non-native iteration
* order for an index
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 18, 2006
@@ -1604,17 +1529,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__dense_build_table
+ * Function: H5A__dense_build_table
*
* Purpose: Builds a table containing a sorted list of attributes for
* an object
*
- * Note: Used for building table of attributes in non-native iteration
+ * Note: Used for building table of attributes in non-native iteration
* order for an index. Uses the "name" index to retrieve records,
- * but the 'idx_type' index for sorting them.
+ * but the 'idx_type' index for sorting them.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 11, 2006
@@ -1861,13 +1785,12 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
/*-------------------------------------------------------------------------
- * Function: H5A__attr_iterate_table
+ * Function: H5A__attr_iterate_table
*
* Purpose: Iterate over table containing a list of attributes for an object,
* making appropriate callbacks
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 18, 2006
@@ -1944,12 +1867,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__attr_release_table
+ * Function: H5A__attr_release_table
*
- * Purpose: Release table containing a list of attributes for an object
+ * Purpose: Release table containing a list of attributes for an object
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 11, 2006
@@ -1991,8 +1913,8 @@ done:
* Purpose: Retrieves the "attribute info" message for an object. Also
* sets the number of attributes correctly, if it isn't set up yet.
*
- * Return: Success: TRUE/FALSE whether message was found & retrieved
- * Failure: FAIL if error occurred
+ * Return: Success: TRUE/FALSE whether message was found & retrieved
+ * Failure: FAIL if error occurred
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -2056,8 +1978,7 @@ done:
* Chooses the oldest version possible, unless the
* file's low bound indicates otherwise.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -2190,14 +2111,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk")
- if(!H5T_committed(attr_src->shared->dt)) {
+ if(!H5T_is_named(attr_src->shared->dt)) {
/* If the datatype is not named, it may have been shared in the
* source file's heap. Un-share it for now. We'll try to shared
* it in the destination file below.
*/
if(H5O_msg_reset_share(H5O_DTYPE_ID, attr_dst->shared->dt) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing")
- } /* end if */
+ }
/* Copy the dataspace for the attribute. Make sure the maximal dimension is also copied.
* Otherwise the comparison in the test may complain about it. SLU 2011/4/12 */
@@ -2215,9 +2136,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
* committed or sharing is disabled.
*/
if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype")
if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace")
/* Compute the sizes of the datatype and dataspace. This is their raw
* size unless they're shared.
@@ -2404,7 +2325,7 @@ done:
* an object may have a reference attribute that points to the
* object itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* March 6, 2005
@@ -2432,7 +2353,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
HDassert(file_src);
HDassert(file_dst);
- if(H5T_committed(attr_src->shared->dt)) {
+ if (H5T_is_named(attr_src->shared->dt)) {
H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */
H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */
@@ -2452,7 +2373,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
/* Update shared message info from named datatype info */
H5T_update_shared(attr_dst->shared->dt);
- } /* end if */
+ }
/* Try to share both the datatype and dataset. This does nothing if the
* datatype is committed or sharing is disabled.
@@ -2555,8 +2476,7 @@ done:
*
* Purpose: Copy all dense attributes from SRC to DST.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* xcao@hdfgroup.org
@@ -2599,45 +2519,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__rename
- *
- * Purpose: Private version of H5Arename
- *
- * Note: This routine is needed so that there's a non-API routine for
- * renaming attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5A__rename(const H5G_loc_t *loc, const char *old_name, const char *new_name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Call object header attribute rename routine */
- if(H5O__attr_rename(loc->oloc, old_name, new_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__rename() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5A__rename_by_name
+ * Function: H5A__rename_by_name
*
* Purpose: Private version of H5Arename_by_name
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* February 20, 2007
@@ -2654,73 +2540,40 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
+ FUNC_ENTER_PACKAGE
- /* Call attribute rename routine */
- if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ /* Avoid thrashing things if the names are the same */
+ if(HDstrcmp(old_attr_name, new_attr_name)) {
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location */
+ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
+ loc_found = TRUE;
+
+ /* Call attribute rename routine */
+ if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ } /* end if */
done:
/* Release resources */
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__rename_by_name() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5A__get_num_attrs
- *
- * Purpose: Private version of deprecated H5Aget_num_attrs
- *
- * Note: This routine is needed so that there's a non-API routine for
- * querying the attribute count that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-int
-H5A__get_num_attrs(const H5O_loc_t *loc)
-{
- int ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Look up the # of attributes for the object */
- if((ret_value = H5O__attr_count(loc)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__get_num_attrs() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
- * Function: H5A__iterate_common
+ * Function: H5A__iterate_common
*
* Purpose: Internal common version of H5Aiterate
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2751,52 +2604,76 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
/*-------------------------------------------------------------------------
- * Function: H5A__iterate
+ * Function: H5A__iterate
*
* Purpose: Private version of H5Aiterate2
*
- * Note: This routine is needed so that there's a non-API routine for
- * iterating over attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
+H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx, H5A_operator2_t op, void *op_data)
{
+ 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 */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */
H5A_attr_iter_op_t attr_op; /* Attribute operator */
+ void *temp_obj = NULL;
+ H5I_type_t obj_type;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_APP2;
attr_op.u.app_op2 = op;
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location */
+ if(H5G_loc_find(loc, obj_name, &obj_loc) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found");
+ loc_found = TRUE;
+
+ /* Open the object */
+ if(NULL == (temp_obj = H5O_open_by_loc(&obj_loc, &obj_type)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object");
+
+ /* Get an ID for the object */
+ if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype");
+
/* Call internal attribute iteration routine */
- if((ret_value = H5A__iterate_common(loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
+ 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")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__iterate() */
+ /* Release resources */
+ if(obj_loc_id != H5I_INVALID_HID) {
+ if(H5I_dec_app_ref(obj_loc_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object");
+ } /* end if */
+ else if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location");
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5A__iterate() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5A__iterate_old
+ * Function: H5A__iterate_old
*
* Purpose: Private version of H5Aiterate1
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2811,7 +2688,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
hsize_t idx; /* Index of attribute to start iterating at */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE_NOERR
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_APP;
@@ -2822,124 +2699,23 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
/* Call internal attribute iteration routine */
if((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &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");
/* Translate hsize_t index value to legacy unsigned index value*/
if(attr_num)
*attr_num = (unsigned)idx;
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_old() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------
- * Function: H5A__iterate_by_name
- *
- * Purpose: Private version of H5Aiterate_by_name
- *
- * Note: This routine is needed so that there's a non-API routine for
- * iterating over attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op,
- void *op_data)
-{
- 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 */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- hid_t obj_loc_id = (-1); /* ID for object located */
- H5A_attr_iter_op_t attr_op; /* Attribute operator */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
-
- /* Open the object */
- if((obj_loc_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
-
- /* Build attribute operator info */
- attr_op.op_type = H5A_ATTR_OP_APP2;
- attr_op.u.app_op2 = op;
-
- /* Call 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")
-
-done:
- /* Release resources */
- if(obj_loc_id > 0) {
- if(H5I_dec_app_ref(obj_loc_id) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- } /* end if */
- else if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
-
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__iterate_by_name() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5A__delete
- *
- * Purpose: Private version of H5Adelete
- *
- * Note: This routine is needed so that there's a non-API routine for
- * deleting attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5A__delete(const H5G_loc_t *loc, const char *name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Call object header attribute delete attribute routine */
- if(H5O__attr_remove(loc->oloc, name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__delete() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5A__delete_by_name
*
* Purpose: Private version of H5Adelete_by_name
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -2955,7 +2731,7 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -2976,7 +2752,7 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__delete_by_name() */
@@ -2985,8 +2761,7 @@ done:
*
* Purpose: Private version of H5Adelete_by_idx
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 6, 2017
@@ -3003,7 +2778,7 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -3024,6 +2799,6 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__delete_by_idx() */
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index af16b55..cfe9dae 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -155,6 +155,21 @@ typedef struct {
H5A_t **attrs; /* Pointer to array of attribute pointers */
} H5A_attr_table_t;
+/* Types for optional attribute VOL operations */
+typedef enum H5VL_attr_optional_t {
+ H5VL_ATTR_ITERATE_OLD /* H5Aiterate (deprecated routine) */
+ /* (This enum value should have an
+ * "#ifndefH5_NO_DEPRECATED_SYMBOLS"
+ * around it, but the compiler
+ * complains about an empty enum
+ * when deprecated symbols are
+ * disabled currently. When
+ * another enum value is added,
+ * please put the #ifdef around
+ * this symbol. QAK - 2018/12/06
+ */
+} H5VL_attr_optional_t;
+
/*****************************/
/* Package Private Variables */
@@ -191,37 +206,28 @@ H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name,
const char *attr_name);
H5_DLL H5A_t *H5A__open_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__open_common(const H5G_loc_t *loc, H5A_t *attr);
H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr);
H5_DLL hid_t H5A__get_type(H5A_t *attr);
H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo);
H5_DLL hid_t H5A__get_create_plist(H5A_t* attr);
H5_DLL herr_t H5A__free(H5A_t *attr);
H5_DLL herr_t H5A__close(H5A_t *attr);
-H5_DLL herr_t H5A__close_cb(H5A_t *attr);
+H5_DLL herr_t H5A__close_cb(H5VL_object_t *attr_vol_obj);
H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo);
H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr);
-H5_DLL herr_t H5A__rename(const H5G_loc_t *loc, const char *old_name,
- const char *new_name);
H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name,
const char *new_attr_name);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL int H5A__get_num_attrs(const H5O_loc_t *loc);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-H5_DLL herr_t H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
+H5_DLL herr_t H5A__iterate(const H5G_loc_t *loc, const char *obj_name,H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx, H5A_operator2_t op, void *op_data);
-H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op,
- void *op_data);
#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(const H5G_loc_t *loc, const char *name);
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 htri_t H5A__exists(const H5G_loc_t *loc, const char *name);
H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name);
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);
diff --git a/src/H5Atest.c b/src/H5Atest.c
index 31fbe8e..6fc1cbf 100644
--- a/src/H5Atest.c
+++ b/src/H5Atest.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Atest.c
- * Dec 18 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Atest.c
*
- * Purpose: Attribute testing routines.
+ * Purpose: Attribute testing routines.
*
*-------------------------------------------------------------------------
*/
@@ -27,19 +25,20 @@
/****************/
#include "H5Amodule.h" /* This source code file is part of the H5A module */
-#define H5A_TESTING /*suppress warning about H5A testing funcs*/
+#define H5A_TESTING /* Suppress warning about H5A testing funcs */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -78,12 +77,11 @@
/*-------------------------------------------------------------------------
- * Function: H5A__is_shared_test
+ * Function: H5A__is_shared_test
*
* Purpose: Check if an attribute is shared
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: TRUE/FALSE/FAIL
*
* Programmer: Quincey Koziol
* Dec 19, 2006
@@ -99,7 +97,7 @@ H5A__is_shared_test(hid_t attr_id)
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Check if attribute is shared */
@@ -111,12 +109,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__get_shared_rc_test
+ * Function: H5A__get_shared_rc_test
*
* Purpose: Retrieve the refcount for a shared attribute
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Dec 19, 2006
@@ -127,13 +124,13 @@ herr_t
H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count)
{
H5A_t *attr; /* Attribute object for ID */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Push API context */
diff --git a/src/H5B.c b/src/H5B.c
index 53d5529..71b9020 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -471,12 +471,12 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
* Create the new B-tree node.
*/
if(H5B_create(f, shared->type, udata, &split_bt_ud->addr/*out*/) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree")
cache_udata.f = f;
cache_udata.type = shared->type;
cache_udata.rc_shared = bt_ud->bt->rc_shared;
if(NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree")
split_bt_ud->bt->level = bt_ud->bt->level;
/*
diff --git a/src/H5B2.c b/src/H5B2.c
index 1f964b8..cf8e4a9 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -220,7 +220,7 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata)
/* Look up the B-tree header */
if(NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header")
/* Check for pending heap deletion */
if(hdr->pending_delete)
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index e9b6810..68669e8 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -523,8 +523,7 @@ done:
*-------------------------------------------------------------------------
*/
H5B2_hdr_t *
-H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata,
- unsigned flags)
+H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags)
{
H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */
H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 83a5272..0b64381 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -25,9 +25,6 @@
#ifndef _H5B2private_H
#define _H5B2private_H
-/* Include package's public header */
-#include "H5B2public.h"
-
/* Private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Fprivate.h" /* File access */
diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c
index 5cad81b..c491783 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -80,7 +80,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/* Get shared info for B-tree */
if(NULL == (rc_shared = (type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -91,7 +91,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/*
* Print the values.
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index e203b87..5aa3628 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -27,7 +27,6 @@
#ifndef _H5Bprivate_H
#define _H5Bprivate_H
-#include "H5Bpublic.h" /*API prototypes */
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
diff --git a/src/H5C.c b/src/H5C.c
index c4d4eed..a22eca0 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1284,7 +1284,7 @@ H5C_insert_entry(H5F_t * f,
insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
- /* Get the ring type from the DXPL */
+ /* Get the ring type from the API context */
ring = H5CX_get_ring();
entry_ptr = (H5C_cache_entry_t *)thing;
@@ -2331,10 +2331,10 @@ H5C_protect(H5F_t * f,
haddr_t tag; /* Tag value */
/* The entry is already in the cache, but make sure that the tag value
- is still legal. This will ensure that had
- the entry NOT been in the cache, tagging was still set up correctly
- and it would have received a legal tag value after getting loaded
- from disk. */
+ * is still legal. This will ensure that had the entry NOT been in the
+ * cache, tagging was still set up correctly and it would have received
+ * a legal tag value after getting loaded from disk.
+ */
/* Get the tag */
tag = H5CX_get_tag();
@@ -2389,10 +2389,10 @@ H5C_protect(H5F_t * f,
else
empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
- /* try to free up if necceary and if evictions are permitted. Note
- * that if evictions are enabled, we will call H5C__make_space_in_cache()
- * regardless if the min_free_space requirement is not met.
- */
+ /* try to free up if necceary and if evictions are permitted. Note
+ * that if evictions are enabled, we will call H5C__make_space_in_cache()
+ * regardless if the min_free_space requirement is not met.
+ */
if ( ( cache_ptr->evictions_enabled ) &&
( ( (cache_ptr->index_size + entry_ptr->size) >
cache_ptr->max_cache_size)
@@ -2438,10 +2438,10 @@ H5C_protect(H5F_t * f,
*
* Second, when writes are not permitted it is also possible
* for the cache to grow without bound.
- *
- * Third, the user may choose to disable evictions -- causing
- * the cache to grow without bound until evictions are
- * re-enabled.
+ *
+ * Third, the user may choose to disable evictions -- causing
+ * the cache to grow without bound until evictions are
+ * re-enabled.
*
* Finally, we usually don't check to see if the cache is
* oversized at the end of an unprotect. As a result, it is
@@ -4287,11 +4287,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__autoadjust__ageout(H5F_t * f,
- double hit_rate,
- enum H5C_resize_status * status_ptr,
- size_t * new_max_cache_size_ptr,
- hbool_t write_permitted)
+H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status * status_ptr,
+ size_t * new_max_cache_size_ptr, hbool_t write_permitted)
{
H5C_t * cache_ptr = f->shared->cache;
size_t test_size;
diff --git a/src/H5CX.c b/src/H5CX.c
index f809d1c..1d9cf3d 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -53,7 +53,7 @@
* each thread individually. The association of contexts to threads will
* be handled by the pthread library.
*
- * In order for this macro to work, H5E_get_my_stack() must be preceeded
+ * In order for this macro to work, H5E__get_my_stack() must be preceeded
* by "H5CX_node_t *ctx =".
*/
#define H5CX_get_my_context() H5CX__get_context()
@@ -125,7 +125,6 @@
(*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \
} /* end if */ \
}
-#endif /* H5_HAVE_PARALLEL */
/* Macro for the duplicated code to test and set properties for a property list */
#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
@@ -140,6 +139,7 @@
if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \
} /* end if */
+#endif /* H5_HAVE_PARALLEL */
/******************/
@@ -267,6 +267,10 @@ typedef struct H5CX_t {
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
+
+ /* Cached VOL properties */
+ void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */
+ hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */
} H5CX_t;
/* Typedef for nodes on the API context stack */
@@ -320,7 +324,9 @@ typedef struct H5CX_lapl_cache_t {
/********************/
/* Local Prototypes */
/********************/
+#ifdef H5_HAVE_THREADSAFE
static H5CX_node_t **H5CX__get_context(void);
+#endif /* H5_HAVE_THREADSAFE */
static void H5CX__push_common(H5CX_node_t *cnode);
static H5CX_node_t *H5CX__pop_common(void);
@@ -862,7 +868,7 @@ done:
*
* Purpose: Sanity checks and sets up collective operations.
*
- * Note: Should be called for all API routines that modify file
+ * Note: Should be called for all API routines that modify file
* file metadata but don't pass in an access property list.
*
* Return: Non-negative on success / Negative on failure
@@ -916,6 +922,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_vol_wrap_ctx
+ *
+ * Purpose: Sets the VOL object wrapping context for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * October 14, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(head && *head);
+
+ /* Set the API context value */
+ (*head)->ctx.vol_wrap_ctx = vol_wrap_ctx;
+
+ /* Mark the value as valid */
+ (*head)->ctx.vol_wrap_ctx_valid = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_set_vol_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_dxpl
*
* Purpose: Retrieves the DXPL ID for the current API call context.
@@ -968,6 +1008,42 @@ H5CX_get_lapl(void)
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_vol_wrap_ctx
+ *
+ * Purpose: Retrieves the VOL object wrapping context for an operation.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * October 14, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_wrap_ctx);
+ HDassert(head && *head);
+
+ /* Check for value that was set */
+ if((*head)->ctx.vol_wrap_ctx_valid)
+ /* Get the value */
+ *vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
+ else
+ *vol_wrap_ctx = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_vol_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_tag
*
* Purpose: Retrieves the object tag for the current API call context.
@@ -2470,7 +2546,11 @@ H5CX__pop_common(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 *ret_value = NULL; /* Return value */
+#ifdef H5_HAVE_PARALLEL
FUNC_ENTER_STATIC
+#else
+ FUNC_ENTER_STATIC_NOERR
+#endif
/* Sanity check */
HDassert(head && *head);
@@ -2495,7 +2575,9 @@ H5CX__pop_common(void)
ret_value = (*head);
(*head) = (*head)->next;
+#ifdef H5_HAVE_PARALLEL
done:
+#endif /* H5_HAVE_PARALLEL */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__pop_common() */
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 44a4067..57ca5cd 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -63,10 +63,12 @@ H5_DLL void H5CX_set_lapl(hid_t lapl_id);
H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
hid_t loc_id, hbool_t is_collective);
H5_DLL herr_t H5CX_set_loc(hid_t loc_id);
+H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx);
/* "Getter" routines for API context info */
H5_DLL hid_t H5CX_get_dxpl(void);
H5_DLL hid_t H5CX_get_lapl(void);
+H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx);
H5_DLL haddr_t H5CX_get_tag(void);
H5_DLL H5AC_ring_t H5CX_get_ring(void);
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index 26b6506..bdab1a3 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -1139,22 +1139,22 @@ H5C__load_cache_image(H5F_t *f)
*/
if(H5F_addr_defined(cache_ptr->image_addr)) {
/* Sanity checks */
- HDassert(cache_ptr->image_len > 0);
+ HDassert(cache_ptr->image_len > 0);
HDassert(cache_ptr->image_buffer == NULL);
- /* Allocate space for the image */
+ /* Allocate space for the image */
if(NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer")
- /* Load the image from file */
- if(H5C__read_cache_image(f, cache_ptr) < 0)
+ /* Load the image from file */
+ if(H5C__read_cache_image(f, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block")
- /* Reconstruct cache contents, from image */
- if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0)
+ /* Reconstruct cache contents, from image */
+ if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block")
- /* Free the image buffer */
+ /* Free the image buffer */
cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer);
/* Update stats -- must do this now, as we are about
diff --git a/src/H5Cquery.c b/src/H5Cquery.c
index 6c927b0..e4f3133 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -472,11 +472,11 @@ H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_le
if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry")
- if(image_addr == NULL || image_len == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry")
- *image_addr = cache_ptr->image_addr;
- *image_len = cache_ptr->image_len;
+ if(image_addr)
+ *image_addr = cache_ptr->image_addr;
+ if(image_len)
+ *image_len = cache_ptr->image_len;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index 66aedd9..0f08ede 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -471,7 +471,7 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx)
if(H5C__flush_single_entry(ctx->f, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.")
ctx->evicted_entries_last_pass = TRUE;
- } /* end else-if */
+ }
else
ctx->skipped_pf_dirty_entries = TRUE;
diff --git a/src/H5Ctest.c b/src/H5Ctest.c
index 2cd0a5d..340071a 100644
--- a/src/H5Ctest.c
+++ b/src/H5Ctest.c
@@ -40,6 +40,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* Files */
#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -142,8 +143,8 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status)
FUNC_ENTER_PACKAGE
/* Get file pointer */
- if(NULL == (f = (H5F_t *)H5I_object_verify(fid, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Get cache pointer */
cache = f->shared->cache;
diff --git a/src/H5D.c b/src/H5D.c
index 61ccb5a..1e16868 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -21,12 +21,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -73,31 +74,28 @@ H5FL_BLK_EXTERN(type_conv);
/*-------------------------------------------------------------------------
- * Function: H5Dcreate2
+ * Function: H5Dcreate2
*
- * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
- * dataset for access, and associates with that dataset constant
- * and initial persistent properties including the type of each
- * datapoint as stored in the file (TYPE_ID), the size of the
- * dataset (SPACE_ID), and other initial miscellaneous
- * properties (DCPL_ID).
+ * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
+ * dataset for access, and associates with that dataset constant
+ * and initial persistent properties including the type of each
+ * datapoint as stored in the file (TYPE_ID), the size of the
+ * dataset (SPACE_ID), and other initial miscellaneous
+ * properties (DCPL_ID).
*
- * All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, dataspaces, and creation
- * parameters from the old ones and reuse them in calls to
- * create other datasets.
+ * All arguments are copied into the dataset, so the caller is
+ * allowed to derive new types, dataspaces, and creation
+ * parameters from the old ones and reuse them in calls to
+ * create other datasets.
*
- * Return: Success: The object ID of the new dataset. At this
- * point, the dataset is ready to receive its
- * raw data. Attempting to read raw data from
- * the dataset will probably return the fill
- * value. The dataset should be closed when the
- * caller is no longer interested in it.
+ * Return: Success: The object ID of the new dataset. At this
+ * point, the dataset is ready to receive its
+ * raw data. Attempting to read raw data from
+ * the dataset will probably return the fill
+ * value. The dataset should be closed when the
+ * caller is no longer interested in it.
*
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Thursday, April 5, 2007
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -105,88 +103,106 @@ hid_t
H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id)
{
- H5G_loc_t loc; /* Object location to insert dataset into */
- H5D_t *dset = NULL; /* New dataset's info */
- const H5S_t *space; /* Dataspace for dataset */
- hid_t ret_value; /* Return value */
+ void *dset = NULL; /* New dataset's info */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id,
dapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(H5I_DATATYPE != H5I_get_type(type_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID")
- if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
- /* Get correct property list */
+ /* Get link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list")
- /* Get correct property list */
+ /* Get dataset creation property list */
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Create the new dataset & get its ID */
- if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
- if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
+ /* Get the property list structure for the dcpl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Set creation properties */
+ if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
+ if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
+ if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Create the dataset */
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
+
+ /* Get an atom for the dataset */
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
done:
- if(ret_value < 0)
- if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if(H5I_INVALID_HID == ret_value)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate2() */
/*-------------------------------------------------------------------------
- * Function: H5Dcreate_anon
+ * Function: H5Dcreate_anon
*
- * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
- * dataset for access, and associates with that dataset constant
- * and initial persistent properties including the type of each
- * datapoint as stored in the file (TYPE_ID), the size of the
- * dataset (SPACE_ID), and other initial miscellaneous
- * properties (DCPL_ID).
+ * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
+ * dataset for access, and associates with that dataset constant
+ * and initial persistent properties including the type of each
+ * datapoint as stored in the file (TYPE_ID), the size of the
+ * dataset (SPACE_ID), and other initial miscellaneous
+ * properties (DCPL_ID).
*
- * All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, dataspaces, and creation
- * parameters from the old ones and reuse them in calls to
- * create other datasets.
+ * All arguments are copied into the dataset, so the caller is
+ * allowed to derive new types, dataspaces, and creation
+ * parameters from the old ones and reuse them in calls to
+ * create other datasets.
*
* The resulting ID should be linked into the file with
* H5Olink or it will be deleted when closed.
*
- * Return: Success: The object ID of the new dataset. At this
- * point, the dataset is ready to receive its
- * raw data. Attempting to read raw data from
- * the dataset will probably return the fill
- * value. The dataset should be linked into
- * the group hierarchy before being closed or
- * it will be deleted. The dataset should be
- * closed when the caller is no longer interested
- * in it.
- *
- * Failure: FAIL
+ * Return: Success: The object ID of the new dataset. At this
+ * point, the dataset is ready to receive its
+ * raw data. Attempting to read raw data from
+ * the dataset will probably return the fill
+ * value. The dataset should be linked into
+ * the group hierarchy before being closed or
+ * it will be deleted. The dataset should be
+ * closed when the caller is no longer interested
+ * in it.
*
- * Programmer: James Laird
- * Tuesday, January 24, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -194,111 +210,118 @@ hid_t
H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
hid_t dapl_id)
{
- H5G_loc_t loc; /* Object location to insert dataset into */
- H5D_t *dset = NULL; /* New dataset's info */
- const H5S_t *space; /* Dataspace for dataset */
- hid_t ret_value; /* Return value */
+ void *dset = NULL; /* dset token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(H5I_DATATYPE != H5I_get_type(type_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID")
- if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* build and open the new dataset */
- if(NULL == (dset = H5D__create_anon(loc.oloc->file, type_id, space, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Register the new dataset to get an ID for it */
- if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
-done:
- /* Release the dataset's object header, if it was created */
- if(dset) {
- H5O_loc_t *oloc; /* Object location for dataset */
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
+ if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
- /* Get the new dataset's object location */
- if(NULL == (oloc = H5D_oloc(dset)))
- HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset")
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
- /* Decrement refcount on dataset's object header in memory */
- if(H5O_dec_rc_by_loc(oloc) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
- } /* end if */
+ /* Create the dataset */
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
+ /* Get an atom for the dataset */
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
+
+done:
/* Cleanup on failure */
- if(ret_value < 0)
- if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if(H5I_INVALID_HID == ret_value)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate_anon() */
/*-------------------------------------------------------------------------
- * Function: H5Dopen2
+ * Function: H5Dopen2
*
- * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
- * its ID. The dataset should be close when the caller is no
- * longer interested in it.
+ * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
+ * its ID. The dataset should be close when the caller is no
+ * longer interested in it.
*
* Takes a dataset access property list
*
- * Return: Success: A new dataset ID
- * Failure: FAIL
+ * Return: Success: Object ID of the dataset
*
- * Programmer: James Laird
- * Thursday, July 27, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
{
- H5D_t *dset = NULL;
- H5G_loc_t loc; /* Object location of group */
- hid_t ret_value;
+ void *dset = NULL; /* dset token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, dapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Set the location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
/* Open the dataset */
- if(NULL == (dset = H5D__open_name(&loc, name, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
+ if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Register an atom for the dataset */
- if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom")
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
- if(ret_value < 0)
- if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if(H5I_INVALID_HID == ret_value)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen2() */
@@ -307,14 +330,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Dclose
*
- * Purpose: Closes access to a dataset (DATASET_ID) and releases
- * resources used by it. It is illegal to subsequently use that
- * same dataset ID in calls to other dataset functions.
+ * Purpose: Closes access to a dataset and releases resources used by
+ * it. It is illegal to subsequently use that same dataset
+ * ID in calls to other dataset functions.
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -327,11 +347,10 @@ H5Dclose(hid_t dset_id)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(NULL == H5I_object_verify(dset_id, H5I_DATASET))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(H5I_DATASET != H5I_get_type(dset_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID")
- /*
- * Decrement the counter on the dataset. It will be freed if the count
+ /* Decrement the counter on the dataset. It will be freed if the count
* reaches zero.
*/
if(H5I_dec_app_ref_always_close(dset_id) < 0)
@@ -343,36 +362,34 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_space
- *
- * Purpose: Returns a copy of the file dataspace for a dataset.
+ * Function: H5Dget_space
*
- * Return: Success: ID for a copy of the dataspace. The data
- * space should be released by calling
- * H5Sclose().
+ * Purpose: Returns a copy of the file dataspace for a dataset.
*
- * Failure: FAIL
+ * Return: Success: ID for a copy of the dataspace. The data
+ * space should be released by calling
+ * H5Sclose().
*
- * Programmer: Robb Matzke
- * Wednesday, January 28, 1998
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Dget_space(hid_t dset_id)
{
- H5D_t *dset = NULL;
- hid_t ret_value;
+ H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset")
+ 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")
- if((ret_value = H5D__get_space(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get dataspace")
+ /* Get the dataspace */
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
done:
FUNC_LEAVE_API(ret_value)
@@ -380,35 +397,30 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_space_status
- *
- * Purpose: Returns the status of dataspace allocation.
+ * Function: H5Dget_space_status
*
- * Return:
- * Success: Non-negative
+ * Purpose: Returns the status of dataspace allocation.
*
- * Failture: Negative
- *
- * Programmer: Raymond Lu
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
{
- H5D_t *dset = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Ds", dset_id, allocation);
- /* Check arguments */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ /* Check args */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- /* Read dataspace address and return */
- if(H5D__get_space_status(dset, allocation) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
+ /* 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status")
done:
FUNC_LEAVE_API(ret_value)
@@ -416,36 +428,34 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_type
+ * Function: H5Dget_type
*
- * Purpose: Returns a copy of the file datatype for a dataset.
+ * Purpose: Returns a copy of the file datatype for a dataset.
*
- * Return: Success: ID for a copy of the datatype. The data
- * type should be released by calling
- * H5Tclose().
+ * Return: Success: ID for a copy of the datatype. The data
+ * type should be released by calling
+ * H5Tclose().
*
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Tuesday, February 3, 1998
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Dget_type(hid_t dset_id)
{
- H5D_t *dset; /* Dataset */
- hid_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ 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")
- if((ret_value = H5D__get_type(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace")
+ /* get the datatype */
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
done:
FUNC_LEAVE_API(ret_value)
@@ -453,15 +463,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_create_plist
+ * Function: H5Dget_create_plist
*
- * Purpose: Returns a copy of the dataset creation property list.
+ * Purpose: Returns a copy of the dataset creation property list.
*
- * Return: Success: ID for a copy of the dataset creation
- * property list. The template should be
- * released by calling H5P_close().
+ * Return: Success: ID for a copy of the dataset creation
+ * property list. The template should be
+ * released by calling H5P_close().
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Tuesday, February 3, 1998
@@ -471,18 +481,19 @@ done:
hid_t
H5Dget_create_plist(hid_t dset_id)
{
- H5D_t *dataset; /* Dataset structure */
- hid_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset")
+ 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")
- if((ret_value = H5D__get_create_plist(dataset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist")
+ /* 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties")
done:
FUNC_LEAVE_API(ret_value)
@@ -490,32 +501,32 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_access_plist
+ * Function: H5Dget_access_plist
*
- * Purpose: Returns a copy of the dataset creation property list.
+ * Purpose: Returns a copy of the dataset access property list.
*
* Description: H5Dget_access_plist returns the dataset access property
- * list identifier of the specified dataset.
+ * list identifier of the specified dataset.
*
- * The chunk cache parameters in the returned property lists will be
- * those used by the dataset. If the properties in the file access
- * property list were used to determine the dataset’s chunk cache
- * configuration, then those properties will be present in the
- * returned dataset access property list. If the dataset does not
- * use a chunked layout, then the chunk cache properties will be set
- * to the default. The chunk cache properties in the returned list
- * are considered to be “set”, and any use of this list will override
- * the corresponding properties in the file’s file access property
- * list.
+ * The chunk cache parameters in the returned property lists will be
+ * those used by the dataset. If the properties in the file access
+ * property list were used to determine the dataset’s chunk cache
+ * configuration, then those properties will be present in the
+ * returned dataset access property list. If the dataset does not
+ * use a chunked layout, then the chunk cache properties will be set
+ * to the default. The chunk cache properties in the returned list
+ * are considered to be “set”, and any use of this list will override
+ * the corresponding properties in the file’s file access property
+ * list.
*
- * All link access properties in the returned list will be set to the
- * default values.
+ * All link access properties in the returned list will be set to the
+ * default values.
*
- * Return: Success: ID for a copy of the dataset access
- * property list. The template should be
- * released by calling H5Pclose().
+ * Return: Success: ID for a copy of the dataset access
+ * property list. The template should be
+ * released by calling H5Pclose().
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Neil Fortner
* Wednesday, October 29, 2008
@@ -525,18 +536,19 @@ done:
hid_t
H5Dget_access_plist(hid_t dset_id)
{
- H5D_t *dset; /* Dataset structure */
- hid_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ 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")
- if((ret_value = H5D_get_access_plist(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist")
+ /* 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties")
done:
FUNC_LEAVE_API(ret_value)
@@ -544,39 +556,36 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_storage_size
+ * Function: H5Dget_storage_size
*
- * Purpose: Returns the amount of storage that is required for the
- * dataset. For chunked datasets this is the number of allocated
- * chunks times the chunk size.
+ * Purpose: Returns the amount of storage that is required for the
+ * dataset. For chunked datasets this is the number of allocated
+ * chunks times the chunk size.
*
- * Return: Success: The amount of storage space allocated for the
- * dataset, not counting meta data. The return
- * value may be zero if no data has been stored.
+ * Return: Success: The amount of storage space allocated for the
+ * dataset, not counting meta data. The return
+ * value may be zero if no data has been stored.
*
- * Failure: Zero
- *
- * Programmer: Robb Matzke
- * Wednesday, April 21, 1999
+ * Failure: Zero
*
*-------------------------------------------------------------------------
*/
hsize_t
H5Dget_storage_size(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to query */
- hsize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset")
+ 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 return value */
- if(H5D__get_storage_size(dset, &ret_value) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage")
+ /* 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size")
done:
FUNC_LEAVE_API(ret_value)
@@ -584,34 +593,32 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dget_offset
- *
- * Purpose: Returns the address of dataset in file.
+ * Function: H5Dget_offset
*
- * Return: Success: the address of dataset
+ * Purpose: Returns the address of dataset in file.
*
- * Failure: HADDR_UNDEF
+ * Return: Success: The address of dataset
*
- * Programmer: Raymond Lu
- * November 6, 2002
+ * Failure: HADDR_UNDEF (can also be a valid return value!)
*
*-------------------------------------------------------------------------
*/
haddr_t
H5Dget_offset(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to query */
- haddr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_API(HADDR_UNDEF)
H5TRACE1("a", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset")
+ 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 return value */
- ret_value = H5D__get_offset(dset);
+ /* Get the offset */
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
done:
FUNC_LEAVE_API(ret_value)
@@ -740,7 +747,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf)
/* Check args */
if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
if(!(H5S_has_extent(space)))
@@ -793,8 +800,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
hsize_t *size)
{
H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0};
- H5D_t *dset; /* Dataset for operation */
- H5S_t *fspace = NULL; /* Dataset's dataspace */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
H5S_t *mspace = NULL; /* Memory dataspace */
char bogus; /* bogus value to pass to H5Diterate() */
H5S_t *space; /* Dataspace for iteration */
@@ -809,8 +815,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
if(H5I_DATASET != H5I_get_type(dataset_id) ||
H5I_DATATYPE != H5I_get_type(type_id) || size == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
- if(NULL == (dset = (H5D_t *)H5I_object(dataset_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -819,17 +825,19 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
/* Save the dataset */
- vlen_bufsize.dset = dset;
+ vlen_bufsize.dset_vol_obj = vol_obj;
+ vlen_bufsize.fspace_id = H5I_INVALID_HID;
+ vlen_bufsize.mspace_id = H5I_INVALID_HID;
/* Get a copy of the dataset's dataspace */
- if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace")
- vlen_bufsize.fspace = fspace;
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
/* Create a scalar for the memory dataspace */
if(NULL == (mspace = H5S_create(H5S_SCALAR)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
- vlen_bufsize.mspace = mspace;
+ if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
/* Grab the temporary buffers required */
if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1)))
@@ -845,9 +853,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
vlen_bufsize.size = 0;
/* Call H5S_select_iterate with args, etc. */
- dset_op.op_type = H5S_SEL_ITER_OP_APP;
- dset_op.u.app_op.op = H5D__vlen_get_buf_size;
- dset_op.u.app_op.type_id = type_id;
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = H5D__vlen_get_buf_size;
+ dset_op.u.app_op.type_id = type_id;
ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
@@ -856,10 +864,14 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
*size = vlen_bufsize.size;
done:
- if(fspace && H5S_close(fspace) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- if(mspace && H5S_close(mspace) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ if(ret_value < 0)
+ if(mspace && H5S_close(mspace) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+
+ if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id")
+ if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id")
if(vlen_bufsize.fl_tbuf != NULL)
vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf);
if(vlen_bufsize.vl_tbuf != NULL)
@@ -870,40 +882,37 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dset_extent
+ * Function: H5Dset_extent
*
- * Purpose: Modifies the dimensions of a dataset.
- * Can change to a smaller dimension.
+ * Purpose: Modifies the dimensions of a dataset.
+ * Can change to a smaller dimension.
*
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * April 9, 2002
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Dset_extent(hid_t dset_id, const hsize_t size[])
{
- H5D_t *dset; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ 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")
if(!size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL")
/* 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")
- /* Private function */
- if(H5D__set_extent(dset, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset")
+ /* Set the extent */
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent")
done:
FUNC_LEAVE_API(ret_value)
@@ -915,33 +924,33 @@ done:
*
* Purpose: Flushes all buffers associated with a dataset.
*
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Mike McGreevy
- * May 19, 2010
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Dflush(hid_t dset_id)
{
- H5D_t *dset; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* return value */
+ 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 == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ 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")
- /* Flush dataset information cached in memory */
- if(H5D__flush(dset, dset_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info")
+ /* 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
done:
FUNC_LEAVE_API(ret_value)
@@ -953,32 +962,29 @@ done:
*
* Purpose: Refreshes all buffers associated with a dataset.
*
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Mike McGreevy
- * July 21, 2010
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Drefresh(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
-
+ 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 == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ 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")
- /* Call private function to refresh the dataset object */
- if((H5D__refresh(dset_id, dset)) < 0)
+ /* 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)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
done:
@@ -990,12 +996,13 @@ done:
* Function: H5Dformat_convert (Internal)
*
* Purpose: For chunked:
- * Convert the chunk indexing type to version 1 B-tree if not
- * For compact/contiguous:
- * Downgrade layout version to 3 if greater than 3
- * For virtual: no conversion
+ * Convert the chunk indexing type to version 1 B-tree if not
+ * For compact/contiguous:
+ * Downgrade layout version to 3 if greater than 3
+ * For virtual:
+ * No conversion
*
- * Return: Non-negative on success, negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* Feb 2015
@@ -1005,47 +1012,23 @@ done:
herr_t
H5Dformat_convert(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
+ 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 == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ 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")
- 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)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset")
- break;
-
- case H5D_CONTIGUOUS:
- 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)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset")
- break;
-
- case H5D_VIRTUAL:
- /* Nothing to do even though layout is version 4 */
- break;
-
- case H5D_LAYOUT_ERROR:
- case H5D_NLAYOUTS:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
- } /* end switch */
+ /* Convert the dataset */
+ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format")
done:
FUNC_LEAVE_API(ret_value)
@@ -1065,25 +1048,23 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type)
+H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type)
{
- H5D_t *dset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
-
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Dk", did, idx_type);
+ H5TRACE2("e", "i*Dk", dset_id, idx_type);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
-
- /* Should be a chunked dataset */
- if(dset->shared->layout.type != H5D_CHUNKED)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked")
+ 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")
+ if(NULL == idx_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
/* Get the chunk indexing type */
- if(idx_type)
- *idx_type = dset->shared->layout.u.chunk.idx_type;
+ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type")
done:
FUNC_LEAVE_API(ret_value)
@@ -1095,7 +1076,10 @@ done:
*
* Purpose: Returns the size of an allocated chunk.
*
- * Return: Non-negative on success, negative on failure
+ * Intended for use with the H5D(O)read_chunk API call so
+ * the caller can construct an appropriate buffer.
+ *
+ * Return: SUCCEED/FAIL
*
* Programmer: Matthew Strong (GE Healthcare)
* 20 October 2016
@@ -1105,25 +1089,22 @@ done:
herr_t
H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes)
{
- H5D_t *dset = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes);
/* Check arguments */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if( NULL == offset )
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
- if( NULL == chunk_nbytes )
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
-
- 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(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")
+ if(NULL == offset)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL")
+ if(NULL == chunk_nbytes)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL")
+
+ /* Get the dataset creation property list */
+ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
done:
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 8abfe27..b61aed4 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -685,13 +685,12 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key
/* decode */
UINT32DECODE(raw, key->nbytes);
UINT32DECODE(raw, key->filter_mask);
- for(u = 0; u < layout->ndims; u++)
- {
- if (layout->dim[u] == 0)
+ for(u = 0; u < layout->ndims; u++) {
+ if(layout->dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
/* Retrieve coordinate offset */
- UINT64DECODE(raw, tmp_offset);
+ UINT64DECODE(raw, tmp_offset);
HDassert(0 == (tmp_offset % layout->dim[u]));
/* Convert to a scaled offset */
@@ -943,7 +942,7 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info)
/* Create the v1 B-tree for the chunk index */
if(H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
index d60e79e..b32f395 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -1547,7 +1547,7 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Close v2 B-tree */
- if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
+ if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
idx_info->storage->u.btree2.bt2 = NULL;
} /* end if */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 4906f3c..91f3b91 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -495,7 +495,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
@@ -551,7 +551,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -565,7 +565,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
*filters = udata.filter_mask;
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_direct_read() */
@@ -590,7 +590,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
H5D_chunk_ud_t udata; /* User data for querying chunk info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
@@ -648,8 +648,8 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
- } /* end if */
+ }
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -663,7 +663,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
*storage_size = dset->shared->layout.u.chunk.size;
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5D__get_chunk_storage_size */
@@ -695,6 +695,9 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
/* Compute the # of chunks in dataset dimensions */
for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) {
+ /* Sanity check */
+ HDassert(layout->dim[u] > 0);
+
/* Round up to the next integer # of chunks, to accommodate partial chunks */
layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
if(H5S_UNLIMITED == max_dims[u])
@@ -949,7 +952,10 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
/* Initial scaled dimension sizes */
if(dset->shared->layout.u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
- rdcc->scaled_dims[u] = dset->shared->curr_dims[u] / dset->shared->layout.u.chunk.dim[u];
+
+ /* Round up to the next integer # of chunks, to accommodate partial chunks */
+ rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) /
+ dset->shared->layout.u.chunk.dim[u];
if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) )
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
@@ -1300,11 +1306,9 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
if(file_type && (H5T_close_real(file_type) < 0))
HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype")
- if(file_space_normalized == TRUE) {
- /* (Casting away const OK -QAK) */
- if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0)
+ if(file_space_normalized == TRUE)
+ if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init() */
@@ -1503,7 +1507,8 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection")
/* Move selection back to have correct offset in chunk */
- H5S_SELECT_ADJUST_U(fm->single_space, coords);
+ if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
#ifdef H5_HAVE_PARALLEL
/* store chunk selection information */
@@ -1615,7 +1620,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Move selection back to have correct offset in chunk */
- H5S_SELECT_ADJUST_U(tmp_fchunk, coords);
+ if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) {
+ (void)H5S_close(tmp_fchunk);
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
+ }
/* Add temporary chunk to the list of chunks */
@@ -1814,7 +1822,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
} /* end for */
/* Adjust the selection */
- if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */
+ if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
/* Get the next chunk node in the skip list */
@@ -2782,8 +2790,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5D__chunk_hash_val
*
- * Purpose: To calculate an index based on the dataset's scaled coordinates and
- * sizes of the faster dimensions.
+ * Purpose: To calculate an index based on the dataset's scaled
+ * coordinates and sizes of the faster dimensions.
*
* Return: Hash value index
*
@@ -2797,6 +2805,7 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
hsize_t val; /* Intermediate value */
unsigned ndims = shared->ndims; /* Rank of dataset */
unsigned ret = 0; /* Value to return */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -2807,17 +2816,11 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
/* If the fastest changing dimension doesn't have enough entropy, use
* other dimensions too
*/
- if(ndims > 1 && shared->cache.chunk.scaled_dims[ndims - 1] <= shared->cache.chunk.nslots) {
- unsigned u; /* Local index variable */
-
- val = scaled[0];
- for(u = 1; u < ndims; u++) {
- val <<= shared->cache.chunk.scaled_encode_bits[u];
- val ^= scaled[u];
- } /* end for */
- } /* end if */
- else
- val = scaled[ndims - 1];
+ val = scaled[0];
+ for(u = 1; u < ndims; u++) {
+ val <<= shared->cache.chunk.scaled_encode_bits[u];
+ val ^= scaled[u];
+ } /* end for */
/* Modulo value against the number of array slots */
ret = (unsigned)(val % shared->cache.chunk.nslots);
@@ -3183,8 +3186,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent,
- hbool_t flush)
+H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
{
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@@ -4199,13 +4201,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
while(!carry) {
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
- /* Look up this chunk */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
+ /* Look up this chunk */
+ if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
- if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type)
- HDassert(!H5F_addr_defined(udata.chunk_block.offset));
+ if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) {
+ HDassert(!H5F_addr_defined(udata.chunk_block.offset));
+ }
/* Make sure the chunk is really in the dataset and outside the
* original dimensions */
@@ -4233,7 +4236,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Check to make sure the buffer is large enough. It is
* possible (though ill-advised) for the filter to shrink the
- * buffer. */
+ * buffer.
+ */
if(fb_info.fill_buf_size < orig_chunk_size) {
if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk")
@@ -4467,10 +4471,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
HGOTO_DONE(SUCCEED)
} /* end if */
- /*
- * Initialize structures needed to lock chunks into cache
- */
-
/* Set up chunked I/O info object, for operations on chunks (in callback).
* Note that we only need to set chunk_offset once, as the array's address
* will never change. */
@@ -6517,31 +6517,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded")
} /* end block */
- if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
- /* Sanity check */
+ if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
+ /* Sanity check */
HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset));
/* Check for chunk being same size */
- if(new_chunk->length != old_chunk->length) {
- /* Release previous chunk */
- /* Only free the old location if not doing SWMR writes - otherwise
+ if(new_chunk->length != old_chunk->length) {
+ /* Release previous chunk */
+ /* Only free the old location if not doing SWMR writes - otherwise
* we must keep the old chunk around in case a reader has an
* outdated version of the B-tree node
*/
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
- alloc_chunk = TRUE;
- } /* end if */
+ if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+ alloc_chunk = TRUE;
+ } /* end if */
else {
- /* Don't need to reallocate chunk, but send its address back up */
+ /* Don't need to reallocate chunk, but send its address back up */
if(!H5F_addr_defined(new_chunk->offset))
new_chunk->offset = old_chunk->offset;
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else {
HDassert(!H5F_addr_defined(new_chunk->offset));
- alloc_chunk = TRUE;
+ alloc_chunk = TRUE;
} /* end else */
} /* end if */
else {
@@ -6646,7 +6646,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
/* Read the non-filtered edge chunk */
- if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
+ if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
/* Pass the chunk through the pipeline */
diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c
index 347e34c..d11a5d8 100644
--- a/src/H5Ddbg.c
+++ b/src/H5Ddbg.c
@@ -21,11 +21,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -60,17 +61,12 @@
/*-------------------------------------------------------------------------
- * Function: H5Ddebug
+ * Function: H5Ddebug
*
- * Purpose: Prints various information about a dataset. This function is
- * not to be documented in the API at this time.
+ * Purpose: Prints various information about a dataset. This function is
+ * not to be documented in the API at this time.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, April 28, 1999
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -84,14 +80,14 @@ H5Ddebug(hid_t dset_id)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Print B-tree information */
if(H5D_CHUNKED == dset->shared->layout.type)
- (void)H5D__chunk_dump_index(dset, stdout);
+ (void)H5D__chunk_dump_index(dset, stdout);
else if(H5D_CONTIGUOUS == dset->shared->layout.type)
- HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
+ HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 0f1bfee..76827b4 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -40,6 +40,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -80,28 +81,28 @@
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5Dcreate1
+ * Function: H5Dcreate1
*
- * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
- * dataset for access, and associates with that dataset constant
- * and initial persistent properties including the type of each
- * datapoint as stored in the file (TYPE_ID), the size of the
- * dataset (SPACE_ID), and other initial miscellaneous
- * properties (DCPL_ID).
+ * Purpose: Creates a new dataset named NAME at LOC_ID, opens the
+ * dataset for access, and associates with that dataset constant
+ * and initial persistent properties including the type of each
+ * datapoint as stored in the file (TYPE_ID), the size of the
+ * dataset (SPACE_ID), and other initial miscellaneous
+ * properties (DCPL_ID).
*
- * All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, dataspaces, and creation
- * parameters from the old ones and reuse them in calls to
- * create other datasets.
+ * All arguments are copied into the dataset, so the caller is
+ * allowed to derive new types, data spaces, and creation
+ * parameters from the old ones and reuse them in calls to
+ * create other datasets.
*
- * Return: Success: The object ID of the new dataset. At this
- * point, the dataset is ready to receive its
- * raw data. Attempting to read raw data from
- * the dataset will probably return the fill
- * value. The dataset should be closed when
- * the caller is no longer interested in it.
+ * Return: Success: The object ID of the new dataset. At this
+ * point, the dataset is ready to receive its
+ * raw data. Attempting to read raw data from
+ * the dataset will probably return the fill
+ * value. The dataset should be closed when
+ * the caller is no longer interested in it.
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, December 3, 1997
@@ -112,62 +113,81 @@ hid_t
H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t dcpl_id)
{
- H5G_loc_t loc; /* Object location to insert dataset into */
- H5D_t *dset = NULL; /* New dataset's info */
- const H5S_t *space; /* Dataspace for dataset */
- hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
- hid_t ret_value; /* Return value */
-
- FUNC_ENTER_API(FAIL)
+ void *dset = NULL; /* dset token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(H5I_DATATYPE != H5I_get_type(type_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID")
- if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
+
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Build and open the new dataset */
- if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
+ if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
+ if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Create the dataset through the VOL */
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
- /* Register the new dataset to get an ID for it */
- if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
+ /* Get an atom for the dataset */
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
- if(ret_value < 0)
- if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if (H5I_INVALID_HID == ret_value)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate1() */
/*-------------------------------------------------------------------------
- * Function: H5Dopen1
+ * Function: H5Dopen1
*
- * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
- * its ID. The dataset should be close when the caller is no
- * longer interested in it.
+ * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns
+ * its ID. The dataset should be close when the caller is no
+ * longer interested in it.
*
- * Note: Deprecated in favor of H5Dopen2
+ * Note: Deprecated in favor of H5Dopen2
*
- * Return: Success: A new dataset ID
- * Failure: FAIL
+ * Return: Success: A new dataset ID
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@@ -177,46 +197,55 @@ done:
hid_t
H5Dopen1(hid_t loc_id, const char *name)
{
- H5D_t *dset = NULL;
- H5G_loc_t loc; /* Object location of group */
- hid_t ret_value; /* Return value */
+ void *dset = NULL; /* dset token from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the dataset */
- if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
+ if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
- /* Register an atom for the dataset */
- if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom")
+ /* Get an atom for the dataset */
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
- if(ret_value < 0)
- if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+ if(H5I_INVALID_HID == ret_value)
+ if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen1() */
/*-------------------------------------------------------------------------
- * Function: H5Dextend
+ * Function: H5Dextend
*
- * Purpose: This function makes sure that the dataset is at least of size
- * SIZE. The dimensionality of SIZE is the same as the data
- * space of the dataset being changed.
+ * Purpose: This function makes sure that the dataset is at least of size
+ * SIZE. The dimensionality of SIZE is the same as the data
+ * space of the dataset being changed.
*
- * Note: Deprecated in favor of H5Dset_extent
+ * Note: Deprecated in favor of H5Dset_extent
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Friday, January 30, 1998
@@ -226,37 +255,62 @@ done:
herr_t
H5Dextend(hid_t dset_id, const hsize_t size[])
{
- H5D_t *dset; /* Pointer to dataset to modify */
- hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ 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 */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ 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(!size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
-
- /* Make certain that the dataset dimensions don't decrease */
- /* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */
- if(H5S_get_simple_extent_dims(dset->shared->space, dset_dims, NULL) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
+
+ /* 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace")
+ 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)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get dataspace structure from ID")
+
+ /* Get the dataset's current extent */
+ if(H5S_get_simple_extent_dims(ds, dset_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
- for(u = 0; u < dset->shared->ndims; u++)
- if(size[u] > dset_dims[u])
- dset_dims[u] = size[u];
+
+ /* Get the dataset dimensions */
+ ndims = H5S_GET_EXTENT_NDIMS(ds);
+
+ /* Make certain that the dataset dimensions don't decrease in any dimension.
+ *
+ * (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend)
+ *
+ * XXX (VOL_MERGE): I feel like we should fail here instead of just silently
+ * not doing what we're supposed to do.
+ */
+ for(i = 0; i < ndims; i++)
+ if(size[i] > dset_dims[i])
+ dset_dims[i] = size[i];
/* 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")
/* Increase size */
- if(H5D__set_extent(dset, dset_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset")
done:
+ /* Close the dataspace */
+ if(sid != H5I_INVALID_HID && H5I_dec_app_ref(sid) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close dataspace")
+
FUNC_LEAVE_API(ret_value)
} /* end H5Dextend() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index e42e551..619f699 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -174,7 +174,7 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
- const H5T_t *buf_type, const H5S_t *space)
+ const H5T_t *buf_type, const H5S_t *space)
{
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index c378326..b980223 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -21,16 +21,17 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -49,22 +50,21 @@
/* General stuff */
static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
-static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id,
- const H5T_t *type);
+static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
-static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id,
- const char *prefix_type, char **file_prefix);
+static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix);
static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id);
static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite,
hsize_t old_dim[]);
-static herr_t H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
-static herr_t H5D__close_cb(H5D_t *dataset);
+static herr_t H5D__close_cb(H5VL_object_t *dset_vol_obj);
static herr_t H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize);
static herr_t H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc);
static size_t H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr);
+
+
/*********************/
/* Package Variables */
/*********************/
@@ -285,6 +285,43 @@ H5D_term_package(void)
/*-------------------------------------------------------------------------
+ * Function: H5D__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on the dataset's ID
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__close_cb(H5VL_object_t *dset_vol_obj)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(dset_vol_obj);
+
+ /* Close the dataset */
+ if(H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset");
+
+done:
+ /* XXX: (MSC) Weird thing for datasets and filters:
+ * Always decrement the ref count on the VOL for datasets, since
+ * the ID is removed even if the close fails.
+ */
+
+ /* Free the VOL object */
+ if(H5VL_free_object(dset_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object");
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__close_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__create_named
*
* Purpose: Internal routine to create a new dataset.
@@ -302,7 +339,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
H5D_obj_create_t dcrt_info; /* Information for dataset creation */
H5D_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -333,52 +370,11 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
ret_value = (H5D_t *)ocrt_info.new_obj;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_named() */
/*-------------------------------------------------------------------------
- * Function: H5D__create_anon
- *
- * Purpose: Internal routine to create a new anonymous dataset.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating datasets that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new dataset object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 9, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5D_t *
-H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
- hid_t dapl_id)
-{
- H5D_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(file);
- HDassert(type_id != H5P_DEFAULT);
- HDassert(space);
- HDassert(dcpl_id != H5P_DEFAULT);
- HDassert(dapl_id != H5P_DEFAULT);
-
- /* Build and open the dataset */
- if(NULL == (ret_value = H5D__create(file, type_id, space, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5D__create_anon() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D__get_space_status
*
* Purpose: Returns the status of dataspace allocation.
@@ -393,7 +389,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(dset);
@@ -426,7 +422,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed")
/* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
- if(H5D__get_storage_size_real(dset, &space_allocated) < 0)
+ if(H5D__get_storage_size(dset, &space_allocated) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
/* Decide on how much of the space is allocated */
@@ -447,7 +443,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
} /* end else */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_space_status() */
@@ -550,7 +546,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
/* Convert a datatype (if committed) to a transient type if the committed datatype's file
- location is different from the file location where the dataset will be created */
+ * location is different from the file location where the dataset will be created.
+ */
if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
@@ -565,7 +562,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* Get a datatype ID for the dataset's datatype */
if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
- } /* end if */
+ }
/* Not a custom datatype, just use it directly */
else {
if(H5I_inc_ref(type_id, FALSE) < 0)
@@ -574,7 +571,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* Use existing datatype */
dset->shared->type_id = type_id;
dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -614,7 +611,7 @@ H5D__cache_dataspace_info(const H5D_t *dset)
if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) )
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
dset->shared->curr_power2up[u] = scaled_power2up;
- } /* end for */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -969,7 +966,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type")
fill_prop->fill_defined = TRUE;
- } /* end if */
+ }
else if(fill_status == H5D_FILL_VALUE_UNDEFINED)
fill_prop->fill_defined = FALSE;
else
@@ -1155,7 +1152,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type
*/
if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0)
prefix = HDgetenv("HDF5_VDS_PREFIX");
- else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
+ else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
else
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible")
@@ -1219,7 +1216,8 @@ H5D_t *
H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
hid_t dapl_id)
{
- const H5T_t *type; /* Datatype for dataset */
+ const H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */
+ H5T_t *dt = NULL; /* Datatype for dataset (non-VOL pointer) */
H5D_t *new_dset = NULL;
H5P_genplist_t *dc_plist = NULL; /* New Property list */
hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */
@@ -1240,8 +1238,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id));
/* Get the dataset's datatype */
- if(NULL == (type = (const H5T_t *)H5I_object(type_id)))
+ if(NULL == (dt = (const H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
+ /* If this is a named datatype, get the pointer via the VOL plugin */
+ type = (const H5T_t *)H5T_get_actual_type(dt);
/* Check if the datatype is "sensible" for use in a dataset */
if(H5T_is_sensible(type) != TRUE)
@@ -1454,7 +1454,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id)
hbool_t loc_found = FALSE; /* Location at 'name' found */
H5D_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(loc);
@@ -1488,7 +1488,7 @@ done:
if(loc_found && H5G_loc_free(&dset_loc) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__open_name() */
@@ -1607,7 +1607,7 @@ done:
dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
- } /* end if */
+ }
H5O_loc_free(&(dataset->oloc));
H5G_name_free(&(dataset->path));
@@ -1868,36 +1868,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__close_cb
- *
- * Purpose: Callback routine for closing a dataset ID. Closes the dataset
- * object that was attached to the ID.
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5D__close_cb(H5D_t *dataset)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* check args */
- HDassert(dataset && dataset->oloc.file && dataset->shared);
- HDassert(dataset->shared->fo_count > 0);
-
- /* Call actual dataset close routine */
- if(H5D_close(dataset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset");
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5D__close_cb() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D_close
*
* Purpose: Insures that all data has been saved to the file, closes the
@@ -2033,8 +2003,7 @@ H5D_close(H5D_t *dataset)
if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
- /*
- * Release datatype, dataspace and creation property list -- there isn't
+ /* Release datatype, dataspace and creation property list -- there isn't
* much we can do if one of these fails, so we just continue.
*/
free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) ||
@@ -2068,6 +2037,7 @@ H5D_close(H5D_t *dataset)
*/
dataset->oloc.file = NULL;
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
+
} /* end if */
else {
/* Decrement the ref. count for this object in the top file */
@@ -2105,7 +2075,7 @@ done:
* Function: H5D_mult_refresh_close
*
* Purpose: Closing down the needed information when the dataset has
- * multiple opens. (From H5O_refresh_metadata_close())
+ * multiple opens. (From H5O__refresh_metadata_close())
*
* Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
@@ -2118,11 +2088,13 @@ H5D_mult_refresh_close(hid_t dset_id)
FUNC_ENTER_NOAPI(FAIL)
- if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if(NULL == (dataset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* check args */
- HDassert(dataset && dataset->oloc.file && dataset->shared);
+ HDassert(dataset);
+ HDassert(dataset->oloc.file);
+ HDassert(dataset->shared);
HDassert(dataset->shared->fo_count > 0);
if(dataset->shared->fo_count > 1) {
@@ -2255,12 +2227,12 @@ H5D_oloc(H5D_t *dataset)
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5D_nameof(H5D_t *dataset)
+H5D_nameof(const H5D_t *dataset)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : (H5G_name_t *)NULL)
+ FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL)
} /* end H5D_nameof() */
@@ -2527,7 +2499,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_storage_size_real
+ * Function: H5D__get_storage_size
*
* Purpose: Determines how much space has been reserved to store the raw
* data of a dataset.
@@ -2535,8 +2507,8 @@ done:
* Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
-static herr_t
-H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size)
+herr_t
+H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2578,46 +2550,19 @@ H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size)
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5D__get_storage_size_real() */
+} /* end H5D__get_storage_size() */
/*-------------------------------------------------------------------------
- * Function: H5D__get_storage_size
+ * Function: H5D__get_offset
*
- * Purpose: Determines how much space has been reserved to store the raw
- * data of a dataset.
+ * Purpose: Private function for H5D__get_offset. Returns the address
+ * of dataset in file.
*
- * Note: This routine is needed so that there's a non-API routine for
- * creating attributes that can set up VOL / SWMR info
- * (which need a DXPL).
+ * Return: Success: The address of dataset
*
- * Return: Non-negative on success, negative on failure
- *-------------------------------------------------------------------------
- */
-herr_t
-H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
- if(H5D__get_storage_size_real(dset, storage_size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5D__get_storage_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5D__get_offset
+ * Failure: HADDR_UNDEF (but also a valid value)
*
- * Purpose: Private function for H5D__get_offset. Returns the address
- * of dataset in file.
- *
- * Return: Success: the address of dataset
- * Failure: HADDR_UNDEF
*-------------------------------------------------------------------------
*/
haddr_t
@@ -2637,7 +2582,8 @@ H5D__get_offset(const H5D_t *dset)
case H5D_CONTIGUOUS:
/* If dataspace hasn't been allocated or dataset is stored in
- * an external file, the value will be HADDR_UNDEF. */
+ * an external file, the value will be HADDR_UNDEF.
+ */
if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.storage.u.contig.addr))
/* Return the absolute dataset offset from the beginning of file. */
ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file);
@@ -2647,7 +2593,7 @@ H5D__get_offset(const H5D_t *dset)
case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type")
- } /*lint !e788 All appropriate cases are covered */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2754,7 +2700,9 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data)
{
H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data;
+ H5VL_object_t *vol_obj = vlen_bufsize->dset_vol_obj;
H5T_t *dt; /* Datatype for operation */
+ H5S_t *fspace; /* File dataspace for operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2771,11 +2719,13 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Select point to read in */
- if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
+ if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->fl_tbuf) < 0)
+ if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
@@ -2845,13 +2795,13 @@ done:
herr_t
H5D__set_extent(H5D_t *dset, const hsize_t *size)
{
- hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
- htri_t changed; /* Whether the dataspace changed size */
- size_t u, v; /* Local index variable */
+ hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
+ htri_t changed; /* Whether the dataspace changed size */
+ size_t u, v; /* Local index variable */
unsigned dim_idx; /* Dimension index */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
/* Check args */
HDassert(dset);
@@ -2985,7 +2935,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage")
- } /* end if */
+ }
/*-------------------------------------------------------------------------
* Remove chunk information in the case of chunked datasets
* This removal takes place only in case we are shrinking the dateset
@@ -3012,7 +2962,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
} /* end if */
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__set_extent() */
@@ -3098,7 +3048,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(dset);
@@ -3113,7 +3063,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__flush() */
@@ -3138,7 +3088,7 @@ H5D__format_convert(H5D_t *dataset)
hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
/* Check args */
HDassert(dataset);
@@ -3264,7 +3214,7 @@ done:
if(newlayout != NULL)
newlayout = (H5O_layout_t *)H5MM_xfree(newlayout);
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__format_convert() */
@@ -3391,44 +3341,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_create_plist
- *
- * Purpose: Internal routine to retrieve a dataset's creation property list.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: ID for a copy of the dataset creation property
- * list. The property list ID should be released
- * by calling H5Pclose().
- *
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5D__get_create_plist(const H5D_t *dset)
-{
- hid_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(dset);
-
- /* Retrieve the DCPL */
- if((ret_value = H5D_get_create_plist(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset's creation property list")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5D__get_create_plist() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D_get_create_plist
*
* Purpose: Private function for H5Dget_create_plist
@@ -3629,7 +3541,7 @@ H5D_get_access_plist(const H5D_t *dset)
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
@@ -3687,7 +3599,7 @@ H5D__get_space(const H5D_t *dset)
H5S_t *space = NULL;
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* If the layout is virtual, update the extent */
if(dset->shared->layout.type == H5D_VIRTUAL)
@@ -3708,7 +3620,7 @@ done:
if(H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_space() */
@@ -3746,8 +3658,18 @@ H5D__get_type(const H5D_t *dset)
if(H5T_lock(dt, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
- if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ /* Create an atom */
+ if(H5T_is_named(dt)) {
+ /* If this is a committed datatype, we need to recreate the
+ * two-level IDs, where the VOL object is a copy of the
+ * returned datatype.
+ */
+ if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ } /* end if */
+ else
+ if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
if(ret_value < 0)
@@ -3773,7 +3695,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset)
hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dset);
@@ -3801,6 +3723,6 @@ done:
if(H5D__virtual_release_source_dset_files(head) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__refresh() */
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 5fea91f..f977b0e 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -21,14 +21,14 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Sprivate.h" /* Dataspace */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Sprivate.h" /* Dataspace */
#ifdef H5_HAVE_PARALLEL
/* Remove this if H5R_DATASET_REGION is no longer used in this file */
@@ -50,8 +50,7 @@
/* Local Prototypes */
/********************/
-static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset,
- hsize_t *offset_copy/*out*/);
+/* Setup/teardown routines */
static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
H5D_storage_t *store, H5D_io_info_t *io_info);
static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id,
@@ -83,14 +82,17 @@ H5FL_DEFINE(H5D_chunk_map_t);
/*-------------------------------------------------------------------------
* Function: H5D__get_offset_copy
*
- * Purpose: Gets a copy of the user's offset array that is guaraneteed
- * to be suitable for use by the library.
+ * 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
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
{
unsigned u;
@@ -102,7 +104,6 @@ H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_c
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).
@@ -127,14 +128,13 @@ done:
} /* end H5D__get_offset_copy() */
-
/*-------------------------------------------------------------------------
- * Function: H5Dread
+ * Function: H5Dread
*
* Purpose: Reads (part of) a DSET from the file into application
* memory BUF. The part of the dataset to read is defined with
- * MEM_SPACE_ID and FILE_SPACE_ID. The data points are
+ * MEM_SPACE_ID and FILE_SPACE_ID. The data points are
* converted from their file type to the MEM_TYPE_ID specified.
* Additional miscellaneous data transfer properties can be
* passed to this function with the PLIST_ID argument.
@@ -152,7 +152,7 @@ done:
* The PLIST_ID can be the constant H5P_DEFAULT in which
* case the default data transfer properties are used.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@@ -163,26 +163,22 @@ herr_t
H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, void *buf/*out*/)
{
- H5D_t *dset = NULL;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
+ H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id,
dxpl_id, buf);
+ /* Check arguments */
+ if (mem_space_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID")
+ if (file_space_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID")
+
/* Get dataset pointer */
- if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
- 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 the default dataset transfer property list if the user didn't provide one */
if (H5P_DEFAULT == dxpl_id)
@@ -194,8 +190,8 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Read raw data */
- if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
+ /* Read the data */
+ if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
@@ -219,20 +215,15 @@ herr_t
H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
void *buf)
{
- H5D_t *dset = NULL;
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
/* Check arguments */
- if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
- if (NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- if (H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
if (!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL")
if (!offset)
@@ -250,14 +241,8 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* 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")
-
/* Read the raw chunk */
- if (H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0)
+ if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
done:
@@ -289,7 +274,7 @@ done:
* The PLIST_ID can be the constant H5P_DEFAULT in which
* case the default data transfer properties are used.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, December 4, 1997
@@ -298,28 +283,24 @@ done:
*/
herr_t
H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t dxpl_id, const void *buf)
+ hid_t file_space_id, hid_t dxpl_id, const void *buf)
{
- H5D_t *dset = NULL;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id,
dxpl_id, buf);
- /* Get dataset pointer and ensure it's associated with a file */
- if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
- if (NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+ /* Check arguments */
+ if (mem_space_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID")
+ if (file_space_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID")
- /* 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 dataset pointer */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
/* Get the default dataset transfer property list if the user didn't provide one */
if (H5P_DEFAULT == dxpl_id)
@@ -332,7 +313,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
H5CX_set_dxpl(dxpl_id);
/* Write the data */
- if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
+ if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
@@ -356,21 +337,16 @@ 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)
{
- H5D_t *dset = NULL;
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- 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 = NULL;
+ 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);
/* Check arguments */
- if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID")
- if (NULL == dset->oloc.file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- if (H5D_CHUNKED != dset->shared->layout.type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
if (!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL")
if (!offset)
@@ -393,14 +369,8 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* 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")
-
/* Write chunk */
- if (H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0)
+ if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:
@@ -449,7 +419,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
/* check args */
HDassert(dataset && dataset->oloc.file);
@@ -616,7 +586,7 @@ done:
if(H5S_close(projected_mem_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace")
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__read() */
@@ -981,8 +951,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
type_info->dst_type_id = mem_type_id;
} /* end else */
- /*
- * Locate the type conversion function and dataspace conversion
+ /* Locate the type conversion function and dataspace conversion
* functions, and set up the element numbering information. If a data
* type conversion is necessary then register datatype atoms. Data type
* conversion is necessary if the user has set the `need_bkg' to a high
@@ -1249,7 +1218,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__ioinfo_adjust() */
-#endif /*H5_HAVE_PARALLEL*/
+#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index c8afb8e..494d2c8 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -25,7 +25,6 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5HLprivate.h" /* Local heaps */
-#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -506,7 +505,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
- } /* end if */
+ }
/* Update external storage message, if it's used */
if(dset->shared->dcpl_cache.efl.nused > 0) {
@@ -557,6 +556,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message")
} /* end if */
+ /* Create layout message */
/* (Don't make layout message constant unless allocation time is early and non-filtered, since space may not be allocated) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 5ebdc06..2c06800 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -479,8 +479,7 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
MPI_Comm_size(comm, &mpi_size);
MPI_Comm_rank(comm, &mpi_rank);
- /*
- * Determine the size of the end result array by collecting the number
+ /* Determine the size of the end result array by collecting the number
* of entries contributed by each processor into a single total.
*/
if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm)))
@@ -925,7 +924,6 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
hbool_t chunk_final_ftype_is_derived = FALSE;
H5D_storage_t ctg_store; /* Storage info for "fake" contiguous dataset */
size_t total_chunks;
- haddr_t *total_chunk_addr_array = NULL;
MPI_Datatype *chunk_mtype = NULL;
MPI_Datatype *chunk_ftype = NULL;
MPI_Aint *chunk_disp_array = NULL;
@@ -1146,20 +1144,7 @@ if(H5DEBUG(D))
mpi_buf_count = (hsize_t)1;
} /* end if */
else { /* no selection at all for this process */
- /* Allocate chunking information */
- if(NULL == (total_chunk_addr_array = (haddr_t *)H5MM_malloc(sizeof(haddr_t) * total_chunks)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate total chunk address arraybuffer")
-
- /* Retrieve chunk address map */
- if(H5D__chunk_addrmap(io_info, total_chunk_addr_array) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
-
- /* Get chunk with lowest address */
- ctg_store.contig.dset_addr = HADDR_MAX;
- for(u = 0; u < total_chunks; u++)
- if(total_chunk_addr_array[u] < ctg_store.contig.dset_addr)
- ctg_store.contig.dset_addr = total_chunk_addr_array[u];
- HDassert(ctg_store.contig.dset_addr != HADDR_MAX);
+ ctg_store.contig.dset_addr = 0;
/* Set the MPI datatype */
chunk_final_ftype = MPI_BYTE;
@@ -1187,8 +1172,6 @@ if(H5DEBUG(D))
HDfprintf(H5DEBUG(D),"before freeing memory inside H5D_link_collective_io ret_value = %d\n", ret_value);
#endif
/* Release resources */
- if(total_chunk_addr_array)
- H5MM_xfree(total_chunk_addr_array);
if(chunk_addr_info_array)
H5MM_xfree(chunk_addr_info_array);
if(chunk_mtype)
diff --git a/src/H5Doh.c b/src/H5Doh.c
index f8ce69f..017bab7 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -29,6 +29,7 @@
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -47,7 +48,7 @@
static void *H5O__dset_get_copy_file_udata(void);
static void H5O__dset_free_copy_file_udata(void *);
static htri_t H5O__dset_isa(const H5O_t *loc);
-static hid_t H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref);
+static void *H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type);
static void *H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc);
static H5O_loc_t *H5O__dset_get_oloc(hid_t obj_id);
static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh,
@@ -189,15 +190,15 @@ H5O__dset_isa(const H5O_t *oh)
/* Datatype */
if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
else if(!exists)
- HGOTO_DONE(FALSE)
+ HGOTO_DONE(FALSE)
/* Layout */
if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
else if(!exists)
- HGOTO_DONE(FALSE)
+ HGOTO_DONE(FALSE)
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -217,17 +218,19 @@ done:
*
*-------------------------------------------------------------------------
*/
-static hid_t
-H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref)
+static void *
+H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type)
{
- H5D_t *dset = NULL; /* Dataset opened */
- hid_t dapl_id; /* dapl to use to open this dataset */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5D_t *dset = NULL; /* Dataset opened */
+ hid_t dapl_id; /* dapl to use to open this dataset */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
HDassert(obj_loc);
+ *opened_type = H5I_DATASET;
+
/* Get the LAPL (which is a superclass of DAPLs) from the API context, but
* if it's the default link access property list or a custom link access
* property list but not a dataset access property list, use the default
@@ -242,9 +245,9 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref)
/* Check class of LAPL from API context */
if((is_lapl = H5P_isa_class(dapl_id, H5P_LINK_ACCESS)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get LAPL status")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get LAPL status")
if((is_dapl = H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get DAPL status")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get DAPL status")
/* Switch to default DAPL if not an actual DAPL in the API context */
if(!is_dapl && is_lapl)
@@ -253,16 +256,14 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref)
/* Open the dataset */
if(NULL == (dset = H5D_open(obj_loc, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
- /* Register an ID for the dataset */
- if((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
+ ret_value = (void *)dset;
done:
- if(ret_value < 0)
+ if(NULL == ret_value)
if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_open() */
@@ -339,7 +340,7 @@ H5O__dset_get_oloc(hid_t obj_id)
FUNC_ENTER_STATIC
/* Get the dataset */
- if(NULL == (dset = (H5D_t *)H5I_object(obj_id)))
+ if(NULL == (dset = (H5D_t *)H5VL_object(obj_id)))
HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID")
/* Get the dataset's object header location */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index b887b87..30652a5 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -110,6 +110,15 @@ typedef struct H5D_type_info_t {
hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */
} H5D_type_info_t;
+/* Types for dataset optional VOL operations */
+typedef enum H5VL_dataset_optional_t {
+ H5VL_DATASET_FORMAT_CONVERT, /* H5Dformat_convert (internal) */
+ H5VL_DATASET_GET_CHUNK_INDEX_TYPE, /* H5Dget_chunk_index_type */
+ H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, /* H5Dget_chunk_storage_size */
+ H5VL_DATASET_CHUNK_READ, /* H5Dchunk_read */
+ H5VL_DATASET_CHUNK_WRITE, /* H5Dchunk_write */
+} H5VL_dataset_optional_t;
+
/* Forward declaration of structs used below */
struct H5D_io_info_t;
struct H5D_chunk_map_t;
@@ -510,12 +519,12 @@ typedef struct H5D_fill_buf_info_t {
/* Internal data structure for computing variable-length dataset's total size */
typedef struct {
- H5D_t *dset; /* Dataset for operation */
- H5S_t *fspace; /* Dataset's dataspace for operation */
- H5S_t *mspace; /* Memory dataspace for operation */
- void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
- void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
- hsize_t size; /* Accumulated number of bytes for the selection */
+ H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */
+ hid_t fspace_id; /* File dataspace ID of the dataset we are working on */
+ hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */
+ void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
+ void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
+ hsize_t size; /* Accumulated number of bytes for the selection */
} H5D_vlen_bufsize_t;
@@ -555,27 +564,21 @@ H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space,
H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name,
hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id,
hid_t dapl_id);
-H5_DLL H5D_t *H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space,
- hid_t dcpl_id, hid_t dapl_id);
H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id);
H5_DLL hid_t H5D__get_space(const H5D_t *dset);
H5_DLL hid_t H5D__get_type(const H5D_t *dset);
H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation);
-H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
- hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]);
H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size);
-H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset,
- hsize_t *storage_size);
+H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
-H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim,
- const hsize_t *point, void *op_data);
+H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data);
H5_DLL herr_t H5D__check_filters(H5D_t *dataset);
H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size);
H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
H5_DLL herr_t H5D__flush_real(H5D_t *dataset);
H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id);
-H5_DLL hid_t H5D__get_create_plist(const H5D_t *dset);
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);
@@ -663,6 +666,7 @@ 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_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,
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index e136c80..aaa3db2 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -159,7 +159,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset);
H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id);
H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset);
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
-H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset);
+H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset);
H5_DLL H5T_t *H5D_typeof(const H5D_t *dset);
H5_DLL herr_t H5D_flush_all(const H5F_t *f);
H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 5856ede..266f5f5 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -559,11 +559,9 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
- } /* end if */
+ }
- /*
- * Scatter the data into memory.
- */
+ /* Scatter the data into memory */
if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
@@ -691,9 +689,9 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
if(H5CX_get_data_transform(&data_transform) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
- if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
- } /* end if */
+ if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
+ }
/*
* Perform datatype conversion.
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
index 321d258..4510a03 100644
--- a/src/H5Dsingle.c
+++ b/src/H5Dsingle.c
@@ -244,10 +244,10 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
} /* end if */
if(dset)
- if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
- /* Mark the layout dirty so that the address of the single chunk will be flushed later */
- if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
+ if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
+ /* Mark the layout dirty so that the address of the single chunk will be flushed later */
+ if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dtest.c b/src/H5Dtest.c
index c2b6199..916ec72 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -28,10 +28,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -88,7 +89,7 @@ H5D__layout_version_test(hid_t did, unsigned *version)
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
if(version)
@@ -127,7 +128,7 @@ H5D__layout_contig_size_test(hid_t did, hsize_t *size)
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
if(size) {
@@ -168,7 +169,7 @@ H5D__layout_compact_dirty_test(hid_t did, hbool_t *dirty)
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
if(dirty) {
@@ -211,7 +212,7 @@ H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type)
HDassert(layout_type);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(layout_type)
@@ -250,7 +251,7 @@ H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type)
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(dset->shared->layout.type != H5D_CHUNKED)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked")
@@ -291,7 +292,7 @@ H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused)
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(nbytes_used) {
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 7f1ac86..c0d49d8 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -58,7 +58,7 @@
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property Lists */
#include "H5Sprivate.h" /* Dataspaces */
-
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
@@ -2961,8 +2961,9 @@ done:
static herr_t
H5D__virtual_refresh_source_dset(H5D_t **dset)
{
- hid_t dset_id; /* Temporary dataset identifier */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */
+ H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2970,20 +2971,26 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HDassert(dset && *dset);
/* Get a temporary identifier for this source dataset */
- if((dset_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID")
+ if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID")
/* Refresh source dataset */
- if(H5D__refresh(dset_id, *dset) < 0)
+ if(H5D__refresh(temp_id, *dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
/* Discard the identifier & replace the dataset */
- if(NULL == (*dset = (H5D_t *)H5I_remove(dset_id)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
+ if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object")
+ vol_obj->data = NULL;
done:
+ if(vol_obj && H5VL_free_object(vol_obj) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object")
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__virtual_refresh_source_dsets() */
+} /* end H5D__virtual_refresh_source_dset() */
/*-------------------------------------------------------------------------
diff --git a/src/H5E.c b/src/H5E.c
index eecf6e7..170133e 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -49,11 +49,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Epkg.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Epkg.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -78,18 +79,17 @@
/* Local Prototypes */
/********************/
/* Static function declarations */
-static herr_t H5E_set_default_auto(H5E_t *stk);
-static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name,
- const char *version);
-static herr_t H5E_unregister_class(H5E_cls_t *cls);
-static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size);
-static int H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata);
-static herr_t H5E_close_msg(H5E_msg_t *err);
-static H5E_msg_t *H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg);
-static H5E_t *H5E_get_current_stack(void);
-static herr_t H5E_set_current_stack(H5E_t *estack);
-static herr_t H5E_close_stack(H5E_t *err_stack);
-static ssize_t H5E_get_num(const H5E_t *err_stack);
+static herr_t H5E__set_default_auto(H5E_t *stk);
+static H5E_cls_t *H5E__register_class(const char *cls_name, const char *lib_name, const char *version);
+static herr_t H5E__unregister_class(H5E_cls_t *cls);
+static ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size);
+static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata);
+static herr_t H5E__close_msg(H5E_msg_t *err);
+static H5E_msg_t *H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg);
+static H5E_t *H5E__get_current_stack(void);
+static herr_t H5E__set_current_stack(H5E_t *estack);
+static herr_t H5E__close_stack(H5E_t *err_stack);
+static ssize_t H5E__get_num(const H5E_t *err_stack);
/*********************/
@@ -123,7 +123,7 @@ static const H5I_class_t H5I_ERRCLS_CLS[1] = {{
H5I_ERROR_CLASS, /* ID class value */
0, /* Class flags */
0, /* # of reserved IDs for class */
- (H5I_free_t)H5E_unregister_class /* Callback routine for closing objects of this class */
+ (H5I_free_t)H5E__unregister_class /* Callback routine for closing objects of this class */
}};
/* Error message ID class */
@@ -131,7 +131,7 @@ static const H5I_class_t H5I_ERRMSG_CLS[1] = {{
H5I_ERROR_MSG, /* ID class value */
0, /* Class flags */
0, /* # of reserved IDs for class */
- (H5I_free_t)H5E_close_msg /* Callback routine for closing objects of this class */
+ (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */
}};
/* Error stack ID class */
@@ -139,19 +139,17 @@ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{
H5I_ERROR_STACK, /* ID class value */
0, /* Class flags */
0, /* # of reserved IDs for class */
- (H5I_free_t)H5E_close_stack /* Callback routine for closing objects of this class */
+ (H5I_free_t)H5E__close_stack /* Callback routine for closing objects of this class */
}};
/*-------------------------------------------------------------------------
- * Function: H5E_init
+ * Function: H5E_init
*
- * Purpose: Initialize the interface from some other layer.
+ * Purpose: Initialize the interface from some other layer.
*
- * Return: Success: non-negative
- *
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, June 29, 2004
@@ -176,7 +174,7 @@ done:
*
* Purpose: Initialize interface-specific information
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -207,13 +205,13 @@ H5E__init_package(void)
#ifndef H5_HAVE_THREADSAFE
H5E_stack_g[0].nused = 0;
- H5E_set_default_auto(H5E_stack_g);
+ H5E__set_default_auto(H5E_stack_g);
#endif /* H5_HAVE_THREADSAFE */
/* Allocate the HDF5 error class */
HDassert(H5E_ERR_CLS_g == (-1));
HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, (HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-"H5_VERS_SUBRELEASE : ""));
- if(NULL == (cls = H5E_register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers)))
+ if(NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers)))
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed")
if((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, FALSE)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class")
@@ -227,14 +225,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_term_package
+ * Function: H5E_term_package
*
- * Purpose: Terminates the H5E interface
+ * Purpose: Terminates the H5E interface
*
- * Return: Success: Positive if anything is done that might
- * affect other interfaces; zero otherwise.
+ * Return: Success: Positive if anything is done that might
+ * affect other interfaces; zero otherwise.
*
- * Failure: Negative.
+ * Failure: Negative
*
* Programmer: Raymond Lu
* Tuesday, July 22, 2003
@@ -262,8 +260,8 @@ H5E_term_package(void)
(void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE);
/* Clear all the error classes */
- if(ncls > 0) {
- (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE);
+ if(ncls > 0) {
+ (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE);
/* Reset the HDF5 error class, if its been closed */
if(H5I_nmembers(H5I_ERROR_CLASS) == 0)
@@ -271,8 +269,8 @@ H5E_term_package(void)
} /* end if */
/* Clear all the error messages */
- if(nmsg > 0) {
- (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE);
+ if(nmsg > 0) {
+ (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE);
/* Reset the HDF5 error messages, if they've been closed */
if(H5I_nmembers(H5I_ERROR_MSG) == 0) {
@@ -282,17 +280,17 @@ H5E_term_package(void)
} /* end if */
n++; /*H5I*/
- } /* end if */
+ } /* end if */
else {
- /* Destroy the error class, message, and stack id groups */
- n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0);
- n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0);
- n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0);
+ /* Destroy the error class, message, and stack id groups */
+ n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0);
+ n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0);
+ n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0);
- /* Mark closed */
+ /* Mark closed */
if(0 == n)
H5_PKG_INIT_VAR = FALSE;
- } /* end else */
+ } /* end else */
} /* end if */
FUNC_LEAVE_NOAPI(n)
@@ -300,12 +298,12 @@ H5E_term_package(void)
/*--------------------------------------------------------------------------
- * Function: H5E_set_default_auto
+ * Function: H5E__set_default_auto
*
* Purpose: Initialize "automatic" error stack reporting info to library
* default
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 1, 2007
@@ -313,9 +311,9 @@ H5E_term_package(void)
*--------------------------------------------------------------------------
*/
static herr_t
-H5E_set_default_auto(H5E_t *stk)
+H5E__set_default_auto(H5E_t *stk)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
#ifndef H5_NO_DEPRECATED_SYMBOLS
#ifdef H5_USE_16_API_DEFAULT
@@ -334,19 +332,19 @@ H5E_set_default_auto(H5E_t *stk)
stk->auto_data = NULL;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5E_set_default_auto() */
+} /* end H5E__set_default_auto() */
#ifdef H5_HAVE_THREADSAFE
/*-------------------------------------------------------------------------
- * Function: H5E_get_stack
+ * Function: H5E__get_stack
*
- * Purpose: Support function for H5E_get_my_stack() to initialize and
+ * Purpose: Support function for H5E__get_my_stack() to initialize and
* acquire per-thread error stack.
*
- * Return: Success: error stack (H5E_t *)
+ * Return: Success: Pointer to an error stack struct (H5E_t *)
*
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Chee Wai LEE
* April 24, 2000
@@ -354,11 +352,11 @@ H5E_set_default_auto(H5E_t *stk)
*-------------------------------------------------------------------------
*/
H5E_t *
-H5E_get_stack(void)
+H5E__get_stack(void)
{
H5E_t *estack = NULL;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
estack = (H5E_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g);
@@ -377,7 +375,7 @@ H5E_get_stack(void)
/* Set the thread-specific info */
estack->nused = 0;
- H5E_set_default_auto(estack);
+ H5E__set_default_auto(estack);
/* (It's not necessary to release this in this API, it is
* released by the "key destructor" set up in the H5TS
@@ -388,16 +386,16 @@ H5E_get_stack(void)
/* Set return value */
FUNC_LEAVE_NOAPI(estack)
-} /* end H5E_get_stack() */
+} /* end H5E__get_stack() */
#endif /* H5_HAVE_THREADSAFE */
/*-------------------------------------------------------------------------
- * Function: H5E_free_class
+ * Function: H5E_free_class
*
- * Purpose: Private function to free an error class.
+ * Purpose: Private function to free an error class.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, January 22, 2009
@@ -423,11 +421,12 @@ H5E_free_class(H5E_cls_t *cls)
/*-------------------------------------------------------------------------
- * Function: H5Eregister_class
+ * Function: H5Eregister_class
*
- * Purpose: Registers an error class.
+ * Purpose: Registers an error class.
*
- * Return: Non-negative value as class ID on success/Negative on failure
+ * Return: Success: An ID for the error class
+ * Failure: H5I_INVALID_HID
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -438,22 +437,22 @@ hid_t
H5Eregister_class(const char *cls_name, const char *lib_name, const char *version)
{
H5E_cls_t *cls; /* Pointer to error class */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "*s*s*s", cls_name, lib_name, version);
/* Check arguments */
if(cls_name == NULL || lib_name == NULL || version == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid string")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid string")
/* Create the new error class object */
- if(NULL == (cls = H5E_register_class(cls_name, lib_name, version)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error class")
+ if(NULL == (cls = H5E__register_class(cls_name, lib_name, version)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error class")
/* Register the new error class to get an ID for it */
if((ret_value = H5I_register(H5I_ERROR_CLASS, cls, TRUE)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class")
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error class")
done:
FUNC_LEAVE_API(ret_value)
@@ -461,11 +460,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_register_class
+ * Function: H5E__register_class
*
- * Purpose: Private function to register an error class.
+ * Purpose: Private function to register an error class.
*
- * Return: Non-negative value as class ID on success/Negative on failure
+ * Return: Success: Pointer to an error class struct
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -473,12 +473,12 @@ done:
*-------------------------------------------------------------------------
*/
static H5E_cls_t *
-H5E_register_class(const char *cls_name, const char *lib_name, const char *version)
+H5E__register_class(const char *cls_name, const char *lib_name, const char *version)
{
H5E_cls_t *cls = NULL; /* Pointer to error class */
H5E_cls_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(cls_name);
@@ -506,15 +506,15 @@ done:
HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_register_class() */
+} /* end H5E__register_class() */
/*-------------------------------------------------------------------------
- * Function: H5Eunregister_class
+ * Function: H5Eunregister_class
*
- * Purpose: Closes an error class.
+ * Purpose: Closes an error class.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -546,11 +546,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_unregister_class
+ * Function: H5E__unregister_class
*
- * Purpose: Private function to close an error class.
+ * Purpose: Private function to close an error class.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -558,17 +558,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_unregister_class(H5E_cls_t *cls)
+H5E__unregister_class(H5E_cls_t *cls)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(cls);
/* Iterate over all the messages and delete those in this error class */
- if(H5I_iterate(H5I_ERROR_MSG, H5E_close_msg_cb, cls, FALSE) < 0)
+ if(H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class")
/* Free error class structure */
@@ -577,16 +577,16 @@ H5E_unregister_class(H5E_cls_t *cls)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_unregister_class() */
+} /* end H5E__unregister_class() */
/*-------------------------------------------------------------------------
- * Function: H5Eget_class_name
+ * Function: H5Eget_class_name
*
- * Purpose: Retrieves error class name.
+ * Purpose: Retrieves error class name.
*
- * Return: Non-negative for name length if succeeds(zero means no name);
- * otherwise returns negative value.
+ * Return: Success: Name length (zero means no name)
+ * Failure: -1
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -597,18 +597,18 @@ ssize_t
H5Eget_class_name(hid_t class_id, char *name, size_t size)
{
H5E_cls_t *cls; /* Pointer to error class */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*sz", class_id, name, size);
/* Get the error class */
if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error class ID")
/* Retrieve the class name */
- if((ret_value = H5E_get_class_name(cls, name, size)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get error class name")
+ if((ret_value = H5E__get_class_name(cls, name, size)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error class name")
done:
FUNC_LEAVE_API(ret_value)
@@ -616,12 +616,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_get_class_name
+ * Function: H5E__get_class_name
*
- * Purpose: Private function to retrieve error class name.
+ * Purpose: Private function to retrieve error class name.
*
- * Return: Non-negative for name length if succeeds(zero means no name);
- * otherwise returns negative value.
+ * Return: Success: Name length (zero means no name)
+ * Failure: -1
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -629,11 +629,11 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size)
+H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size)
{
- ssize_t len = 0; /* Length of error class's name */
+ ssize_t len = -1; /* Length of error class's name */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(cls);
@@ -650,16 +650,17 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size)
/* Return the full length */
FUNC_LEAVE_NOAPI(len)
-} /* end H5E_get_class_name() */
+} /* end H5E__get_class_name() */
/*-------------------------------------------------------------------------
- * Function: H5E_close_msg_cb
+ * Function: H5E__close_msg_cb
*
* Purpose: H5I_iterate callback function to close error messages in the
* error class.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: Success: H5_ITER_CONT (0)
+ * Failure: H5_ITER_ERROR (-1)
*
* Programmer: Raymond Lu
* July 14, 2003
@@ -667,36 +668,36 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size)
*-------------------------------------------------------------------------
*/
static int
-H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata)
+H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata)
{
H5E_msg_t *err_msg = (H5E_msg_t*)obj_ptr;
H5E_cls_t *cls = (H5E_cls_t*)udata;
- herr_t ret_value = SUCCEED; /* Return value */
+ int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(err_msg);
/* Close the message if it is in the class being closed */
if(err_msg->cls == cls) {
- if(H5E_close_msg(err_msg) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, FAIL, "unable to close error message")
+ if(H5E__close_msg(err_msg) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message")
if(NULL == H5I_remove(obj_id))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, FAIL, "unable to remove error message")
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_close_msg_cb() */
+} /* end H5E__close_msg_cb() */
/*-------------------------------------------------------------------------
- * Function: H5Eclose_msg
+ * Function: H5Eclose_msg
*
- * Purpose: Closes a major or minor error.
+ * Purpose: Closes a major or minor error.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -725,11 +726,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_close_msg
+ * Function: H5E__close_msg
*
- * Purpose: Private function to close an error messge.
+ * Purpose: Private function to close an error messge.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -737,9 +738,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_close_msg(H5E_msg_t *err)
+H5E__close_msg(H5E_msg_t *err)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(err);
@@ -750,15 +751,16 @@ H5E_close_msg(H5E_msg_t *err)
err = H5FL_FREE(H5E_msg_t, err);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5E_close_msg() */
+} /* end H5E__close_msg() */
/*-------------------------------------------------------------------------
- * Function: H5Ecreate_msg
+ * Function: H5Ecreate_msg
*
- * Purpose: Creates a major or minor error, returns an ID.
+ * Purpose: Creates a major or minor error, returns an ID.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: Success: An error ID
+ * Failure: H5I_INVALID_HID
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -770,39 +772,40 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str)
{
H5E_cls_t *cls; /* Pointer to error class */
H5E_msg_t *msg; /* Pointer to new error message */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iEt*s", class_id, msg_type, msg_str);
/* Check arguments */
if(msg_type != H5E_MAJOR && msg_type != H5E_MINOR)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid message type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "not a valid message type")
if(msg_str == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "message is NULL")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "message is NULL")
/* Get the error class */
if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an error class ID")
/* Create the new error message object */
- if(NULL == (msg = H5E_create_msg(cls, msg_type, msg_str)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error message")
+ if(NULL == (msg = H5E__create_msg(cls, msg_type, msg_str)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error message")
/* Register the new error class to get an ID for it */
if((ret_value = H5I_register(H5I_ERROR_MSG, msg, TRUE)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error message")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ecreate_msg() */
/*-------------------------------------------------------------------------
- * Function: H5E_create_msg
+ * Function: H5E__create_msg
*
- * Purpose: Private function to create a major or minor error.
+ * Purpose: Private function to create a major or minor error.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: Success: Pointer to a message struct
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -810,12 +813,12 @@ done:
*-------------------------------------------------------------------------
*/
static H5E_msg_t *
-H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
+H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
{
H5E_msg_t *msg = NULL; /* Pointer to new error message */
H5E_msg_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(cls);
@@ -837,20 +840,20 @@ H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
done:
if(!ret_value)
- if(msg && H5E_close_msg(msg) < 0)
+ if(msg && H5E__close_msg(msg) < 0)
HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_create_msg() */
+} /* end H5E__create_msg() */
/*-------------------------------------------------------------------------
- * Function: H5Eget_msg
+ * Function: H5Eget_msg
*
- * Purpose: Retrieves an error message.
+ * Purpose: Retrieves an error message.
*
- * Return: Non-negative for message length if succeeds(zero means no message);
- * otherwise returns negative value.
+ * Return: Success: Message length (zero means no message)
+ * Failure: -1
*
* Programmer: Raymond Lu
* Friday, July 14, 2003
@@ -861,18 +864,18 @@ ssize_t
H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size)
{
H5E_msg_t *msg; /* Pointer to error message */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size);
/* Get the message object */
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error message ID")
/* Get the message's text */
- if((ret_value = H5E_get_msg(msg, type, msg_str, size)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get error message text")
+ if((ret_value = H5E__get_msg(msg, type, msg_str, size)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error message text")
done:
FUNC_LEAVE_API(ret_value)
@@ -880,11 +883,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ecreate_stack
+ * Function: H5Ecreate_stack
*
- * Purpose: Creates a new, empty, error stack.
+ * Purpose: Creates a new, empty, error stack.
*
- * Return: Non-negative value as stack ID on success/Negative on failure
+ * Return: Success: An error stack ID
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* Thursday, November 1, 2007
@@ -895,21 +899,21 @@ hid_t
H5Ecreate_stack(void)
{
H5E_t *stk; /* Error stack */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE0("i","");
/* Allocate a new error stack */
if(NULL == (stk = H5FL_CALLOC(H5E_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed")
/* Set the "automatic" error reporting info to the library default */
- H5E_set_default_auto(stk);
+ H5E__set_default_auto(stk);
/* Register the stack */
if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't create error stack")
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack")
done:
FUNC_LEAVE_API(ret_value)
@@ -917,12 +921,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eget_current_stack
+ * Function: H5Eget_current_stack
*
- * Purpose: Registers current error stack, returns object handle for it,
+ * Purpose: Registers current error stack, returns object handle for it,
* clears it.
*
- * Return: Non-negative value as stack ID on success/Negative on failure
+ * Return: Success: An error stack ID
+ * Failure: H5I_INVALID_HID
*
* Programmer: Raymond Lu
* Friday, July 14, 2003
@@ -933,19 +938,19 @@ hid_t
H5Eget_current_stack(void)
{
H5E_t *stk; /* Error stack */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(FAIL)
+ FUNC_ENTER_API_NOCLEAR(H5I_INVALID_HID)
H5TRACE0("i","");
/* Get the current stack */
- if(NULL == (stk = H5E_get_current_stack()))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error stack")
+ if(NULL == (stk = H5E__get_current_stack()))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error stack")
/* Register the stack */
if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't create error stack")
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack")
done:
FUNC_LEAVE_API(ret_value)
@@ -953,11 +958,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_get_current_stack
+ * Function: H5E__get_current_stack
*
- * Purpose: Private function to register an error stack.
+ * Purpose: Private function to register an error stack.
*
- * Return: Non-negative value as class ID on success/Negative on failure
+ * Return: Success: Pointer to an error class struct
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Friday, July 11, 2003
@@ -965,17 +971,17 @@ done:
*-------------------------------------------------------------------------
*/
static H5E_t *
-H5E_get_current_stack(void)
+H5E__get_current_stack(void)
{
H5E_t *current_stack; /* Pointer to the current error stack */
H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */
unsigned u; /* Local index variable */
H5E_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Get a pointer to the current error stack */
- if(NULL == (current_stack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack")
/* Allocate a new error stack */
@@ -1026,24 +1032,19 @@ done:
estack_copy = H5FL_FREE(H5E_t, estack_copy);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_get_current_stack() */
+} /* end H5E__get_current_stack() */
/*-------------------------------------------------------------------------
- * Function: H5Eset_current_stack
+ * Function: H5Eset_current_stack
*
- * Purpose: Replaces current stack with specified stack. This closes the
- * stack ID also.
+ * Purpose: Replaces current stack with specified stack. This closes the
+ * stack ID also.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 15, 2003
- *
- * Modification:
- * Raymond Lu
- * 7 September 2010
- * Also closes the stack to avoid potential problem (bug 1799)
*
*-------------------------------------------------------------------------
*/
@@ -1061,7 +1062,7 @@ H5Eset_current_stack(hid_t err_stack)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/* Set the current error stack */
- if(H5E_set_current_stack(estack) < 0)
+ if(H5E__set_current_stack(estack) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack")
/*
@@ -1078,11 +1079,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_set_current_stack
+ * Function: H5E__set_current_stack
*
- * Purpose: Private function to replace an error stack.
+ * Purpose: Private function to replace an error stack.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 15, 2003
@@ -1090,19 +1091,19 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_set_current_stack(H5E_t *estack)
+H5E__set_current_stack(H5E_t *estack)
{
H5E_t *current_stack; /* Default error stack */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(estack);
/* Get a pointer to the current error stack */
- if(NULL == (current_stack = H5E_get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (current_stack = H5E__get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Empty current error stack */
@@ -1138,15 +1139,15 @@ H5E_set_current_stack(H5E_t *estack)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_set_current_stack() */
+} /* end H5E__set_current_stack() */
/*-------------------------------------------------------------------------
- * Function: H5Eclose_stack
+ * Function: H5Eclose_stack
*
- * Purpose: Closes an error stack.
+ * Purpose: Closes an error stack.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 14, 2003
@@ -1180,11 +1181,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_close_stack
+ * Function: H5E__close_stack
*
- * Purpose: Private function to close an error stack.
+ * Purpose: Private function to close an error stack.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 14, 2003
@@ -1192,9 +1193,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_close_stack(H5E_t *estack)
+H5E__close_stack(H5E_t *estack)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(estack);
@@ -1206,15 +1207,16 @@ H5E_close_stack(H5E_t *estack)
estack = H5FL_FREE(H5E_t, estack);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5E_close_stack() */
+} /* end H5E__close_stack() */
/*-------------------------------------------------------------------------
- * Function: H5Eget_num
+ * Function: H5Eget_num
*
- * Purpose: Retrieves the number of error message.
+ * Purpose: Retrieves the number of error messages.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: Success: The number of errors
+ * Failure: -1
*
* Programmer: Raymond Lu
* Friday, July 15, 2003
@@ -1228,13 +1230,13 @@ H5Eget_num(hid_t error_stack_id)
ssize_t ret_value; /* Return value */
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(FAIL)
+ FUNC_ENTER_API_NOCLEAR((-1))
H5TRACE1("Zs", "i", error_stack_id);
/* Need to check for errors */
if(error_stack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get current error stack")
} /* end if */
else {
/* Only clear the error stack if it's not the default stack */
@@ -1242,12 +1244,12 @@ H5Eget_num(hid_t error_stack_id)
/* Get the error stack to operate on */
if(NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an error stack ID")
} /* end else */
/* Get the number of errors on stack */
- if((ret_value = H5E_get_num(estack)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get number of errors")
+ if((ret_value = H5E__get_num(estack)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors")
done:
FUNC_LEAVE_API(ret_value)
@@ -1255,11 +1257,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_get_num
+ * Function: H5E__get_num
*
- * Purpose: Private function to retrieve number of errors in error stack.
+ * Purpose: Private function to retrieve number of errors in error stack.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: Success: The number of errors
+ * Failure: -1 (can't fail at this time)
*
* Programmer: Raymond Lu
* Friday, July 15, 2003
@@ -1267,22 +1270,22 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5E_get_num(const H5E_t *estack)
+H5E__get_num(const H5E_t *estack)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(estack);
FUNC_LEAVE_NOAPI((ssize_t)estack->nused)
-} /* end H5E_get_num() */
+} /* end H5E__get_num() */
/*-------------------------------------------------------------------------
- * Function: H5Epop
+ * Function: H5Epop
*
- * Purpose: Deletes some error messages from the top of error stack.
+ * Purpose: Deletes some error messages from the top of error stack.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 16, 2003
@@ -1301,7 +1304,7 @@ H5Epop(hid_t err_stack, size_t count)
/* 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 non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else {
@@ -1318,7 +1321,7 @@ H5Epop(hid_t err_stack, size_t count)
count = estack->nused;
/* Pop the errors off the stack */
- if(H5E_pop(estack, count) < 0)
+ if(H5E__pop(estack, count) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't pop errors from stack")
done:
@@ -1327,22 +1330,22 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Epush2
+ * Function: H5Epush2
*
- * Purpose: Pushes a new error record onto error stack for the current
- * thread. The error has major and minor IDs MAJ_ID and
- * MIN_ID, the name of a function where the error was detected,
- * the name of the file where the error was detected, the
- * line within that file, and an error description string. The
- * function name, file name, and error description strings must
- * be statically allocated.
+ * Purpose: Pushes a new error record onto error stack for the current
+ * thread. The error has major and minor IDs MAJ_ID and
+ * MIN_ID, the name of a function where the error was detected,
+ * the name of the file where the error was detected, the
+ * line within that file, and an error description string. The
+ * function name, file name, and error description strings must
+ * be statically allocated.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, October 18, 1999
*
- * Notes: Basically a new public API wrapper around the H5E__push_stack
+ * Notes: Basically a new public API wrapper around the H5E__push_stack
* function.
*
*-------------------------------------------------------------------------
@@ -1435,11 +1438,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eclear2
+ * Function: H5Eclear2
*
- * Purpose: Clears the error stack for the specified error stack.
+ * Purpose: Clears the error stack for the specified error stack.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Wednesday, July 16, 2003
@@ -1477,14 +1480,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eprint2
+ * Function: H5Eprint2
*
- * Purpose: Prints the error stack in some default way. This is just a
- * convenience function for H5Ewalk() with a function that
- * prints error messages. Users are encouraged to write there
- * own more specific error handlers.
+ * Purpose: Prints the error stack in some default way. This is just a
+ * convenience function for H5Ewalk() with a function that
+ * prints error messages. Users are encouraged to write there
+ * own more specific error handlers.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, February 27, 1998
@@ -1503,7 +1506,7 @@ H5Eprint2(hid_t err_stack, FILE *stream)
/* 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 non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else {
@@ -1515,7 +1518,7 @@ H5Eprint2(hid_t err_stack, FILE *stream)
} /* end else */
/* Print error stack */
- if(H5E_print(estack, stream, FALSE) < 0)
+ if(H5E__print(estack, stream, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
done:
@@ -1524,12 +1527,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ewalk2
+ * Function: H5Ewalk2
*
- * Purpose: Walks the error stack for the current thread and calls some
- * function for each error along the way.
+ * Purpose: Walks the error stack for the current thread and calls some
+ * function for each error along the way.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, February 27, 1998
@@ -1549,7 +1552,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi
/* 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 non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else {
@@ -1563,7 +1566,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi
/* Walk the error stack */
op.vers = 2;
op.u.func2 = stack_func;
- if(H5E_walk(estack, direction, &op, client_data) < 0)
+ if(H5E__walk(estack, direction, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
done:
@@ -1572,23 +1575,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eget_auto2
+ * Function: H5Eget_auto2
*
- * Purpose: Returns the current settings for the automatic error stack
- * traversal function and its data for specific error stack.
- * Either (or both) arguments may be null in which case the
- * value is not returned.
+ * Purpose: Returns the current settings for the automatic error stack
+ * traversal function and its data for specific error stack.
+ * Either (or both) arguments may be null in which case the
+ * value is not returned.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Saturday, February 28, 1998
*
- * Modification:Raymond Lu
- * 4 October 2010
- * If the printing function isn't the default H5Eprint1 or 2,
- * and H5Eset_auto1 has been called to set the old style
- * printing function, a call to H5Eget_auto2 should fail.
*-------------------------------------------------------------------------
*/
herr_t
@@ -1602,7 +1600,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
H5TRACE3("e", "i*x**x", estack_id, func, client_data);
if(estack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else
@@ -1610,7 +1608,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/* Get the automatic error reporting information */
- if(H5E_get_auto(estack, &op, client_data) < 0)
+ if(H5E__get_auto(estack, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -1628,28 +1626,25 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eset_auto2
+ * Function: H5Eset_auto2
*
- * Purpose: Turns on or off automatic printing of errors for certain
+ * Purpose: Turns on or off automatic printing of errors for certain
* error stack. When turned on (non-null FUNC pointer) any
* API function which returns an error indication will first
* call FUNC passing it CLIENT_DATA as an argument.
*
- * The default values before this function is called are
- * H5Eprint2() with client data being the standard error stream,
- * stderr.
+ * The default values before this function is called are
+ * H5Eprint2() with client data being the standard error stream,
+ * stderr.
*
- * Automatic stack traversal is always in the H5E_WALK_DOWNWARD
- * direction.
+ * Automatic stack traversal is always in the H5E_WALK_DOWNWARD
+ * direction.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, February 27, 1998
*
- * Modification:Raymond Lu
- * 4 October 2010
- * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on.
*-------------------------------------------------------------------------
*/
herr_t
@@ -1664,7 +1659,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
H5TRACE3("e", "ix*x", estack_id, func, client_data);
if(estack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else
@@ -1673,7 +1668,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Get the automatic error reporting information */
- if(H5E_get_auto(estack, &op, NULL) < 0)
+ if(H5E__get_auto(estack, &op, NULL) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
/* Set the automatic error reporting information */
@@ -1688,7 +1683,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
/* Set the automatic error reporting function */
op.func2 = func;
- if(H5E_set_auto(estack, &op, client_data) < 0)
+ if(H5E__set_auto(estack, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info")
done:
@@ -1697,14 +1692,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eauto_is_v2
+ * Function: H5Eauto_is_v2
*
- * Purpose: Determines if the error auto reporting function for an
+ * Purpose: Determines if the error auto reporting function for an
* error stack conforms to the H5E_auto_stack_t typedef
* or the H5E_auto_t typedef. The IS_STACK parameter is set
* to 1 for the first case and 0 for the latter case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, September 8, 2004
@@ -1721,7 +1716,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
H5TRACE2("e", "i*Iu", estack_id, is_stack);
if(estack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index fb9afc0..0adcde2 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -469,8 +469,8 @@ H5_DLL herr_t H5EA__dblock_debug(H5F_t *f, haddr_t addr,
/* Testing routines */
#ifdef H5EA_TESTING
-H5_DLL herr_t H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam);
-H5_DLL int H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2);
+H5_DLL herr_t H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam);
+H5_DLL int H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2);
#endif /* H5EA_TESTING */
#endif /* _H5EApkg_H */
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 3da7996..7c02e16 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -401,7 +401,7 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */
/*-------------------------------------------------------------------------
- * Function: H5EA_get_cparam_test
+ * Function: H5EA__get_cparam_test
*
* Purpose: Retrieve the parameters used to create the extensible array
*
@@ -413,9 +413,9 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR,
+BEGIN_FUNC(PKG, NOERR,
herr_t, SUCCEED, -,
-H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam))
+H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam))
/* Check arguments. */
HDassert(ea);
@@ -429,11 +429,11 @@ H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam))
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(PRIV) /* end H5EA_get_cparam_test() */
+END_FUNC(PKG) /* end H5EA__get_cparam_test() */
/*-------------------------------------------------------------------------
- * Function: H5EA_cmp_cparam_test
+ * Function: H5EA__cmp_cparam_test
*
* Purpose: Compare the parameters used to create the extensible array
*
@@ -445,9 +445,9 @@ END_FUNC(PRIV) /* end H5EA_get_cparam_test() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERRCATCH,
+BEGIN_FUNC(PKG, ERRCATCH,
int, 0, -,
-H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2))
+H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2))
/* Check arguments. */
HDassert(cparam1);
@@ -481,5 +481,5 @@ H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)
CATCH
-END_FUNC(PRIV) /* end H5EA_cmp_cparam_test() */
+END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */
diff --git a/src/H5B2public.h b/src/H5ESpublic.h
index 6e0b964..e3b1b56 100644
--- a/src/H5B2public.h
+++ b/src/H5ESpublic.h
@@ -1,9 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
@@ -11,22 +10,11 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*-------------------------------------------------------------------------
- *
- * Created: H5B2public.h
- * Jan 31 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Public declarations for the v2 B-tree package.
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef _H5B2public_H
-#define _H5B2public_H
+#ifndef _H5ESpublic_H
+#define _H5ESpublic_H
/* Public headers needed by this file */
-#include "H5public.h"
+#include "H5public.h" /* Generic Functions */
/*****************/
/* Public Macros */
@@ -36,9 +24,22 @@
/* Public Typedefs */
/*******************/
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
+/* Asynchronous operation status */
+typedef enum H5ES_status_t {
+ H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */
+ H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */
+ H5ES_STATUS_FAIL, /* Operation has completed, but failed */
+ H5ES_STATUS_CANCELED /* Operation has not completed and was canceled */
+} H5ES_status_t;
+
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
#ifdef __cplusplus
extern "C" {
@@ -48,5 +49,5 @@ extern "C" {
}
#endif
-#endif /* _H5B2public_H */
+#endif /* _H5ESpublic_H */
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index fc3eb9c..4462303 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -35,11 +35,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Epkg.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Epkg.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -80,12 +80,12 @@
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5Eget_major
+ * Function: H5Eget_major
*
- * Purpose: Retrieves a major error message.
+ * Purpose: Retrieves a major error message.
*
- * Return: Returns message if succeeds.
- * otherwise returns NULL.
+ * Return: Success: Pointer to the message
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Friday, July 14, 2003
@@ -106,21 +106,21 @@ H5Eget_major(H5E_major_t maj)
/* Get the message object */
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
/* Get the size & type of the message's text */
- if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
+ if((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
if(type != H5E_MAJOR)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one")
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one")
/* Application will free this */
size++;
msg_str = (char *)H5MM_malloc((size_t)size);
/* Get the text for the message */
- if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
+ if(H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
ret_value = msg_str;
@@ -133,12 +133,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eget_minor
+ * Function: H5Eget_minor
*
- * Purpose: Retrieves a minor error message.
+ * Purpose: Retrieves a minor error message.
*
- * Return: Returns message if succeeds.
- * otherwise returns NULL.
+ * Return: Success: Pointer to the message
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Friday, July 14, 2003
@@ -159,21 +159,21 @@ H5Eget_minor(H5E_minor_t min)
/* Get the message object */
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
/* Get the size & type of the message's text */
- if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
+ if((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
if(type != H5E_MINOR)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one")
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one")
/* Application will free this */
size++;
msg_str = (char *)H5MM_malloc((size_t)size);
/* Get the text for the message */
- if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
+ if(H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
ret_value = msg_str;
@@ -186,19 +186,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Epush1
+ * Function: H5Epush1
*
- * Purpose: This function definition is for backward compatibility only.
+ * Purpose: This function definition is for backward compatibility only.
* It doesn't have error stack and error class as parameters.
* The old definition of major and minor is casted as HID_T
* in H5Epublic.h
*
- * Notes: Basically a public API wrapper around the H5E_push2
+ * Notes: Basically a public API wrapper around the H5E_push2
* function. For backward compatibility, it maintains the
* same parameter as the old function, in contrary to
* H5Epush2.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Tuesday, Sep 16, 2003
@@ -225,12 +225,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eclear1
+ * Function: H5Eclear1
*
- * Purpose: This function is for backward compatibility.
+ * Purpose: This function is for backward compatibility.
* Clears the error stack for the specified error stack.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Wednesday, July 16, 2003
@@ -256,15 +256,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eprint1
+ * Function: H5Eprint1
*
- * Purpose: This function is for backward compatibility.
+ * Purpose: This function is for backward compatibility.
* Prints the error stack in some default way. This is just a
- * convenience function for H5Ewalk() with a function that
- * prints error messages. Users are encouraged to write there
- * own more specific error handlers.
+ * convenience function for H5Ewalk() with a function that
+ * prints error messages. Users are encouraged to write there
+ * own more specific error handlers.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Sep 16, 2003
@@ -281,11 +281,11 @@ H5Eprint1(FILE *stream)
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Print error stack */
- if(H5E_print(estack, stream, TRUE) < 0)
+ if(H5E__print(estack, stream, TRUE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
done:
@@ -294,13 +294,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ewalk1
+ * Function: H5Ewalk1
*
- * Purpose: This function is for backward compatibility.
+ * Purpose: This function is for backward compatibility.
* Walks the error stack for the current thread and calls some
- * function for each error along the way.
+ * function for each error along the way.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Sep 16, 2003
@@ -318,13 +318,13 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data)
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Walk the error stack */
walk_op.vers = 1;
walk_op.u.func1 = func;
- if(H5E_walk(estack, direction, &walk_op, client_data) < 0)
+ if(H5E__walk(estack, direction, &walk_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
done:
@@ -333,24 +333,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eget_auto1
+ * Function: H5Eget_auto1
*
- * Purpose: This function is for backward compatibility.
+ * Purpose: This function is for backward compatibility.
* Returns the current settings for the automatic error stack
- * traversal function and its data for specific error stack.
- * Either (or both) arguments may be null in which case the
- * value is not returned.
+ * traversal function and its data for specific error stack.
+ * Either (or both) arguments may be null in which case the
+ * value is not returned.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Sep 16, 2003
*
- * Modification:Raymond Lu
- * 4 October 2010
- * If the printing function isn't the default H5Eprint1 or 2,
- * and H5Eset_auto2 has been called to set the new style
- * printing function, a call to H5Eget_auto1 should fail.
*-------------------------------------------------------------------------
*/
herr_t
@@ -364,11 +359,11 @@ H5Eget_auto1(H5E_auto1_t *func, void **client_data)
H5TRACE2("e", "*x**x", func, client_data);
/* Retrieve default error stack */
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Get the automatic error reporting information */
- if(H5E_get_auto(estack, &auto_op, client_data) < 0)
+ if(H5E__get_auto(estack, &auto_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
/* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto2 */
@@ -384,29 +379,26 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Eset_auto1
+ * Function: H5Eset_auto1
*
- * Purpose: This function is for backward compatibility.
+ * Purpose: This function is for backward compatibility.
* Turns on or off automatic printing of errors for certain
* error stack. When turned on (non-null FUNC pointer) any
* API function which returns an error indication will first
* call FUNC passing it CLIENT_DATA as an argument.
*
- * The default values before this function is called are
- * H5Eprint1() with client data being the standard error stream,
- * stderr.
+ * The default values before this function is called are
+ * H5Eprint1() with client data being the standard error stream,
+ * stderr.
*
- * Automatic stack traversal is always in the H5E_WALK_DOWNWARD
- * direction.
+ * Automatic stack traversal is always in the H5E_WALK_DOWNWARD
+ * direction.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Sep 16, 2003
*
- * Modification:Raymond Lu
- * 4 October 2010
- * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on.
*-------------------------------------------------------------------------
*/
herr_t
@@ -420,11 +412,11 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data)
FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE2("e", "x*x", func, client_data);
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Get the automatic error reporting information */
- if(H5E_get_auto(estack, &auto_op, NULL) < 0)
+ if(H5E__get_auto(estack, &auto_op, NULL) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
/* Set the automatic error reporting information */
@@ -435,7 +427,7 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data)
auto_op.is_default = TRUE;
auto_op.func1 = func;
- if(H5E_set_auto(estack, &auto_op, client_data) < 0)
+ if(H5E__set_auto(estack, &auto_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info")
done:
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 15953af..540c9b1 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -32,11 +32,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Epkg.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Epkg.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -64,12 +64,12 @@ typedef struct H5E_print_t {
/* Local Prototypes */
/********************/
#ifndef H5_NO_DEPRECATED_SYMBOLS
-static herr_t H5E_walk1_cb(int n, H5E_error1_t *err_desc,
+static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc,
void *client_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-static herr_t H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc,
+static herr_t H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc,
void *client_data);
-static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries);
+static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries);
/*********************/
@@ -108,18 +108,18 @@ hid_t H5E_ERR_CLS_g = FAIL;
* variables used for MPI error reporting
*/
char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
-int H5E_mpi_error_str_len;
+int H5E_mpi_error_str_len;
#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
- * Function: H5E_get_msg
+ * Function: H5E__get_msg
*
- * Purpose: Private function to retrieve an error message.
+ * Purpose: Private function to retrieve an error message.
*
- * Return: Non-negative for name length if succeeds(zero means no name);
- * otherwise returns negative value.
+ * Return: Success: Message length (zero means no message)
+ * Failure: -1
*
* Programmer: Raymond Lu
* Friday, July 14, 2003
@@ -127,11 +127,11 @@ int H5E_mpi_error_str_len;
*-------------------------------------------------------------------------
*/
ssize_t
-H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
+H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
{
ssize_t len = -1; /* Length of error message */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments */
HDassert(msg);
@@ -152,37 +152,37 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
/* Set the return value to the full length of the message */
FUNC_LEAVE_NOAPI(len)
-} /* end H5E_get_msg() */
+} /* end H5E__get_msg() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5E_walk1_cb
+ * Function: H5E__walk1_cb
*
- * Purpose: This function is for backward compatibility.
+ * Purpose: This function is for backward compatibility.
* This is a default error stack traversal callback function
- * that prints error messages to the specified output stream.
- * This function is for backward compatibility with v1.6.
- * It is not meant to be called directly but rather as an
- * argument to the H5Ewalk() function. This function is called
- * also by H5Eprint(). Application writers are encouraged to
- * use this function as a model for their own error stack
- * walking functions.
+ * that prints error messages to the specified output stream.
+ * This function is for backward compatibility with v1.6.
+ * It is not meant to be called directly but rather as an
+ * argument to the H5Ewalk() function. This function is called
+ * also by H5Eprint(). Application writers are encouraged to
+ * use this function as a model for their own error stack
+ * walking functions.
*
- * N is a counter for how many times this function has been
- * called for this particular traversal of the stack. It always
- * begins at zero for the first error on the stack (either the
- * top or bottom error, or even both, depending on the traversal
- * direction and the size of the stack).
+ * N is a counter for how many times this function has been
+ * called for this particular traversal of the stack. It always
+ * begins at zero for the first error on the stack (either the
+ * top or bottom error, or even both, depending on the traversal
+ * direction and the size of the stack).
*
- * ERR_DESC is an error description. It contains all the
- * information about a particular error.
+ * ERR_DESC is an error description. It contains all the
+ * information about a particular error.
*
- * CLIENT_DATA is the same pointer that was passed as the
- * CLIENT_DATA argument of H5Ewalk(). It is expected to be a
- * file pointer (or stderr if null).
+ * CLIENT_DATA is the same pointer that was passed as the
+ * CLIENT_DATA argument of H5Ewalk(). It is expected to be a
+ * file pointer (or stderr if null).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Thursday, May 11, 2006
@@ -190,7 +190,7 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
+H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
{
H5E_print_t *eprint = (H5E_print_t *)client_data;
FILE *stream; /* I/O stream to print output to */
@@ -202,7 +202,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(err_desc);
@@ -239,7 +239,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
if(cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
- fprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
+ HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
(cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
(cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
(cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
@@ -249,22 +249,22 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
{
int mpi_rank, mpi_initialized, mpi_finalized;
- MPI_Initialized(&mpi_initialized);
+ MPI_Initialized(&mpi_initialized);
MPI_Finalized(&mpi_finalized);
if(mpi_initialized && !mpi_finalized) {
- MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- fprintf(stream, "MPI-process %d", mpi_rank);
- } /* end if */
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ HDfprintf(stream, "MPI-process %d", mpi_rank);
+ } /* end if */
else
- fprintf(stream, "thread 0");
+ HDfprintf(stream, "thread 0");
} /* end block */
#elif defined(H5_HAVE_THREADSAFE)
- fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
+ HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
- fprintf(stream, "thread 0");
+ HDfprintf(stream, "thread 0");
#endif
- fprintf(stream, ":\n");
+ HDfprintf(stream, ":\n");
} /* end if */
/* Check for "real" error description - used to format output more nicely */
@@ -272,44 +272,44 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
have_desc=0;
/* Print error message */
- fprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n",
+ HDfprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n",
H5E_INDENT, "", n, err_desc->file_name, err_desc->line,
err_desc->func_name, (have_desc ? ": " : ""),
(have_desc ? err_desc->desc : ""));
- fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
- fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
+ HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
+ HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_walk1_cb() */
+} /* end H5E__walk1_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------
- * Function: H5E_walk2_cb
+ * Function: H5E__walk2_cb
*
- * Purpose: This is a default error stack traversal callback function
- * that prints error messages to the specified output stream.
- * It is not meant to be called directly but rather as an
- * argument to the H5Ewalk2() function. This function is
- * called also by H5Eprint2(). Application writers are
- * encouraged to use this function as a model for their own
- * error stack walking functions.
+ * Purpose: This is a default error stack traversal callback function
+ * that prints error messages to the specified output stream.
+ * It is not meant to be called directly but rather as an
+ * argument to the H5Ewalk2() function. This function is
+ * called also by H5Eprint2(). Application writers are
+ * encouraged to use this function as a model for their own
+ * error stack walking functions.
*
- * N is a counter for how many times this function has been
- * called for this particular traversal of the stack. It always
- * begins at zero for the first error on the stack (either the
- * top or bottom error, or even both, depending on the traversal
- * direction and the size of the stack).
+ * N is a counter for how many times this function has been
+ * called for this particular traversal of the stack. It always
+ * begins at zero for the first error on the stack (either the
+ * top or bottom error, or even both, depending on the traversal
+ * direction and the size of the stack).
*
- * ERR_DESC is an error description. It contains all the
- * information about a particular error.
+ * ERR_DESC is an error description. It contains all the
+ * information about a particular error.
*
- * CLIENT_DATA is the same pointer that was passed as the
- * CLIENT_DATA argument of H5Ewalk(). It is expected to be a
- * file pointer (or stderr if null).
+ * CLIENT_DATA is the same pointer that was passed as the
+ * CLIENT_DATA argument of H5Ewalk(). It is expected to be a
+ * file pointer (or stderr if null).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, December 12, 1997
@@ -317,7 +317,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
+H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
{
H5E_print_t *eprint = (H5E_print_t *)client_data;
FILE *stream; /* I/O stream to print output to */
@@ -329,7 +329,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(err_desc);
@@ -371,7 +371,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
if(cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
- fprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
+ HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
(cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
(cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
(cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
@@ -381,22 +381,22 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
{
int mpi_rank, mpi_initialized, mpi_finalized;
- MPI_Initialized(&mpi_initialized);
+ MPI_Initialized(&mpi_initialized);
MPI_Finalized(&mpi_finalized);
if(mpi_initialized && !mpi_finalized) {
- MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- fprintf(stream, "MPI-process %d", mpi_rank);
- } /* end if */
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ HDfprintf(stream, "MPI-process %d", mpi_rank);
+ } /* end if */
else
- fprintf(stream, "thread 0");
+ HDfprintf(stream, "thread 0");
} /* end block */
#elif defined(H5_HAVE_THREADSAFE)
- fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
+ HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
- fprintf(stream, "thread 0");
+ HDfprintf(stream, "thread 0");
#endif
- fprintf(stream, ":\n");
+ HDfprintf(stream, ":\n");
} /* end if */
/* Check for "real" error description - used to format output more nicely */
@@ -404,28 +404,28 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
have_desc = 0;
/* Print error message */
- fprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n",
+ HDfprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n",
H5E_INDENT, "", n, err_desc->file_name, err_desc->line,
err_desc->func_name, (have_desc ? ": " : ""),
(have_desc ? err_desc->desc : ""));
- fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
- fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
+ HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
+ HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_walk2_cb() */
+} /* end H5E__walk2_cb() */
/*-------------------------------------------------------------------------
- * Function: H5E_print
+ * Function: H5E__print
*
- * Purpose: Private function to print the error stack in some default
+ * Purpose: Private function to print the error stack in some default
* way. This is just a convenience function for H5Ewalk() and
* H5Ewalk2() with a function that prints error messages.
* Users are encouraged to write there own more specific error
* handlers.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, February 27, 1998
@@ -433,13 +433,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
+H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
{
H5E_print_t eprint; /* Callback information to pass to H5E_walk() */
H5E_walk_op_t walk_op; /* Error stack walking callback */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(estack);
@@ -457,8 +457,8 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
if(bk_compatible) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
walk_op.vers = 1;
- walk_op.u.func1 = H5E_walk1_cb;
- if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
+ walk_op.u.func1 = H5E__walk1_cb;
+ if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
#else /* H5_NO_DEPRECATED_SYMBOLS */
HDassert(0 && "version 1 error stack print without deprecated symbols!");
@@ -466,40 +466,40 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
} /* end if */
else {
walk_op.vers = 2;
- walk_op.u.func2 = H5E_walk2_cb;
- if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
+ walk_op.u.func2 = H5E__walk2_cb;
+ if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_print() */
+} /* end H5E__print() */
/*-------------------------------------------------------------------------
- * Function: H5E_walk
+ * Function: H5E__walk
*
- * Purpose: Private function for H5Ewalk.
+ * Purpose: Private function for H5Ewalk.
* Walks the error stack, calling the specified function for
- * each error on the stack. The DIRECTION argument determines
- * whether the stack is walked from the inside out or the
- * outside in. The value H5E_WALK_UPWARD means begin with the
- * most specific error and end at the API; H5E_WALK_DOWNWARD
- * means to start at the API and end at the inner-most function
- * where the error was first detected.
- *
- * The function pointed to by STACK_FUNC will be called for
- * each error record in the error stack. It's arguments will
- * include an index number (beginning at zero regardless of
- * stack traversal direction), an error stack entry, and the
- * CLIENT_DATA pointer passed to H5E_print.
- *
- * The function FUNC is also provided for backward compatibility.
- * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be
- * compatible with older library. If BK_COMPATIBLE is FALSE,
- * STACK_FUNC is used.
- *
- * Return: Non-negative on success/Negative on failure
+ * each error on the stack. The DIRECTION argument determines
+ * whether the stack is walked from the inside out or the
+ * outside in. The value H5E_WALK_UPWARD means begin with the
+ * most specific error and end at the API; H5E_WALK_DOWNWARD
+ * means to start at the API and end at the inner-most function
+ * where the error was first detected.
+ *
+ * The function pointed to by STACK_FUNC will be called for
+ * each error record in the error stack. It's arguments will
+ * include an index number (beginning at zero regardless of
+ * stack traversal direction), an error stack entry, and the
+ * CLIENT_DATA pointer passed to H5E_print.
+ *
+ * The function FUNC is also provided for backward compatibility.
+ * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be
+ * compatible with older library. If BK_COMPATIBLE is FALSE,
+ * STACK_FUNC is used.
+ *
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, December 12, 1997
@@ -507,14 +507,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op,
+H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op,
void *client_data)
{
int i; /* Local index variable */
herr_t status; /* Status from callback function */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(estack);
@@ -587,18 +587,18 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_walk() */
+} /* end H5E__walk() */
/*-------------------------------------------------------------------------
- * Function: H5E_get_auto
+ * Function: H5E__get_auto
*
- * Purpose: Private function to return the current settings for the
+ * Purpose: Private function to return the current settings for the
* automatic error stack traversal function and its data
* for specific error stack. Either (or both) arguments may
* be null in which case the value is not returned.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* July 18, 2003
@@ -606,9 +606,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data)
+H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(estack);
@@ -619,26 +619,26 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data)
*client_data = estack->auto_data;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5E_get_auto2() */
+} /* end H5E__get_auto() */
/*-------------------------------------------------------------------------
- * Function: H5E_set_auto
+ * Function: H5E__set_auto
*
- * Purpose: Private function to turn on or off automatic printing of
+ * Purpose: Private function to turn on or off automatic printing of
* errors for certain error stack. When turned on (non-null
* FUNC pointer) any API function which returns an error
* indication will first call FUNC passing it CLIENT_DATA
* as an argument.
*
- * The default values before this function is called are
- * H5Eprint2() with client data being the standard error stream,
- * stderr.
+ * The default values before this function is called are
+ * H5Eprint2() with client data being the standard error stream,
+ * stderr.
*
- * Automatic stack traversal is always in the H5E_WALK_DOWNWARD
- * direction.
+ * Automatic stack traversal is always in the H5E_WALK_DOWNWARD
+ * direction.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, February 27, 1998
@@ -646,9 +646,9 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data)
*-------------------------------------------------------------------------
*/
herr_t
-H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data)
+H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(estack);
@@ -657,15 +657,15 @@ H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data)
estack->auto_data = client_data;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5E_set_auto() */
+} /* end H5E__set_auto() */
/*-------------------------------------------------------------------------
- * Function: H5E_printf_stack
+ * Function: H5E_printf_stack
*
- * Purpose: Printf-like wrapper around H5E__push_stack.
+ * Purpose: Printf-like wrapper around H5E__push_stack.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, August 12, 2008
@@ -758,19 +758,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E__push_stack
+ * Function: H5E__push_stack
*
- * Purpose: Pushes a new error record onto error stack for the current
- * thread. The error has major and minor IDs MAJ_ID and
- * MIN_ID, the name of a function where the error was detected,
- * the name of the file where the error was detected, the
- * line within that file, and an error description string. The
- * function name, file name, and error description strings must
- * be statically allocated (the FUNC_ENTER() macro takes care of
- * the function name and file name automatically, but the
- * programmer is responsible for the description string).
+ * Purpose: Pushes a new error record onto error stack for the current
+ * thread. The error has major and minor IDs MAJ_ID and
+ * MIN_ID, the name of a function where the error was detected,
+ * the name of the file where the error was detected, the
+ * line within that file, and an error description string. The
+ * function name, file name, and error description strings must
+ * be statically allocated (the FUNC_ENTER() macro takes care of
+ * the function name and file name automatically, but the
+ * programmer is responsible for the description string).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Friday, December 12, 1997
@@ -799,7 +799,7 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line
/* Check for 'default' error stack */
if(estack == NULL)
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_DONE(FAIL)
/*
@@ -845,12 +845,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_clear_entries
+ * Function: H5E__clear_entries
*
- * Purpose: Private function to clear the error stack entries for the
+ * Purpose: Private function to clear the error stack entries for the
* specified error stack.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, August 6, 2003
@@ -858,13 +858,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_clear_entries(H5E_t *estack, size_t nentries)
+H5E__clear_entries(H5E_t *estack, size_t nentries)
{
H5E_error2_t *error; /* Pointer to error stack entry to clear */
unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(estack);
@@ -897,16 +897,16 @@ H5E_clear_entries(H5E_t *estack, size_t nentries)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_clear_entries() */
+} /* end H5E__clear_entries() */
/*-------------------------------------------------------------------------
- * Function: H5E_clear_stack
+ * Function: H5E_clear_stack
*
- * Purpose: Private function to clear the error stack for the
+ * Purpose: Private function to clear the error stack for the
* specified error stack.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Wednesday, July 16, 2003
@@ -922,13 +922,13 @@ H5E_clear_stack(H5E_t *estack)
/* Check for 'default' error stack */
if(estack == NULL)
- if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Empty the error stack */
HDassert(estack);
if(estack->nused)
- if(H5E_clear_entries(estack, estack->nused) < 0)
+ if(H5E__clear_entries(estack, estack->nused) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack")
done:
@@ -937,12 +937,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_pop
+ * Function: H5E__pop
*
- * Purpose: Private function to delete some error messages from the top
+ * Purpose: Private function to delete some error messages from the top
* of error stack.
*
- * Return: Non-negative value on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Friday, July 16, 2003
@@ -950,33 +950,33 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E_pop(H5E_t *estack, size_t count)
+H5E__pop(H5E_t *estack, size_t count)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(estack);
HDassert(estack->nused >= count);
/* Remove the entries from the error stack */
- if(H5E_clear_entries(estack, count) < 0)
+ if(H5E__clear_entries(estack, count) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't remove errors from stack")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_pop() */
+} /* end H5E__pop() */
/*-------------------------------------------------------------------------
- * Function: H5E_dump_api_stack
+ * Function: H5E_dump_api_stack
*
- * Purpose: Private function to dump the error stack during an error in
+ * Purpose: Private function to dump the error stack during an error in
* an API function if a callback function is defined for the
* current error stack.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, August 6, 2003
@@ -992,7 +992,7 @@ H5E_dump_api_stack(hbool_t is_api)
/* Only dump the error stack during an API call */
if(is_api) {
- H5E_t *estack = H5E_get_my_stack();
+ H5E_t *estack = H5E__get_my_stack();
HDassert(estack);
diff --git a/src/H5Epkg.h b/src/H5Epkg.h
index fcde1ca..ac98496 100644
--- a/src/H5Epkg.h
+++ b/src/H5Epkg.h
@@ -49,15 +49,15 @@
* each thread individually. The association of stacks to threads will
* be handled by the pthread library.
*
- * In order for this macro to work, H5E_get_my_stack() must be preceeded
+ * In order for this macro to work, H5E__get_my_stack() must be preceeded
* by "H5E_t *estack =".
*/
-#define H5E_get_my_stack() H5E_get_stack()
+#define H5E__get_my_stack() H5E__get_stack()
#else /* H5_HAVE_THREADSAFE */
/*
* The current error stack.
*/
-#define H5E_get_my_stack() (H5E_stack_g + 0)
+#define H5E__get_my_stack() (H5E_stack_g + 0)
#endif /* H5_HAVE_THREADSAFE */
@@ -132,20 +132,20 @@ H5_DLLVAR H5E_t H5E_stack_g[1];
/******************************/
H5_DLL herr_t H5E__term_deprec_interface(void);
#ifdef H5_HAVE_THREADSAFE
-H5_DLL H5E_t *H5E_get_stack(void);
+H5_DLL H5E_t *H5E__get_stack(void);
#endif /* H5_HAVE_THREADSAFE */
H5_DLL herr_t H5E__push_stack(H5E_t *estack, const char *file, const char *func,
unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc);
-H5_DLL ssize_t H5E_get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type,
+H5_DLL ssize_t H5E__get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type,
char *msg, size_t size);
-H5_DLL herr_t H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compat);
-H5_DLL herr_t H5E_walk(const H5E_t *estack, H5E_direction_t direction,
+H5_DLL herr_t H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compat);
+H5_DLL herr_t H5E__walk(const H5E_t *estack, H5E_direction_t direction,
const H5E_walk_op_t *op, void *client_data);
-H5_DLL herr_t H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op,
+H5_DLL herr_t H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op,
void **client_data);
-H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op,
+H5_DLL herr_t H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op,
void *client_data);
-H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count);
+H5_DLL herr_t H5E__pop(H5E_t *err_stack, size_t count);
#endif /* _H5Epkg_H */
diff --git a/src/H5F.c b/src/H5F.c
index 7e206bb..3cf912d 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -21,30 +21,46 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
+/* User data for traversal routine to get ID counts */
+typedef struct {
+ size_t obj_count; /* Number of objects counted so far */
+ unsigned types; /* Types of objects to be counted */
+} H5F_trav_obj_cnt_t;
+
+/* User data for traversal routine to get ID lists */
+typedef struct {
+ size_t max_objs; /* Maximum # of IDs to record */
+ hid_t *oid_list; /* Array of recorded IDs*/
+ size_t obj_count; /* Number of objects counted so far */
+} H5F_trav_obj_ids_t;
+
/********************/
/* Package Typedefs */
@@ -55,6 +71,14 @@
/* Local Prototypes */
/********************/
+static herr_t H5F__close_cb(H5VL_object_t *file_vol_obj);
+
+/* Callback for getting object counts in a file */
+static int H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key);
+
+/* Callback for getting IDs for open objects in a file */
+static int H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key);
+
/*********************/
/* Package Variables */
@@ -73,13 +97,18 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Local Variables */
/*******************/
+/* Declare a free list to manage the H5VL_t struct */
+H5FL_EXTERN(H5VL_t);
+
+/* Declare a free list to manage the H5VL_object_t struct */
+H5FL_EXTERN(H5VL_object_t);
/* File ID class */
static const H5I_class_t H5I_FILE_CLS[1] = {{
- H5I_FILE, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */
+ H5I_FILE, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */
}};
@@ -113,16 +142,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_term_package
+ * Function: H5F_term_package
*
- * Purpose: Terminate this interface: free all memory and reset global
- * variables to their initial values. Release all ID groups
- * associated with this interface.
+ * Purpose: Terminate this interface: free all memory and reset global
+ * variables to their initial values. Release all ID groups
+ * associated with this interface.
+ *
+ * Return: Success: Positive if anything was done that might
+ * have affected other interfaces;
+ * zero otherwise.
+ *
+ * Failure: Never fails
*
- * Return: Success: Positive if anything was done that might
- * have affected other interfaces;
- * zero otherwise.
- * Failure: Never fails.
*-------------------------------------------------------------------------
*/
int
@@ -155,35 +186,75 @@ H5F_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5Fget_create_plist
+ * Function: H5F__close_cb
+ *
+ * Purpose: Closes a file or causes the close operation to be pended.
+ * This function is called from the API and gets called
+ * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref()
+ * decrements the file ID reference count to zero. The file ID
+ * is removed from the H5I_FILE group by H5I_dec_ref() just
+ * before H5F__close_cb() is called. If there are open object
+ * headers then the close is pended by moving the file to the
+ * H5I_FILE_CLOSING ID group (the f->closing contains the ID
+ * assigned to file).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F__close_cb(H5VL_object_t *file_vol_obj)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(file_vol_obj);
+
+ /* Close the file */
+ if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+
+ /* Free the VOL object */
+ if(H5VL_free_object(file_vol_obj) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__close_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_create_plist
*
- * Purpose: Get an atom for a copy of the file-creation property list for
- * this file. This function returns an atom with a copy of the
- * properties used to create a file.
+ * Purpose: Get an atom for a copy of the file-creation property list for
+ * this file. This function returns an atom with a copy of the
+ * properties used to create a file.
+ *
+ * Return: Success: Object ID for a copy of the file creation
+ * property list.
+ *
+ * Failure: H5I_INVALID_HID
*
- * Return: Success: template ID
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5Fget_create_plist(hid_t file_id)
{
- H5F_t *file; /* File info */
- H5P_genplist_t *plist; /* Property list */
- hid_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", file_id);
/* check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
- /* Create the property list object to return */
- if((ret_value = H5P_copy_plist(plist, TRUE)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties")
+ /* Retrieve the file creation property list */
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties")
done:
FUNC_LEAVE_API(ret_value)
@@ -191,37 +262,39 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_access_plist
+ * Function: H5Fget_access_plist
*
- * Purpose: Returns a copy of the file access property list of the
- * specified file.
+ * Purpose: Returns a copy of the file access property list of the
+ * specified file.
*
* NOTE: Make sure that, if you are going to overwrite
* information in the copied property list that was
* previously opened and assigned to the property list, then
* you must close it before overwriting the values.
*
- * Return: Success: Object ID for a copy of the file access
- * property list.
- * Failure: FAIL
+ * Return: Success: Object ID for a copy of the file access
+ * property list.
+ *
+ * Failure: H5I_INVALID_HID
+ *
*-------------------------------------------------------------------------
*/
hid_t
H5Fget_access_plist(hid_t file_id)
{
- H5F_t *f; /* File info */
- hid_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", file_id);
/* Check args */
- if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Retrieve the file's access property list */
- if((ret_value = H5F_get_access_plist(f, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list")
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list")
done:
FUNC_LEAVE_API(ret_value)
@@ -229,36 +302,98 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_obj_count
+ * Function: H5F__get_all_count_cb
+ *
+ * Purpose: Get counter of all object types currently open.
*
- * Purpose: Public function returning the number of opened object IDs
- * (files, datasets, groups and datatypes) in the same file.
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ *
+ * Failure: H5_ITER_ERROR
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
+{
+ H5F_trav_obj_cnt_t *udata = (H5F_trav_obj_cnt_t *)key;
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ udata->obj_count++;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F_get_all_count_cb */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_obj_count
+ *
+ * Purpose: Public function returning the number of opened object IDs
+ * (files, datasets, groups and datatypes) in the same file.
+ *
+ * Return: Success: The number of opened object IDs
+ *
+ * Failure: -1
*
- * Return: Non-negative on success; negative on failure.
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_obj_count(hid_t file_id, unsigned types)
{
- H5F_t *f = NULL; /* File to query */
- size_t obj_count = 0; /* Number of opened objects */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = 0; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE2("Zs", "iIu", file_id, types);
/* Check arguments */
- if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id")
if(0 == (types & H5F_OBJ_ALL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type")
/* Perform the query */
- if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
-
- /* Set the return value */
- ret_value = (ssize_t)obj_count;
+ /* If the 'special' ID wasn't passed in, just make a normal call to
+ * count the IDs in the file.
+ */
+ if(file_id != (hid_t)H5F_OBJ_ALL) {
+ H5VL_object_t *vol_obj;
+
+ /* 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")
+
+ /* 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)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)")
+ }
+ /* 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.
+ */
+ else {
+ H5F_trav_obj_cnt_t udata;
+
+ /* Set up callback context */
+ udata.types = types | H5F_OBJ_LOCAL;
+ udata.obj_count = 0;
+
+ if(types & H5F_OBJ_FILE)
+ if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed")
+ if(types & H5F_OBJ_DATASET)
+ if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed")
+ if(types & H5F_OBJ_GROUP)
+ if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed")
+ if(types & H5F_OBJ_DATATYPE)
+ if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed")
+ if(types & H5F_OBJ_ATTR)
+ if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed")
+
+ /* Set return value */
+ ret_value = (ssize_t)udata.obj_count;
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
@@ -266,37 +401,116 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_object_ids
+ * Function: H5F__get_all_ids_cb
+ *
+ * Purpose: Get IDs of all currently open objects of a given type.
*
- * Purpose: Public function to return a list of opened object IDs.
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ *
+ * Failure: H5_ITER_ERROR
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key)
+{
+ H5F_trav_obj_ids_t *udata = (H5F_trav_obj_ids_t *)key;
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(udata->obj_count >= udata->max_objs)
+ HGOTO_DONE(H5_ITER_STOP);
+
+ /* Add the ID to the array */
+ udata->oid_list[udata->obj_count] = obj_id;
+ udata->obj_count++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F__get_all_ids_cb */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_object_ids
+ *
+ * Purpose: Public function to return a list of opened object IDs.
+ *
+ * NOTE: Type mismatch - You can ask for more objects than can be
+ * returned.
+ *
+ * NOTE: Currently, the IDs' ref counts are not incremented. Is this
+ * intentional and documented?
+ *
+ * Return: Success: The number of IDs in oid_list
+ *
+ * Failure: -1
*
- * Return: Non-negative on success; negative on failure.
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
{
- H5F_t *f = NULL; /* File to query */
- size_t obj_id_count = 0; /* Number of open objects */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = 0; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list);
/* Check arguments */
- if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id")
if(0 == (types & H5F_OBJ_ALL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type")
if(!oid_list)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object ID list is NULL")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list cannot be NULL")
/* Perform the query */
- if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_id_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
+ /* If the 'special' ID wasn't passed in, just make a normal VOL call to
+ * get the IDs from the file.
+ */
+ if(file_id != (hid_t)H5F_OBJ_ALL) {
+ H5VL_object_t *vol_obj;
- /* Set the return value */
- ret_value = (ssize_t)obj_id_count;
+ /* 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")
+
+ /* 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)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)")
+ } /* 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.
+ *
+ * XXX: Note that the RM states that passing in a negative value for max_objs
+ * gets you all the objects. This technically works, but is clearly wrong
+ * behavior since max_objs is an unsigned type.
+ */
+ else {
+ H5F_trav_obj_ids_t udata;
+
+ /* Set up callback context */
+ udata.max_objs = max_objs;
+ udata.oid_list = oid_list;
+ udata.obj_count = 0;
+
+ if(types & H5F_OBJ_FILE)
+ if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed")
+ if(types & H5F_OBJ_DATASET)
+ if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed")
+ if(types & H5F_OBJ_GROUP)
+ if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed")
+ if(types & H5F_OBJ_DATATYPE)
+ if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed")
+ if(types & H5F_OBJ_ATTR)
+ if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed")
+
+ /* Set return value */
+ ret_value = (ssize_t)udata.obj_count;
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
@@ -309,30 +523,30 @@ done:
* Purpose: Returns a pointer to the file handle of the low-level file
* driver.
*
- * Return: Success: non-negative value.
- * Failure: negative.
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle)
+H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle)
{
- H5F_t *file; /* File to query */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "ii**x", file_id, fapl, file_handle);
+ H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle);
/* Check args */
if(!file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer")
- /* Get the file */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id")
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Retrieve the VFD handle for the file */
- if(H5F_get_vfd_handle(file, fapl, file_handle) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle")
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -340,38 +554,40 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fis_hdf5
+ * Function: H5Fis_accessible
*
- * Purpose: Check the file signature to detect an HDF5 file.
+ * Purpose: Check if the file can be opened with the given fapl.
*
- * Bugs: This function is not robust: it only uses the default file
- * driver when attempting to open the file when in fact it
- * should use all known file drivers.
+ * Return: TRUE/FALSE/FAIL
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
*-------------------------------------------------------------------------
*/
htri_t
-H5Fis_hdf5(const char *name)
+H5Fis_accessible(const char *name, hid_t fapl_id)
{
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("t", "*s", name);
+ H5TRACE2("t", "*si", name, fapl_id);
- /* Check args and all the boring stuff. */
+ /* Check args */
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
- /* call the private is_HDF5 function */
- /* (Should not trigger raw data I/O - QAK, 2018/01/03) */
- if((ret_value = H5F__is_hdf5(name)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file")
+ /* Check the file access property list */
+ 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 file access property list")
+
+ /* Check if file is accessible */
+ if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Fis_hdf5() */
+} /* end H5Fis_accessible() */
/*-------------------------------------------------------------------------
@@ -394,66 +610,70 @@ done:
* the list of file creation and file access properties.
*
* Return: Success: A file ID
- * Failure: FAIL
+ *
+ * Failure: H5I_INVALID_HID
+ *
*-------------------------------------------------------------------------
*/
hid_t
H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
- H5F_t *new_file = NULL; /* file struct for new file */
- hid_t ret_value; /* return value */
+ H5F_t *new_file = NULL; /* File struct for new file */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id);
/* Check/fix arguments */
- if (!filename || !*filename)
+ if(!filename || !*filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name")
/* In this routine, we only accept the following flags:
* H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE
*/
- if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE))
+ if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags")
/* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */
- if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC))
+ if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation")
/* Check file creation property list */
- if (H5P_DEFAULT == fcpl_id)
+ if(H5P_DEFAULT == fcpl_id)
fcpl_id = H5P_FILE_CREATE_DEFAULT;
else
- if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE))
+ if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+
/* Adjust bit flags by turning on the creation bit and making sure that
* the EXCL or TRUNC bit is set. All newly-created files are opened for
* reading and writing.
*/
- if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC)))
+ if(0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC)))
flags |= H5F_ACC_EXCL; /*default*/
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
- /* Create a new file or truncate an existing file. */
- if (NULL == (new_file = H5F__create(filename, flags, fcpl_id, fapl_id)))
+ /* Create a new file or truncate an existing file through the VOL */
+ if(NULL == (new_file = (H5F_t *)H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file")
/* Get an atom for the file */
- if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file")
-
- /* Keep this ID in file object structure */
- new_file->file_id = ret_value;
+ if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
- if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Fcreate() */
@@ -473,26 +693,29 @@ done:
*
* Return: Success: A file ID
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
{
- H5F_t *new_file = NULL; /* file struct for new file */
- hid_t ret_value; /* return value */
+ H5F_t *new_file = NULL; /* File struct for new file */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "*sIui", filename, flags, fapl_id);
- /* Check/fix arguments. */
+ /* Check arguments */
if(!filename || !*filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name")
/* Reject undefined flags (~H5F_ACC_PUBLIC_FLAGS) and the H5F_ACC_TRUNC & H5F_ACC_EXCL flags */
if((flags & ~H5F_ACC_PUBLIC_FLAGS) ||
(flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags")
+ /* XXX (VOL MERGE): Might want to move SWMR flag checks to H5F_open() */
/* Asking for SWMR write access on a read-only file is invalid */
if((flags & H5F_ACC_SWMR_WRITE) && 0 == (flags & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "SWMR write access on a file open for read-only access is not allowed")
@@ -504,133 +727,59 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Open the file */
- if(NULL == (new_file = H5F__open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file")
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
- /* Get an atom for the file */
- if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ /* Open the file through the VOL layer */
+ if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file")
- /* Keep this ID in file object structure */
- new_file->file_id = ret_value;
+ /* Get an ID for the file */
+ if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
- if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Fopen() */
/*-------------------------------------------------------------------------
- * Function: H5Fflush
+ * Function: H5Fflush
+ *
+ * Purpose: Flushes all outstanding buffers of a file to disk but does
+ * not remove them from the cache. The OBJECT_ID can be a file,
+ * dataset, group, attribute, or named data type.
*
- * Purpose: Flushes all outstanding buffers of a file to disk but does
- * not remove them from the cache. The OBJECT_ID can be a file,
- * dataset, group, attribute, or named data type.
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Fflush(hid_t object_id, H5F_scope_t scope)
{
- H5F_t *f = NULL; /* File to flush */
- H5O_loc_t *oloc = NULL; /* Object location for ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object info */
+ H5I_type_t obj_type; /* Type of object */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iFs", object_id, scope);
- switch(H5I_get_type(object_id)) {
- case H5I_FILE:
- if(NULL == (f = (H5F_t *)H5I_object(object_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- break;
-
- case H5I_GROUP:
- {
- H5G_t *grp;
-
- if(NULL == (grp = (H5G_t *)H5I_object(object_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier")
- oloc = H5G_oloc(grp);
- }
- break;
-
- case H5I_DATATYPE:
- {
- H5T_t *type;
-
- if(NULL == (type = (H5T_t *)H5I_object(object_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier")
- oloc = H5T_oloc(type);
- }
- break;
-
- case H5I_DATASET:
- {
- H5D_t *dset;
-
- if(NULL == (dset = (H5D_t *)H5I_object(object_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- oloc = H5D_oloc(dset);
- }
- break;
-
- case H5I_ATTR:
- {
- H5A_t *attr;
-
- if(NULL == (attr = (H5A_t *)H5I_object(object_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier")
- oloc = H5A_oloc(attr);
- }
- break;
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_DATASPACE:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- } /* end switch */
-
- if(!f) {
- if(!oloc)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not assocated with a file")
- f = oloc->file;
- } /* end if */
- if(!f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file")
-
- /* Flush the file */
- /*
- * Nothing to do if the file is read only. This determination is
- * made at the shared open(2) flags level, implying that opening a
- * file twice, once for read-only and once for read-write, and then
- * calling H5Fflush() with the read-only handle, still causes data
- * to be flushed.
- */
- if(H5F_ACC_RDWR & H5F_INTENT(f)) {
- hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */
+ /* Get the type of object we're flushing + sanity check */
+ obj_type = H5I_get_type(object_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")
- /* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- /* Flush the file */
- if(H5F__flush(f, scope) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
- } /* end if */
+ /* Flush the object */
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file")
done:
FUNC_LEAVE_API(ret_value)
@@ -638,17 +787,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fclose
+ * Function: H5Fclose
*
- * Purpose: This function closes the file specified by FILE_ID by
- * flushing all data to storage, and terminating access to the
- * file through FILE_ID. If objects (e.g., datasets, groups,
- * etc.) are open in the file then the underlying storage is not
- * closed until those objects are closed; however, all data for
- * the file and the open objects is flushed.
+ * Purpose: This function closes the file specified by FILE_ID by
+ * flushing all data to storage, and terminating access to the
+ * file through FILE_ID. If objects (e.g., datasets, groups,
+ * etc.) are open in the file then the underlying storage is not
+ * closed until those objects are closed; however, all data for
+ * the file and the open objects is flushed.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: Non-negative
- * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -661,11 +810,13 @@ H5Fclose(hid_t file_id)
/* Check arguments */
if(H5I_FILE != H5I_get_type(file_id))
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID")
- /* Close the file */
- if(H5F__close(file_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "closing file ID failed")
+ /* Decrement reference count on atom. When it reaches zero the file will
+ * be closed.
+ */
+ if(H5I_dec_app_ref(file_id) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -673,63 +824,60 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Freopen
+ * Function: H5Freopen
+ *
+ * Purpose: Reopen a file. The new file handle which is returned points
+ * to the same file as the specified file handle. Both handles
+ * share caches and other information. The only difference
+ * between the handles is that the new handle is not mounted
+ * anywhere and no files are mounted on it.
*
- * Purpose: Reopen a file. The new file handle which is returned points
- * to the same file as the specified file handle. Both handles
- * share caches and other information. The only difference
- * between the handles is that the new handle is not mounted
- * anywhere and no files are mounted on it.
+ * Return: Success: New file ID
+ *
+ * Failure: H5I_INVALID_HID
*
- * Return: Success: New file ID
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5Freopen(hid_t file_id)
{
- H5F_t *old_file = NULL;
- H5F_t *new_file = NULL;
- hid_t ret_value;
+ H5VL_object_t *vol_obj = NULL;
+ H5F_t *file = NULL; /* File struct for new file */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", file_id);
- /* Check arguments */
- if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
-
- /* Get a new "top level" file struct, sharing the same "low level" file struct */
- if(NULL == (new_file = H5F__new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
+ /* Get the file object */
+ 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")
- /* Duplicate old file's names */
- new_file->open_name = H5MM_xstrdup(old_file->open_name);
- new_file->actual_name = H5MM_xstrdup(old_file->actual_name);
- new_file->extpath = H5MM_xstrdup(old_file->extpath);
+ /* Reopen the file */
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector")
- if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
+ /* Make sure that worked */
+ if(NULL == file)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file")
- /* Keep this ID in file object structure */
- new_file->file_id = ret_value;
+ /* Get an atom for the file */
+ if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
- if(ret_value < 0 && new_file)
- if(H5F__dest(new_file, FALSE) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
-
+ /* XXX (VOL MERGE): If registration fails, file will not be closed */
FUNC_LEAVE_API(ret_value)
} /* end H5Freopen() */
/*-------------------------------------------------------------------------
- * Function: H5Fget_intent
+ * Function: H5Fget_intent
*
- * Purpose: Public API to retrieve the file's 'intent' flags passed
- * during H5Fopen()
+ * Purpose: Public API to retrieve the file's 'intent' flags passed
+ * during H5Fopen()
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -742,30 +890,15 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags)
/* If no intent flags were passed in, exit quietly */
if(intent_flags) {
- H5F_t *file; /* Pointer to file structure */
+ H5VL_object_t *vol_obj; /* File info */
/* Get the internal file structure */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
-
- /* HDF5 uses some flags internally that users don't know about.
- * Simplify things for them so that they only get either H5F_ACC_RDWR
- * or H5F_ACC_RDONLY.
- */
- if(H5F_INTENT(file) & H5F_ACC_RDWR) {
- *intent_flags = H5F_ACC_RDWR;
-
- /* Check for SWMR write access on the file */
- if(H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)
- *intent_flags |= H5F_ACC_SWMR_WRITE;
- } /* end if */
- else {
- *intent_flags = H5F_ACC_RDONLY;
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- /* Check for SWMR read access on the file */
- if(H5F_INTENT(file) & H5F_ACC_SWMR_READ)
- *intent_flags |= H5F_ACC_SWMR_READ;
- } /* end else */
+ /* 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)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags")
} /* end if */
done:
@@ -778,29 +911,28 @@ done:
*
* Purpose: Retrieves the amount of free space in the file.
*
- * Return: Success: Amount of free space for type
- * Failure: Negative
+ * Return: Success: Amount of free space for type
+ *
+ * Failure: -1
+ *
*-------------------------------------------------------------------------
*/
hssize_t
H5Fget_freespace(hid_t file_id)
{
- H5F_t *file; /* File object for file ID */
- hsize_t tot_space; /* Amount of free space in the file */
+ H5VL_object_t *vol_obj = NULL;
hssize_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE1("Hs", "i", file_id);
- /* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
-
- /* Get the free space in the file */
- if(H5F__get_freespace(file, &tot_space) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
- ret_value = (hssize_t)tot_space;
+ /* Get the amount of free space in the file */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space")
done:
FUNC_LEAVE_API(ret_value)
@@ -812,35 +944,30 @@ done:
*
* Purpose: Retrieves the file size of the HDF5 file. This function
* is called after an existing file is opened in order
- * to learn the true size of the underlying file.
+ * to learn the true size of the underlying file.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: Non-negative
- * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_filesize(hid_t file_id, hsize_t *size)
{
- H5F_t *file; /* File object for file ID */
- haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
- haddr_t base_addr; /* Base address for the file */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", file_id, size);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ if(!size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL")
+ 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")
- /* Go get the actual file size */
- if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
-
- base_addr = H5FD_get_base_addr(file->shared->lf);
-
- if(size)
- *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */
+ /* Get the file size */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
done:
FUNC_LEAVE_API(ret_value)
@@ -851,56 +978,57 @@ done:
* Function: H5Fget_file_image
*
* Purpose: If a buffer is provided (via the buf_ptr argument) and is
- * big enough (size in buf_len argument), load *buf_ptr with
- * an image of the open file whose ID is provided in the
- * file_id parameter, and return the number of bytes copied
- * to the buffer.
+ * big enough (size in buf_len argument), load *buf_ptr with
+ * an image of the open file whose ID is provided in the
+ * file_id parameter, and return the number of bytes copied
+ * to the buffer.
*
- * If the buffer exists, but is too small to contain an image
- * of the indicated file, return a negative number.
+ * If the buffer exists, but is too small to contain an image
+ * of the indicated file, return a negative number.
*
- * Finally, if no buffer is provided, return the size of the
- * buffer needed. This value is simply the eoa of the target
- * file.
+ * Finally, if no buffer is provided, return the size of the
+ * buffer needed. This value is simply the eoa of the target
+ * file.
*
- * Note that any user block is skipped.
+ * Note that any user block is skipped.
*
- * Also note that the function may not be used on files
- * opened with either the split/multi file driver or the
- * family file driver.
+ * Also note that the function may not be used on files
+ * opened with either the split/multi file driver or the
+ * family file driver.
*
- * In the former case, the sparse address space makes the
- * get file image operation impractical, due to the size of
- * the image typically required.
+ * In the former case, the sparse address space makes the
+ * get file image operation impractical, due to the size of
+ * the image typically required.
*
- * In the case of the family file driver, the problem is
- * the driver message in the super block, which will prevent
- * the image being opened with any driver other than the
- * family file driver -- which negates the purpose of the
- * operation. This can be fixed, but no resources for
- * this now.
+ * In the case of the family file driver, the problem is
+ * the driver message in the super block, which will prevent
+ * the image being opened with any driver other than the
+ * family file driver -- which negates the purpose of the
+ * operation. This can be fixed, but no resources for
+ * this now.
+ *
+ * Return: Success: Bytes copied / number of bytes needed
+ *
+ * Failure: -1
*
- * Return: Success: Bytes copied / number of bytes needed.
- * Failure: negative value
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
{
- H5F_t *file; /* File object for file ID */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* File object for file ID */
+ ssize_t ret_value; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID")
- /* call private get_file_image function */
- /* (Should not trigger raw data I/O - QAK, 2018/01/03) */
- if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image")
+ /* Get the file image */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
done:
FUNC_LEAVE_API(ret_value)
@@ -908,37 +1036,39 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_mdc_config
+ * Function: H5Fget_mdc_config
+ *
+ * Purpose: Retrieves the current automatic cache resize configuration
+ * from the metadata cache, and return it in *config_ptr.
*
- * Purpose: Retrieves the current automatic cache resize configuration
- * from the metadata cache, and return it in *config_ptr.
+ * Note that the version field of *config_Ptr must be correctly
+ * filled in by the caller. This allows us to adapt for
+ * obsolete versions of the structure.
*
- * Note that the version field of *config_Ptr must be correctly
- * filled in by the caller. This allows us to adapt for
- * obsolete versions of the structure.
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
{
- H5F_t *file; /* File object for file ID */
+ H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", file_id, config_ptr);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr")
- /* Go get the resize configuration */
- if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ /* Get the metadata cache configuration */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
FUNC_LEAVE_API(ret_value)
@@ -949,29 +1079,29 @@ done:
* Function: H5Fset_mdc_config
*
* Purpose: Sets the current metadata cache automatic resize
- * configuration, using the contents of the instance of
- * H5AC_cache_config_t pointed to by config_ptr.
+ * configuration, using the contents of the instance of
+ * H5AC_cache_config_t pointed to by config_ptr.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
{
- H5F_t *file; /* File object for file ID */
+ H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", file_id, config_ptr);
- /* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- /* set the resize configuration */
- if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.")
+ /* Set the metadata cache configuration */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration")
done:
FUNC_LEAVE_API(ret_value)
@@ -982,33 +1112,32 @@ done:
* Function: H5Fget_mdc_hit_rate
*
* Purpose: Retrieves the current hit rate from the metadata cache.
- * This rate is the overall hit rate since the last time
- * the hit rate statistics were reset either manually or
- * automatically.
+ * This rate is the overall hit rate since the last time
+ * the hit rate statistics were reset either manually or
+ * automatically.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
{
- H5F_t *file; /* File object for file ID */
+ H5VL_object_t *vol_obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*d", file_id, hit_rate_ptr);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
-
if(NULL == hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- /* Go get the current hit rate */
- if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.")
+ /* Get the current hit rate */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
FUNC_LEAVE_API(ret_value)
@@ -1019,21 +1148,20 @@ done:
* Function: H5Fget_mdc_size
*
* Purpose: Retrieves the maximum size, minimum clean size, current
- * size, and current number of entries from the metadata
- * cache associated with the specified file. If any of
- * the ptr parameters are NULL, the associated datum is
- * not returned.
+ * size, and current number of entries from the metadata
+ * cache associated with the specified file. If any of
+ * the ptr parameters are NULL, the associated datum is
+ * not returned.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
size_t *cur_size_ptr, int *cur_num_entries_ptr)
{
- H5F_t *file; /* File object for file ID */
- uint32_t cur_num_entries;
+ H5VL_object_t *vol_obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1041,16 +1169,12 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
cur_size_ptr, cur_num_entries_ptr);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
- /* Go get the size data */
- if(H5AC_get_cache_size(file->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.")
-
- if(cur_num_entries_ptr != NULL)
- *cur_num_entries_ptr = (int)cur_num_entries;
+ /* Get the size data */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
done:
FUNC_LEAVE_API(ret_value)
@@ -1061,34 +1185,34 @@ done:
* Function: H5Freset_mdc_hit_rate_stats
*
* Purpose: Reset the hit rate statistic whose current value can
- * be obtained via the H5Fget_mdc_hit_rate() call. Note
- * that this statistic will also be reset once per epoch
- * by the automatic cache resize code if it is enabled.
+ * be obtained via the H5Fget_mdc_hit_rate() call. Note
+ * that this statistic will also be reset once per epoch
+ * by the automatic cache resize code if it is enabled.
*
- * It is probably a bad idea to call this function unless
- * you are controlling cache size from your program instead
- * of using our cache size control code.
+ * It is probably a bad idea to call this function unless
+ * you are controlling cache size from your program instead
+ * of using our cache size control code.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5Freset_mdc_hit_rate_stats(hid_t file_id)
{
- H5F_t *file; /* File object for file ID */
+ H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
- /* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the hit rate statistic */
- if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
done:
FUNC_LEAVE_API(ret_value)
@@ -1099,57 +1223,45 @@ done:
* Function: H5Fget_name
*
* Purpose: Gets the name of the file to which object OBJ_ID belongs.
- * If `name' is non-NULL then write up to `size' bytes into that
+ * If 'name' is non-NULL then write up to 'size' bytes into that
* buffer and always return the length of the entry name.
- * Otherwise `size' is ignored and the function does not store the name,
- * just returning the number of characters required to store the name.
- * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL)
- * is unchanged and the function returns a negative value.
+ * Otherwise `size' is ignored and the function does not store
+ * the name, just returning the number of characters required to
+ * store the name. If an error occurs then the buffer pointed to
+ * by 'name' (NULL or non-NULL) is unchanged and the function
+ * returns a negative value.
*
* Note: This routine returns the name that was used to open the file,
* not the actual name after resolving symlinks, etc.
*
- * Return: Success: The length of the file name
- * Failure: Negative
+ * Return: Success: The length of the file name
+ *
+ * Failure: -1
+ *
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
{
- H5F_t *f; /* Top file in mount hierarchy */
- size_t len;
- ssize_t ret_value;
+ H5VL_object_t *vol_obj = NULL;
+ H5I_type_t type;
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, name, size);
- /* For file IDs, get the file object directly */
- /* (This prevents the H5G_loc() call from returning the file pointer for
- * the top file in a mount hierarchy)
- */
- if(H5I_get_type(obj_id) == H5I_FILE ) {
- if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
- } /* end if */
- else {
- H5G_loc_t loc; /* Object location */
-
- /* Get symbol table entry */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
- f = loc.oloc->file;
- } /* end else */
-
- len = HDstrlen(H5F_OPEN_NAME(f));
+ /* Check the type */
+ type = H5I_get_type(obj_id);
+ if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object")
- if(name) {
- HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size));
- if(len >= size)
- name[size-1]='\0';
- } /* end if */
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
- /* Set return value */
- ret_value = (ssize_t)len;
+ /* Get the filename via the VOL */
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name")
done:
FUNC_LEAVE_API(ret_value)
@@ -1165,43 +1277,35 @@ done:
* in the SOHM table if there is one.
* 3. The amount of free space tracked in the file.
*
- * Return: Success: non-negative on success
- * Failure: Negative
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
{
- H5F_t *f; /* Top file in mount hierarchy */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ H5I_type_t type;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", obj_id, finfo);
/* Check args */
if(!finfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL")
- /* For file IDs, get the file object directly */
- /* (This prevents the H5G_loc() call from returning the file pointer for
- * the top file in a mount hierarchy)
- */
- if(H5I_get_type(obj_id) == H5I_FILE ) {
- if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
- } /* end if */
- else {
- H5G_loc_t loc; /* Object location */
+ /* Check the type */
+ type = H5I_get_type(obj_id);
+ if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- /* Get symbol table entry */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
- f = loc.oloc->file;
- } /* end else */
- HDassert(f->shared);
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- /* Get the file info */
- if(H5F__get_info(f, finfo) < 0)
+ /* Get the file information */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
done:
@@ -1212,17 +1316,18 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Fget_metadata_read_retry_info
*
- * Purpose: To retrieve the collection of read retries for metadata items with checksum.
+ * Purpose: To retrieve the collection of read retries for metadata
+ * items with checksum.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: non-negative on success
- * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
{
- H5F_t *file; /* File object for file ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* File object for file ID */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", file_id, info);
@@ -1232,11 +1337,11 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
/* Get the file pointer */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the retry info */
- if(H5F__get_metadata_read_retry_info(file, info) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info")
done:
@@ -1245,36 +1350,38 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_free_sections
+ * Function: H5Fget_free_sections
+ *
+ * Purpose: To get free-space section information for free-space manager with
+ * TYPE that is associated with file FILE_ID.
+ * If SECT_INFO is null, this routine returns the total # of free-space
+ * sections.
+ *
+ * Return: Success: The total # of free space sections
*
- * Purpose: To get free-space section information for free-space manager with
- * TYPE that is associated with file FILE_ID.
- * If SECT_INFO is null, this routine returns the total # of free-space
- * sections.
+ * Failure: -1
*
- * Return: Success: non-negative, the total # of free space sections
- * Failure: negative
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
H5F_sect_info_t *sect_info/*out*/)
{
- H5F_t *file; /* Top file in mount hierarchy */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
if(sect_info && nsects == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0")
/* Get the free-space section information in the file */
- if((ret_value = H5F__get_free_sections(file, type, nsects, sect_info)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections")
done:
FUNC_LEAVE_API(ret_value)
@@ -1288,28 +1395,26 @@ done:
* provided file, potentially closing any cached files
* unless they are held open from somewhere\ else.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fclear_elink_file_cache(hid_t file_id)
{
- H5F_t *file; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
- /* See if there's an EFC */
- if(file->shared->efc)
- /* Release the EFC */
- if(H5F__efc_release(file->shared->efc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
+ /* Release the EFC */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
FUNC_LEAVE_API(ret_value)
@@ -1319,32 +1424,57 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Fstart_swmr_write
*
- * Purpose: To enable SWMR writing mode for the file
+ * Purpose: To enable SWMR writing mode for the file
+ *
+ * 1) Refresh opened objects: part 1
+ * 2) Flush & reset accumulator
+ * 3) Mark the file in SWMR writing mode
+ * 4) Set metadata read attempts and retries info
+ * 5) Disable accumulator
+ * 6) Evict all cache entries except the superblock
+ * 7) Refresh opened objects (part 2)
+ * 8) Unlock the file
+ *
+ * Pre-conditions:
+ *
+ * 1) The file being opened has v3 superblock
+ * 2) The file is opened with H5F_ACC_RDWR
+ * 3) The file is not already marked for SWMR writing
+ * 4) Current implementaion for opened objects:
+ * --only allow datasets and groups without attributes
+ * --disallow named datatype with/without attributes
+ * --disallow opened attributes attached to objects
+ *
+ * NOTE: Currently, only opened groups and datasets are allowed
+ * when enabling SWMR via H5Fstart_swmr_write().
+ * Will later implement a different approach--
+ * set up flush dependency/proxy even for file opened without
+ * SWMR to resolve issues with opened objects.
*
- * Return: Non-negative on success/negative on failure
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Fstart_swmr_write(hid_t file_id)
{
- H5F_t *file = NULL; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
- /* check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ /* Check args */
+ 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 collective metadata if appropriate */
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the internal routine */
- if(H5F__start_swmr_write(file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format")
+ /* Start SWMR writing */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing")
done:
FUNC_LEAVE_API(ret_value)
@@ -1357,24 +1487,25 @@ done:
* Purpose: Start metadata cache logging operations for a file.
* - Logging must have been set up via the fapl.
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fstart_mdc_logging(hid_t file_id)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
/* Sanity check */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
/* Call mdc logging function */
- if(H5C_start_logging(file->shared->cache) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
done:
@@ -1389,24 +1520,25 @@ done:
* - Does not close the log file.
* - Logging must have been set up via the fapl.
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fstop_mdc_logging(hid_t file_id)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
/* Sanity check */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
/* Call mdc logging function */
- if(H5C_stop_logging(file->shared->cache) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
done:
@@ -1421,25 +1553,26 @@ done:
* set up via the fapl. is_currently_logging determines if
* log messages are being recorded at this time.
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled,
hbool_t *is_currently_logging)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging);
/* Sanity check */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
/* Call mdc logging function */
- if(H5C_get_logging_status(file->shared->cache, is_enabled, is_currently_logging) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status")
done:
@@ -1455,29 +1588,30 @@ done:
* H5Fset_latest_format() starting release 1.10.2.
* See explanation for H5Fset_latest_format() in H5Fdeprec.c.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
- H5F_t *f; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File as VOL object */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFvFv", file_id, low, high);
/* Check args */
- if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal set_libver_bounds function */
- if(H5F__set_libver_bounds(f, low, high) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
+ /* Set the library's version bounds */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
FUNC_LEAVE_API(ret_value)
@@ -1485,38 +1619,36 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fformat_convert
+ * Function: H5Fformat_convert (Internal)
*
- * Purpose: Downgrade the superblock version to v2 and
- * downgrade persistent file space to non-persistent
- * for 1.8 library.
+ * Purpose: Downgrade the superblock version to v2 and
+ * downgrade persistent file space to non-persistent
+ * for 1.8 library.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
-H5Fformat_convert(hid_t fid)
+H5Fformat_convert(hid_t file_id)
{
- H5F_t *f; /* File to flush */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* File */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", fid);
-
- if(H5I_FILE != H5I_get_type(fid))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ H5TRACE1("e", "i", file_id);
- /* Get file object */
- if(NULL == (f = (H5F_t *)H5I_object(fid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Check args */
+ 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")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(fid) < 0)
+ if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the internal routine */
- if(H5F__format_convert(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format")
+ /* Convert the format */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
FUNC_LEAVE_API(ret_value)
@@ -1528,28 +1660,26 @@ done:
*
* Purpose: Resets statistics for the page buffer layer.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Freset_page_buffering_stats(hid_t file_id)
{
- H5F_t *file; /* File to reset stats on */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File to reset stats on */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object(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")
- if(NULL == file->shared->page_buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file")
/* Reset the statistics */
- if(H5PB_reset_stats(file->shared->page_buf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering")
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
FUNC_LEAVE_API(ret_value)
@@ -1561,31 +1691,29 @@ done:
*
* Purpose: Retrieves statistics for the page buffer layer.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2],
unsigned misses[2], unsigned evictions[2], unsigned bypasses[2])
{
- H5F_t *file; /* File object for file ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File object */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions,
bypasses);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
- if(NULL == file->shared->page_buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file")
if(NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
/* Get the statistics */
- if(H5PB_get_stats(file->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0)
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
done:
@@ -1602,28 +1730,26 @@ done:
* image_len: --size of the on disk metadata cache image
* --zero if no cache image
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
{
- H5F_t *file; /* File object for file ID */
+ H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*a*h", file_id, image_addr, image_len);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- if(NULL == image_addr || NULL == image_len)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len")
+ 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")
/* Go get the address and size of the cache image */
- if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
FUNC_LEAVE_API(ret_value)
@@ -1637,38 +1763,29 @@ done:
* allocated memory in the file.
* (See H5FDget_eoa() in H5FD.c)
*
- * Return: Success: First byte after allocated memory.
- * Failure: HADDR_UNDEF
- *
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_eoa(hid_t file_id, haddr_t *eoa)
{
- H5F_t *file; /* File object for file ID */
- haddr_t rel_eoa; /* Relative address of EOA */
+ H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*a", file_id, eoa);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
- /* This public routine will work only for drivers with this feature enabled.*/
- /* We might introduce a new feature flag in the future */
- if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
-
- /* The real work */
- if(HADDR_UNDEF == (rel_eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed")
+ /* Only do work if valid pointer to fill in */
+ if(eoa) {
+ /* Retrieve the EOA for the file */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA")
+ } /* end if */
- /* (Note compensating for base address subtraction in internal routine) */
- if(eoa)
- *eoa = rel_eoa + H5FD_get_base_addr(file->shared->lf);
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_eoa() */
@@ -1679,36 +1796,25 @@ done:
*
* Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment
*
- * Return: Non-negative on success/Negative on errors
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5Fincrement_filesize(hid_t file_id, hsize_t increment)
{
- H5F_t *file; /* File object for file ID */
- haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", file_id, increment);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ 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")
- /* This public routine will work only for drivers with this feature enabled.*/
- /* We might introduce a new feature flag in the future */
- if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
-
- /* Get the maximum of EOA and EOF */
- if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
-
- /* Set EOA to the maximum value + increment */
- /* H5FD_set_eoa() will add base_addr to max_eof_eoa */
- if(H5FD_set_eoa(file->shared->lf, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
+ /* Increment the file size */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size")
done:
FUNC_LEAVE_API(ret_value)
@@ -1740,24 +1846,30 @@ herr_t
H5Fget_dset_no_attrs_hint(hid_t file_id,
hbool_t *minimize)
{
- H5F_t *f = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*b", file_id, minimize);
if (NULL == minimize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "out pointer 'minimize' cannot be NULL")
-
- f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
- if (NULL == f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "can't get file from id")
+ "out pointer 'minimize' cannot be NULL")
- HDassert(f->shared);
+ vol_obj = (H5VL_object_t *)H5I_object(file_id);
+ if (NULL == vol_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- *minimize = f->shared->crt_dset_min_ohdr_flag;
+ if (0 > H5VL_file_get(
+ vol_obj,
+ H5VL_FILE_GET_MIN_DSET_OHDR_FLAG,
+ H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL,
+ minimize))
+ {
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL,
+ "unable to get file's dataset header minimization flag")
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -1788,20 +1900,26 @@ herr_t
H5Fset_dset_no_attrs_hint(hid_t file_id,
hbool_t minimize)
{
- H5F_t *f = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, minimize);
- f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
- if (NULL == f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "can't get file from id")
-
- HDassert(f->shared);
+ vol_obj = (H5VL_object_t *)H5I_object(file_id);
+ if (NULL == vol_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- f->shared->crt_dset_min_ohdr_flag = minimize;
+ if (0 > H5VL_file_optional(
+ vol_obj,
+ H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL,
+ H5VL_FILE_SET_MIN_DSET_OHDR_FLAG,
+ minimize))
+ {
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL,
+ "unable to set file's dataset header minimization flag")
+ }
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5FApkg.h b/src/H5FApkg.h
index 720c046..8f76fc9 100644
--- a/src/H5FApkg.h
+++ b/src/H5FApkg.h
@@ -275,8 +275,7 @@ H5_DLL herr_t H5FA__hdr_decr(H5FA_hdr_t *hdr);
H5_DLL herr_t H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr);
H5_DLL size_t H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr);
H5_DLL herr_t H5FA__hdr_modified(H5FA_hdr_t *hdr);
-H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata,
- unsigned flags);
+H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags);
H5_DLL herr_t H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags);
H5_DLL herr_t H5FA__hdr_delete(H5FA_hdr_t *hdr);
H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr);
@@ -285,8 +284,7 @@ H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr);
H5_DLL H5FA_dblock_t *H5FA__dblock_alloc(H5FA_hdr_t *hdr);
H5_DLL haddr_t H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty);
H5_DLL unsigned H5FA__dblock_sblk_idx(const H5FA_hdr_t *hdr, hsize_t idx);
-H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr,
- unsigned flags);
+H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags);
H5_DLL herr_t H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags);
H5_DLL herr_t H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr);
H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock);
@@ -294,21 +292,18 @@ H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock);
/* Data block page routines */
H5_DLL herr_t H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts);
H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts);
-H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr,
- size_t dblk_page_nelmts, unsigned flags);
+H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags);
H5_DLL herr_t H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags);
H5_DLL herr_t H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page);
/* Debugging routines for dumping file structures */
-H5_DLL 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);
-H5_DLL 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);
+H5_DLL 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);
+H5_DLL 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);
/* Testing routines */
#ifdef H5FA_TESTING
-H5_DLL herr_t H5FA_get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam);
-H5_DLL int H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2);
+H5_DLL herr_t H5FA__get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam);
+H5_DLL int H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2);
#endif /* H5FA_TESTING */
#endif /* _H5FApkg_H */
diff --git a/src/H5FAtest.c b/src/H5FAtest.c
index 4b03036..27cd8b7 100644
--- a/src/H5FAtest.c
+++ b/src/H5FAtest.c
@@ -70,12 +70,9 @@ typedef struct H5FA__test_ctx_t {
static void *H5FA__test_crt_context(void *udata);
static herr_t H5FA__test_dst_context(void *ctx);
static herr_t H5FA__test_fill(void *nat_blk, size_t nelmts);
-static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth,
- hsize_t idx, const void *elmt);
+static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts, void *ctx);
+static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts, void *ctx);
+static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt);
static void *H5FA__test_crt_dbg_context(H5F_t *f, haddr_t obj_addr);
@@ -361,7 +358,7 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */
/*-------------------------------------------------------------------------
- * Function: H5FA_get_cparam_test
+ * Function: H5FA__get_cparam_test
*
* Purpose: Retrieve the parameters used to create the fixed array
*
@@ -372,9 +369,9 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR,
+BEGIN_FUNC(PKG, NOERR,
herr_t, SUCCEED, -,
-H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam))
+H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam))
/* Check arguments. */
HDassert(fa);
@@ -384,11 +381,11 @@ H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam))
cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size;
cparam->nelmts = fa->hdr->cparam.nelmts;
-END_FUNC(PRIV) /* end H5FA_get_cparam_test() */
+END_FUNC(PKG) /* end H5FA__get_cparam_test() */
/*-------------------------------------------------------------------------
- * Function: H5FA_cmp_cparam_test
+ * Function: H5FA__cmp_cparam_test
*
* Purpose: Compare the parameters used to create the fixed array
*
@@ -399,9 +396,9 @@ END_FUNC(PRIV) /* end H5FA_get_cparam_test() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERRCATCH,
+BEGIN_FUNC(PKG, ERRCATCH,
int, 0, -,
-H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2))
+H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2))
/* Check arguments. */
HDassert(cparam1);
@@ -415,5 +412,5 @@ H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)
CATCH
-END_FUNC(PRIV) /* end H5FA_cmp_cparam_test() */
+END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */
diff --git a/src/H5FD.c b/src/H5FD.c
index d74ea31..5585f37 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -23,22 +23,22 @@
/* Module Setup */
/****************/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
#include "H5FDmodule.h" /* This source code file is part of the H5FD module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDpkg.h" /* File Drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDpkg.h" /* File Drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
@@ -58,8 +58,8 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5FD_free_cls(H5FD_class_t *cls);
-static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/);
+static herr_t H5FD__free_cls(H5FD_class_t *cls);
+static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags/*out*/);
/*********************/
/* Package Variables */
@@ -94,21 +94,20 @@ static unsigned long H5FD_file_serial_no_g;
/* File driver ID class */
static const H5I_class_t H5I_VFL_CLS[1] = {{
- H5I_VFL, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5FD_free_cls /* Callback routine for closing objects of this class */
+ H5I_VFL, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5FD__free_cls /* Callback routine for closing objects of this class */
}};
/*-------------------------------------------------------------------------
- * Function: H5FD__init_package
+ * Function: H5FD__init_package
*
- * Purpose: Initialize the virtual file layer.
+ * Purpose: Initialize the virtual file layer.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -131,16 +130,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_term_package
+ * Function: H5FD_term_package
+ *
+ * Purpose: Terminate this interface: free all memory and reset global
+ * variables to their initial values. Release all ID groups
+ * associated with this interface.
*
- * Purpose: Terminate this interface: free all memory and reset global
- * variables to their initial values. Release all ID groups
- * associated with this interface.
+ * Return: Success: Positive if anything was done that might
+ * have affected other interfaces; zero
+ * otherwise.
*
- * Return: Success: Positive if anything was done that might
- * have affected other interfaces; zero
- * otherwise.
- * Failure: Never fails.
+ * Failure: Never fails.
*
*-------------------------------------------------------------------------
*/
@@ -171,26 +171,24 @@ H5FD_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5FD_free_cls
+ * Function: H5FD__free_cls
*
- * Purpose: Frees a file driver class struct and returns an indication of
- * success. This function is used as the free callback for the
- * virtual file layer object identifiers (cf H5FD__init_package).
- *
- * Return: Success: Non-negative
+ * Purpose: Frees a file driver class struct and returns an indication of
+ * success. This function is used as the free callback for the
+ * virtual file layer object identifiers (cf H5FD__init_package).
*
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_free_cls(H5FD_class_t *cls)
+H5FD__free_cls(H5FD_class_t *cls)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- /* Sanity check */
+ /* Sanity checks */
HDassert(cls);
/* If the file driver has a terminate callback, call it to give the file
@@ -219,37 +217,37 @@ done:
* library is closed or the driver is
* unregistered.
*
- * Failure: A negative value.
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5FDregister(const H5FD_class_t *cls)
{
- hid_t ret_value;
- H5FD_mem_t type;
+ H5FD_mem_t type;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*x", cls);
/* Check arguments */
if(!cls)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null class pointer is disallowed")
if(!cls->open || !cls->close)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'open' and/or 'close' methods are not defined")
if(!cls->get_eoa || !cls->set_eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eoa' and/or 'set_eoa' methods are not defined")
if(!cls->get_eof)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined")
if(!cls->read || !cls->write)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined")
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'read' and/or 'write' method is not defined")
for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type))
if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping")
/* Create the new class ID */
if((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID")
done:
FUNC_LEAVE_API(ret_value)
@@ -268,7 +266,7 @@ done:
* library is closed or the driver is
* unregistered.
*
- * Failure: A negative value.
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -276,34 +274,35 @@ hid_t
H5FD_register(const void *_cls, size_t size, hbool_t app_ref)
{
const H5FD_class_t *cls = (const H5FD_class_t *)_cls;
- H5FD_class_t *saved = NULL;
- H5FD_mem_t type;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5FD_class_t *saved = NULL;
+ H5FD_mem_t type;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
- /* Check arguments */
+ /* Sanity checks */
HDassert(cls);
HDassert(cls->open && cls->close);
HDassert(cls->get_eoa && cls->set_eoa);
HDassert(cls->get_eof);
HDassert(cls->read && cls->write);
- for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES);
+ }
/* Copy the class structure so the caller can reuse or free it */
if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for file driver class struct")
HDmemcpy(saved, cls, size);
/* Create the new class ID */
if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(saved)
- H5MM_xfree(saved);
+ saved = (H5FD_class_t *)H5MM_xfree(saved);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_register() */
@@ -317,9 +316,7 @@ done:
* this driver or files which are already opened under this
* driver.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -333,11 +330,11 @@ H5FDunregister(hid_t driver_id)
/* Check arguments */
if(NULL == H5I_object_verify(driver_id, H5I_VFL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver")
/* The H5FD_class_t struct will be freed by this function */
if(H5I_dec_app_ref(driver_id) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver")
done:
FUNC_LEAVE_API(ret_value)
@@ -345,19 +342,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_get_class
+ * Function: H5FD_get_class
*
- * Purpose: Obtains a pointer to the driver struct containing all the
- * callback pointers, etc. The PLIST_ID argument can be a file
- * access property list, a data transfer property list, or a
- * file driver identifier.
+ * Purpose: Obtains a pointer to the driver struct containing all the
+ * callback pointers, etc. The PLIST_ID argument can be a file
+ * access property list, a data transfer property list, or a
+ * file driver identifier.
*
- * Return: Success: Ptr to the driver information. The pointer is
- * only valid as long as the driver remains
- * registered or some file or property list
- * exists which references the driver.
+ * Return: Success: Ptr to the driver information. The pointer is
+ * only valid as long as the driver remains
+ * registered or some file or property list
+ * exists which references the driver.
*
- * Failure: NULL
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
@@ -369,7 +366,7 @@ H5FD_get_class(hid_t id)
FUNC_ENTER_NOAPI(NULL)
if(H5I_VFL == H5I_get_type(id))
- ret_value = (H5FD_class_t *)H5I_object(id);
+ ret_value = (H5FD_class_t *)H5I_object(id);
else {
H5P_genplist_t *plist; /* Property list pointer */
@@ -394,29 +391,32 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_sb_size
+ * Function: H5FD_sb_size
*
- * Purpose: Obtains the number of bytes required to store the driver file
- * access data in the HDF5 superblock.
+ * Purpose: Obtains the number of bytes required to store the driver file
+ * access data in the HDF5 superblock.
*
- * Return: Success: Number of bytes required.
+ * Return: Success: Number of bytes required. May be zero if the
+ * driver has no data to store in the superblock.
*
- * Failure: 0 if an error occurs or if the driver has no
- * data to store in the superblock.
+ * Failure: This function cannot indicate errors.
*
*-------------------------------------------------------------------------
*/
hsize_t
H5FD_sb_size(H5FD_t *file)
{
- hsize_t ret_value=0;
+ hsize_t ret_value = 0;
FUNC_ENTER_NOAPI(0)
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
+ /* Dispatch to driver */
if(file->cls->sb_size)
- ret_value = (file->cls->sb_size)(file);
+ ret_value = (file->cls->sb_size)(file);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -424,31 +424,33 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_sb_encode
+ * Function: H5FD_sb_encode
*
- * Purpose: Encode driver-specific data into the output arguments. The
- * NAME is a nine-byte buffer which should get an
- * eight-character driver name and/or version followed by a null
- * terminator. The BUF argument is a buffer to receive the
- * encoded driver-specific data. The size of the BUF array is
- * the size returned by the H5FD_sb_size() call.
+ * Purpose: Encode driver-specific data into the output arguments. The
+ * NAME is a nine-byte buffer which should get an
+ * eight-character driver name and/or version followed by a null
+ * terminator. The BUF argument is a buffer to receive the
+ * encoded driver-specific data. The size of the BUF array is
+ * the size returned by the H5FD_sb_size() call.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
+
+ /* Dispatch to driver */
if(file->cls->sb_encode && (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -456,12 +458,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD__sb_decode
+ * Function: H5FD__sb_decode
*
- * Purpose: Decodes the driver information block.
+ * Purpose: Decodes the driver information block.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -472,11 +473,13 @@ H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
FUNC_ENTER_STATIC
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
- /* Decode driver information */
+ /* Dispatch to driver */
if(file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -484,12 +487,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_sb_load
+ * Function: H5FD_sb_load
*
- * Purpose: Validate and decode the driver information block.
+ * Purpose: Validate and decode the driver information block.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -500,7 +502,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf)
FUNC_ENTER_NOAPI(FAIL)
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
/* 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.
@@ -520,37 +524,41 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_fapl_get
+ * Function: H5FD_fapl_get
+ *
+ * Purpose: Gets the file access property list associated with a file.
+ * Usually the file will copy what it needs from the original
+ * file access property list when the file is created. The
+ * purpose of this function is to create a new file access
+ * property list based on the settings in the file, which may
+ * have been modified from the original file access property
+ * list.
*
- * Purpose: Gets the file access property list associated with a file.
- * Usually the file will copy what it needs from the original
- * file access property list when the file is created. The
- * purpose of this function is to create a new file access
- * property list based on the settings in the file, which may
- * have been modified from the original file access property
- * list.
+ * Return: Success: Pointer to a new file access property list
+ * with all members copied. If the file is
+ * closed then this property list lives on, and
+ * vice versa.
*
- * Return: Success: Pointer to a new file access property list
- * with all members copied. If the file is
- * closed then this property list lives on, and
- * vice versa.
+ * This can be NULL if the file has no properties.
*
- * Failure: NULL, including when the file has no
- * properties.
+ * Failure: This function cannot indicate errors.
*
*-------------------------------------------------------------------------
*/
void *
H5FD_fapl_get(H5FD_t *file)
{
- void *ret_value=NULL;
+ void *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
+ /* Sanity checks */
HDassert(file);
+ HDassert(file->cls);
+ /* Dispatch to driver */
if(file->cls->fapl_get)
- ret_value = (file->cls->fapl_get)(file);
+ ret_value = (file->cls->fapl_get)(file);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -558,12 +566,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_fapl_close
+ * Function: H5FD_fapl_close
*
- * Purpose: Closes a driver for a dataset transfer property list
+ * Purpose: Closes a driver for a dataset transfer property list
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -574,7 +581,6 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info)
FUNC_ENTER_NOAPI(FAIL)
- /* Check args */
if(driver_id > 0) {
H5FD_class_t *driver;
@@ -589,7 +595,7 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed")
} /* end if */
else
- H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */
+ driver_info = H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */
} /* end if */
} /* end if */
@@ -599,59 +605,59 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDopen
+ * Function: H5FDopen
*
- * Purpose: Opens a file named NAME for the type(s) of access described
- * by the bit vector FLAGS according to a file access property
- * list FAPL_ID (which may be the constant H5P_DEFAULT). The
- * file should expect to handle format addresses in the range [0,
- * MAXADDR] (if MAXADDR is the undefined address then the caller
- * doesn't care about the address range).
+ * Purpose: Opens a file named NAME for the type(s) of access described
+ * by the bit vector FLAGS according to a file access property
+ * list FAPL_ID (which may be the constant H5P_DEFAULT). The
+ * file should expect to handle format addresses in the range [0,
+ * MAXADDR] (if MAXADDR is the undefined address then the caller
+ * doesn't care about the address range).
*
- * Possible values for the FLAGS bits are:
+ * Possible values for the FLAGS bits are:
*
- * H5F_ACC_RDWR: Open the file for read and write access. If
- * this bit is not set then open the file for
- * read only access. It is permissible to open a
- * file for read and write access when only read
- * access is requested by the library (the
- * library will never attempt to write to a file
- * which it opened with only read access).
+ * H5F_ACC_RDWR: Open the file for read and write access. If
+ * this bit is not set then open the file for
+ * read only access. It is permissible to open a
+ * file for read and write access when only read
+ * access is requested by the library (the
+ * library will never attempt to write to a file
+ * which it opened with only read access).
*
- * H5F_ACC_CREATE: Create the file if it doesn't already exist.
- * However, see H5F_ACC_EXCL below.
+ * H5F_ACC_CREATE: Create the file if it doesn't already exist.
+ * However, see H5F_ACC_EXCL below.
*
- * H5F_ACC_TRUNC: Truncate the file if it already exists. This
- * is equivalent to deleting the file and then
- * creating a new empty file.
+ * H5F_ACC_TRUNC: Truncate the file if it already exists. This
+ * is equivalent to deleting the file and then
+ * creating a new empty file.
*
- * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file
- * already exists then the open should fail.
- * Note that this is unsupported/broken with
- * some file drivers (e.g., sec2 across nfs) and
- * will contain a race condition when used to
- * perform file locking.
+ * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file
+ * already exists then the open should fail.
+ * Note that this is unsupported/broken with
+ * some file drivers (e.g., sec2 across nfs) and
+ * will contain a race condition when used to
+ * perform file locking.
*
- * The MAXADDR is the maximum address which will be requested by
- * the library during an allocation operation. Usually this is
- * the same value as the MAXADDR field of the class structure,
- * but it can be smaller if the driver is being used under some
- * other driver.
+ * The MAXADDR is the maximum address which will be requested by
+ * the library during an allocation operation. Usually this is
+ * the same value as the MAXADDR field of the class structure,
+ * but it can be smaller if the driver is being used under some
+ * other driver.
*
- * Note that when the driver `open' callback gets control that
- * the public part of the file struct (the H5FD_t part) will be
- * incomplete and will be filled in after that callback returns.
+ * Note that when the driver 'open' callback gets control that
+ * the public part of the file struct (the H5FD_t part) will be
+ * incomplete and will be filled in after that callback returns.
*
- * Return: Success: Pointer to a new file driver struct.
+ * Return: Success: Pointer to a new file driver struct.
*
- * Failure: NULL
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
H5FD_t *
H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
- H5FD_t *ret_value=NULL;
+ H5FD_t *ret_value = NULL;
FUNC_ENTER_API(NULL)
H5TRACE4("*x", "*sIuia", name, flags, fapl_id, maxaddr);
@@ -660,11 +666,12 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if(H5P_DEFAULT == fapl_id)
fapl_id = H5P_FILE_ACCESS_DEFAULT;
else
- if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS))
+ if(TRUE != H5P_isa_class(fapl_id,H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if(NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file")
+ /* Call private function */
+ if(NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file")
done:
FUNC_LEAVE_API(ret_value)
@@ -672,13 +679,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_open
+ * Function: H5FD_open
*
- * Purpose: Private version of H5FDopen()
+ * Purpose: Private version of H5FDopen()
*
- * Return: Success: Pointer to a new file driver struct
+ * Return: Success: Pointer to a new file driver struct
*
- * Failure: NULL
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
@@ -695,9 +702,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
FUNC_ENTER_NOAPI(NULL)
- /* Sanity check */
+ /* Sanity checks */
if(0 == maxaddr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range")
/* Get file access property list */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@@ -709,9 +716,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Get driver info */
if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id)))
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list")
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list")
if(NULL == driver->open)
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method")
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method")
/* Query driver flag */
if(H5FD_driver_query(driver, &driver_flags) < 0)
@@ -731,13 +738,12 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if(HADDR_UNDEF == maxaddr)
maxaddr = driver->maxaddr;
if(NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed")
/* Set the file access flags */
file->access_flags = flags;
- /*
- * Fill in public fields. We must increment the reference count on the
+ /* Fill in public fields. We must increment the reference count on the
* driver ID to prevent it from being freed while this file is open.
*/
file->driver_id = driver_prop.driver_id;
@@ -751,7 +757,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment")
/* Retrieve the VFL driver feature flags */
- if(H5FD_query(file, &(file->feature_flags)) < 0)
+ if(H5FD__query(file, &(file->feature_flags)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver")
/* Increment the global serial number & assign it to this H5FD_t object */
@@ -775,32 +781,35 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDclose
+ * Function: H5FDclose
*
- * Purpose: Closes the file by calling the driver `close' callback, which
- * should free all driver-private data and free the file struct.
- * Note that the public part of the file struct (the H5FD_t part)
- * will be all zero during the driver close callback like during
- * the `open' callback.
+ * Purpose: Closes the file by calling the driver 'close' callback, which
+ * should free all driver-private data and free the file struct.
+ * Note that the public part of the file struct (the H5FD_t part)
+ * will be all zero during the driver close callback like during
+ * the 'open' callback.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5FDclose(H5FD_t *file)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "*x", file);
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
+ /* Call private function */
if(H5FD_close(file) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
done:
FUNC_LEAVE_API(ret_value)
@@ -808,12 +817,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_close
+ * Function: H5FD_close
*
- * Purpose: Private version of H5FDclose()
+ * Purpose: Private version of H5FDclose()
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -825,16 +833,16 @@ H5FD_close(H5FD_t *file)
FUNC_ENTER_NOAPI(FAIL)
- /* check args */
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
/* Prepare to close file by clearing all public fields */
driver = file->cls;
if(H5I_dec_ref(file->driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
- /*
- * Dispatch to the driver for actual close. If the driver fails to
+ /* Dispatch to the driver for actual close. If the driver fails to
* close the file then the file will be in an unusable state.
*/
HDassert(driver->close);
@@ -847,47 +855,48 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDcmp
+ * Function: H5FDcmp
*
- * Purpose: Compare the keys of two files using the file driver callback
- * if the files belong to the same driver, otherwise sort the
- * files by driver class pointer value.
+ * Purpose: Compare the keys of two files using the file driver callback
+ * if the files belong to the same driver, otherwise sort the
+ * files by driver class pointer value.
*
- * Return: Success: A value like strcmp()
+ * Return: Success: A value like strcmp()
*
- * Failure: Must never fail. If both file handles are
- * invalid then they compare equal. If one file
- * handle is invalid then it compares less than
- * the other. If both files belong to the same
- * driver and the driver doesn't provide a
- * comparison callback then the file pointers
- * themselves are compared.
+ * Failure: Must never fail. If both file handles are
+ * invalid then they compare equal. If one file
+ * handle is invalid then it compares less than
+ * the other. If both files belong to the same
+ * driver and the driver doesn't provide a
+ * comparison callback then the file pointers
+ * themselves are compared.
*
*-------------------------------------------------------------------------
*/
int
H5FDcmp(const H5FD_t *f1, const H5FD_t *f2)
{
- int ret_value;
+ int ret_value = -1;
- FUNC_ENTER_API(-1) /*return value is arbitrary*/
+ FUNC_ENTER_API(-1) /* return value is arbitrary */
H5TRACE2("Is", "*x*x", f1, f2);
+ /* Call private function */
ret_value = H5FD_cmp(f1, f2);
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5FDcmp() */
/*-------------------------------------------------------------------------
- * Function: H5FD_cmp
+ * Function: H5FD_cmp
*
- * Purpose: Private version of H5FDcmp()
+ * Purpose: Private version of H5FDcmp()
*
- * Return: Success: A value like strcmp()
+ * Return: Success: A value like strcmp()
*
- * Failure: Must never fail.
+ * Failure: Must never fail.
*
*-------------------------------------------------------------------------
*/
@@ -896,7 +905,7 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
{
int ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI(-1) /*return value is arbitrary*/
+ FUNC_ENTER_NOAPI(-1) /* return value is arbitrary */
if((!f1 || !f1->cls) && (!f2 || !f2->cls))
HGOTO_DONE(0)
@@ -911,43 +920,50 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
/* Files are same driver; no cmp callback */
if(!f1->cls->cmp) {
- if(f1<f2)
+ if(f1 < f2)
HGOTO_DONE(-1)
- if(f1>f2)
+ if(f1 > f2)
HGOTO_DONE(1)
- HGOTO_DONE(0)
+ HGOTO_DONE(0)
}
+ /* Dispatch to driver */
ret_value = (f1->cls->cmp)(f1, f2);
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_cmp() */
/*-------------------------------------------------------------------------
- * Function: H5FDquery
- *
- * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h)
+ * Function: H5FDquery
*
- * Return: Success: non-negative
+ * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h)
*
- * Failure: negative
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
int
-H5FDquery(const H5FD_t *f, unsigned long *flags/*out*/)
+H5FDquery(const H5FD_t *file, unsigned long *flags/*out*/)
{
- int ret_value;
+ int ret_value = 0;
- FUNC_ENTER_API(FAIL)
- H5TRACE2("Is", "*xx", f, flags);
+ FUNC_ENTER_API((-1))
+ H5TRACE2("Is", "*xx", file, flags);
- HDassert(f);
- HDassert(flags);
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file class pointer cannot be NULL")
+ if(!flags)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "flags parameter cannot be NULL")
- ret_value = H5FD_query(f, flags);
+ /* Call private function */
+ if(H5FD__query(file, flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "unable to query feature flags")
done:
FUNC_LEAVE_API(ret_value)
@@ -955,69 +971,72 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_query
- *
- * Purpose: Private version of H5FDquery()
+ * Function: H5FD_query
*
- * Return: Success: non-negative
+ * Purpose: Private version of H5FDquery()
*
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static int
-H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
+static herr_t
+H5FD__query(const H5FD_t *file, unsigned long *flags/*out*/)
{
- int ret_value = 0; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
- HDassert(f);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
HDassert(flags);
- /* Check for query driver and call it */
- if(f->cls->query)
- ret_value = (f->cls->query)(f, flags);
+ /* Dispatch to driver (if available) */
+ if(file->cls->query) {
+ if((file->cls->query)(file, flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to query feature flags")
+ }
else
*flags=0;
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_query() */
/*-------------------------------------------------------------------------
- * Function: H5FDalloc
+ * Function: H5FDalloc
*
- * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will
- * be used according to the allocation class TYPE. First we try
- * to satisfy the request from one of the free lists, according
- * to the free list map provided by the driver. The free list
- * array has one entry for each request type and the value of
- * that array element can be one of four possibilities:
+ * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will
+ * be used according to the allocation class TYPE. First we try
+ * to satisfy the request from one of the free lists, according
+ * to the free list map provided by the driver. The free list
+ * array has one entry for each request type and the value of
+ * that array element can be one of four possibilities:
*
- * It can be the constant H5FD_MEM_DEFAULT (or zero) which
- * indicates that the identity mapping is used. In other
- * words, the request type maps to its own free list.
+ * It can be the constant H5FD_MEM_DEFAULT (or zero) which
+ * indicates that the identity mapping is used. In other
+ * words, the request type maps to its own free list.
*
- * It can be the request type itself, which has the same
- * effect as the H5FD_MEM_DEFAULT value above.
+ * It can be the request type itself, which has the same
+ * effect as the H5FD_MEM_DEFAULT value above.
*
- * It can be the ID for another request type, which
- * indicates that the free list for the specified type
- * should be used instead.
+ * It can be the ID for another request type, which
+ * indicates that the free list for the specified type
+ * should be used instead.
*
- * It can be the constant H5FD_MEM_NOLIST which means that
- * no free list should be used for this type of request.
+ * It can be the constant H5FD_MEM_NOLIST which means that
+ * no free list should be used for this type of request.
*
- * If the request cannot be satisfied from a free list then
- * either the driver's `alloc' callback is invoked (if one was
- * supplied) or the end-of-address marker is extended. The
- * `alloc' callback is always called with the same arguments as
- * the H5FDalloc().
+ * If the request cannot be satisfied from a free list then
+ * either the driver's 'alloc' callback is invoked (if one was
+ * supplied) or the end-of-address marker is extended. The
+ * 'alloc' callback is always called with the same arguments as
+ * the H5FDalloc().
*
- * Return: Success: The format address of the new file memory.
+ * Return: Success: The format address of the new file memory.
*
- * Failure: The undefined address HADDR_UNDEF
+ * Failure: The undefined address HADDR_UNDEF
*
*-------------------------------------------------------------------------
*/
@@ -1029,13 +1048,15 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
FUNC_ENTER_API(HADDR_UNDEF)
H5TRACE4("a", "*xMtih", file, type, dxpl_id, size);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL")
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type")
if(size == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
if(H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
@@ -1045,9 +1066,9 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Do the real work */
+ /* Call private function */
if(HADDR_UNDEF == (ret_value = H5FD__alloc_real(file, type, size, NULL, NULL)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory")
/* (Note compensating for base address subtraction in internal routine) */
ret_value += file->base_addr;
@@ -1058,32 +1079,32 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDfree
+ * Function: H5FDfree
*
- * Purpose: Frees format addresses starting with ADDR and continuing for
- * SIZE bytes in the file FILE. The type of space being freed is
- * specified by TYPE, which is mapped to a free list as
- * described for the H5FDalloc() function above. If the request
- * doesn't map to a free list then either the application `free'
- * callback is invoked (if defined) or the memory is leaked.
- *
- * Return: Success: Non-negative
+ * Purpose: Frees format addresses starting with ADDR and continuing for
+ * SIZE bytes in the file FILE. The type of space being freed is
+ * specified by TYPE, which is mapped to a free list as
+ * described for the H5FDalloc() function above. If the request
+ * doesn't map to a free list then either the application 'free'
+ * callback is invoked (if defined) or the memory is leaked.
*
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*xMtiah", file, type, dxpl_id, addr, size);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type")
if(H5P_DEFAULT == dxpl_id)
@@ -1095,9 +1116,9 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Do the real work */
+ /* Call private function */
/* (Note compensating for base address addition in internal routine) */
- if(H5FD_free_real(file, type, addr - file->base_addr, size) < 0)
+ if(H5FD__free_real(file, type, addr - file->base_addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed")
done:
@@ -1124,13 +1145,15 @@ H5FDget_eoa(H5FD_t *file, H5FD_mem_t type)
FUNC_ENTER_API(HADDR_UNDEF)
H5TRACE2("a", "*xMt", file, type);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL")
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type")
- /* The real work */
+ /* Call private function */
if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(file, type)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed")
@@ -1171,15 +1194,17 @@ H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr)
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "*xMta", file, type, addr);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type")
if(!H5F_addr_defined(addr) || addr > file->maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value")
- /* The real work */
+ /* Call private function */
/* (Note compensating for base address addition in internal routine) */
if(H5FD_set_eoa(file, type, addr - file->base_addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed")
@@ -1190,23 +1215,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDget_eof
+ * Function: H5FDget_eof
*
- * Purpose: Returns the end-of-file address, which is the greater of the
- * end-of-format address and the actual EOF marker. This
- * function is called after an existing file is opened in order
- * for the library to learn the true size of the underlying file
- * and to determine whether the hdf5 data has been truncated.
+ * Purpose: Returns the end-of-file address, which is the greater of the
+ * end-of-format address and the actual EOF marker. This
+ * function is called after an existing file is opened in order
+ * for the library to learn the true size of the underlying file
+ * and to determine whether the hdf5 data has been truncated.
*
- * It is also used when a file is first opened to learn whether
- * the file is empty or not.
+ * It is also used when a file is first opened to learn whether
+ * the file is empty or not.
*
- * It is permissible for the driver to return the maximum address
- * for the file size if the file is not empty.
+ * It is permissible for the driver to return the maximum address
+ * for the file size if the file is not empty.
*
- * Return: Success: The EOF address.
+ * Return: Success: The EOF address.
*
- * Failure: HADDR_UNDEF
+ * Failure: HADDR_UNDEF
*
*-------------------------------------------------------------------------
*/
@@ -1219,10 +1244,12 @@ H5FDget_eof(H5FD_t *file, H5FD_mem_t type)
H5TRACE2("a", "*xMt", file, type);
/* Check arguments */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL")
- /* The real work */
+ /* Call private function */
if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed")
@@ -1235,12 +1262,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_get_maxaddr
+ * Function: H5FD_get_maxaddr
*
- * Purpose: Private version of H5FDget_eof()
+ * Purpose: Private version of H5FDget_eof()
*
- * Return: Success: The maximum address allowed in the file.
- * Failure: HADDR_UNDEF
+ * Return: Success: The maximum address allowed in the file.
+ * Failure: HADDR_UNDEF
*
*-------------------------------------------------------------------------
*/
@@ -1251,6 +1278,7 @@ H5FD_get_maxaddr(const H5FD_t *file)
FUNC_ENTER_NOAPI(HADDR_UNDEF)
+ /* Sanity checks */
HDassert(file);
/* Set return value */
@@ -1262,12 +1290,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_get_feature_flags
+ * Function: H5FD_get_feature_flags
*
- * Purpose: Retrieve the feature flags for the VFD
+ * Purpose: Retrieve the feature flags for the VFD
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1276,6 +1303,7 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
HDassert(file);
HDassert(feature_flags);
@@ -1287,12 +1315,11 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags)
/*-------------------------------------------------------------------------
- * Function: H5FD_set_feature_flags
+ * Function: H5FD_set_feature_flags
*
- * Purpose: Set the feature flags for the VFD
+ * Purpose: Set the feature flags for the VFD
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1301,6 +1328,7 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
HDassert(file);
/* Set the file's feature flags */
@@ -1311,12 +1339,11 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags)
/*-------------------------------------------------------------------------
- * Function: H5FD_get_fs_type_map
+ * Function: H5FD_get_fs_type_map
*
- * Purpose: Retrieve the free space type mapping for the VFD
+ * Purpose: Retrieve the free space type mapping for the VFD
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1327,8 +1354,9 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map)
FUNC_ENTER_NOAPI(FAIL)
- /* Sanity check */
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
HDassert(type_map);
/* Check for VFD class providing a type map retrieval rouine */
@@ -1347,18 +1375,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDread
+ * Function: H5FDread
*
- * Purpose: Reads SIZE bytes from FILE beginning at address ADDR
- * according to the data transfer property list DXPL_ID (which may
- * be the constant H5P_DEFAULT). The result is written into the
- * buffer BUF.
+ * Purpose: Reads SIZE bytes from FILE beginning at address ADDR
+ * according to the data transfer property list DXPL_ID (which may
+ * be the constant H5P_DEFAULT). The result is written into the
+ * buffer BUF.
*
- * Return: Success: Non-negative. The read result is written into
- * the BUF buffer which should be allocated by
- * the caller.
+ * Return: Success: SUCCEED
+ * The read result is written into the BUF buffer
+ * which should be allocated by the caller.
*
- * Failure: Negative. The contents of BUF is undefined.
+ * Failure: FAIL
+ * The contents of BUF are undefined.
*
*-------------------------------------------------------------------------
*/
@@ -1366,14 +1395,18 @@ herr_t
H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
void *buf/*out*/)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "*xMtiazx", file, type, dxpl_id, addr, size, buf);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
+ if(!buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL")
/* Get the default dataset transfer property list if the user didn't provide one */
if(H5P_DEFAULT == dxpl_id)
@@ -1381,16 +1414,14 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
else
if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
- if(!buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Do the real work */
+ /* Call private function */
/* (Note compensating for base address addition in internal routine) */
if(H5FD_read(file, type, addr - file->base_addr, size, buf) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1398,16 +1429,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDwrite
+ * Function: H5FDwrite
*
- * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according
- * to the data transfer property list DXPL_ID (which may be the
- * constant H5P_DEFAULT). The bytes to be written come from the
- * buffer BUF.
- *
- * Return: Success: Non-negative
+ * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according
+ * to the data transfer property list DXPL_ID (which may be the
+ * constant H5P_DEFAULT). The bytes to be written come from the
+ * buffer BUF.
*
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1415,30 +1444,33 @@ herr_t
H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
const void *buf)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "*xMtiaz*x", file, type, dxpl_id, addr, size, buf);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
+ if(!buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL")
+
/* 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, "not a data transfer property list")
- if(!buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* The real work */
+ /* Call private function */
/* (Note compensating for base address addition in internal routine) */
if(H5FD_write(file, type, addr - file->base_addr, size, buf) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1446,17 +1478,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDflush
- *
- * Purpose: Notify driver to flush all cached data. If the driver has no
- * flush method then nothing happens.
- *
- * Return: Success: Non-negative
+ * Function: H5FDflush
*
- * Failure: Negative
+ * Purpose: Notify driver to flush all cached data. If the driver has no
+ * flush method then nothing happens.
*
- * Programmer: Robb Matzke
- * Thursday, July 29, 1999
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1468,9 +1495,12 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing)
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "*xib", file, dxpl_id, closing);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
+
if(H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
@@ -1480,9 +1510,9 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing)
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Do the real work */
+ /* Call private function */
if(H5FD_flush(file, closing) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1490,12 +1520,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_flush
+ * Function: H5FD_flush
*
- * Purpose: Private version of H5FDflush()
+ * Purpose: Private version of H5FDflush()
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1507,8 +1536,10 @@ H5FD_flush(H5FD_t *file, hbool_t closing)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(file && file->cls);
+ HDassert(file);
+ HDassert(file->cls);
+ /* Dispatch to driver */
if(file->cls->flush && (file->cls->flush)(file, H5CX_get_dxpl(), closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed")
@@ -1518,12 +1549,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDtruncate
+ * Function: H5FDtruncate
*
- * Purpose: Notify driver to truncate the file back to the allocated size.
+ * Purpose: Notify driver to truncate the file back to the allocated size.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1535,9 +1565,11 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing)
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "*xib", file, dxpl_id, closing);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
if(H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
@@ -1547,9 +1579,9 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing)
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Do the real work */
+ /* Call private function */
if(H5FD_truncate(file, closing) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1559,22 +1591,22 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_truncate
*
- * Purpose: Private version of H5FDtruncate()
+ * Purpose: Private version of H5FDtruncate()
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5FD_truncate(H5FD_t *file, hbool_t closing)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(file && file->cls);
+ HDassert(file);
+ HDassert(file->cls);
/* Dispatch to driver */
if(file->cls->truncate && (file->cls->truncate)(file, H5CX_get_dxpl(), closing) < 0)
@@ -1586,12 +1618,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDlock
+ * Function: H5FDlock
*
- * Purpose: Set a file lock
+ * Purpose: Set a file lock
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1603,13 +1634,15 @@ H5FDlock(H5FD_t *file, hbool_t rw)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "*xb", file, rw);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
- /* The real work */
+ /* Call private function */
if(H5FD_lock(file, rw) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1618,12 +1651,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_lock
+ * Function: H5FD_lock
*
- * Purpose: Private version of H5FDlock()
+ * Purpose: Private version of H5FDlock()
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1634,8 +1666,11 @@ H5FD_lock(H5FD_t *file, hbool_t rw)
FUNC_ENTER_NOAPI(FAIL)
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
+ /* Dispatch to driver */
if(file->cls->lock && (file->cls->lock)(file, rw) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed")
@@ -1645,12 +1680,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FDunlock
+ * Function: H5FDunlock
*
- * Purpose: Remove a file lock
+ * Purpose: Remove a file lock
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1662,13 +1696,15 @@ H5FDunlock(H5FD_t *file)
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "*x", file);
- /* Check args */
- if(!file || !file->cls)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
+ /* Check arguments */
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
- /* The real work */
+ /* Call private function */
if(H5FD_unlock(file) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1676,12 +1712,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_unlock
+ * Function: H5FD_unlock
*
- * Purpose: Private version of H5FDunlock()
+ * Purpose: Private version of H5FDunlock()
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1692,8 +1727,11 @@ H5FD_unlock(H5FD_t *file)
FUNC_ENTER_NOAPI(FAIL)
- HDassert(file && file->cls);
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(file->cls);
+ /* Dispatch to driver */
if(file->cls->unlock && (file->cls->unlock)(file) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed")
@@ -1703,13 +1741,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_get_fileno
+ * Function: H5FD_get_fileno
*
- * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value
- * (Mainly added to stop non-file routines from poking about in the
- * H5FD_t data structure)
+ * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5FD_t data structure)
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1718,6 +1756,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
HDassert(file);
HDassert(filenum);
@@ -1734,28 +1773,36 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
* Purpose: Returns a pointer to the file handle of low-level virtual
* file driver.
*
- * Return: Non-negative if succeed; negative otherwise.
- *
- * Programmer: Raymond Lu
- * Sep. 16, 2002
+ * Return: SUCCEED/FAIL
*
*--------------------------------------------------------------------------
*/
herr_t
-H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle)
+H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle)
{
- herr_t ret_value;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "*xi**x", file, fapl, file_handle);
+ H5TRACE3("e", "*xi**x", file, fapl_id, file_handle);
/* Check arguments */
- HDassert(file);
- HDassert(file_handle);
-
- ret_value = H5FD_get_vfd_handle(file, fapl, file_handle);
+ if(!file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL")
+ if(!file->cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL")
+ if(FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fapl_id parameter is not a file access property list")
+ if(!file_handle)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle parameter cannot be NULL")
+
+ /* Call private function */
+ if(H5FD_get_vfd_handle(file, fapl_id, file_handle) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver")
done:
+ if(FAIL == ret_value)
+ *file_handle = NULL;
+
FUNC_LEAVE_API(ret_value)
} /* end H5FDget_vfd_handle() */
@@ -1763,29 +1810,28 @@ done:
/*--------------------------------------------------------------------------
* Function: H5FD_get_vfd_handle
*
- * Purpose: Retrieve the file handle for file driver.
+ * Purpose: Private version of H5FDget_vfd_handle()
*
- * Return: Non-negative if succeed; negative if fails.
- *
- * Programmer: Raymond Lu
- * Sep. 16, 2002
+ * Return: SUCCEED/FAIL
*
*--------------------------------------------------------------------------
*/
herr_t
-H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle)
+H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
- /* Sanity check */
+ /* Sanity checks */
HDassert(file);
+ HDassert(file->cls);
HDassert(file_handle);
+ /* Dispatch to driver */
if(NULL == file->cls->get_handle)
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method")
- if((file->cls->get_handle)(file, fapl, file_handle) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method")
+ if((file->cls->get_handle)(file, fapl_id, file_handle) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver")
done:
@@ -1798,7 +1844,7 @@ done:
*
* Purpose: Set the base address for the file
*
- * Return: Non-negative if succeed; negative if fails.
+ * Return: SUCCEED (Can't fail)
*
*--------------------------------------------------------------------------
*/
@@ -1807,6 +1853,7 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
HDassert(file);
HDassert(H5F_addr_defined(base_addr));
@@ -1822,8 +1869,8 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr)
*
* Purpose: Get the base address for the file
*
- * Return: Success: The absolute base address of the file
- * Failure: The undefined address (HADDR_UNDEF)
+ * Return: Success: The absolute base address of the file
+ * (Can't fail)
*
*--------------------------------------------------------------------------
*/
@@ -1832,6 +1879,7 @@ H5FD_get_base_addr(const H5FD_t *file)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
HDassert(file);
/* Return the file's base address */
@@ -1844,7 +1892,7 @@ H5FD_get_base_addr(const H5FD_t *file)
*
* Purpose: Set "paged_aggr" for the file.
*
- * Return: Non-negative if succeed; negative if fails.
+ * Return: SUCCEED (Can't fail)
*
*--------------------------------------------------------------------------
*/
@@ -1853,6 +1901,7 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
HDassert(file);
/* Indicate whether paged aggregation for handling file space is enabled or not */
@@ -1883,6 +1932,7 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", driver_id, flags);
+ /* Check arguments */
if(NULL == flags)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL")
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 023ff57..ea8c4d8 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5FDint.c
- * Jan 17 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5FDint.c
*
- * Purpose: Internal routine for VFD operations
+ * Purpose: Internal routine for VFD operations
*
*-------------------------------------------------------------------------
*/
@@ -32,12 +30,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDpkg.h" /* File Drivers */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDpkg.h" /* File Drivers */
+#include "H5Iprivate.h" /* IDs */
/****************/
@@ -83,26 +81,26 @@
* signature can appear at address 0, or any power of two
* beginning with 512.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr)
{
- haddr_t addr, eoa, eof;
+ haddr_t addr = HADDR_UNDEF;
+ haddr_t eoa = HADDR_UNDEF;
+ haddr_t eof = HADDR_UNDEF;
uint8_t buf[H5F_SIGNATURE_LEN];
- unsigned n, maxpow;
+ unsigned n;
+ unsigned maxpow;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(file);
+ HDassert(sig_addr);
/* Find the least N such that 2^N is larger than the file size */
eof = H5FD_get_eof(file, H5FD_MEM_SUPER);
@@ -114,8 +112,7 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr)
addr >>= 1;
maxpow = MAX(maxpow, 9);
- /*
- * Search for the file signature at format address zero followed by
+ /* Search for the file signature at format address zero followed by
* powers of two larger than 9.
*/
for(n = 8; n < maxpow; n++) {
@@ -126,17 +123,16 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature")
if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
break;
- } /* end for */
+ }
- /*
- * If the signature was not found then reset the EOA value and return
+ /* If the signature was not found then reset the EOA value and return
* HADDR_UNDEF.
*/
if(n >= maxpow) {
if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value")
*sig_addr = HADDR_UNDEF;
- } /* end if */
+ }
else
/* Set return value */
*sig_addr = addr;
@@ -147,44 +143,41 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_read
- *
- * Purpose: Private version of H5FDread()
+ * Function: H5FD_read
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Purpose: Private version of H5FDread()
*
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size,
- void *buf/*out*/)
+H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/)
{
- hid_t dxpl_id; /* DXPL for operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(file && file->cls);
+ HDassert(file);
+ HDassert(file->cls);
HDassert(buf);
/* Get proper DXPL for I/O */
dxpl_id = H5CX_get_dxpl();
#ifndef H5_HAVE_PARALLEL
- /* Do not return early for Parallel mode since the I/O could be a */
- /* collective transfer. */
- /* The no-op case */
+ /* The no-op case
+ *
+ * Do not return early for Parallel mode since the I/O could be a
+ * collective transfer.
+ */
if(0 == size)
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
- /*
- * If the file is open for SWMR read access, allow access to data past
+ /* If the file is open for SWMR read access, allow access to data past
* the end of the allocated space (the 'eoa'). This is done because the
* eoa stored in the file's superblock might be out of sync with the
* objects being written within the file by the application performing
@@ -198,7 +191,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size,
if((addr + file->base_addr + size) > eoa)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)(addr + file->base_addr), (unsigned long long)size, (unsigned long long)eoa)
- } /* end if */
+ }
/* Dispatch to driver */
if((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
@@ -210,45 +203,43 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_write
- *
- * Purpose: Private version of H5FDwrite()
+ * Function: H5FD_write
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Purpose: Private version of H5FDwrite()
*
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size,
- const void *buf)
+H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf)
{
- hid_t dxpl_id; /* DXPL for operation */
- haddr_t eoa = HADDR_UNDEF; /* EOA for file */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t dxpl_id; /* DXPL for operation */
+ haddr_t eoa = HADDR_UNDEF; /* EOA for file */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(file && file->cls);
+ HDassert(file);
+ HDassert(file->cls);
HDassert(buf);
/* Get proper DXPL for I/O */
dxpl_id = H5CX_get_dxpl();
#ifndef H5_HAVE_PARALLEL
- /* Do not return early for Parallel mode since the I/O could be a */
- /* collective transfer. */
- /* The no-op case */
+ /* The no-op case
+ *
+ * Do not return early for Parallel mode since the I/O could be a
+ * collective transfer.
+ */
if(0 == size)
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
if(HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
if((addr + file->base_addr + size) > eoa)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size=%llu, eoa=%llu",
(unsigned long long)(addr+ file->base_addr), (unsigned long long)size, (unsigned long long)eoa)
@@ -263,20 +254,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_set_eoa
+ * Function: H5FD_set_eoa
*
- * Purpose: Private version of H5FDset_eoa()
+ * Purpose: Private version of H5FDset_eoa()
*
* This function expects the EOA is a RELATIVE address, i.e.
* relative to the base address. This is NOT the same as the
* EOA stored in the superblock, which is an absolute
* address. Object addresses are relative.
*
- * Return: Success: Non-negative
- * Failure: Negative, no side effect
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -292,7 +279,7 @@ H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr)
/* Dispatch to driver, convert to absolute address */
if((file->cls->set_eoa)(file, type, addr + file->base_addr) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -300,20 +287,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_get_eoa
+ * Function: H5FD_get_eoa
*
- * Purpose: Private version of H5FDget_eoa()
+ * Purpose: Private version of H5FDget_eoa()
*
* This function returns the EOA as a RELATIVE address, i.e.
* relative to the base address. This is NOT the same as the
* EOA stored in the superblock, which is an absolute
* address. Object addresses are relative.
*
- * Return: Success: First byte after allocated memory.
- * Failure: HADDR_UNDEF
+ * Return: Success: First byte after allocated memory
*
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
+ * Failure: HADDR_UNDEF
*
*-------------------------------------------------------------------------
*/
@@ -328,7 +313,7 @@ H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type)
/* Dispatch to driver */
if(HADDR_UNDEF == (ret_value = (file->cls->get_eoa)(file, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
/* Adjust for base address in file (convert to relative address) */
ret_value -= file->base_addr;
@@ -339,23 +324,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_get_eof
+ * Function: H5FD_get_eof
*
- * Purpose: Private version of H5FDget_eof()
+ * Purpose: Private version of H5FDget_eof()
*
* This function returns the EOF as a RELATIVE address, i.e.
* relative to the base address. This will be different
* from the end of the physical file if there is a user
* block.
*
- * Return: Success: The EOF address.
+ * Return: Success: The EOF address.
*
- * Failure: HADDR_UNDEF
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
+ * Failure: HADDR_UNDEF
*
*-------------------------------------------------------------------------
*/
@@ -370,11 +350,11 @@ H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type)
/* Dispatch to driver */
if(file->cls->get_eof) {
- if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed")
- } /* end if */
+ if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed")
+ }
else
- ret_value = file->maxaddr;
+ ret_value = file->maxaddr;
/* Adjust for base address in file (convert to relative address) */
ret_value -= file->base_addr;
@@ -385,17 +365,14 @@ done:
/*-------------------------------------------------------------------------
-* Function: H5FD_driver_query
-*
-* Purpose: Similar to H5FD_query(), but intended for cases when we don't
-* have a file available (e.g. before one is opened). Since we
-* can't use the file to get the driver, the driver is passed in
-* as a parameter.
+* Function: H5FD_driver_query
*
-* Return: SUCCEED/FAIL
+* Purpose: Similar to H5FD_query(), but intended for cases when we don't
+* have a file available (e.g. before one is opened). Since we
+* can't use the file to get the driver, the driver is passed in
+* as a parameter.
*
-* Programmer: Jacob Gruber
-* Wednesday, August 17, 2011
+* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 7c2297a..3dcd7f5 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -117,7 +117,7 @@ typedef struct H5FD_log_t {
* Whether to eliminate the family driver info and convert this file to
* a single file
*/
- hbool_t fam_to_sec2;
+ hbool_t fam_to_single;
/* Fields for tracking I/O operations */
unsigned char *nread; /* Number of reads from a file location */
@@ -635,13 +635,13 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Check for non-default FAPL */
if(H5P_FILE_ACCESS_DEFAULT != fapl_id) {
/* This step is for h5repart tool only. If user wants to change file driver from
- * family to sec2 while using h5repart, this private property should be set so that
- * in the later step, the library can ignore the family driver information saved
- * in the superblock.
+ * family to one that uses single files (sec2, etc.) while using h5repart, this
+ * private property should be set so that in the later step, the library can ignore
+ * the family driver information saved in the superblock.
*/
- if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0)
- if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2")
+ 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 */
@@ -900,7 +900,7 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */)
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */
/* Check for flags that are set by h5repart */
- if(file && file->fam_to_sec2)
+ if(file && file->fam_to_single)
*flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */
} /* end if */
diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c
index 4b42a73..7d58b7a 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -153,7 +153,7 @@ done:
*
* Return: Success: SUCCEED
*
- * Failure: Negative
+ * Failure: FAIL
*
* Programmer: John Mainzer
* 4/4/17
diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h
index 6f47efb..22b5d17 100644
--- a/src/H5FDpkg.h
+++ b/src/H5FDpkg.h
@@ -30,7 +30,6 @@
#include "H5FDprivate.h" /* File drivers */
/* Other private headers needed by this file */
-#include "H5FLprivate.h" /* Free lists */
/**************************/
/* Package Private Macros */
@@ -50,14 +49,12 @@
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size,
- haddr_t *align_addr, hsize_t *align_size);
-H5_DLL herr_t H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr,
- hsize_t size);
+H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *align_addr, hsize_t *align_size);
+H5_DLL herr_t H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size);
/* Testing functions */
#ifdef H5FD_TESTING
-H5_DLL hbool_t H5FD_supports_swmr_test(const char *vfd_name);
+H5_DLL hbool_t H5FD__supports_swmr_test(const char *vfd_name);
#endif /* H5FD_TESTING */
#endif /* _H5FDpkg_H */
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 0430064..c79d676 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -130,7 +130,7 @@ H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
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 haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type,
+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);
@@ -143,10 +143,8 @@ H5_DLL haddr_t H5FD_get_maxaddr(const H5FD_t *file);
H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags);
H5_DLL herr_t H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags);
H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map);
-H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr,
- size_t size, void *buf/*out*/);
-H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr,
- size_t size, const void *buf);
+H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/);
+H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf);
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);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 32aff0f..06c008d 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -94,7 +94,7 @@ typedef struct H5FD_sec2_t {
* Whether to eliminate the family driver info and convert this file to
* a single file.
*/
- hbool_t fam_to_sec2;
+ hbool_t fam_to_single;
} H5FD_sec2_t;
@@ -386,13 +386,13 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list")
/* This step is for h5repart tool only. If user wants to change file driver from
- * family to sec2 while using h5repart, this private property should be set so that
- * in the later step, the library can ignore the family driver information saved
- * in the superblock.
+ * family to one that uses single files (sec2, etc.) while using h5repart, this
+ * private property should be set so that in the later step, the library can ignore
+ * the family driver information saved in the superblock.
*/
- if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0)
- if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2")
+ 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 */
@@ -532,7 +532,7 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */)
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */
/* Check for flags that are set by h5repart */
- if(file && file->fam_to_sec2)
+ if(file && file->fam_to_single)
*flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */
} /* end if */
diff --git a/src/H5FDspace.c b/src/H5FDspace.c
index e158a44..e1f0cb2 100644
--- a/src/H5FDspace.c
+++ b/src/H5FDspace.c
@@ -38,6 +38,7 @@
#include "H5Fprivate.h" /* File access */
#include "H5FDpkg.h" /* File Drivers */
#include "H5FDmulti.h" /* Usage-partitioned file family */
+#include "H5FLprivate.h" /* Free lists */
/****************/
@@ -273,7 +274,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_free_real
+ * Function: H5FD__free_real
*
* Purpose: Release space back to the VFD
*
@@ -286,11 +287,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
+H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(file);
@@ -348,13 +349,13 @@ HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUN
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_free_real() */
+} /* end H5FD__free_real() */
/*-------------------------------------------------------------------------
* Function: H5FD_free
*
- * Purpose: Wrapper for H5FD_free_real, to make certain EOA changes are
+ * Purpose: Wrapper for H5FD__free_real, to make certain EOA changes are
* reflected in superblock.
*
* Note: When the metadata cache routines are updated to allow
@@ -383,7 +384,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t addr, hsize_t size)
HDassert(size > 0);
/* Call the real 'free' routine */
- if(H5FD_free_real(file, type, addr, size) < 0)
+ if(H5FD__free_real(file, type, addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "real 'free' request failed")
/* Mark EOA info dirty in cache, so change will get encoded */
@@ -414,8 +415,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end,
- hsize_t extra_requested)
+H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, hsize_t extra_requested)
{
haddr_t eoa; /* End of allocated space in file */
htri_t ret_value = FALSE; /* Return value */
diff --git a/src/H5FDtest.c b/src/H5FDtest.c
index f528dfb..dec0818 100644
--- a/src/H5FDtest.c
+++ b/src/H5FDtest.c
@@ -71,7 +71,7 @@
/*-------------------------------------------------------------------------
- * Function: H5FD_supports_swmr_test()
+ * Function: H5FD__supports_swmr_test()
*
* Purpose: Determines if a VFD supports SWMR.
*
@@ -98,19 +98,18 @@
*-------------------------------------------------------------------------
*/
hbool_t
-H5FD_supports_swmr_test(const char *vfd_name)
+H5FD__supports_swmr_test(const char *vfd_name)
{
hbool_t ret_value = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(!vfd_name || !HDstrcmp(vfd_name, ""))
+ if(!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch"))
ret_value = TRUE;
else
- ret_value = !HDstrcmp(vfd_name, "log")
- || !HDstrcmp(vfd_name, "sec2");
+ ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2");
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_supports_swmr_test() */
+} /* end H5FD__supports_swmr_test() */
diff --git a/src/H5FS.c b/src/H5FS.c
index 113c8ae..8fee634 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -58,8 +58,8 @@
/********************/
/* Section info routines */
-static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data);
-static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data);
+static herr_t H5FS__sinfo_free_sect_cb(void *item, void *key, void *op_data);
+static herr_t H5FS__sinfo_free_node_cb(void *item, void *key, void *op_data);
/*********************/
@@ -221,7 +221,7 @@ HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc);
/* Increment the reference count on the free space manager header */
HDassert(fspace->rc <= 1);
- if(H5FS_incr(fspace) < 0)
+ if(H5FS__incr(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header")
fspace->alignment = alignment;
@@ -545,7 +545,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC);
} /* end if */
/* Destroy section info */
- if(H5FS_sinfo_dest(fspace->sinfo) < 0)
+ if(H5FS__sinfo_dest(fspace->sinfo) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space section info")
} /* end else */
@@ -560,7 +560,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC);
} /* end else */
/* Decrement the reference count on the free space manager header */
- if(H5FS_decr(fspace) < 0)
+ if(H5FS__decr(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header")
done:
@@ -683,7 +683,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size)
/*-------------------------------------------------------------------------
- * Function: H5FS_incr
+ * Function: H5FS__incr
*
* Purpose: Increment reference count on free space header
*
@@ -695,11 +695,11 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size)
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_incr(H5FS_t *fspace)
+H5FS__incr(H5FS_t *fspace)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc);
#endif /* H5FS_DEBUG */
@@ -719,11 +719,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FS_incr() */
+} /* end H5FS__incr() */
/*-------------------------------------------------------------------------
- * Function: H5FS_decr
+ * Function: H5FS__decr
*
* Purpose: Decrement reference count on free space header
*
@@ -735,11 +735,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_decr(H5FS_t *fspace)
+H5FS__decr(H5FS_t *fspace)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc);
#endif /* H5FS_DEBUG */
@@ -766,11 +766,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FS_decr() */
+} /* end H5FS__decr() */
/*-------------------------------------------------------------------------
- * Function: H5FS_dirty
+ * Function: H5FS__dirty
*
* Purpose: Mark free space header as dirty
*
@@ -782,11 +782,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_dirty(H5FS_t *fspace)
+H5FS__dirty(H5FS_t *fspace)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
#ifdef QAK
HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC);
#endif /* QAK */
@@ -802,7 +802,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FS_dirty() */
+} /* end H5FS__dirty() */
/*-------------------------------------------------------------------------
@@ -875,7 +875,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace)
fspace->alloc_sect_size = fspace->sect_size;
/* Mark free-space header as dirty */
- if(H5FS_dirty(fspace) < 0)
+ if(H5FS__dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
/* Cache the free-space section info */
@@ -959,7 +959,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space)
} /* end if */
/* Mark free-space manager header as dirty */
- if(H5FS_dirty(fspace) < 0)
+ if(H5FS__dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
} /* end if */
@@ -1052,7 +1052,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FS_sinfo_free_sect_cb
+ * Function: H5FS__sinfo_free_sect_cb
*
* Purpose: Free a size-tracking node for a bin
*
@@ -1064,12 +1064,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data)
+H5FS__sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data)
{
H5FS_section_info_t *sect = (H5FS_section_info_t *)_sect; /* Section to free */
const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)op_data; /* Free space manager for section */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(sect);
HDassert(sinfo);
@@ -1078,11 +1078,11 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data)
(*sinfo->fspace->sect_cls[sect->type].free)(sect);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5FS_sinfo_free_sect_cb() */
+} /* H5FS__sinfo_free_sect_cb() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sinfo_free_node_cb
+ * Function: H5FS__sinfo_free_node_cb
*
* Purpose: Free a size-tracking node for a bin
*
@@ -1094,27 +1094,27 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data)
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data)
+H5FS__sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data)
{
H5FS_node_t *fspace_node = (H5FS_node_t *)item; /* Temporary pointer to free space list node */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(fspace_node);
HDassert(op_data);
/* Release the skip list for sections of this size */
- H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data);
+ H5SL_destroy(fspace_node->sect_list, H5FS__sinfo_free_sect_cb, op_data);
/* Release free space list node */
fspace_node = H5FL_FREE(H5FS_node_t, fspace_node);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5FS_sinfo_free_node_cb() */
+} /* H5FS__sinfo_free_node_cb() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sinfo_dest
+ * Function: H5FS__sinfo_dest
*
* Purpose: Destroys a free space section info in memory.
*
@@ -1126,12 +1126,12 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data)
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_sinfo_dest(H5FS_sinfo_t *sinfo)
+H5FS__sinfo_dest(H5FS_sinfo_t *sinfo)
{
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/*
* Check arguments.
@@ -1143,7 +1143,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo)
/* Clear out lists of nodes */
for(u = 0; u < sinfo->nbins; u++)
if(sinfo->bins[u].bin_list) {
- H5SL_destroy(sinfo->bins[u].bin_list, H5FS_sinfo_free_node_cb, sinfo);
+ H5SL_destroy(sinfo->bins[u].bin_list, H5FS__sinfo_free_node_cb, sinfo);
sinfo->bins[u].bin_list = NULL;
} /* end if */
@@ -1160,7 +1160,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo)
* disappearing immediately)
*/
sinfo->fspace->sinfo = NULL;
- if(H5FS_decr(sinfo->fspace) < 0)
+ if(H5FS__decr(sinfo->fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header")
sinfo->fspace = NULL;
@@ -1169,7 +1169,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FS_sinfo_dest() */
+} /* end H5FS__sinfo_dest() */
herr_t
H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count)
diff --git a/src/H5FScache.c b/src/H5FScache.c
index fa04ba1..ac0874e 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -926,7 +926,7 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU
uint32_t computed_chksum; /* Computed metadata checksum value */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments */
HDassert(image);
@@ -981,7 +981,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata,
HDassert(dirty);
/* Allocate a new free space section info */
- if(NULL == (sinfo = H5FS_sinfo_new(udata->f, fspace)))
+ if(NULL == (sinfo = H5FS__sinfo_new(udata->f, fspace)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* initialize old_sect_size */
@@ -1087,7 +1087,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata,
done:
if(!ret_value && sinfo)
- if(H5FS_sinfo_dest(sinfo) < 0)
+ if(H5FS__sinfo_dest(sinfo) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1321,7 +1321,7 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing)
H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(sinfo);
@@ -1404,7 +1404,7 @@ H5FS__cache_sinfo_free_icr(void *_thing)
HDassert(fspace->cache_info.is_pinned);
/* Destroy free space info */
- if(H5FS_sinfo_dest(sinfo) < 0)
+ if(H5FS__sinfo_dest(sinfo) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info")
done:
@@ -1512,3 +1512,4 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS__sinfo_serialize_node_cb() */
+
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index a5896ee..2c56ab6 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -215,24 +215,22 @@ H5FL_EXTERN(H5FS_t);
/******************************/
/* Generic routines */
-H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry);
-H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry);
+H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
+H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
/* Free space manager header routines */
H5_DLL H5FS_t *H5FS__new(const H5F_t *f, uint16_t nclasses,
const H5FS_section_class_t *classes[], void *cls_init_udata);
-H5_DLL herr_t H5FS_incr(H5FS_t *fspace);
-H5_DLL herr_t H5FS_decr(H5FS_t *fspace);
-H5_DLL herr_t H5FS_dirty(H5FS_t *fspace);
+H5_DLL herr_t H5FS__incr(H5FS_t *fspace);
+H5_DLL herr_t H5FS__decr(H5FS_t *fspace);
+H5_DLL herr_t H5FS__dirty(H5FS_t *fspace);
/* Free space section routines */
-H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace);
+H5_DLL H5FS_sinfo_t *H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace);
/* Routines for destroying structures */
H5_DLL herr_t H5FS__hdr_dest(H5FS_t *hdr);
-H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo);
+H5_DLL herr_t H5FS__sinfo_dest(H5FS_sinfo_t *sinfo);
/* Sanity check routines */
#ifdef H5FS_DEBUG_ASSERT
@@ -242,8 +240,8 @@ H5_DLL void H5FS__sect_assert(const H5FS_t *fspace);
/* Testing routines */
#ifdef H5FS_TESTING
-H5_DLL herr_t H5FS_get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam);
-H5_DLL int H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2);
+H5_DLL herr_t H5FS__get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam);
+H5_DLL int H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2);
#endif /* H5FS_TESTING */
#endif /* _H5FSpkg_H */
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index de1b4c1..31fc63c 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -25,9 +25,6 @@
#ifndef _H5FSprivate_H
#define _H5FSprivate_H
-/* Include package's public header */
-#include "H5FSpublic.h"
-
/* Private headers needed by this file */
#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
diff --git a/src/H5FSpublic.h b/src/H5FSpublic.h
deleted file mode 100644
index 3090d0d..0000000
--- a/src/H5FSpublic.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5FSpublic.h
- * May 2 2006
- * Quincey Koziol <koziol@hdfgroup.org>
- *
- * Purpose: Public declarations for the file free space package.
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef _H5FSpublic_H
-#define _H5FSpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
-/*****************/
-/* Public Macros */
-/*****************/
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H5FSpublic_H */
-
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index a58347f..27486f1 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -64,26 +64,26 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls,
+static herr_t H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls,
unsigned flags);
-static herr_t H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls);
-static herr_t H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node,
+static herr_t H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls);
+static herr_t H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node,
const H5FS_section_class_t *cls);
-static herr_t H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
+static herr_t H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect);
-static herr_t H5FS_sect_unlink_rest(H5FS_t *fspace,
+static herr_t H5FS__sect_unlink_rest(H5FS_t *fspace,
const H5FS_section_class_t *cls, H5FS_section_info_t *sect);
-static herr_t H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect);
-static herr_t H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
+static herr_t H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect);
+static herr_t H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect);
-static herr_t H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls,
+static herr_t H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect, unsigned flags);
-static herr_t H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect,
+static herr_t H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect,
unsigned flags);
-static herr_t H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect,
+static herr_t H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect,
void *op_data);
-static htri_t H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node);
-static herr_t H5FS_sect_serialize_size(H5FS_t *fspace);
+static htri_t H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node);
+static herr_t H5FS__sect_serialize_size(H5FS_t *fspace);
/*********************/
@@ -112,7 +112,7 @@ H5FL_DEFINE(H5FS_sinfo_t);
/*-------------------------------------------------------------------------
- * Function: H5FS_sinfo_new
+ * Function: H5FS__sinfo_new
*
* Purpose: Create new section info structure
*
@@ -125,12 +125,12 @@ H5FL_DEFINE(H5FS_sinfo_t);
*-------------------------------------------------------------------------
*/
H5FS_sinfo_t *
-H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace)
+H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace)
{
H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */
H5FS_sinfo_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(f);
@@ -160,7 +160,7 @@ HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n",
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section bin array")
/* Increment the reference count on the free space manager header */
- if(H5FS_incr(fspace) < 0)
+ if(H5FS__incr(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header")
sinfo->fspace = fspace;
@@ -183,11 +183,11 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sinfo_new() */
+} /* H5FS__sinfo_new() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sinfo_lock
+ * Function: H5FS__sinfo_lock
*
* Purpose: Make certain the section info for the free space manager is
* in memory.
@@ -204,12 +204,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
+H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
{
H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, fspace->addr, fspace->sinfo, fspace->sect_addr);
@@ -280,7 +280,7 @@ HDfprintf(stderr, "%s: Creating new section info\n", FUNC);
HDassert(fspace->ghost_sect_count == 0);
/* Allocate and initialize free space section info */
- if(NULL == (fspace->sinfo = H5FS_sinfo_new(f, fspace)))
+ if(NULL == (fspace->sinfo = H5FS__sinfo_new(f, fspace)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create section info")
/* Set initial size of section info to 0 */
@@ -298,11 +298,11 @@ HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->s
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)
-} /* H5FS_sinfo_lock() */
+} /* H5FS__sinfo_lock() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sinfo_unlock
+ * Function: H5FS__sinfo_unlock
*
* Purpose: Release the section info, either giving ownership back to
* the cache or letting the free space header keep it.
@@ -315,11 +315,11 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
+H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5FS_SINFO_DEBUG
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);
@@ -347,7 +347,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
/* Assume that the modification will affect the statistics in the header
* and mark that dirty also
*/
- if(H5FS_dirty(fspace) < 0)
+ if(H5FS__dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
} /* end if */
@@ -442,7 +442,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC);
/* If we haven't already marked the header dirty, do so now */
if(!modified)
- if(H5FS_dirty(fspace) < 0)
+ if(H5FS__dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
#ifdef H5FS_SINFO_DEBUG
@@ -460,11 +460,11 @@ done:
HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
#endif /* H5FS_SINFO_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sinfo_unlock() */
+} /* H5FS__sinfo_unlock() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_serialize_size
+ * Function: H5FS__sect_serialize_size
*
* Purpose: Determine serialized size of all sections in free space manager
*
@@ -476,17 +476,17 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_serialize_size(H5FS_t *fspace)
+H5FS__sect_serialize_size(H5FS_t *fspace)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(fspace);
#ifdef QAK
-HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->sect_size);
-HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count);
-HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->alloc_sect_size);
-HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count);
+HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->sect_size);
+HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count);
+HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->alloc_sect_size);
+HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count);
#endif /* QAK */
/* Compute the size of the buffer required to serialize all the sections */
@@ -498,8 +498,8 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_ser
/* Count for each differently sized serializable section */
#ifdef QAK
-HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count);
-HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count);
+HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count);
+HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count);
#endif /* QAK */
sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count);
@@ -523,11 +523,11 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_
fspace->sect_size = fspace->sinfo->sect_prefix_size;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5FS_sect_serialize_size() */
+} /* H5FS__sect_serialize_size() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_increase
+ * Function: H5FS__sect_increase
*
* Purpose: Increase the size of the serialized free space section info
* on disk
@@ -540,12 +540,12 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls,
+H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls,
unsigned flags)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -577,18 +577,18 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size);
/* Update the free space sections' serialized size */
/* (if we're not deserializing the sections from disk) */
if(!(flags & H5FS_ADD_DESERIALIZING)) {
- if(H5FS_sect_serialize_size(fspace) < 0)
+ if(H5FS__sect_serialize_size(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk")
} /* end if */
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_increase() */
+} /* H5FS__sect_increase() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_decrease
+ * Function: H5FS__sect_decrease
*
* Purpose: Decrease the size of the serialized free space section info
* on disk
@@ -601,11 +601,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls)
+H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -635,17 +635,17 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size);
fspace->sinfo->serial_size -= cls->serial_size;
/* Update the free space sections' serialized size */
- if(H5FS_sect_serialize_size(fspace) < 0)
+ if(H5FS__sect_serialize_size(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_decrease() */
+} /* H5FS__sect_decrease() */
/*-------------------------------------------------------------------------
- * Function: H5FS_size_node_decr
+ * Function: H5FS__size_node_decr
*
* Purpose: Decrement the number of sections of a particular size
*
@@ -657,12 +657,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node,
+H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node,
const H5FS_section_class_t *cls)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sinfo);
@@ -728,11 +728,11 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_size_node_decr() */
+} /* H5FS__size_node_decr() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_unlink_size
+ * Function: H5FS__sect_unlink_size
*
* Purpose: Remove a section node from size tracking data structures for
* a free space manager
@@ -745,7 +745,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
+H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect)
{
H5FS_node_t *fspace_node; /* Free list size node */
@@ -753,7 +753,7 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
unsigned bin; /* Bin to put the free space section in */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sinfo);
@@ -777,16 +777,16 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list")
/* Decrement # of sections in section size node */
- if(H5FS_size_node_decr(sinfo, bin, fspace_node, cls) < 0)
+ if(H5FS__size_node_decr(sinfo, bin, fspace_node, cls) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_unlink_size() */
+} /* H5FS__sect_unlink_size() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_unlink_rest
+ * Function: H5FS__sect_unlink_rest
*
* Purpose: Finish unlinking a section from the rest of the free space
* manager's data structures, after the section has been removed
@@ -800,12 +800,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls,
+H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -826,7 +826,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC
} /* end if */
/* Update section info & check if we need less room for the serialized free space sections */
- if(H5FS_sect_decrease(fspace, cls) < 0)
+ if(H5FS__sect_decrease(fspace, cls) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk")
/* Decrement amount of free space managed */
@@ -837,11 +837,11 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_unlink_rest() */
+} /* H5FS__sect_unlink_rest() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_remove_real
+ * Function: H5FS__sect_remove_real
*
* Purpose: Remove a section from the free space manager
*
@@ -853,12 +853,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect)
+H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect)
{
const H5FS_section_class_t *cls; /* Class of section */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -869,16 +869,16 @@ H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect)
cls = &fspace->sect_cls[sect->type];
/* Remove node from size tracked data structures */
- if(H5FS_sect_unlink_size(fspace->sinfo, cls, sect) < 0)
+ if(H5FS__sect_unlink_size(fspace->sinfo, cls, sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from size tracking data structures")
/* Update rest of free space manager data structures for node removal */
- if(H5FS_sect_unlink_rest(fspace, cls, sect) < 0)
+ if(H5FS__sect_unlink_rest(fspace, cls, sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_remove_real() */
+} /* H5FS__sect_remove_real() */
/*-------------------------------------------------------------------------
@@ -907,17 +907,17 @@ H5FS_sect_remove(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect)
HDassert(sect);
/* Get a pointer to the section info */
- if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
/* Perform actual section removal */
- if(H5FS_sect_remove_real(fspace, sect) < 0)
+ if(H5FS__sect_remove_real(fspace, sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove section")
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -925,7 +925,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_link_size
+ * Function: H5FS__sect_link_size
*
* Purpose: Add a section of free space to the free list bins
*
@@ -937,7 +937,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
+H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect)
{
H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */
@@ -945,7 +945,7 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
unsigned bin; /* Bin to put the free space section in */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef QAK
HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr);
#endif /* QAK */
@@ -1028,11 +1028,11 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_link_size() */
+} /* H5FS__sect_link_size() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_link_rest
+ * Function: H5FS__sect_link_rest
*
* Purpose: Link a section into the rest of the non-size tracking
* free space manager data structures
@@ -1045,12 +1045,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls,
+H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect, unsigned flags)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -1070,7 +1070,7 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN
} /* end if */
/* Update section info & check if we need more room for the serialized free space sections */
- if(H5FS_sect_increase(fspace, cls, flags) < 0)
+ if(H5FS__sect_increase(fspace, cls, flags) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk")
/* Increment amount of free space managed */
@@ -1078,11 +1078,11 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_link_rest() */
+} /* H5FS__sect_link_rest() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_link
+ * Function: H5FS__sect_link
*
* Purpose: Link a section into the internal data structures
*
@@ -1094,12 +1094,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags)
+H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags)
{
const H5FS_section_class_t *cls; /* Class of section */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -1113,14 +1113,14 @@ H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags)
#ifdef QAK
HDfprintf(stderr, "%s: Check 1.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
#endif /* QAK */
- if(H5FS_sect_link_size(fspace->sinfo, cls, sect) < 0)
+ if(H5FS__sect_link_size(fspace->sinfo, cls, sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures")
#ifdef QAK
HDfprintf(stderr, "%s: Check 2.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
#endif /* QAK */
/* Update rest of free space manager data structures for section addition */
- if(H5FS_sect_link_rest(fspace, cls, sect, flags) < 0)
+ if(H5FS__sect_link_rest(fspace, cls, sect, flags) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to non-size tracking data structures")
#ifdef QAK
HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
@@ -1128,11 +1128,11 @@ HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_link() */
+} /* H5FS__sect_link() */
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_merge
+ * Function: H5FS__sect_merge
*
* Purpose: Attempt to merge a returned free space section with existing
* free space.
@@ -1145,7 +1145,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
+H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
{
H5FS_section_class_t *sect_cls; /* Section's class */
hbool_t modified; /* Flag to indicate merge or shrink occurred */
@@ -1153,7 +1153,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
htri_t status; /* Status value */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -1203,7 +1203,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
HDassert(tmp_sect_cls->merge);
/* Remove 'less than' node from data structures */
- if(H5FS_sect_remove_real(fspace, tmp_sect) < 0)
+ if(H5FS__sect_remove_real(fspace, tmp_sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
/* Merge the two sections together */
@@ -1249,7 +1249,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
HDassert(sect_cls->merge);
/* Remove 'greater than' node from data structures */
- if(H5FS_sect_remove_real(fspace, tmp_sect) < 0)
+ if(H5FS__sect_remove_real(fspace, tmp_sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
/* Merge the two sections together */
@@ -1290,7 +1290,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC);
/* Remove SECT from free-space manager */
/* (only possible to happen on second+ pass through loop) */
if(remove_sect) {
- if(H5FS_sect_remove_real(fspace, *sect) < 0)
+ if(H5FS__sect_remove_real(fspace, *sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
remove_sect = FALSE;
} /* end if */
@@ -1342,7 +1342,7 @@ done:
HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
#endif /* QAK */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_merge() */
+} /* H5FS__sect_merge() */
/*-------------------------------------------------------------------------
@@ -1379,7 +1379,7 @@ HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->siz
HDassert(sect->size);
/* Get a pointer to the section info */
- if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
@@ -1396,7 +1396,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC);
#endif /* H5FS_SINFO_DEBUG */
/* Attempt to merge returned section with existing sections */
- if(H5FS_sect_merge(fspace, &sect, op_data) < 0)
+ if(H5FS__sect_merge(fspace, &sect, op_data) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections")
} /* end if */
@@ -1405,7 +1405,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC);
* be NULL at this point - QAK)
*/
if(sect)
- if(H5FS_sect_link(fspace, sect, flags) < 0)
+ if(H5FS__sect_link(fspace, sect, flags) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
#ifdef H5FS_SINFO_DEBUG
@@ -1418,7 +1418,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
#ifdef H5FS_DEBUG_ASSERT
@@ -1475,7 +1475,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se
H5FS_section_info_t *sect; /* Temporary free space section */
/* Get a pointer to the section info */
- if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
@@ -1511,7 +1511,7 @@ if(_section_)
H5FS_section_class_t *cls; /* Section's class */
/* Remove section from data structures */
- if(H5FS_sect_remove_real(fspace, sect) < 0)
+ if(H5FS__sect_remove_real(fspace, sect) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
/* Get class for section */
@@ -1537,7 +1537,7 @@ if(_section_)
/* Re-adding the section could cause it to disappear (particularly when paging) */
if(sect) {
/* Re-add adjusted section to free sections data structures */
- if(H5FS_sect_link(fspace, sect, 0) < 0)
+ if(H5FS__sect_link(fspace, sect, 0) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
} /* end if */
} /* end if */
@@ -1561,7 +1561,7 @@ if(_section_)
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1601,13 +1601,13 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect,
HDassert(sect->size);
/* Get a pointer to the section info */
- if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
saved_fs_size = sect->size;
/* Attempt to merge/shrink section with existing sections */
- if(H5FS_sect_merge(fspace, &sect, op_data) < 0)
+ if(H5FS__sect_merge(fspace, &sect, op_data) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections")
/* Check if section is shrunk and/or merged away completely */
@@ -1618,7 +1618,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect,
else {
/* Check if section is merged */
if(sect->size > saved_fs_size) {
- if(H5FS_sect_link(fspace, sect, flags) < 0)
+ if(H5FS__sect_link(fspace, sect, flags) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
sinfo_modified = TRUE;
HGOTO_DONE(TRUE)
@@ -1627,7 +1627,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect,
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1635,7 +1635,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_find_node
+ * Function: H5FS__sect_find_node
*
* Purpose: Locate a section of free space (in existing free space list
* bins) that is large enough to fulfill request.
@@ -1648,7 +1648,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node)
+H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node)
{
H5FS_node_t *fspace_node; /* Free list size node */
unsigned bin; /* Bin to put the free space section in */
@@ -1658,7 +1658,7 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node)
const H5FS_section_class_t *cls; /* Class of section */
hsize_t alignment;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(fspace);
@@ -1696,9 +1696,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin);
/* Get section's class */
cls = &fspace->sect_cls[(*node)->type];
/* Decrement # of sections in section size node */
- if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0)
+ if(H5FS__size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list")
- if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0)
+ if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures")
/* Indicate that we found a node for the request */
HGOTO_DONE(TRUE)
@@ -1741,10 +1741,10 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin);
if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove(curr_fspace_node->sect_list, &curr_sect->addr)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list")
/* Decrement # of sections in section size node */
- if(H5FS_size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0)
+ if(H5FS__size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list")
- if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0)
+ if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures")
/*
@@ -1755,7 +1755,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin);
*/
if(mis_align) {
split_sect = cls->split(*node, frag_size);
- if((H5FS_sect_link(fspace, split_sect, 0) < 0))
+ if((H5FS__sect_link(fspace, split_sect, 0) < 0))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
/* sanity check */
HDassert(split_sect->addr < (*node)->addr);
@@ -1780,7 +1780,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_sect_find_node() */
+} /* H5FS__sect_find_node() */
/*-------------------------------------------------------------------------
@@ -1823,12 +1823,12 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se
#endif /* QAK */
if(fspace->tot_sect_count > 0) {
/* Get a pointer to the section info */
- if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
/* Look for node in bins */
- if((ret_value = H5FS_sect_find_node(fspace, request, node)) < 0)
+ if((ret_value = H5FS__sect_find_node(fspace, request, node)) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from bins")
/* Decrement # of sections on free list, if we found an object */
@@ -1843,7 +1843,7 @@ HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type =
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
#ifdef H5FS_DEBUG_ASSERT
@@ -1965,7 +1965,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c
unsigned bin; /* Current bin we are on */
/* Get a pointer to the section info */
- if(H5FS_sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
@@ -1985,7 +1985,7 @@ HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC);
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, FALSE) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, FALSE) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2054,7 +2054,7 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect,
HDassert(new_class < fspace->nclasses);
/* Get a pointer to the section info */
- if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
@@ -2179,12 +2179,12 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC
fspace->sinfo->serial_size += fspace->sect_cls[new_class].serial_size;
/* Update current space used for free space sections */
- if(H5FS_sect_serialize_size(fspace) < 0)
+ if(H5FS__sect_serialize_size(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk")
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2343,13 +2343,12 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H
/*-------------------------------------------------------------------------
- * Function: H5FS_sect_try_shrink_eoa
+ * Function: H5FS_sect_try_shrink_eoa
*
- * Purpose: To shrink the last section on the merge list if the section
- * is at EOF.
+ * Purpose: To shrink the last section on the merge list if the section
+ * is at EOF.
*
- * Return: Success: non-negative (TRUE/FALSE)
- * Failure: negative
+ * Return: TRUE/FALSE/FAIL
*
* Programmer: Vailin Choi
*
@@ -2367,7 +2366,7 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data)
/* Check arguments. */
HDassert(fspace);
- if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
+ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
sinfo_valid = TRUE;
@@ -2382,30 +2381,30 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data)
/* Get the pointer to the last section, from the last node */
tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node);
HDassert(tmp_sect);
- tmp_sect_cls = &fspace->sect_cls[tmp_sect->type];
- if(tmp_sect_cls->can_shrink) {
+ tmp_sect_cls = &fspace->sect_cls[tmp_sect->type];
+ if(tmp_sect_cls->can_shrink) {
/* Check if the section can be shrunk away */
- if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container")
- if(ret_value > 0) {
- HDassert(tmp_sect_cls->shrink);
+ if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container")
+ if(ret_value > 0) {
+ HDassert(tmp_sect_cls->shrink);
/* Remove section from free space manager */
- if(H5FS_sect_remove_real(fspace, tmp_sect) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
+ if(H5FS__sect_remove_real(fspace, tmp_sect) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
section_removed = TRUE;
/* Shrink away section */
- if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container")
- } /* end if */
- } /* end if */
- } /* end if */
+ if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container")
+ } /* end if */
+ } /* end if */
+ } /* end if */
} /* end if */
done:
/* Release the section info */
- if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, section_removed) < 0)
+ if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, section_removed) < 0)
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2557,15 +2556,15 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace,
if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "hdr file space alloc will overlap into 'temporary' file space")
- hdr_alloc_size = H5FS_HEADER_SIZE(f);
+ hdr_alloc_size = H5FS_HEADER_SIZE(f);
- /* if page allocation is enabled, extend the hdr_alloc_size to the
- * next page boundary.
+ /* if page allocation is enabled, extend the hdr_alloc_size to the
+ * next page boundary.
*/
if(H5F_PAGED_AGGR(f)) {
HDassert(0 == (eoa % f->shared->fs_page_size));
- hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size;
+ hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size;
HDassert(hdr_alloc_size >= H5FS_HEADER_SIZE(f));
HDassert((hdr_alloc_size % f->shared->fs_page_size) == 0);
@@ -2599,13 +2598,13 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace,
sinfo_alloc_size = fspace->sect_size;
- /* if paged allocation is enabled, extend the sinfo_alloc_size to the
- * next page boundary.
+ /* if paged allocation is enabled, extend the sinfo_alloc_size to the
+ * next page boundary.
*/
if(H5F_PAGED_AGGR(f)) {
HDassert(0 == (eoa % f->shared->fs_page_size));
- sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size;
+ sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size;
HDassert(sinfo_alloc_size >= fspace->sect_size);
HDassert((sinfo_alloc_size % f->shared->fs_page_size) == 0);
diff --git a/src/H5FStest.c b/src/H5FStest.c
index 5ab0219..120a9a8 100644
--- a/src/H5FStest.c
+++ b/src/H5FStest.c
@@ -69,7 +69,7 @@
/*-------------------------------------------------------------------------
- * Function: H5FS_get_cparam_test
+ * Function: H5FS__get_cparam_test
*
* Purpose: Retrieve the parameters used to create the free-space manager
* similar to H5HF_get_cparam_test()
@@ -82,9 +82,9 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam)
+H5FS__get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(frsp);
@@ -97,16 +97,16 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam)
cparam->max_sect_size = frsp->max_sect_size;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5FS_get_cparam_test() */
+} /* H5FS__get_cparam_test() */
/*-------------------------------------------------------------------------
- * Function: H5FS_cmp_cparam_test
+ * Function: H5FS__cmp_cparam_test
*
* Purpose: Compare the parameters used to create the free space manager
* similar to H5HF_cmp_cparam_test()
*
- * Return: SUCCEED/FAIL
+ * Return: A value like strcmp()
*
* Programmer: Vailin Choi
* August 25th, 2008
@@ -114,11 +114,11 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam)
*-------------------------------------------------------------------------
*/
int
-H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2)
+H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2)
{
- int ret_value = SUCCEED; /* Return value */
+ int ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(cparam1);
@@ -151,5 +151,5 @@ H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FS_cmp_cparam_test */
+} /* H5FS__cmp_cparam_test */
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 6417956..dfc1441 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -35,12 +35,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5Iprivate.h" /* IDs */
-#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
+#include "H5SMprivate.h" /* Shared object header messages */
/****************/
@@ -84,23 +84,20 @@
* Function: H5Fget_info1
*
* Purpose: Gets general information about the file, including:
- * 1. Get storage size for superblock extension if there is one.
+ * 1. Get storage size for superblock extension if there is one.
* 2. Get the amount of btree and heap storage for entries
* in the SOHM table if there is one.
- * 3. The amount of free space tracked in the file.
+ * 3. The amount of free space tracked in the file.
*
- * Return: Success: non-negative on success
- * Failure: Negative
- *
- * Programmer: Vailin Choi
- * July 11, 2007
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
{
- H5F_t *f; /* Top file in mount hierarchy */
+ 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 */
@@ -111,26 +108,17 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
if(!finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- /* For file IDs, get the file object directly */
- /* (This prevents the H5G_loc() call from returning the file pointer for
- * the top file in a mount hierarchy)
- */
- if(H5I_get_type(obj_id) == H5I_FILE ) {
- if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
- } /* end if */
- else {
- H5G_loc_t loc; /* Object location */
-
- /* Get symbol table entry */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
- f = loc.oloc->file;
- } /* end else */
- HDassert(f->shared);
-
- /* Get the current file info */
- if(H5F__get_info(f, &finfo2) < 0)
+ /* Check the type */
+ type = H5I_get_type(obj_id);
+ if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Get the file information */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
/* Copy the compatible fields into the older struct */
@@ -144,6 +132,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Fis_hdf5
+ *
+ * Purpose: Check the file signature to detect an HDF5 file.
+ *
+ * Bugs: This function is not robust: it only uses the default file
+ * driver when attempting to open the file when in fact it
+ * should use all known file drivers.
+ *
+ * Return: TRUE/FALSE/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5Fis_hdf5(const char *name)
+{
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_API((-1))
+ H5TRACE1("t", "*s", name);
+
+ /* Check args and all the boring stuff. */
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified")
+
+ /* 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)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fis_hdf5() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Fset_latest_format
*
* Purpose: Enable switching between latest or non-latest format while
@@ -180,26 +202,31 @@ done:
herr_t
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
{
- H5F_t *f; /* File */
- 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 */
+ 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 */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, latest_format);
/* Check args */
- if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(file_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+
/* 'low' and 'high' are both initialized to LATEST.
- If latest format is not expected, set 'low' to EARLIEST */
+ * If latest format is not expected, set 'low' to EARLIEST
+ */
if(!latest_format)
low = H5F_LIBVER_EARLIEST;
- /* Call private set_libver_bounds function to set the bounds */
- if(H5F__set_libver_bounds(f, low, high) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
+ /* Set the library's version bounds */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 07bb644..a394071 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -481,7 +481,7 @@ H5F__efc_release(H5F_efc_t *efc)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(efc);
@@ -491,7 +491,7 @@ H5F__efc_release(H5F_efc_t *efc)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_efc_release() */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index c3fe07a..1282608 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -37,6 +37,7 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -47,7 +48,7 @@
/* Local Typedefs */
/******************/
-/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */
+/* Struct only used by functions H5F__get_objects and H5F__get_objects_cb */
typedef struct H5F_olist_t {
H5I_type_t obj_type; /* Type of object to look for */
hid_t *obj_id_list; /* Pointer to the list of open IDs to return */
@@ -73,10 +74,12 @@ typedef struct H5F_olist_t {
/* Local Prototypes */
/********************/
-static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
+static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
+static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/);
static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/);
-static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name);
+static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
+static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name);
static herr_t H5F__flush_phase1(H5F_t *f);
static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing);
@@ -104,19 +107,66 @@ H5FL_DEFINE(H5F_file_t);
/*-------------------------------------------------------------------------
- * Function: H5F_get_access_plist
+ * Function: H5F__set_vol_conn
*
- * Purpose: Returns a copy of the file access property list of the
- * specified file.
+ * Purpose: Set the VOL connector ID and info for a file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info)
+{
+ void *new_connector_info = NULL; /* Copy of connector info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(file);
+
+ /* Only cache VOL connector ID & info the first time the file is opened */
+ if(file->shared->nrefs == 1) {
+ /* Copy connector info, if it exists */
+ if(vol_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allocate and copy connector info */
+ if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed")
+ } /* end if */
+
+ /* Cache the connector ID & info for the container */
+ file->shared->vol_id = vol_id;
+ file->shared->vol_info = new_connector_info;
+ if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__set_vol_conn() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_access_plist
+ *
+ * Purpose: Returns a copy of the file access property list of the
+ * specified file.
*
* NOTE: Make sure that, if you are going to overwrite
* information in the copied property list that was
* previously opened and assigned to the property list, then
* you must close it before overwriting the values.
*
- * Return: Success: Object ID for a copy of the file access
- * property list.
- * Failure: FAIL
+ * Return: Success: Object ID for a copy of the file access
+ * property list.
+ * Failure: H5I_INVALID_HID
*-------------------------------------------------------------------------
*/
hid_t
@@ -126,72 +176,73 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
H5P_genplist_t *old_plist; /* Old property list */
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
unsigned efc_size = 0;
- hid_t ret_value = SUCCEED; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
/* Check args */
HDassert(f);
/* Make a copy of the default file access property list */
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Copy properties of the file access property list */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots")
if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size")
if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks")
if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment threshold")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold")
if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment")
if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference")
if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size")
if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size")
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size")
if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag")
if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback")
if(f->shared->efc)
efc_size = H5F__efc_max_nfiles(f->shared->efc);
if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size")
if(f->shared->page_buf != NULL) {
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set page buffer size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum metadata fraction of page buffer")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum raw data fraction of page buffer")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer")
} /* end if */
#ifdef H5_HAVE_PARALLEL
if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
#endif /* H5_HAVE_PARALLEL */
if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.")
+ 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;
@@ -200,18 +251,24 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
/* Set the driver property */
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID & info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info")
+
+ /* Set the VOL connector property */
+ connector_prop.connector_id = f->shared->vol_id;
+ connector_prop.connector_info = f->shared->vol_info;
+ if(H5P_set(new_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info")
/* Set the file close degree appropriately */
if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
done:
/* Release the copy of the driver info, if it was set up */
if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info")
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_access_plist() */
@@ -237,8 +294,8 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_i
HDassert(obj_id_count_ptr);
/* Perform the query */
- if((ret_value = H5F_get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed")
+ if((ret_value = H5F__get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -264,8 +321,8 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list
HDassert(obj_id_count_ptr);
/* Perform the query */
- if((ret_value = H5F_get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed")
+ if((ret_value = H5F__get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -273,23 +330,23 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5F_get_objects
+ * Function: H5F__get_objects
*
- * Purpose: This function is called by H5F_get_obj_count or
- * H5F_get_obj_ids to get number of object IDs and/or a
- * list of opened object IDs (in return value).
+ * Purpose: This function is called by H5F_get_obj_count or
+ * H5F_get_obj_ids to get number of object IDs and/or a
+ * list of opened object IDs (in return value).
*
- * Return: Non-negative on success; Can't fail.
+ * Return: SUCCEED/FAIL
*---------------------------------------------------------------------------
*/
-herr_t
-H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr)
+static herr_t
+H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr)
{
- size_t obj_id_count=0; /* Number of open IDs */
+ size_t obj_id_count = 0; /* Number of open IDs */
H5F_olist_t olist; /* Structure to hold search results */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(obj_id_count_ptr);
@@ -314,7 +371,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
* IDs on the object list. */
if(types & H5F_OBJ_FILE) {
olist.obj_type = H5I_FILE;
- if(H5I_iterate(H5I_FILE, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)")
} /* end if */
@@ -323,12 +380,12 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
* search through dataset IDs to count number of datasets, and put their
* IDs on the object list */
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
- if (types & H5F_OBJ_DATASET) {
+ if(types & H5F_OBJ_DATASET) {
olist.obj_type = H5I_DATASET;
- if(H5I_iterate(H5I_DATASET, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)")
} /* end if */
- }
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -337,10 +394,10 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_GROUP) {
olist.obj_type = H5I_GROUP;
- if(H5I_iterate(H5I_GROUP, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)")
} /* end if */
- }
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -349,10 +406,10 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_DATATYPE) {
olist.obj_type = H5I_DATATYPE;
- if(H5I_iterate(H5I_DATATYPE, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)")
} /* end if */
- }
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -361,38 +418,38 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_ATTR) {
olist.obj_type = H5I_ATTR;
- if(H5I_iterate(H5I_ATTR, H5F_get_objects_cb, &olist, app_ref) < 0)
+ if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)")
} /* end if */
- }
+ } /* end if */
/* Set the number of objects currently open */
*obj_id_count_ptr = obj_id_count;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_objects() */
+} /* end H5F__get_objects() */
/*-------------------------------------------------------------------------
- * Function: H5F_get_objects_cb
+ * Function: H5F__get_objects_cb
*
- * Purpose: H5F_get_objects' callback function. It verifies if an
- * object is in the file, and either count it or put its ID
- * on the list.
+ * Purpose: H5F__get_objects' callback function. It verifies if an
+ * object is in the file, and either count it or put its ID
+ * on the list.
*
- * Return: H5_ITER_STOP if the array of object IDs is filled up.
- * H5_ITER_CONT otherwise.
+ * Return: H5_ITER_STOP if the array of object IDs is filled up.
+ * H5_ITER_CONT otherwise.
*-------------------------------------------------------------------------
*/
static int
-H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
+H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
{
H5F_olist_t *olist = (H5F_olist_t *)key; /* Alias for search info */
hbool_t add_obj = FALSE;
int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(obj_ptr);
HDassert(olist);
@@ -408,7 +465,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
add_obj = TRUE;
} /* end if */
} /* end if */
- else { /* either count opened object IDs or put the IDs on the list */
+ else { /* Either count opened object IDs or put the IDs on the list */
H5O_loc_t *oloc; /* Group entry info for object */
switch(olist->obj_type) {
@@ -437,6 +494,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_DATASPACE:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
@@ -473,14 +531,15 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Check if we've filled up the array. Return H5_ITER_STOP only if
* we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is
* preset to H5_ITER_CONT) because H5I_iterate needs the return value of
- * H5_ITER_CONT to continue the iteration. */
+ * H5_ITER_CONT to continue the iteration.
+ */
if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs)
HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_objects_cb() */
+} /* end H5F__get_objects_cb() */
/*--------------------------------------------------------------------------
@@ -489,7 +548,6 @@ done:
* Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME
*
* Return: SUCCEED/FAIL
- *
*--------------------------------------------------------------------------*/
static herr_t
H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/)
@@ -517,14 +575,14 @@ done:
/*--------------------------------------------------------------------------
- * Function: H5F__getenv_prefix_name
+ * Function: H5F__getenv_prefix_name
*
- * Purpose: Get the first pathname in the list of pathnames stored in env_prefix,
- * which is separated by the environment delimiter.
- * env_prefix is modified to point to the remaining pathnames
- * in the list.
+ * Purpose: Get the first pathname in the list of pathnames stored in env_prefix,
+ * which is separated by the environment delimiter.
+ * env_prefix is modified to point to the remaining pathnames
+ * in the list.
*
- * Return: A pointer to a pathname
+ * Return: A pointer to a pathname (can't fail but can return NULL)
--------------------------------------------------------------------------*/
static char *
H5F__getenv_prefix_name(char **env_prefix/*in,out*/)
@@ -666,6 +724,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type,
/* Leave if file was opened */
else
break;
+ H5E_clear_stack(NULL);
} /* end if */
} /* end while */
@@ -776,29 +835,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__is_hdf5
- *
- * Purpose: Check the file signature to detect an HDF5 file.
+ * Function: H5F__is_hdf5
*
- * Bugs: This function is not robust: it only uses the default file
- * driver when attempting to open the file when in fact it
- * should use all known file drivers.
+ * Purpose: Check the file signature to detect an HDF5 file.
*
- * Return: Success: TRUE/FALSE
- * * Failure: Negative
+ * Return: TRUE/FALSE/FAIL
*-------------------------------------------------------------------------
*/
htri_t
-H5F__is_hdf5(const char *name)
+H5F__is_hdf5(const char *name, hid_t fapl_id)
{
- H5FD_t *file = NULL; /* Low-level file struct */
- haddr_t sig_addr; /* Addess of hdf5 file signature */
- htri_t ret_value = FAIL; /* Return value */
+ H5FD_t *file = NULL; /* Low-level file struct */
+ haddr_t sig_addr; /* Addess of hdf5 file signature */
+ htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
- /* Open the file at the virtual file layer */
- if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF)))
+ /* Open the file */
+ /* NOTE: This now uses the fapl_id that was passed in, so H5Fis_accessible()
+ * should work with arbitrary VFDs, unlike H5Fis_hdf5().
+ */
+ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
/* The file is an hdf5 file if the hdf5 file signature can be found */
@@ -809,10 +866,10 @@ H5F__is_hdf5(const char *name)
done:
/* Close the file */
if(file)
- if(H5FD_close(file) < 0 && ret_value >= 0)
+ if(H5FD_close(file) < 0 && TRUE == ret_value)
HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__is_hdf5() */
@@ -832,17 +889,17 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5F_t *
+static H5F_t *
H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
{
H5F_t *f = NULL;
H5F_t *ret_value = NULL;
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
if(NULL == (f = H5FL_CALLOC(H5F_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure")
- f->file_id = H5I_INVALID_HID;
+ f->id_exists = FALSE;
if(shared) {
HDassert(lf == NULL);
@@ -1005,12 +1062,12 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA;
if(H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD")
- }
+ } /* end if */
else {
/* If no value for read attempts has been set, use the default */
if(!f->shared->read_attempts)
f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS;
- }
+ } /* end else */
/* Determine the # of bins for metdata read retries */
if(H5F_set_retries(f) < 0)
@@ -1048,7 +1105,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Add new "shared" struct to list of open files */
- if(H5F_sfile_add(f->shared) < 0)
+ if(H5F__sfile_add(f->shared) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files")
} /* end else */
@@ -1082,14 +1139,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__dest
+ * Function: H5F__dest
*
- * Purpose: Destroys a file structure. This function flushes the cache
- * but doesn't do any other cleanup other than freeing memory
- * for the file struct. The shared info for the file is freed
- * only when its reference count reaches zero.
+ * Purpose: Destroys a file structure. This function flushes the cache
+ * but doesn't do any other cleanup other than freeing memory
+ * for the file struct. The shared info for the file is freed
+ * only when its reference count reaches zero.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1243,7 +1300,7 @@ H5F__dest(H5F_t *f, hbool_t flush)
HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM));
/* Remove shared file struct from list of open files */
- if(H5F_sfile_remove(f->shared) < 0)
+ if(H5F__sfile_remove(f->shared) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
@@ -1296,6 +1353,25 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list")
+ /* Clean up the cached VOL connector ID & info */
+ if(f->shared->vol_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(f->shared->vol_id)))
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Free the connector info */
+ if(H5VL_free_connector_info(connector, f->shared->vol_info) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+ } /* end if */
+ if(f->shared->vol_id > 0)
+ if(H5I_dec_ref(f->shared->vol_id) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID")
+
/* Close the file */
if(H5FD_close(f->shared->lf) < 0)
/* Push error, but keep going*/
@@ -1336,78 +1412,6 @@ H5F__dest(H5F_t *f, hbool_t flush)
/*-------------------------------------------------------------------------
- * Function: H5F__create
- *
- * Purpose: Internal routine to create a file.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating files that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new file object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 13, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5F_t *
-H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
-{
- H5F_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(filename);
-
- /* Create a new file or truncate an existing file. */
- if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5F__create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F__open
- *
- * Purpose: Internal routine to open a file.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * opening files that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new file object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 13, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5F_t *
-H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
-{
- H5F_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(filename);
-
- /* Open the file */
- if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5F__open() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_open
*
* Purpose: Opens (or creates) a file. This function understands the
@@ -1542,30 +1546,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
tent_flags = flags;
if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) {
- if(tent_flags == flags) {
-#ifndef H5_USING_MEMCHECKER
- time_t mytime = HDtime(NULL);
-
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags)
-#else /* H5_USING_MEMCHECKER */
+ if(tent_flags == flags)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags)
-#endif /* H5_USING_MEMCHECKER */
- } /* end if */
H5E_clear_stack(NULL);
tent_flags = flags;
- if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) {
-#ifndef H5_USING_MEMCHECKER
- time_t mytime = HDtime(NULL);
-
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags)
-#else /* H5_USING_MEMCHECKER */
+ if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags)
-#endif /* H5_USING_MEMCHECKER */
- } /* end if */
} /* end if */
/* Is the file already open? */
- if((shared = H5F_sfile_search(lf)) != NULL) {
+ if((shared = H5F__sfile_search(lf)) != NULL) {
/*
* The file is already open, so use that one instead of the one we
* just opened. We only one one H5FD_t* per file so one doesn't
@@ -1621,7 +1611,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Create the 'top' file structure */
if(NULL == (file = H5F__new(NULL, flags, fcpl_id, fapl_id, lf))) {
/* If this is the only time the file has been opened and the struct
- * returned is NULL, H5FD_close() will never be called via H5F_dest()
+ * returned is NULL, H5FD_close() will never be called via H5F__dest()
* so we have to close lf here before heading to the error handling.
*/
if(H5FD_close(lf) < 0)
@@ -1697,7 +1687,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if(H5G_mkroot(file, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group")
} /* end if */
- else if (1 == shared->nrefs) {
+ else if(1 == shared->nrefs) {
/* Read the superblock if it hasn't been read before. */
if(H5F__super_read(file, a_plist, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
@@ -1720,16 +1710,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
*/
if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree")
-
- /* This is a private property to clear the status_flags in the super block */
- /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
- if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
- if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
- else if(clear)
- file->shared->sblock->status_flags = 0;
- } /* end if */
-
if(shared->nrefs == 1) {
if(fc_degree == H5F_CLOSE_DEFAULT)
shared->fc_degree = lf->cls->fc_degree;
@@ -1743,6 +1723,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match")
} /* end if */
+ /* This is a private property to clear the status_flags in the super block */
+ /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
+ if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
+ if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
+ else if(clear)
+ file->shared->sblock->status_flags = 0;
+ } /* end if */
+
/* Record the evict-on-close MDC behavior. If it's the first time opening
* the file, set it to access property list value; if it's the second time
* or later, verify that the access property list value matches the value
@@ -1762,7 +1751,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath")
/* Formulate the actual file name, after following symlinks, etc. */
- if(H5F_build_actual_name(file, a_plist, name, &file->actual_name) < 0)
+ if(H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name")
if(set_flag) {
@@ -1824,11 +1813,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_flush_phase1
+ * Function: H5F_flush_phase1
*
- * Purpose: First phase of flushing cached data.
+ * Purpose: First phase of flushing cached data.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1861,11 +1851,12 @@ H5F__flush_phase1(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F__flush_phase2
+ * Function: H5F__flush_phase2
*
- * Purpose: Second phase of flushing cached data.
+ * Purpose: Second phase of flushing cached data.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1884,13 +1875,14 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing)
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache")
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
/* Since we just returned from a call to H5AC_flush(), we just
* passed through a barrier. Hence we can skip the barrier on
* entry to the mpio file driver truncate call below, and the first
* barrier in the following call to flush the cache again.
*/
H5CX_set_mpi_file_flushing(TRUE);
+ }
#endif /* H5_HAVE_PARALLEL */
/* Truncate the file to the current allocated size */
@@ -1929,15 +1921,16 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing)
/*-------------------------------------------------------------------------
- * Function: H5F__flush_real
+ * Function: H5F__flush
*
- * Purpose: Flushes cached data.
+ * Purpose: Flushes cached data.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
-H5F__flush_real(H5F_t *f)
+H5F__flush(H5F_t *f)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1957,133 +1950,43 @@ H5F__flush_real(H5F_t *f)
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__flush_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F__flush
- *
- * Purpose: Internal routine to flush a file.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * flushing files that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * December 13, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F__flush(H5F_t *f, H5F_scope_t scope)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
-
- /* Flush other files, depending on scope */
- if(H5F_SCOPE_GLOBAL == 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")
- } /* end if */
- else
- /* Call the flush routine, for this file */
- if(H5F__flush_real(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5F__flush() */
/*-------------------------------------------------------------------------
* Function: H5F__close
*
- * Purpose: Internal routine to close a file.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * closing files that can set up VOL / SWMR info
- * (which need a DXPL).
+ * Purpose: Closes a file or causes the close operation to be pended.
+ * This function is called two ways: from the API it gets called
+ * by H5Fclose->H5I_dec_ref->H5F__close when H5I_dec_ref()
+ * decrements the file ID reference count to zero. The file ID
+ * is removed from the H5I_FILE group by H5I_dec_ref() just
+ * before H5F__close() is called. If there are open object
+ * headers then the close is pended by moving the file to the
+ * H5I_FILE_CLOSING ID group (the f->closing contains the ID
+ * assigned to file).
*
- * Return: Non-negative on success / Negative on failure
+ * This function is also called directly from H5O_close() when
+ * the last object header is closed for the file and the file
+ * has a pending close.
*
- * Programmer: Quincey Koziol
- * December 16, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5F__close(hid_t file_id)
+H5F__close(H5F_t *f)
{
- H5F_t *f; /* File pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
-
- /* Flush file if this is the last reference to this id and we have write
- * intent, unless it will be flushed by the "shared" file being closed.
- * This is only necessary to replicate previous behaviour, and could be
- * disabled by an option/property to improve performance.
- */
- if(NULL == (f = (H5F_t *)H5I_object(file_id)))
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid file identifier")
- if((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) {
- int nref; /* Number of references to file ID */
-
- if((nref = H5I_get_ref(file_id, FALSE)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ID ref count")
- if(nref == 1)
- if(H5F__flush_real(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
- } /* end if */
-
- /* Decrement reference count on file ID */
- /* (When it reaches zero the file will be closed) */
- if(H5I_dec_app_ref(file_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "decrementing file ID failed")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5F__close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F__close_cb
- *
- * Purpose: Closes a file or causes the close operation to be pended.
- * This function is called from the API and gets called
- * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref()
- * decrements the file ID reference count to zero. The file ID
- * is removed from the H5I_FILE group by H5I_dec_ref() just
- * before H5F__close_cb() is called. If there are open object
- * headers then the close is pended by moving the file to the
- * H5I_FILE_CLOSING ID group (the f->closing contains the ID
- * assigned to file).
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F__close_cb(H5F_t *f)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
- HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */
/* Perform checks for "semi" file close degree here, since closing the
- * file is not allowed if there are objects still open */
+ * file is not allowed if there are objects still open.
+ */
if(f->shared->fc_degree == H5F_CLOSE_SEMI) {
unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */
unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */
@@ -2095,32 +1998,33 @@ H5F__close_cb(H5F_t *f)
/* If there are no other file IDs open on this file/mount hier., but
* there are still open objects, issue an error and bail out now,
* without decrementing the file ID's reference count and triggering
- * a "real" attempt at closing the file */
+ * a "real" attempt at closing the file.
+ */
if(nopen_files == 1 && nopen_objs > 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open")
- } /* end if */
+ }
/* Reset the file ID for this file */
- f->file_id = -1;
+ f->id_exists = FALSE;
/* Attempt to close the file/mount hierarchy */
if(H5F_try_close(f, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5F__close_cb() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__close() */
/*-------------------------------------------------------------------------
- * Function: H5F_try_close
+ * Function: H5F_try_close
*
- * Purpose: Attempts to close a file due to one of several actions:
- * - The reference count on the file ID dropped to zero
- * - The last open object was closed in the file
- * - The file was unmounted
+ * Purpose: Attempts to close a file due to one of several actions:
+ * - The reference count on the file ID dropped to zero
+ * - The last open object was closed in the file
+ * - The file was unmounted
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -2151,7 +2055,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
if(was_closed)
*was_closed = TRUE;
HGOTO_DONE(SUCCEED)
- } /* end if */
+ }
/* Get the number of open objects and open files on this file/mount hierarchy */
if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0)
@@ -2185,7 +2089,8 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
HGOTO_DONE(SUCCEED)
/* Sanity check: If close degree if "semi" and we have gotten this
- * far and there are objects left open, bail out now */
+ * far and there are objects left open, bail out now.
+ */
HDassert(nopen_files == 0 && nopen_objs == 0);
/* If we've gotten this far (ie. there are no open objects in the file), fall through to flush & close */
@@ -2226,9 +2131,9 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
for(u = 0; u < obj_count; u++)
if(H5I_dec_ref(objs[u]) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
- } /* end while */
+ }
if(result < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)")
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)")
/* Get the list of IDs of open named datatype objects */
/* (Do this separately from the dataset & attribute IDs, because
@@ -2242,7 +2147,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
for(u = 0; u < obj_count; u++)
if(H5I_dec_ref(objs[u]) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
- } /* end while */
+ }
if(result < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)")
} /* end if */
@@ -2261,17 +2166,18 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
/* If there is more than one reference to the shared file struct and the
* file has an external file cache, we should see if it can be closed. This
- * can happen if a cycle is formed with external file caches */
+ * can happen if a cycle is formed with external file caches.
+ */
if(f->shared->efc && (f->shared->nrefs > 1))
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). */
+ * (unless it will have been flushed in H5F__dest anyways).
+ */
- /*
- * Destroy the H5F_t struct and decrement the reference count for the
+ /* Destroy the H5F_t struct and decrement the reference count for the
* shared H5F_file_t struct. If the reference count for the H5F_file_t
* struct reaches zero then destroy it also.
*/
@@ -2285,18 +2191,57 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_try_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F__reopen
+ *
+ * Purpose: Reopen a file. The new file handle which is returned points
+ * to the same file as the specified file handle. Both handles
+ * share caches and other information. The only difference
+ * between the handles is that the new handle is not mounted
+ * anywhere and no files are mounted on it.
+ *
+ * Return: Success: A pointer to a file struct
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_t *
+H5F__reopen(H5F_t *f)
+{
+ H5F_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get a new "top level" file struct, sharing the same "low level" file struct */
+ if(NULL == (ret_value = H5F__new(f->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to reopen file")
+
+ /* Duplicate old file's names */
+ ret_value->open_name = H5MM_xstrdup(f->open_name);
+ ret_value->actual_name = H5MM_xstrdup(f->actual_name);
+ ret_value->extpath = H5MM_xstrdup(f->extpath);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__reopen() */
+
/*-------------------------------------------------------------------------
- * Function: H5F_get_id
+ * Function: H5F_get_id
*
- * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
- * appropriate.
+ * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
+ * appropriate.
+ *
+ * Return: Success: An ID for a file
+ *
+ * Failure: H5I_INVALID_HID
*
- * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
hid_t
-H5F_get_id(H5F_t *file, hbool_t app_ref)
+H5F_get_id(H5F_t *file)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -2304,31 +2249,30 @@ H5F_get_id(H5F_t *file, hbool_t app_ref)
HDassert(file);
- if(file->file_id == -1) {
- /* Get an atom for the file */
- if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
- }
+ if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) {
+ /* resurrect the ID - Register an ID with the native connector */
+ if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ file->id_exists = TRUE;
+ } /* end if */
else {
- /* Increment reference count on atom. */
- if(H5I_inc_ref(file->file_id, app_ref) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
+ /* Increment reference count on existing ID */
+ if(H5I_inc_ref(ret_value, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed")
} /* end else */
- ret_value = file->file_id;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_id() */
/*-------------------------------------------------------------------------
- * Function: H5F_incr_nopen_objs
+ * Function: H5F_incr_nopen_objs
*
- * Purpose: Increment the number of open objects for a file.
+ * Purpose: Increment the number of open objects for a file.
*
- * Return: Success: The number of open objects, after the increment
- * Failure: (can't happen)
+ * Return: Success: The number of open objects, after the increment
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -2344,12 +2288,12 @@ H5F_incr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_decr_nopen_objs
+ * Function: H5F_decr_nopen_objs
*
- * Purpose: Decrement the number of open objects for a file.
+ * Purpose: Decrement the number of open objects for a file.
*
- * Return: Success: The number of open objects, after the decrement
- * Failure: (can't happen)
+ * Return: Success: The number of open objects, after the decrement
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -2365,28 +2309,27 @@ H5F_decr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_build_actual_name
+ * Function: H5F__build_actual_name
*
- * Purpose: Retrieve the name of a file, after following symlinks, etc.
+ * Purpose: Retrieve the name of a file, after following symlinks, etc.
*
- * Note: Currently only working for "POSIX I/O compatible" VFDs
+ * Note: Currently only working for "POSIX I/O compatible" VFDs
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name,
+H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name,
char **actual_name/*out*/)
{
- hid_t new_fapl_id = -1; /* ID for duplicated FAPL */
+ hid_t new_fapl_id = H5I_INVALID_HID; /* ID for duplicated FAPL */
#ifdef H5_HAVE_SYMLINK
/* This has to be declared here to avoid unfreed resources on errors */
char *realname = NULL; /* Fully resolved path name of file */
#endif /* H5_HAVE_SYMLINK */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -2483,17 +2426,17 @@ done:
#endif /* H5_HAVE_SYMLINK */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_build_actual_name() */
+} /* H5F__build_actual_name() */
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode_len
+ * Function: H5F_addr_encode_len
*
- * Purpose: Encodes an address into the buffer pointed to by *PP and
- * then increments the pointer to the first byte after the
- * address. An undefined value is stored as all 1's.
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2524,13 +2467,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode
+ * Function: H5F_addr_encode
*
- * Purpose: Encodes an address into the buffer pointed to by *PP and
- * then increments the pointer to the first byte after the
- * address. An undefined value is stored as all 1's.
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2548,16 +2491,16 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode_len
+ * Function: H5F_addr_decode_len
*
- * Purpose: Decodes an address from the buffer pointed to by *PP and
- * updates the pointer to point to the next byte after the
- * address.
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
*
- * If the value read is all 1's then the address is returned
- * with an undefined value.
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2612,16 +2555,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode
+ * Function: H5F_addr_decode
*
- * Purpose: Decodes an address from the buffer pointed to by *PP and
- * updates the pointer to point to the next byte after the
- * address.
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
*
- * If the value read is all 1's then the address is returned
- * with an undefined value.
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2643,8 +2586,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
*
* Purpose: Set the grp_btree_shared field with a valid ref-count pointer.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2669,8 +2611,7 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc)
*
* Purpose: Set the sohm_addr field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2694,8 +2635,7 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr)
*
* Purpose: Set the sohm_vers field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2719,8 +2659,7 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers)
*
* Purpose: Set the sohm_nindexes field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2744,8 +2683,7 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes)
*
* Purpose: Set the store_msg_crt_idx field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -2765,14 +2703,14 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
/*-------------------------------------------------------------------------
- * Function: H5F_set_libver_bounds()
+ * Function: H5F__set_libver_bounds()
*
* Purpose: Set the file's low and high bound to the input parameters
* 'low' and 'high' respectively.
* This is done only if the existing setting is different
* from the inputs.
*
- * Return: SUCCEED on success, and FAIL on failure.
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi; December 2017
*
@@ -2783,7 +2721,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(f);
@@ -2811,49 +2749,17 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high)
*
* QAK - April, 2018
*/
- if(H5F__flush_real(f) < 0)
+ if(H5F__flush(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Set the new bounds */
f->shared->low_bound = low;
f->shared->high_bound = high;
- } /* end if */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_set_libver_bounds() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F__get_freespace
- *
- * Purpose: Private version of H5Fget_freespace
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F__get_freespace(H5F_t *f, hsize_t *tot_space)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
-
- /* Go get the actual amount of free space in the file */
- if(H5MF_get_freespace(f, tot_space, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5F__get_freespace() */
+} /* H5F__set_libver_bounds() */
/*-------------------------------------------------------------------------
@@ -2861,11 +2767,8 @@ done:
*
* Purpose: Private version of H5Fget_file_image
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Bytes copied / number of bytes needed.
- * Failure: negative value
+ * Failure: -1
*-------------------------------------------------------------------------
*/
ssize_t
@@ -2875,14 +2778,14 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
haddr_t eoa; /* End of file address */
ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
if(!file || !file->shared || !file->shared->lf)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "file_id yields invalid file pointer")
fd_ptr = file->shared->lf;
if(!fd_ptr->cls)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "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
@@ -2903,7 +2806,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, FAIL, "Not supported for multi file driver.")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "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
@@ -2925,11 +2828,11 @@ 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, FAIL, "Not supported for family file driver.")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "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, FAIL, "unable to get file size")
+ 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;
@@ -2942,14 +2845,14 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
/* Check for buffer too small */
if((haddr_t)buf_len < eoa)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "supplied buffer too small")
space_needed = (size_t)eoa;
/* 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, FAIL, "file image read request failed")
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, (-1), "file image read request failed")
/* Offset to "status_flags" in the superblock */
tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers);
@@ -2962,7 +2865,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
} /* end if */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__get_file_image() */
@@ -2971,9 +2874,6 @@ done:
*
* Purpose: Private version of H5Fget_info
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: SUCCEED
* Failure: FAIL
*-------------------------------------------------------------------------
@@ -2983,7 +2883,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -3012,21 +2912,20 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo)
finfo->free.version = HDF5_FREESPACE_VERSION;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__get_info() */
/*-------------------------------------------------------------------------
- * Function: H5F_track_metadata_read_retries
+ * Function: H5F_track_metadata_read_retries
*
- * Purpose: To track the # of a "retries" (log10) for a metadata item.
- * This routine should be used only when:
- * "retries" > 0
- * f->shared->read_attempts > 1 (does not have retry when 1)
- * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts)
+ * Purpose: To track the # of a "retries" (log10) for a metadata item.
+ * This routine should be used only when:
+ * "retries" > 0
+ * f->shared->read_attempts > 1 (does not have retry when 1)
+ * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts)
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -3065,14 +2964,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_set_retries
+ * Function: H5F_set_retries
*
- * Purpose: To initialize data structures for read retries:
- * --zero out "retries"
- * --set up "retries_nbins" based on read_attempts
+ * Purpose: To initialize data structures for read retries:
+ * --zero out "retries"
+ * --set up "retries_nbins" based on read_attempts
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -3101,39 +2999,6 @@ H5F_set_retries(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F__get_free_sections
- *
- * Purpose: Private version of H5Fget_free_sections
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: non-negative, the total # of free space sections
- * Failure: negative
- *-------------------------------------------------------------------------
- */
-ssize_t
-H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects,
- H5F_sect_info_t *sect_info)
-{
- ssize_t ret_value = -1; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
-
- /* Go get the actual amount of free space in the file */
- if((ret_value = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space sections for file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5F__get_free_sections() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_object_flush_cb
*
* Purpose: To invoke the callback function for object flush that is set
@@ -3209,6 +3074,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr)
HDassert(f->shared);
/* Dispatch to driver */
+ /* (H5FD_set_eoa() will add base_addr to addr) */
if(H5FD_set_eoa(f->shared->lf, type, addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
@@ -3246,11 +3112,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__get_max_eof_eoa
+ * Function: H5F__get_max_eof_eoa
*
- * Purpose: Determine the maximum of (EOA, EOF) for the file
+ * Purpose: Determine the maximum of (EOA, EOF) for the file
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -3289,8 +3155,7 @@ done:
*
* Purpose: Set the coll_md_read field with a new value.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
void
@@ -3310,7 +3175,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
/*-------------------------------------------------------------------------
- * Function: H5F__get_metadata_read_retry_info
+ * Function: H5F_get_metadata_read_retry_info
*
* Purpose: Private function to retrieve the collection of read retries
* for metadata items with checksum.
@@ -3320,13 +3185,13 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
*-------------------------------------------------------------------------
*/
herr_t
-H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
+H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
{
unsigned i, j; /* Local index variable */
size_t tot_size; /* Size of each retries[i] */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(file);
@@ -3339,7 +3204,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
HDmemset(info->retries, 0, sizeof(info->retries));
/* Return if there are no bins -- no retries */
- if (!info->nbins)
+ if(!info->nbins)
HGOTO_DONE(SUCCEED);
/* Calculate size for each retries[i] */
@@ -3347,7 +3212,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
/* Map and copy information to info's retries for metadata items with tracking for read retries */
j = 0;
- for (i = 0; i < H5AC_NTYPES; i++) {
+ for(i = 0; i < H5AC_NTYPES; i++) {
switch (i) {
case H5AC_OHDR_ID:
case H5AC_OHDR_CHK_ID:
@@ -3371,13 +3236,13 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
case H5AC_FARRAY_DBLK_PAGE_ID:
case H5AC_SUPERBLOCK_ID:
HDassert(j < H5F_NUM_METADATA_READ_RETRY_TYPES);
- if (file->shared->retries[i] != NULL) {
+ if(file->shared->retries[i] != NULL) {
/* Allocate memory for retries[i]
*
* This memory should be released by the user with
* the H5free_memory() call.
*/
- if (NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size)))
+ if(NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the information */
@@ -3395,8 +3260,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__get_metadata_read_retry_info() */
-
+} /* end H5F_get_metadata_read_retry_info() */
/*-------------------------------------------------------------------------
@@ -3423,17 +3287,14 @@ done:
* --disallow named datatype with/without attributes
* --disallow opened attributes attached to objects
*
- * Note: Currently, only opened groups and datasets are allowed
+ * NOTE: Currently, only opened groups and datasets are allowed
* when enabling SWMR via H5Fstart_swmr_write().
* Will later implement a different approach--
* set up flush dependency/proxy even for file opened without
* SWMR to resolve issues with opened objects.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
+ * Return: SUCCEED/FAIL
*
- * Return: Success: SUCCEED
- * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -3449,9 +3310,10 @@ H5F__start_swmr_write(H5F_t *f)
H5G_name_t *obj_paths = NULL; /* Group hierarchy path */
size_t u; /* Local index variable */
hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */
+ H5VL_t *vol_connector = NULL; /* VOL connector for the file */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -3484,20 +3346,20 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension")
/* Flush data buffers */
- if(H5F__flush_real(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information")
+ if(H5F__flush(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Get the # of opened named datatypes and attributes */
- if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
- if(nt_attr_count)
+ if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+ if(nt_attr_count > 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file")
/* Get the # of opened datasets and groups */
- if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+ if(H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
- if(grp_dset_count) {
+ if(grp_dset_count > 0) {
/* Allocate space for group and object locations */
if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL)
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t")
@@ -3512,7 +3374,20 @@ H5F__start_swmr_write(H5F_t *f)
if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed")
- /* Refresh opened objects (groups, datasets) in the file */
+ /* Save the VOL connector and the object wrapping context for the refresh step */
+ if(grp_dset_count > 0) {
+ H5VL_object_t *vol_obj;
+
+ /* Get the VOL object for one of the IDs */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0])))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Get the (top) connector for the ID */
+ vol_connector = vol_obj->connector;
+ } /* end if */
+
+ /* Gather information about opened objects (groups, datasets) in the file */
+ /* (For refresh later on) */
for(u = 0; u < grp_dset_count; u++) {
H5O_loc_t *oloc; /* object location */
H5G_loc_t tmp_loc;
@@ -3574,7 +3449,7 @@ H5F__start_swmr_write(H5F_t *f)
/* Refresh (reopen) the objects (groups & datasets) in the file */
for(u = 0; u < grp_dset_count; u++)
- if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], TRUE) < 0)
+ if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object")
/* Unlock the file */
@@ -3583,7 +3458,6 @@ H5F__start_swmr_write(H5F_t *f)
done:
if(ret_value < 0 && setup) {
- HDassert(f);
/* Re-enable accumulator */
f->shared->feature_flags |= (unsigned)H5FD_FEAT_ACCUMULATE_METADATA;
@@ -3598,7 +3472,7 @@ done:
/* Un-set H5F_ACC_SWMR_WRITE in shared open flags */
f->shared->flags &= ~H5F_ACC_SWMR_WRITE;
- /* Unmark the f: not in SWMR writing mode */
+ /* Unmark the file: not in SWMR writing mode */
f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS);
/* Mark superblock as dirty */
@@ -3620,8 +3494,8 @@ done:
if(obj_paths)
H5MM_xfree(obj_paths);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5F__start_swmr_write() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__start_swmr_write() */
/*-------------------------------------------------------------------------
@@ -3629,9 +3503,6 @@ done:
*
* Purpose: Private version of H5Fformat_convert
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: SUCCEED
* Failure: FAIL
*-------------------------------------------------------------------------
@@ -3642,7 +3513,7 @@ H5F__format_convert(H5F_t *f)
hbool_t mark_dirty = FALSE; /* Whether to mark the file's superblock dirty */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -3650,41 +3521,217 @@ H5F__format_convert(H5F_t *f)
/* Check if the superblock should be downgraded */
if(f->shared->sblock->super_vers > HDF5_SUPERBLOCK_VERSION_V18_LATEST) {
- f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST;
- mark_dirty = TRUE;
- } /* end if */
+ f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST;
+ mark_dirty = TRUE;
+ }
/* Check for persistent freespace manager, which needs to be downgraded */
if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF &&
f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF &&
f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF &&
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) {
- /* Check to remove free-space manager info message from superblock extension */
- if(H5F_addr_defined(f->shared->sblock->ext_addr))
- if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension")
-
- /* Close freespace manager */
- if(H5MF_try_close(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address")
-
- /* Set non-persistent freespace manager */
- f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF;
- f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF;
- f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
- f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
-
- /* Indicate that the superblock should be marked dirty */
- mark_dirty = TRUE;
+
+ /* Check to remove free-space manager info message from superblock extension */
+ if(H5F_addr_defined(f->shared->sblock->ext_addr))
+ if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension")
+
+ /* Close freespace manager */
+ if(H5MF_try_close(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address")
+
+ /* Set non-persistent freespace manager */
+ f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF;
+ f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF;
+ f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
+ f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
+
+ /* Indicate that the superblock should be marked dirty */
+ mark_dirty = TRUE;
} /* end if */
/* Check if we should mark the superblock dirty */
if(mark_dirty)
- /* Mark superblock as dirty */
- if(H5F_super_dirty(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
+ /* Mark superblock as dirty */
+ if(H5F_super_dirty(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__format_convert() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5F__get_file
+ *
+ * Purpose: Utility routine to get file struct for an object
+ *
+ * Returns: SUCCESS: A pointer to the H5F_t struct for the file
+ * associated with the object.
+ * FAILURE: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+H5F_t *
+H5F__get_file(void *obj, H5I_type_t type)
+{
+ H5F_t *ret_value = NULL; /* File pointer */
+ H5O_loc_t *oloc = NULL; /* Object location for ID */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(type) {
+ case H5I_FILE:
+ ret_value = (H5F_t *)obj;
+ break;
+
+ case H5I_GROUP:
+ oloc = H5G_oloc((H5G_t *)obj);
+ break;
+
+ case H5I_DATATYPE:
+ oloc = H5T_oloc((H5T_t *)obj);
+ break;
+
+ case H5I_DATASET:
+ oloc = H5D_oloc((H5D_t *)obj);
+ break;
+
+ case H5I_ATTR:
+ oloc = H5A_oloc((H5A_t *)obj);
+ break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_DATASPACE:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+ } /* end switch */
+
+ /* Set return value for objects (not files) */
+ if(oloc)
+ ret_value = oloc->file;
+
+ /* Couldn't find a file struct */
+ if(!ret_value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F__get_file */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F__get_file_id
+ *
+ * Purpose: The package version of H5Iget_file_id(), obtains the file
+ * ID given an object ID.
+ *
+ * Return: Success: The file ID associated with the object
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5F__get_file_id(H5F_t *file)
+{
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check if the file's ID already exists */
+ if(H5I_find_id(file, H5I_FILE, &file_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed")
+
+ /* If the ID does not exist, register it with the VOL connector */
+ if(H5I_INVALID_HID == file_id) {
+ if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ file->id_exists = TRUE;
+ } /* end if */
+ else {
+ /* Increment ref count on existing ID */
+ if(H5I_inc_ref(file_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
+ } /* end else */
+
+ /* Set return value */
+ ret_value = file_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__get_file_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_file_id
+ *
+ * Purpose: The private version of H5Iget_file_id(), obtains the file
+ * ID given an object ID.
+ *
+ * Return: Success: The file ID associated with the object
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5F_get_file_id(hid_t obj_id, H5I_type_t type)
+{
+ H5VL_object_t *vol_obj; /* File info */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Get the object pointer */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
+
+ /* Get the file through the VOL */
+ if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_ID, type, &file_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID")
+ if(H5I_INVALID_HID == file_id)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL")
+
+ /* Set return value */
+ ret_value = file_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_get_file_id() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_min_dset_ohdr
+ *
+ * Purpose: Set the crt_dset_ohdr_flag field with a new value.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+
+ f->shared->crt_dset_min_ohdr_flag = minimize;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_min_dset_ohdr() */
+
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 830b7ee..69e6bb2 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -92,8 +92,7 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- void *buf/*out*/)
+H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/)
{
H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
@@ -138,8 +137,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- const void *buf)
+H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf)
{
H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 4cd1edf..d7f8915 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -24,6 +24,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* PRIVATE PROTOTYPES */
static void H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
@@ -112,7 +113,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_VOL
+ FUNC_ENTER_PACKAGE
HDassert(loc);
HDassert(name && *name);
@@ -132,7 +133,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
*/
if(child->parent)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted")
- if(H5G_loc_find(loc, name, &mp_loc/*out*/) < 0)
+ if(H5G_loc_find(loc, name, &mp_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
/* If the mount location is holding its file open, that file will close
* and remove the mount as soon as we exit this function. Prevent the
@@ -240,7 +241,7 @@ done:
}
}
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__mount() */
@@ -277,7 +278,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_VOL
+ FUNC_ENTER_PACKAGE
HDassert(loc);
HDassert(name && *name);
@@ -390,7 +391,7 @@ done:
if(mp_loc_setup)
H5G_loc_free(&mp_loc);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__unmount() */
@@ -438,8 +439,8 @@ H5F_is_mount(const H5F_t *file)
herr_t
H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
{
- H5G_loc_t loc; /* Parent location */
- H5F_t *child = NULL; /* Child object */
+ 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 */
@@ -462,22 +463,26 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
plist_id = H5P_FILE_MOUNT_DEFAULT;
else
if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a property list ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Get the location object */
- if(H5G_loc(loc_id, &loc) < 0)
+ if(NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
/* Get the child object */
- if(NULL == (child = (H5F_t *)H5I_object_verify(child_id, H5I_FILE)))
+ if(NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object")
+ /* Check if both objects are associated with the same VOL connector */
+ if(loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector")
+
/* Perform the mount operation */
- if(H5F__mount(&loc, name, child, plist_id) < 0)
+ if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
done:
@@ -504,7 +509,7 @@ done:
herr_t
H5Funmount(hid_t loc_id, const char *name)
{
- H5G_loc_t loc; /* Parent location */
+ H5VL_object_t *vol_obj = NULL; /* Parent object */
H5I_type_t loc_type; /* ID type of location */
herr_t ret_value = SUCCEED; /* Return value */
@@ -525,11 +530,11 @@ 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(H5G_loc(loc_id, &loc) < 0)
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
/* Perform the unmount operation */
- if(H5F__unmount(&loc, name) < 0)
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
done:
@@ -563,7 +568,7 @@ H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_ob
HDassert(nopen_objs);
/* If this file is still open, increment number of file IDs open */
- if(f->file_id > 0)
+ if(H5F_ID_EXISTS(f))
*nopen_files += 1;
/* Increment number of open objects in file
@@ -651,7 +656,7 @@ H5F_flush_mounts_recurse(H5F_t *f)
nerrors++;
/* Call the "real" flush routine, for this file */
- if(H5F__flush_real(f) < 0)
+ if(H5F__flush(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Check flush errors for children - errors are already on the stack */
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index f854d3b..6ddbfbb 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -231,7 +231,7 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
H5TRACE2("e", "ib", file_id, flag);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Check VFD */
@@ -271,7 +271,7 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag)
H5TRACE2("e", "i*b", file_id, flag);
/* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Check VFD */
@@ -320,11 +320,11 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
attached to the loc_id */
if(H5I_INVALID_HID != loc_id) {
H5G_loc_t loc;
- H5F_t *f;
+ H5F_t *f = NULL;
/* Retrieve the file structure */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
f = loc.oloc->file;
HDassert(f);
@@ -333,8 +333,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
/* retrieve the file communicator */
if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator")
- } /* end if */
- } /* end if */
+ }
+ }
/* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */
else {
H5P_genplist_t *plist; /* Property list pointer */
@@ -349,8 +349,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad VFL driver info")
*mpi_comm = fa->comm;
- } /* end if */
- } /* end else */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index edbd460..266ae6e 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -30,11 +30,12 @@
#include "H5Fprivate.h"
/* Other public headers needed by this file */
-#include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */
+#include "H5VLpublic.h" /* Virtual Object Layer */
/* Other private headers needed by this file */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Bprivate.h" /* B-trees */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5FSprivate.h" /* File free space */
@@ -291,7 +292,7 @@ struct H5F_file_t {
/* begin on file access/create */
char *mdc_log_location; /* location of mdc log */
hid_t fcpl_id; /* File creation property list ID */
- H5F_close_degree_t fc_degree; /* File close behavior degree */
+ H5F_close_degree_t fc_degree; /* File close behavior degree */
hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */
size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */
size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */
@@ -309,6 +310,10 @@ struct H5F_file_t {
H5FO_t *open_objs; /* Open objects in file */
H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
+ /* Cached VOL connector ID & info */
+ hid_t vol_id; /* ID of VOL connector for the container */
+ void *vol_info; /* Copy of VOL connector info for container */
+
/* File space allocation information */
H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
hsize_t fs_threshold; /* Free space section threshold */
@@ -325,7 +330,7 @@ struct H5F_file_t {
/* been used accessed for either */
/* allocation or deallocation */
/* since file open. */
- haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
+ haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
/* for self referential FSMs */
haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */
/* for self referential FSMs */
@@ -368,7 +373,7 @@ struct H5F_t {
H5F_file_t *shared; /* The shared file info */
unsigned nopen_objs; /* Number of open object headers */
H5FO_t *obj_count; /* # of time each object is opened through top file structure */
- hid_t file_id; /* ID of this file */
+ hbool_t id_exists; /* Whether an ID for this struct exists */
hbool_t closing; /* File is in the process of being closed */
struct H5F_t *parent; /* Parent file that this file is mounted to */
unsigned nmounts; /* Number of children mounted to this file */
@@ -378,6 +383,36 @@ struct H5F_t {
#endif /* H5_HAVE_PARALLEL */
};
+/* types for file optional VOL operations */
+typedef enum H5VL_file_optional_t {
+ H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */
+ H5VL_FILE_GET_FILE_IMAGE, /* file image */
+ H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */
+ H5VL_FILE_GET_FREE_SPACE, /* file freespace */
+ H5VL_FILE_GET_INFO, /* file info */
+ H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */
+ H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */
+ H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */
+ H5VL_FILE_GET_SIZE, /* file size */
+ H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */
+ H5VL_FILE_GET_FILE_ID, /* retrieve or resurrect file ID of object */
+ H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */
+ H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */
+ H5VL_FILE_GET_METADATA_READ_RETRY_INFO,
+ H5VL_FILE_START_SWMR_WRITE,
+ H5VL_FILE_START_MDC_LOGGING,
+ H5VL_FILE_STOP_MDC_LOGGING,
+ H5VL_FILE_GET_MDC_LOGGING_STATUS,
+ H5VL_FILE_FORMAT_CONVERT,
+ H5VL_FILE_RESET_PAGE_BUFFERING_STATS,
+ H5VL_FILE_GET_PAGE_BUFFERING_STATS,
+ H5VL_FILE_GET_MDC_IMAGE_INFO,
+ H5VL_FILE_GET_EOA,
+ H5VL_FILE_INCR_FILESIZE,
+ H5VL_FILE_SET_LIBVER_BOUNDS,
+ H5VL_FILE_SET_MIN_DSET_OHDR_FLAG
+} H5VL_file_optional_t;
+
/*****************************/
/* Package Private Variables */
@@ -395,24 +430,19 @@ H5FL_EXTERN(H5F_file_t);
/******************************/
/* General routines */
-H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
+H5_DLL H5F_t *H5F__reopen(H5F_t *f);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
-H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
-H5_DLL H5F_t *H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
-H5_DLL herr_t H5F__flush(H5F_t *f, H5F_scope_t scope);
-H5_DLL herr_t H5F__flush_real(H5F_t *f);
-H5_DLL htri_t H5F__is_hdf5(const char *name);
-H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
-H5_DLL herr_t H5F__get_freespace(H5F_t *f, hsize_t *tot_space);
+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 ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info);
-H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info);
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(hid_t file_id);
-H5_DLL herr_t H5F__close_cb(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 H5F_t *H5F__get_file(void *obj, H5I_type_t type);
+H5_DLL hid_t H5F__get_file_id(H5F_t *file);
+H5_DLL herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info);
/* File mount related routines */
H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
@@ -427,7 +457,7 @@ H5_DLL herr_t H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_
H5_DLL herr_t H5F__super_free(H5F_super_t *sblock);
/* Superblock extension related routines */
-H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
+H5_DLL herr_t H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags);
H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id);
H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created);
@@ -440,9 +470,9 @@ H5_DLL herr_t H5F__accum_flush(H5F_t *f);
H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush);
/* Shared file list related routines */
-H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared);
-H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf);
-H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared);
+H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared);
+H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf);
+H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared);
/* External file cache routines */
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);
@@ -468,10 +498,11 @@ H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f);
/* Testing functions */
#ifdef H5F_TESTING
-H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count);
-H5_DLL herr_t H5F_check_cached_stab_test(hid_t file_id);
-H5_DLL herr_t H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr);
-H5_DLL herr_t H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr);
+H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count);
+H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id);
+H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr);
+H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr);
+H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2);
#endif /* H5F_TESTING */
#endif /* _H5Fpkg_H */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 5d0c11a..f728200 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -286,7 +286,7 @@ typedef struct H5F_t H5F_t;
#define H5F_NOPEN_OBJS(F) ((F)->nopen_objs)
#define H5F_INCR_NOPEN_OBJS(F) ((F)->nopen_objs++)
#define H5F_DECR_NOPEN_OBJS(F) ((F)->nopen_objs--)
-#define H5F_FILE_ID(F) ((F)->file_id)
+#define H5F_ID_EXISTS(F) ((F)->id_exists)
#define H5F_PARENT(F) ((F)->parent)
#define H5F_NMOUNTS(F) ((F)->nmounts)
#define H5F_GET_READ_ATTEMPTS(F) ((F)->shared->read_attempts)
@@ -332,6 +332,7 @@ typedef struct H5F_t H5F_t;
#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc)
#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc)
#define H5F_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag)
+#define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V))
#else /* H5F_MODULE */
#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
@@ -344,7 +345,7 @@ typedef struct H5F_t H5F_t;
#define H5F_NOPEN_OBJS(F) (H5F_get_nopen_objs(F))
#define H5F_INCR_NOPEN_OBJS(F) (H5F_incr_nopen_objs(F))
#define H5F_DECR_NOPEN_OBJS(F) (H5F_decr_nopen_objs(F))
-#define H5F_FILE_ID(F) (H5F_get_file_id(F))
+#define H5F_ID_EXISTS(F) (H5F_file_id_exists(F))
#define H5F_PARENT(F) (H5F_get_parent(F))
#define H5F_NMOUNTS(F) (H5F_get_nmounts(F))
#define H5F_GET_READ_ATTEMPTS(F) (H5F_get_read_attempts(F))
@@ -390,6 +391,7 @@ typedef struct H5F_t H5F_t;
#define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F))
#define H5F_EOA_PRE_FSM_FSALLOC(F) (H5F_get_eoa_pre_fsm_fsalloc(F))
#define H5F_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F))
+#define H5F_SET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr((F), (V)))
#endif /* H5F_MODULE */
@@ -481,10 +483,11 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */
#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */
#define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */
+#define H5F_ACS_VOL_CONN_NAME "vol_connector_info" /* VOL connector ID & info */
#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */
#define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */
-#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */
+#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single" /* Whether to convert family to a single-file driver. (private property only used by h5repart) */
#define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */
#define H5F_ACS_LIBVER_LOW_BOUND_NAME "libver_low_bound" /* 'low' bound of library format versions */
#define H5F_ACS_LIBVER_HIGH_BOUND_NAME "libver_high_bound" /* 'high' bound of library format versions */
@@ -717,7 +720,7 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
-H5_DLL herr_t H5F_start_swmr_write(H5F_t *file);
+H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
@@ -731,12 +734,12 @@ H5_DLL hbool_t H5F_same_shared(const H5F_t *f1, const H5F_t *f2);
H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f);
H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f);
H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f);
-H5_DLL hid_t H5F_get_file_id(const H5F_t *f);
+H5_DLL hbool_t H5F_file_id_exists(const H5F_t *f);
H5_DLL H5F_t *H5F_get_parent(const H5F_t *f);
H5_DLL unsigned H5F_get_nmounts(const H5F_t *f);
H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f);
H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
-H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
+H5_DLL hid_t H5F_get_id(H5F_t *file);
H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f);
@@ -766,7 +769,6 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f);
H5_DLL double H5F_rdcc_w0(const H5F_t *f);
H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f);
H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
-H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
@@ -782,6 +784,7 @@ H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag);
H5_DLL hbool_t H5F_use_mdc_logging(const H5F_t *f);
H5_DLL hbool_t H5F_start_mdc_log_on_access(const H5F_t *f);
H5_DLL char *H5F_mdc_log_location(const H5F_t *f);
+H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize);
/* Functions that retrieve values from VFD layer */
H5_DLL hid_t H5F_get_driver_id(const H5F_t *f);
@@ -802,7 +805,7 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si
/* Functions that flush or evict */
H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag);
-H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t * f, haddr_t tag);
+H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag);
/* Functions that verify a piece of metadata with checksum */
H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s_chksum, uint32_t *c_chksum);
@@ -810,6 +813,7 @@ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s
/* Routine to track the # of retries */
H5_DLL herr_t H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries);
H5_DLL herr_t H5F_set_retries(H5F_t *f);
+H5_DLL herr_t H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info);
/* Routine to invoke callback function upon object flush */
H5_DLL herr_t H5F_object_flush_cb(H5F_t *f, hid_t obj_id);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 6274eb0..e79a147 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -223,7 +223,7 @@ extern "C" {
#endif
/* Functions in H5F.c */
-H5_DLL htri_t H5Fis_hdf5(const char *filename);
+H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags,
hid_t create_plist, hid_t access_plist);
H5_DLL hid_t H5Fopen(const char *filename, unsigned flags,
@@ -305,6 +305,7 @@ typedef struct H5F_info1_t {
/* Function prototypes */
H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo);
H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
+H5_DLL htri_t H5Fis_hdf5(const char *filename);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index e02e402..103ad3b 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -277,23 +277,23 @@ H5F_get_nopen_objs(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_file_id
+ * Function: H5F_file_id_exists
*
- * Purpose: Retrieve the file's 'file_id' value
+ * Purpose: Determines if a file ID exists for this file struct
*
- * Return: 'file_id' on success/abort on failure (shouldn't fail)
+ * Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
-hid_t
-H5F_get_file_id(const H5F_t *f)
+hbool_t
+H5F_file_id_exists(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
- FUNC_LEAVE_NOAPI(f->file_id)
-} /* end H5F_get_file_id() */
+ FUNC_LEAVE_NOAPI(f->id_exists)
+} /* end H5F_file_id_exists() */
/*-------------------------------------------------------------------------
@@ -923,7 +923,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type)
/* Dispatch to driver */
if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
index e0c830b..ebc2ab2 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -40,11 +40,11 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL;
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_assert_num
+ * Function: H5F_sfile_assert_num
*
- * Purpose: Sanity checking that shared file list is empty
+ * Purpose: Sanity checking that shared file list is empty
*
- * Return: none (void)
+ * Return: void
*
* Programmer: Quincey Koziol
* Monday, July 25, 2005
@@ -84,33 +84,31 @@ H5F_sfile_assert_num(unsigned n)
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_add
+ * Function: H5F__sfile_add
*
- * Purpose: Add a "shared" file struct to the list of open files
+ * Purpose: Add a "shared" file struct to the list of open files
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5F_sfile_add(H5F_file_t *shared)
+H5F__sfile_add(H5F_file_t *shared)
{
H5F_sfile_node_t *new_shared; /* New shared file node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
/* Allocate new shared file node */
if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Set shared file value */
new_shared->shared = shared;
@@ -121,31 +119,29 @@ H5F_sfile_add(H5F_file_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_add() */
+} /* end H5F__sfile_add() */
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_search
+ * Function: H5F__sfile_search
*
- * Purpose: Search for a "shared" file with low-level file info that
+ * Purpose: Search for a "shared" file with low-level file info that
* matches
*
- * Return: Non-NULL on success / NULL on failure
+ * Return: Non-NULL on success / NULL on failure
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5F_file_t *
-H5F_sfile_search(H5FD_t *lf)
+H5F__sfile_search(H5FD_t *lf)
{
H5F_sfile_node_t *curr; /* Current shared file node */
H5F_file_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(lf);
@@ -154,7 +150,7 @@ H5F_sfile_search(H5FD_t *lf)
curr = H5F_sfile_head_g;
while(curr) {
/* Check for match */
- if(0==H5FD_cmp(curr->shared->lf, lf))
+ if(0 == H5FD_cmp(curr->shared->lf, lf))
HGOTO_DONE(curr->shared)
/* Advance to next shared file node */
@@ -163,31 +159,29 @@ H5F_sfile_search(H5FD_t *lf)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_search() */
+} /* end H5F__sfile_search() */
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_remove
+ * Function: H5F__sfile_remove
*
- * Purpose: Remove a "shared" file struct from the list of open files
+ * Purpose: Remove a "shared" file struct from the list of open files
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, July 18, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5F_sfile_remove(H5F_file_t *shared)
+H5F__sfile_remove(H5F_file_t *shared)
{
H5F_sfile_node_t *curr; /* Current shared file node */
H5F_sfile_node_t *last; /* Last shared file node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
@@ -203,7 +197,7 @@ H5F_sfile_remove(H5F_file_t *shared)
/* Indicate error if the node wasn't found */
if(curr == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
+ HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
/* Remove node found from list */
if(last != NULL)
@@ -219,5 +213,5 @@ H5F_sfile_remove(H5F_file_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_remove() */
+} /* end H5F__sfile_remove() */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 9339b3d..489cc21 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -134,7 +134,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_super_ext_open
+ * Function: H5F__super_ext_open
*
* Purpose: Open an existing superblock extension
*
@@ -146,11 +146,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
+H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -168,7 +168,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_super_ext_open() */
+} /* H5F__super_ext_open() */
/*-------------------------------------------------------------------------
@@ -398,7 +398,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
} /* end if */
else {
- /* Locate the signature as per per the serial library */
+ /* Locate the signature as per per the serial library */
#endif /* H5_HAVE_PARALLEL */
if(H5FD_locate_signature(file, &super_addr) < 0)
@@ -705,7 +705,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
} /* end if */
/* Open the superblock extension */
- if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
+ if(H5F__super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
/* Check for the extension having a 'driver info' message */
@@ -836,7 +836,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(!skip_eof_check && !null_fsm_addr) {
HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF));
HDassert(!f->shared->first_alloc_dealloc);
- } /* end if */
+ }
/* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file
* with persistent free space managers, therefore, set
@@ -882,14 +882,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
if(null_fsm_addr) {
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
- } /* end if */
+ }
else {
if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension")
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
- } /* end else */
+ }
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
f->shared->sblock = NULL;
#endif /* JRM */
@@ -962,20 +962,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Write driver info information to the superblock extension */
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
- /* KLUGE ALERT!!
- *
- * H5F__super_ext_write_msg() expects f->shared->sblock to
- * be set -- verify that it is NULL, and then set it.
- * Set it back to NULL when we are done.
- */
- HDassert(f->shared->sblock == NULL);
- f->shared->sblock = sblock;
+ /* KLUGE ALERT!!
+ *
+ * H5F__super_ext_write_msg() expects f->shared->sblock to
+ * be set -- verify that it is NULL, and then set it.
+ * Set it back to NULL when we are done.
+ */
+ HDassert(f->shared->sblock == NULL);
+ f->shared->sblock = sblock;
#endif /* JRM */
- if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
+ if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
- f->shared->sblock = NULL;
+ f->shared->sblock = NULL;
#endif /* JRM */
} /* end if */
@@ -1320,10 +1320,11 @@ H5F__super_init(H5F_t *f)
/* Create the Shared Object Header Message table and register it with
* the metadata cache, if this file supports shared messages.
*/
- if(f->shared->sohm_nindexes > 0)
+ if(f->shared->sohm_nindexes > 0) {
/* Initialize the shared message code & write the SOHM message to the extension */
if(H5SM_init(f, plist, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table")
+ }
/* Check for non-default v1 B-tree 'K' values to store */
if(sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF ||
@@ -1503,9 +1504,10 @@ H5F_eoa_dirty(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty")
} /* end if */
/* If the driver info is stored as a message, update that instead */
- else if(f->shared->drvinfo_sb_msg_exists)
+ else if(f->shared->drvinfo_sb_msg_exists) {
if(H5F__update_super_ext_driver_msg(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty")
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1676,13 +1678,13 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Open/create the superblock extension object header */
if(H5F_addr_defined(f->shared->sblock->ext_addr)) {
- if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
+ if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
} /* end if */
else {
HDassert(may_create);
- if(H5F__super_ext_create(f, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
+ if(H5F__super_ext_create(f, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension")
ext_created = TRUE;
} /* end else */
HDassert(H5F_addr_defined(ext_loc.addr));
@@ -1690,24 +1692,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg,
/* Check if message with ID does not exist in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists")
/* Check for creating vs. writing */
if(may_create) {
if(status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist")
- /* Create the message with ID in the superblock extension */
- if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
+ /* Create the message with ID in the superblock extension */
+ if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header")
} /* end if */
else {
if(!status)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist")
- /* Update the message with ID in the superblock extension */
- if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
+ /* Update the message with ID in the superblock extension */
+ if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header")
} /* end else */
done:
@@ -1757,35 +1759,36 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id)
H5AC_set_ring(H5AC_RING_SBE, &orig_ring);
/* Open superblock extension object header */
- if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
+ if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
ext_opened = TRUE;
/* Check if message with ID exists in the object header */
if((status = H5O_msg_exists(&ext_loc, id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
- else if(status) { /* message exists */
- H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
-
- /* Remove the message */
- if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
-
- /* Get info for the superblock extension's object header */
- if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
-
- /* If the object header is an empty base chunk, remove superblock extension */
- if(hdr_info.nchunks == 1) {
- if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
- else if((unsigned)null_count == hdr_info.nmesgs) {
- HDassert(H5F_addr_defined(ext_loc.addr));
- if(H5O_delete(f, ext_loc.addr) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
- f->shared->sblock->ext_addr = HADDR_UNDEF;
- } /* end if */
- } /* end if */
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
+ else if(status) {
+ /* message exists */
+ H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
+
+ /* Remove the message */
+ if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
+
+ /* Get info for the superblock extension's object header */
+ if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+
+ /* If the object header is an empty base chunk, remove superblock extension */
+ if(hdr_info.nchunks == 1) {
+ if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ else if((unsigned)null_count == hdr_info.nmesgs) {
+ HDassert(H5F_addr_defined(ext_loc.addr));
+ if(H5O_delete(f, ext_loc.addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ f->shared->sblock->ext_addr = HADDR_UNDEF;
+ } /* end else-if */
+ } /* end if */
} /* end if */
done:
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 76866db..361f8a1 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -42,7 +42,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
/****************/
diff --git a/src/H5Ftest.c b/src/H5Ftest.c
index bdecad2..49a2a22 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -26,24 +26,25 @@
/* Module Setup */
/****************/
-#include "H5Fmodule.h" /* This source code file is part of the H5F module */
-#define H5F_TESTING /*suppress warning about H5F testing funcs*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
-#define H5G_TESTING /*suppress warning about H5G testing funcs*/
-#define H5SM_FRIEND /*suppress error about including H5SMpkg */
-#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/
+#include "H5Fmodule.h" /* This source code file is part of the H5F module */
+#define H5F_TESTING /* Suppress warning about H5F testing funcs */
+#define H5G_FRIEND /* Suppress error about including H5Gpkg.h */
+#define H5G_TESTING /* Suppress warning about H5G testing funcs */
+#define H5SM_FRIEND /* Suppress error about including H5SMpkg.h */
+#define H5SM_TESTING /* Suppress warning about H5SM testing funcs */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5SMpkg.h" /* Shared object header messages */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5SMpkg.h" /* Shared object header messages */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -82,31 +83,29 @@
/*-------------------------------------------------------------------------
- * Function: H5F_get_sohm_mesg_count_test
+ * Function: H5F__get_sohm_mesg_count_test
*
* Purpose: Retrieve the number of shared messages of a given type in a file
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * Jan 3, 2007
+ * Programmer: Quincey Koziol
+ * Jan 3, 2007
*
*-------------------------------------------------------------------------
*/
herr_t
-H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id,
- size_t *mesg_count)
+H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_count)
{
- H5F_t *file; /* File info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Push API context */
if(H5CX_push() < 0)
@@ -122,19 +121,18 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_sohm_mesg_count_test() */
+} /* end H5F__get_sohm_mesg_count_test() */
/*-------------------------------------------------------------------------
- * Function: H5F_check_cached_stab_test
+ * Function: H5F__check_cached_stab_test
*
* Purpose: Check that a file's superblock contains a cached symbol
* table entry, that the entry matches that in the root
* group's object header, and check that the addresses are
* valid.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Neil Fortner
* Mar 31, 2009
@@ -142,17 +140,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_check_cached_stab_test(hid_t file_id)
+H5F__check_cached_stab_test(hid_t file_id)
{
- H5F_t *file; /* File info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Push API context */
if(H5CX_push() < 0)
@@ -168,16 +166,15 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_check_cached_stab_test() */
+} /* end H5F__check_cached_stab_test() */
/*-------------------------------------------------------------------------
- * Function: H5F_get_maxaddr_test
+ * Function: H5F__get_maxaddr_test
*
* Purpose: Retrieve the maximum address for a file
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Jun 10, 2009
@@ -185,33 +182,32 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr)
+H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Retrieve maxaddr for file */
*maxaddr = file->shared->maxaddr;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_maxaddr_test() */
+} /* end H5F__get_maxaddr_test() */
/*-------------------------------------------------------------------------
- * Function: H5F_get_sbe_addr_test
+ * Function: H5F__get_sbe_addr_test
*
* Purpose: Retrieve the address of a superblock extension's object header
- * for a file
+ * for a file
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Jul 10, 2016
@@ -219,21 +215,55 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr)
+H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Retrieve maxaddr for file */
*sbe_addr = file->shared->sblock->ext_addr;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_sbe_addr_test() */
+} /* end H5F__get_sbe_addr_test() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F__same_file_test
+ *
+ * Purpose: Check if two file IDs refer to the same underlying file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Oct 13, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5F__same_file_test(hid_t file_id1, hid_t file_id2)
+{
+ H5F_t *file1, *file2; /* File info */
+ htri_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
+ if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+
+ /* If they are using the same underlying "shared" file struct, they are the same file */
+ ret_value = (file1->shared == file2->shared);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__same_file_test() */
diff --git a/src/H5G.c b/src/H5G.c
index fa065fa..20df130 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -14,14 +14,12 @@
/*-------------------------------------------------------------------------
*
* Created: H5G.c
- * Jul 18 1997
- * Robb Matzke <matzke@llnl.gov>
*
* Purpose: Symbol table functions. The functions that begin with
- * `H5G_stab_' don't understand the naming system; they operate
+ * 'H5G_stab_' don't understand the naming system; they operate
* on a single symbol table at a time.
*
- * The functions that begin with `H5G_node_' operate on the leaf
+ * The functions that begin with 'H5G_node_' operate on the leaf
* nodes of a symbol table B-tree. They should be defined in
* the H5Gnode.c file.
*
@@ -42,11 +40,11 @@
* +--------------+----------- +--------------------------------+
* | Location ID | Name | Meaning |
* +--------------+------------+--------------------------------+
- * | File ID | "/foo/bar" | Find `foo' within `bar' within |
+ * | File ID | "/foo/bar" | Find 'foo' within 'bar' within |
* | | | the root group of the specified|
* | | | file. |
* +--------------+------------+--------------------------------+
- * | File ID | "foo/bar" | Find `foo' within `bar' within |
+ * | File ID | "foo/bar" | Find 'foo' within 'bar' within |
* | | | the root group of the specified|
* | | | file. |
* +--------------+------------+--------------------------------+
@@ -56,11 +54,11 @@
* | File ID | "." | The root group of the specified|
* | | | the specified file. |
* +--------------+------------+--------------------------------+
- * | Group ID | "/foo/bar" | Find `foo' within `bar' within |
+ * | Group ID | "/foo/bar" | Find 'foo' within 'bar' within |
* | | | the root group of the file |
* | | | containing the specified group.|
* +--------------+------------+--------------------------------+
- * | Group ID | "foo/bar" | File `foo' within `bar' within |
+ * | Group ID | "foo/bar" | File 'foo' within 'bar' within |
* | | | the specified group. |
* +--------------+------------+--------------------------------+
* | Group ID | "/" | The root group of the file |
@@ -83,13 +81,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -111,6 +109,9 @@
/* Local Prototypes */
/********************/
+/* Group close callback */
+static herr_t H5G__close_cb(H5VL_object_t *grp_vol_obj);
+
/*********************/
/* Package Variables */
@@ -131,10 +132,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Group ID class */
static const H5I_class_t H5I_GROUP_CLS[1] = {{
- H5I_GROUP, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */
+ H5I_GROUP, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
@@ -258,9 +259,41 @@ H5G_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5Gcreate2
+ * Function: H5G__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on the group's ID
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G__close_cb(H5VL_object_t *grp_vol_obj)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(grp_vol_obj);
+
+ /* Close the group */
+ if(H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group")
+
+ /* Free the VOL object */
+ if(H5VL_free_object(grp_vol_obj) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to free VOL object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G__close_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Gcreate2
*
- * Purpose: Creates a new group relative to LOC_ID, giving it the
+ * Purpose: Creates a new group relative to LOC_ID, giving it the
* specified creation property list GCPL_ID and access
* property list GAPL_ID. The link to the new group is
* created with the LCPL_ID.
@@ -272,14 +305,11 @@ H5G_term_package(void)
* hid_t gcpl_id; IN: Property list for group creation
* hid_t gapl_id; IN: Property list for group access
*
- * Return: Success: The object ID of a new, empty group open for
- * writing. Call H5Gclose() when finished with
- * the group.
- *
- * Failure: H5I_INVALID_HID
+ * Return: Success: The object ID of a new, empty group open for
+ * writing. Call H5Gclose() when finished with
+ * the group.
*
- * Programmer: Quincey Koziol
- * April 5, 2007
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
@@ -287,46 +317,64 @@ hid_t
H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
hid_t gapl_id)
{
- H5G_loc_t loc; /* Location to create group */
- H5G_t *grp = NULL; /* New group created */
- hid_t ret_value; /* Return value */
+ void *grp = NULL; /* Structure for new group */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
- /* Get correct property list */
+ /* Check link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link creation property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a link creation property list")
/* Check group creation property list */
if(H5P_DEFAULT == gcpl_id)
gcpl_id = H5P_GROUP_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Create the new group & get its ID */
- if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id)))
+ /* Get the gcpl structure and set the link properties on it */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+ if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id")
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Set the location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Create the group */
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
- if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+
+ /* Get an atom for the group */
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
- if(ret_value < 0)
- if(grp && H5G_close(grp) < 0)
+ if(H5I_INVALID_HID == ret_value)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -334,9 +382,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gcreate_anon
+ * Function: H5Gcreate_anon
*
- * Purpose: Creates a new group relative to LOC_ID, giving it the
+ * Purpose: Creates a new group relative to LOC_ID, giving it the
* specified creation property list GCPL_ID and access
* property list GAPL_ID.
*
@@ -352,37 +400,30 @@ done:
* hid_t gcpl_id; IN: Property list for group creation
* hid_t gapl_id; IN: Property list for group access
*
- * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp"
+ * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp"
* hid_t create_id = H5Pcreate(H5P_GROUP_CREATE);
* int status = H5Pset_create_intermediate_group(create_id, TRUE);
* hid_t gid = H5Gcreate_anon(file_id, "/A/B01/grp", create_id, H5P_DEFAULT);
*
- * Return: Success: The object ID of a new, empty group open for
- * writing. Call H5Gclose() when finished with
- * the group.
+ * Return: Success: The object ID of a new, empty group open for
+ * writing. Call H5Gclose() when finished with
+ * the group.
*
- * Failure: H5I_INVALID_HID
- *
- * Programmer: Peter Cao
- * May 08, 2005
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
{
- H5G_loc_t loc;
- H5G_t *grp = NULL;
- H5G_obj_create_t gcrt_info; /* Information for group creation */
- hid_t ret_value;
+ void *grp = NULL; /* Structure for new group */
+ H5VL_object_t *vol_obj = NULL; /* Object token for loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id);
- /* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
-
/* Check group creation property list */
if(H5P_DEFAULT == gcpl_id)
gcpl_id = H5P_GROUP_CREATE_DEFAULT;
@@ -394,34 +435,26 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- /* Set up group creation info */
- gcrt_info.gcpl_id = gcpl_id;
- gcrt_info.cache_type = H5G_NOTHING_CACHED;
- HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
-
- /* Create the new group & get its ID */
- if(NULL == (grp = H5G__create_anon(loc.oloc->file, &gcrt_info)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
- if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
-done:
- /* Release the group's object header, if it was created */
- if(grp) {
- H5O_loc_t *oloc; /* Object location for group */
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Get the new group's object location */
- if(NULL == (oloc = H5G_oloc(grp)))
- HDONE_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to get object location of group")
+ /* Create the group */
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
- /* Decrement refcount on group's object header in memory */
- if(H5O_dec_rc_by_loc(oloc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on newly created object")
- } /* end if */
+ /* Get an atom for the group */
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
+done:
/* Cleanup on failure */
- if(ret_value < 0)
- if(grp && H5G_close(grp) < 0)
+ if(H5I_INVALID_HID == ret_value)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -429,53 +462,59 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gopen2
+ * Function: H5Gopen2
*
- * Purpose: Opens an existing group for modification. When finished,
- * call H5Gclose() to close it and release resources.
+ * Purpose: Opens an existing group for modification. When finished,
+ * call H5Gclose() to close it and release resources.
*
* This function allows the user the pass in a Group Access
* Property List, which H5Gopen1() does not.
*
- * Return: Success: Object ID of the group.
- * Failure: H5I_INVALID_HID
+ * Return: Success: Object ID of the group
*
- * Programmer: James Laird
- * Thursday, July 27, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
{
- H5G_t *grp = NULL; /* Group opened */
- H5G_loc_t loc; /* Location of parent for group */
- hid_t ret_value; /* Return value */
+ void *grp = NULL; /* Group opened */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, gapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
/* Open the group */
- if(NULL == (grp = H5G__open_name(&loc, name)))
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Register an ID for the group */
- if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
- if(ret_value < 0)
- if(grp && H5G_close(grp) < 0)
+ if(H5I_INVALID_HID == ret_value)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -483,36 +522,34 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_create_plist
- *
- * Purpose: Returns a copy of the group creation property list.
+ * Function: H5Gget_create_plist
*
- * Return: Success: ID for a copy of the group creation
- * property list. The property list ID should be
- * released by calling H5Pclose().
+ * Purpose: Returns a copy of the group creation property list.
*
- * Failure: H5I_INVALID_HID
+ * Return: Success: ID for a copy of the group creation
+ * property list. The property list ID should be
+ * released by calling H5Pclose().
*
- * Programmer: Quincey Koziol
- * Tuesday, October 25, 2005
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Gget_create_plist(hid_t group_id)
{
- H5G_t *group = NULL;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", group_id);
/* Check args */
- if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group")
+ 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")
- if((ret_value = H5G__get_create_plist(group)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
+ /* 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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
done:
FUNC_LEAVE_API(ret_value)
@@ -520,42 +557,41 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_info
- *
- * Purpose: Retrieve information about a group.
+ * Function: H5Gget_info
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Purpose: Retrieve information about a group.
*
- * Programmer: Quincey Koziol
- * November 27 2006
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Gget_info(hid_t grp_id, H5G_info_t *grp_info)
+H5Gget_info(hid_t loc_id, H5G_info_t *group_info)
{
- H5I_type_t id_type; /* Type of ID */
- H5G_loc_t loc; /* Location of group */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj;
+ H5I_type_t id_type; /* Type of ID */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", grp_id, grp_info);
+ H5TRACE2("e", "i*x", loc_id, group_info);
/* Check args */
- id_type = H5I_get_type(grp_id);
+ id_type = H5I_get_type(loc_id);
if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
- if(!grp_info)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID")
+ if(!group_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* Get group location */
- if(H5G_loc(grp_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the group's information */
- if(H5G__get_info(&loc, grp_info/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = id_type;
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
FUNC_LEAVE_API(ret_value)
@@ -563,42 +599,50 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_info_by_name
- *
- * Purpose: Retrieve information about a group.
+ * Function: H5Gget_info_by_name
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Purpose: Retrieve information about a group, where the group is
+ * identified by name instead of ID.
*
- * Programmer: Quincey Koziol
- * November 27 2006
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
+H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*s*xi", loc_id, name, grp_info, lapl_id);
+ H5TRACE4("e", "i*s*xi", loc_id, name, group_info, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(!grp_info)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
+ if(!group_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* 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 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 = lapl_id;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
/* Retrieve the group's information */
- if(H5G__get_info_by_name(&loc, name, grp_info/*out*/) < 0)
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@@ -607,48 +651,58 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_info_by_idx
+ * Function: H5Gget_info_by_idx
*
- * Purpose: Retrieve information about a group, according to the order
+ * Purpose: Retrieve information about a group, according to the order
* of an index.
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 27 2006
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info, hid_t lapl_id)
+ H5_iter_order_t order, hsize_t n, H5G_info_t *group_info, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj;
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, grp_info,
+ H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, group_info,
lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(!grp_info)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!group_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* 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 location parameters */
+ 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;
+ 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);
+
/* Retrieve the group's information */
- if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, grp_info/*out*/) < 0)
+ if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@@ -657,15 +711,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gclose
+ * Function: H5Gclose
*
- * Purpose: Closes the specified group. The group ID will no longer be
- * valid for accessing the group.
+ * Purpose: Closes the specified group. The group ID will no longer be
+ * valid for accessing the group.
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, December 31, 1997
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -678,11 +729,10 @@ H5Gclose(hid_t group_id)
H5TRACE1("e", "i", group_id);
/* Check args */
- if(NULL == H5I_object_verify(group_id,H5I_GROUP))
+ if(NULL == H5I_object_verify(group_id, H5I_GROUP))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
- /*
- * Decrement the counter on the group atom. It will be freed if the count
+ /* Decrement the counter on the group atom. It will be freed if the count
* reaches zero.
*/
if(H5I_dec_app_ref(group_id) < 0)
@@ -708,22 +758,22 @@ done:
herr_t
H5Gflush(hid_t group_id)
{
- H5G_t *grp; /* Group for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Group for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", group_id);
/* Check args */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Flush group's metadata to file */
- if(H5G__flush(grp, group_id) < 0)
+ if(H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
done:
@@ -746,22 +796,22 @@ done:
herr_t
H5Grefresh(hid_t group_id)
{
- H5G_t *grp; /* Group for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
-
+ H5VL_object_t *vol_obj; /* Group for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", group_id);
/* Check args */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call private function to refresh group object */
- if((H5G__refresh(grp, group_id)) < 0)
+ /* Refresh group's metadata */
+ if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
done:
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index aae5496..7e2b324 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -59,19 +59,20 @@ typedef struct {
/* Private macros */
/* PRIVATE PROTOTYPES */
-static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
+static herr_t H5G__compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
static herr_t H5G__compact_build_table(const H5O_loc_t *oloc,
const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
H5G_link_table_t *ltable);
+static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata);
/*-------------------------------------------------------------------------
- * Function: H5G_compact_build_table_cb
+ * Function: H5G__compact_build_table_cb
*
- * Purpose: Callback routine for searching 'link' messages for a particular
+ * Purpose: Callback routine for searching 'link' messages for a particular
* name.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -80,13 +81,13 @@ static herr_t H5G__compact_build_table(const H5O_loc_t *oloc,
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
+H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
H5G_iter_bt_t *udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */
herr_t ret_value=H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(lnk);
@@ -102,7 +103,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_compact_build_table_cb() */
+} /* end H5G__compact_build_table_cb() */
/*-------------------------------------------------------------------------
@@ -151,7 +152,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
- op.u.app_op = H5G_compact_build_table_cb;
+ op.u.app_op = H5G__compact_build_table_cb;
if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
@@ -432,12 +433,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_compact_lookup_cb
+ * Function: H5G__compact_lookup_cb
*
- * Purpose: Callback routine for searching 'link' messages for a particular
+ * Purpose: Callback routine for searching 'link' messages for a particular
* name & gettting object location for it
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -446,13 +447,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
+H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
H5G_iter_lkp_t *udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(lnk);
@@ -475,7 +476,7 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_uda
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_compact_lookup_cb() */
+} /* end H5G__compact_lookup_cb() */
/*-------------------------------------------------------------------------
@@ -511,7 +512,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk)
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
- op.u.app_op = H5G_compact_lookup_cb;
+ op.u.app_op = H5G__compact_lookup_cb;
if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
@@ -571,71 +572,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_lookup_by_idx() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5G__compact_get_type_by_idx
- *
- * Purpose: Returns the type of objects in the group by giving index.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Sep 12, 2005
- *
- *-------------------------------------------------------------------------
- */
-H5G_obj_t
-H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo,
- hsize_t idx)
-{
- H5G_link_table_t ltable = {0, NULL}; /* Link table */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- HDassert(oloc);
-
- /* Build table of all link messages */
- if(H5G__compact_build_table(oloc, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
-
- /* Check for going out of bounds */
- if(idx >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
-
- /* Determine type of object */
- if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
- ret_value = H5G_LINK;
- else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
- ret_value = H5G_UDLINK;
- else if(ltable.lnks[idx].type == H5L_TYPE_HARD){
- H5O_loc_t tmp_oloc; /* Temporary object location */
- H5O_type_t obj_type; /* Type of object at location */
-
- /* Build temporary object location */
- tmp_oloc.file = oloc->file;
- tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
-
- /* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
-
- /* Map to group object type */
- if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
- } else {
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type")
- } /* end else */
-
-done:
- /* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G__compact_get_type_by_idx() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 326561a..a2ef55c 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
/* Create serialized form of link */
if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, (unsigned char *)link_ptr, lnk) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
/* Open the fractal heap */
if(NULL == (fheap = H5HF_open(f, linfo->fheap_addr)))
@@ -966,8 +966,7 @@ done:
*/
herr_t
H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
- void *op_data)
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data)
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5G_link_table_t ltable = {0, NULL}; /* Table of links */
@@ -1778,80 +1777,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__dense_delete() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5G__dense_get_type_by_idx
- *
- * Purpose: Returns the type of objects in the group by giving index.
- *
- * Note: This routine assumes a lookup on the link name index in
- * increasing order and isn't currently set up to be as
- * flexible as other routines in this code module, because
- * the H5Gget_objtype_by_idx that it's supporting is
- * deprecated.
- *
- * Return: Success: Non-negative, object type
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Sep 19 2006
- *
- *-------------------------------------------------------------------------
- */
-H5G_obj_t
-H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, hsize_t idx)
-{
- H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(linfo);
-
- /* Build the table of links for this group */
- if(H5G__dense_build_table(f, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links")
-
- /* Check for going out of bounds */
- if(idx >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound")
-
- /* Determine type of object */
- if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
- ret_value = H5G_LINK;
- else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
- ret_value = H5G_UDLINK;
- else if(ltable.lnks[idx].type == H5L_TYPE_HARD) {
- H5O_loc_t tmp_oloc; /* Temporary object location */
- H5O_type_t obj_type; /* Type of object at location */
-
- /* Build temporary object location */
- tmp_oloc.file = f;
- tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
-
- /* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
-
- /* Map to group object type */
- if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
- } else {
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type")
- } /* end else */
-
-done:
- /* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G__dense_get_type_by_idx() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index f6c6d8f..a15703e 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -43,6 +43,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -71,30 +72,9 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
-
-static herr_t H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
- hid_t new_loc_id, const char *new_name, hid_t lcpl_id);
-static herr_t H5G__move(hid_t src_loc_id, const char *src_name,
- hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id);
-static herr_t H5G__unlink(H5G_loc_t *loc, const char *name);
-static herr_t H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size,
- char *buf/*out*/);
-static herr_t H5G__set_comment(const H5G_loc_t *loc, const char *name,
- const char *comment);
-static int H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf,
- size_t bufsize);
-static herr_t H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk,
- const H5G_link_iterate_t *lnk_op, void *op_data);
-static herr_t H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info);
static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name,
- hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
-static ssize_t H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, char *name, size_t size);
-static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -177,7 +157,7 @@ H5G_map_obj_type(H5O_type_t obj_type)
* writing. Call H5Gclose() when finished with
* the group.
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, September 24, 1997
@@ -187,67 +167,86 @@ H5G_map_obj_type(H5O_type_t obj_type)
hid_t
H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
{
- H5G_loc_t loc; /* Location to create group */
- H5G_t *grp = NULL; /* New group created */
- hid_t tmp_gcpl = (-1); /* Temporary group creation property list */
- hid_t ret_value; /* Return value */
-
- FUNC_ENTER_API(FAIL)
+ void *grp = NULL; /* New group created */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*sz", loc_id, name, size_hint);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
/* Check if we need to create a non-standard GCPL */
if(size_hint > 0) {
- H5P_genplist_t *gc_plist; /* Property list created */
H5O_ginfo_t ginfo; /* Group info property */
+ H5P_genplist_t *gc_plist; /* Property list created */
/* Get the default property list */
if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Make a copy of the default property list */
if((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list")
/* Get pointer to the copied property list */
if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
/* Get the group info property */
if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info")
/* Set the non-default local heap size hint */
H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t);
if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
- } /* end if */
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info")
+ }
else
tmp_gcpl = H5P_GROUP_CREATE_DEFAULT;
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(tmp_gcpl)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+
+ /* get creation properties */
+ if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Create the new group & get its ID */
- if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
- if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ /* Create the group */
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
+
+ /* Get an atom for the group */
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
- if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
+ if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
if(H5I_dec_ref(tmp_gcpl) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list")
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list")
- if(ret_value < 0)
- if(grp && H5G_close(grp) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
+ if(H5I_INVALID_HID == ret_value)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate1() */
@@ -263,7 +262,7 @@ done:
*
* Return: Success: Object ID of the group.
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, December 31, 1997
@@ -273,31 +272,38 @@ done:
hid_t
H5Gopen1(hid_t loc_id, const char *name)
{
- H5G_t *grp = NULL; /* Group opened */
- H5G_loc_t loc; /* Location of parent for group */
- hid_t ret_value; /* Return value */
+ void *grp = NULL; /* Group opened */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the group */
- if(NULL == (grp = H5G__open_name(&loc, name)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+ if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
- /* Register an atom for the group */
- if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ /* Get an atom for the group */
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
- if(ret_value < 0)
- if(grp && H5G_close(grp) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
+ if(H5I_INVALID_HID == ret_value)
+ if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gopen1() */
@@ -314,6 +320,8 @@ done:
herr_t
H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name)
{
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -321,17 +329,75 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Check arguments */
if(!cur_name || !*cur_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!new_name || !*new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine to create link */
- if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Create link */
+ if(type == H5L_TYPE_HARD) {
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+
+ 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_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_DEFAULT;
+
+ /* 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")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj->data) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target")
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params")
+
+ /* Construct a temporary VOL object */
+ tmp_vol_obj.data = NULL;
+ tmp_vol_obj.connector = vol_obj->connector;
+
+ /* Create the link through the VOL */
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_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 token of loc_id */
+ H5VL_loc_params_t loc_params;
+
+ 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_DEFAULT;
+ loc_params.obj_type = H5I_get_type(cur_loc_id);
+
+ /* 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")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
+
+ /* Create the link through the VOL */
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
done:
FUNC_LEAVE_API(ret_value)
@@ -350,6 +416,8 @@ 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)
{
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -357,92 +425,83 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Check arguments */
if(!cur_name || !*cur_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!new_name || !*new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine to create link */
- if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Glink2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__link
- *
- * Purpose: Internal routine to create a new link.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
- hid_t new_loc_id, const char *new_name, hid_t lcpl_id)
-{
- H5G_loc_t new_loc; /* Information about new link's group */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
- H5G_loc_t cur_loc, *cur_loc_p; /* Information about current link's group */
- H5G_loc_t *new_loc_p; /* Information about new link's group */
-
- /* Finish checking arguments */
- if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
- if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
- if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
-
- /* Set up current & new location pointers */
- cur_loc_p = &cur_loc;
- new_loc_p = &new_loc;
- if(cur_loc_id == H5L_SAME_LOC)
- cur_loc_p = new_loc_p;
- else if(new_loc_id == H5L_SAME_LOC)
- new_loc_p = cur_loc_p;
- else if(cur_loc_p->oloc->file != new_loc_p->oloc->file)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
-
- /* Create the link */
- if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
+ H5VL_object_t *vol_obj1; /* Object token of loc_id */
+ H5VL_object_t *vol_obj2; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+
+ 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_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_DEFAULT;
+
+ /* get the location object */
+ 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 creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
+
+ /* Create the link through the VOL */
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_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) {
- /* Soft links only need one location, the new_loc_id, but it's possible
- * that new_loc_id is H5L_SAME_LOC
- */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+
+ /* Soft links only need one location, the new_loc_id, but it's possible that
+ * new_loc_id is H5L_SAME_LOC */
if(new_loc_id == H5L_SAME_LOC)
new_loc_id = cur_loc_id;
- /* Finish checking arguments */
- if(H5G_loc(new_loc_id, &new_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ 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_DEFAULT;
+ loc_params.obj_type = H5I_get_type(new_loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
- /* Create the link */
- if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0)
+ /* Create the link through the VOL */
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- } /* end else if */
+ } /* end else-if */
else
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__link() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Glink2() */
/*-------------------------------------------------------------------------
@@ -455,7 +514,10 @@ done:
herr_t
H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name);
@@ -464,9 +526,22 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
if(H5CX_set_loc(src_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call common routine to move the link */
- if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.obj_type = H5I_get_type(src_loc_id);
+ loc_params1.loc_data.loc_by_name.name = src_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.loc_data.loc_by_name.name = dst_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Move the link */
+ if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
FUNC_LEAVE_API(ret_value)
@@ -484,80 +559,47 @@ herr_t
H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
+ H5VL_loc_params_t loc_params2;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name);
- /* Check arguments */
- if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
-
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(dst_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call common routine to move the link */
- if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gmove2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__move
- *
- * Purpose: Renames an object within an HDF5 file and moves it to a new
- * group. The original name SRC is unlinked from the group graph
- * and then inserted with the new name DST (which can specify a
- * new path for the object) as an atomic operation. The names
- * are interpreted relative to SRC_LOC_ID and
- * DST_LOC_ID, which are either file IDs or group ID.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, November 6, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
- const char *dst_name, hid_t lcpl_id)
-{
- H5G_loc_t src_loc, *src_loc_p; /* Group info for source location */
- H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
- if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
- if(!src_name || !*src_name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no current name specified")
- if(!dst_name || !*dst_name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no destination name specified")
-
- /* Set up src & dst location pointers */
- src_loc_p = &src_loc;
- dst_loc_p = &dst_loc;
- if(src_loc_id == H5L_SAME_LOC)
- src_loc_p = dst_loc_p;
- else if(dst_loc_id == H5L_SAME_LOC)
- dst_loc_p = src_loc_p;
+ /* Set location parameter for source object */
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.loc_data.loc_by_name.name = src_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params1.obj_type = H5I_get_type(src_loc_id);
+
+ /* Set location parameter for destination object */
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.loc_data.loc_by_name.name = dst_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params2.obj_type = H5I_get_type(dst_loc_id);
+
+ if(H5L_SAME_LOC != src_loc_id)
+ /* get the location object */
+ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if(H5L_SAME_LOC != dst_loc_id)
+ /* get the location object */
+ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Move the link */
- if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
+ if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__move() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gmove2() */
/*-------------------------------------------------------------------------
@@ -570,60 +612,37 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if(H5G__unlink(&loc, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gunlink() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__unlink
- *
- * Purpose: Internal version of H5Gunlink.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__unlink(H5G_loc_t *loc, const char *name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
+ 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 = H5P_LINK_ACCESS_DEFAULT;
- FUNC_ENTER_STATIC_VOL
+ /* 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")
- /* Call H5L routine... */
- if(H5L_delete(loc, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
+ /* Delete the link */
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__unlink() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gunlink() */
/*-------------------------------------------------------------------------
@@ -637,61 +656,37 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ 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);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if(H5G__get_linkval(&loc, name, size, buf) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
+ 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 = H5P_LINK_ACCESS_DEFAULT;
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_linkval() */
+ /* 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")
-
-/*-------------------------------------------------------------------------
- * Function: H5G__get_linkval
- *
- * Purpose: Internal version of H5Gget_linkval.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size,
- char *buf/*out*/)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Call the link routine which provides this capability */
- if(H5L_get_val(loc, name, buf, size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
+ /* 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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_linkval() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gget_linkval() */
/*-------------------------------------------------------------------------
@@ -714,59 +709,37 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
- H5G_loc_t loc; /* Group's location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ 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);
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if(H5G__set_comment(&loc, name, comment) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gset_comment() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__set_comment
- *
- * Purpose: Internal version of H5Gset_comment.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__set_comment(const H5G_loc_t *loc, const char *name, const char *comment)
-{
- herr_t ret_value = SUCCEED; /* Return value */
+ /* Fill in location struct fields */
+ 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);
- FUNC_ENTER_STATIC_VOL
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Call the common routine which provides this capability */
- if(H5G_loc_set_comment(loc, name, comment) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
+ /* Set the comment */
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__set_comment() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gset_comment() */
/*-------------------------------------------------------------------------
@@ -795,62 +768,39 @@ done:
int
H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf);
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(bufsize > 0 && !buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if((ret_value = H5G__get_comment(&loc, name, buf, bufsize)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_comment() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__get_comment
- *
- * Purpose: Internal version of H5Gget_comment.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf,
- size_t bufsize)
-{
- int ret_value = FAIL; /* Return value */
+ /* Fill in location struct fields */
+ 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);
- FUNC_ENTER_STATIC_VOL
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Call the common routine which provides this capability */
- if((ret_value = (int)H5G_loc_get_comment(loc, name, buf, bufsize)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
+ /* Get the comment */
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &ret_value) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_comment() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gget_comment() */
/*-------------------------------------------------------------------------
@@ -881,6 +831,8 @@ 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 token 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 */
@@ -891,11 +843,11 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
/* Check args */
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_p && *idx_p < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "invalid index specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
if(!op)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no operator specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
/* Set number of objects looked at to zero */
last_obj = 0;
@@ -905,9 +857,19 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
lnk_op.op_type = H5G_LINK_OP_OLD;
lnk_op.op_func.op_old = op;
- /* Call private function. */
- if((ret_value = H5G__iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
+ /* 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_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+
+ /* Call private iteration function, through VOL callback */
+ if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
+ HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
/* Set the index we stopped at */
if(idx_p)
@@ -919,39 +881,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__iterate
- *
- * Purpose: Internal version of H5Giterate.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk,
- const H5G_link_iterate_t *lnk_op, void *op_data)
-{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Call the common routine which provides this capability */
- if((ret_value = H5G_iterate(loc_id, name, idx_type, order, idx, last_lnk, lnk_op, op_data)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__iterate() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_num_objs
*
* Purpose: Returns the number of objects in the group. It iterates
@@ -970,24 +899,35 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
{
- H5G_loc_t loc; /* Location of object */
- H5G_info_t grp_info; /* Group information */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t *vol_obj; /* Object token 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 */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", loc_id, num_objs);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
+ id_type = H5I_get_type(loc_id);
+ if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID")
if(!num_objs)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
- /* Call the internal routine */
- if(H5G__get_num_objs(loc.oloc, &grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine")
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = id_type;
- /* Set the number of objects [sic: links] in the group */
+ /* Get group location */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* 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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
+
+ /* Set the number of objects [i.e. links] in the group */
*num_objs = grp_info.nlinks;
done:
@@ -996,44 +936,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_num_objs
- *
- * Purpose: Internal version of H5Gget_num_objs.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info)
-{
- H5O_type_t obj_type; /* Type of object at location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check args */
- if(H5O_obj_type(oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
-
- /* Retrieve information about the group */
- if(H5G__obj_info(oloc, grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_num_objs() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_objinfo
*
* Purpose: Returns information about an object. If FOLLOW_LINK is
@@ -1052,23 +954,40 @@ done:
*/
herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
- H5G_stat_t *statbuf/*out*/)
+ H5G_stat_t *statbuf/*out*/)
{
- H5G_loc_t loc; /* Group's location */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+
+ /* Retrieve object info, if pointer to struct is given */
+ if(statbuf) {
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
- /* Get info */
- if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
+ /* 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")
+
+ /* Retrieve the object's information */
+ if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -1093,6 +1012,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */
+ H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1101,48 +1021,43 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
if(lnk == NULL && obj_loc == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name)
- /* Only modify user's buffer if it's available */
- if(udata->statbuf) {
- H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */
-
- /* Common code to retrieve the file's fileno */
- if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
+ /* Common code to retrieve the file's fileno */
+ if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
- /* Info for soft and UD links is gotten by H5L_get_info. If we have
- * a hard link, follow it and get info on the object
- */
- if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
- H5O_info_t oinfo; /* Object information */
+ /* Info for soft and UD links is gotten by H5L_get_info. If we have
+ * a hard link, follow it and get info on the object
+ */
+ if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
+ H5O_info_t oinfo; /* Object information */
- /* Go retrieve the object information */
- /* (don't need index & heap info) */
- HDassert(obj_loc);
- if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
+ /* Go retrieve the object information */
+ /* (don't need index & heap info) */
+ HDassert(obj_loc);
+ if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
- /* Get mapped object type */
- statbuf->type = H5G_map_obj_type(oinfo.type);
+ /* Get mapped object type */
+ statbuf->type = H5G_map_obj_type(oinfo.type);
- /* Get object number (i.e. address) for object */
- statbuf->objno[0] = (unsigned long)(oinfo.addr);
+ /* Get object number (i.e. address) for object */
+ statbuf->objno[0] = (unsigned long)(oinfo.addr);
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long));
+ statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long));
#else
- statbuf->objno[1] = 0;
+ statbuf->objno[1] = 0;
#endif
- /* Get # of hard links pointing to object */
- statbuf->nlink = oinfo.rc;
+ /* Get # of hard links pointing to object */
+ statbuf->nlink = oinfo.rc;
- /* Get modification time for object */
- statbuf->mtime = oinfo.ctime;
+ /* Get modification time for object */
+ statbuf->mtime = oinfo.ctime;
- /* Retrieve the object header information */
- statbuf->ohdr.size = oinfo.hdr.space.total;
- statbuf->ohdr.free = oinfo.hdr.space.free;
- statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs;
- statbuf->ohdr.nchunks = oinfo.hdr.nchunks;
- } /* end if */
+ /* Retrieve the object header information */
+ statbuf->ohdr.size = oinfo.hdr.space.total;
+ statbuf->ohdr.free = oinfo.hdr.space.free;
+ statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs;
+ statbuf->ohdr.nchunks = oinfo.hdr.nchunks;
} /* end if */
done:
@@ -1170,22 +1085,22 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
H5G_stat_t *statbuf/*out*/)
{
H5G_trav_goi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(loc);
HDassert(name && *name);
+ HDassert(statbuf);
- /* Reset stat buffer, if one was given */
- if(statbuf)
- HDmemset(statbuf, 0, sizeof(H5G_stat_t));
+ /* Reset stat buffer */
+ HDmemset(statbuf, 0, sizeof(H5G_stat_t));
/* Set up user data for retrieving information */
udata.statbuf = statbuf;
@@ -1193,12 +1108,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
udata.loc_file = loc->oloc->file;
/* Traverse the group hierarchy to locate the object to get info about */
- if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : H5G_TARGET_SLINK|H5G_TARGET_UDLINK),
- H5G__get_objinfo_cb, &udata) < 0)
+ if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist")
/* If we're pointing at a soft or UD link, get the real link length and type */
- if(statbuf && follow_link == 0) {
+ if(follow_link == 0) {
H5L_info_t linfo; /* Link information buffer */
herr_t ret;
@@ -1220,7 +1134,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
} /* end if */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__get_objinfo() */
@@ -1250,19 +1164,33 @@ done:
ssize_t
H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
{
- H5G_loc_t loc; /* Object location */
- ssize_t ret_value;
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size);
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
+ /* Set up collective metadata if appropriate */
+ 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 */
+ 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;
+ loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
+ loc_params.loc_data.loc_by_idx.n = idx;
+ loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Call internal function */
- if((ret_value = H5G__get_objname_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name")
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name")
done:
FUNC_LEAVE_API(ret_value)
@@ -1270,45 +1198,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_objname_by_idx
- *
- * Purpose: Internal version of H5Gget_objname_by_idx.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static ssize_t
-H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, char *name, size_t size)
-{
- H5O_type_t obj_type; /* Type of object at location */
- ssize_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check args */
- if(H5O_obj_type(oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
-
- /* Call common routine */
- if((ret_value = H5G_obj_get_name_by_idx(oloc, idx_type, order, idx, name, size)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_objname_by_idx() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_objtype_by_idx
*
* Purpose: Returns the type of objects in the group by giving index.
@@ -1326,82 +1215,39 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
- H5G_loc_t loc; /* Object location */
- H5G_obj_t ret_value;
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5O_info_t oinfo; /* Object info (contains object type) */
+ unsigned fields; /* Which fields in object info to populate */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE2("Go", "ih", loc_id, idx);
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID")
+ /* Set location parameters */
+ 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;
+ loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
+ loc_params.loc_data.loc_by_idx.n = idx;
+ loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
- /* Call internal function*/
- if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx)))
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type")
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_objtype_by_idx() */
+ /* Retrieve the object's basic information (which includes its type) */
+ fields = H5O_INFO_BASIC;
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info")
-
-/*-------------------------------------------------------------------------
- * Function: H5G__obj_get_type_by_idx
- *
- * Purpose: Private function for H5Gget_objtype_by_idx.
- * Returns the type of objects in the group by giving index.
- *
- * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3)
- *
- * Failure: Negative
- *
- * Programmer: Raymond Lu
- * Nov 20, 2002
- *
- *-------------------------------------------------------------------------
- */
-static H5G_obj_t
-H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx)
-{
- H5O_linfo_t linfo; /* Link info message */
- htri_t linfo_exists; /* Whether the link info message exists */
- H5O_type_t obj_type; /* Type of object at location */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
-
- FUNC_ENTER_STATIC_VOL_TAG(oloc->addr)
-
- /* Sanity check */
- HDassert(oloc);
-
- /* Check args */
- if(H5O_obj_type(oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group")
-
- /* Attempt to get the link info for this group */
- if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't check for link info message")
- if(linfo_exists) {
- if(H5F_addr_defined(linfo.fheap_addr)) {
- /* Get the object's name from the dense link storage */
- if((ret_value = H5G__dense_get_type_by_idx(oloc->file, &linfo, idx)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
- } /* end if */
- else {
- /* Get the object's type from the link messages */
- if((ret_value = H5G__compact_get_type_by_idx(oloc, &linfo, idx)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
- } /* end else */
- } /* end if */
- else {
- /* Get the object's type from the symbol table */
- if((ret_value = H5G__stab_get_type_by_idx(oloc, idx)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
- } /* end else */
+ /* Map to group object type */
+ if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type)))
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
-} /* end H5G__obj_get_type_by_idx() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gget_objtype_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 3b5de44..049c696 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -32,13 +32,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -134,7 +134,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id,
H5G_obj_create_t gcrt_info; /* Information for group creation */
H5G_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -161,48 +161,11 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id,
ret_value = (H5G_t *)ocrt_info.new_obj;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__create_named() */
/*-------------------------------------------------------------------------
- * Function: H5G__create_anon
- *
- * Purpose: Internal routine to create a new anonymous group.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating groups that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new group object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 17, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5G_t *
-H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info)
-{
- H5G_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(file);
- HDassert(gcrt_info);
-
- /* Create the new group & get its ID */
- if(NULL == (ret_value = H5G__create(file, gcrt_info)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "unable to create group")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__create_anon() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G__create
*
* Purpose: Creates a new empty group with the specified name. The name
@@ -302,7 +265,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name)
H5O_type_t obj_type; /* Type of object at location */
H5G_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(loc);
@@ -336,7 +299,7 @@ done:
if(loc_found && H5G_loc_free(&grp_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__open_name() */
@@ -486,38 +449,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__close_cb
- *
- * Purpose: Closes the specified group.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Sunday, February 18, 2018
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__close_cb(H5G_t *grp)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check args */
- HDassert(grp && grp->shared);
- HDassert(grp->shared->fo_count > 0);
-
- /* Call actual group close routine */
- if(H5G_close(grp) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__close_cb() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_close
*
* Purpose: Closes the specified group.
@@ -647,7 +578,7 @@ H5G_oloc(H5G_t *grp)
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5G_nameof(H5G_t *grp)
+H5G_nameof(const H5G_t *grp)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -842,12 +773,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_iterate
+ * Function: H5G_iterate
*
* Purpose: Private function for iterating over links in a group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Oct 3, 2005
@@ -855,32 +785,29 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_iterate(hid_t loc_id, const char *group_name,
+H5G_iterate(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
const H5G_link_iterate_t *lnk_op, void *op_data)
{
- H5G_loc_t loc; /* Location of parent for group */
- hid_t gid = -1; /* ID of group to iterate over */
- H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */
- H5G_iter_appcall_ud_t udata; /* User data for callback */
- herr_t ret_value = FAIL; /* Return value */
+ hid_t gid = H5I_INVALID_HID; /* ID of group to iterate over */
+ H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */
+ H5G_iter_appcall_ud_t udata; /* User data for callback */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(loc);
HDassert(group_name);
HDassert(last_lnk);
HDassert(lnk_op && lnk_op->op_func.op_new);
- /*
- * Open the group on which to operate. We also create a group ID which
+ /* Open the group on which to operate. We also create a group ID which
* we can pass to the application-defined operator.
*/
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(NULL == (grp = H5G__open_name(&loc, group_name)))
+ if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Set up user data for callback */
@@ -894,10 +821,10 @@ H5G_iterate(hid_t loc_id, const char *group_name,
done:
/* Release the group opened */
- if(gid > 0) {
+ if(gid != H5I_INVALID_HID) {
if(H5I_dec_app_ref(gid) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
- } /* end if */
+ }
else if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
@@ -1091,9 +1018,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_visit
+ * Function: H5G_visit
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1105,31 +1032,25 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
- *
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
- *
- *
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Programmer: Quincey Koziol
- * November 4 2007
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
*-------------------------------------------------------------------------
*/
herr_t
-H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, H5L_iterate_t op, void *op_data)
{
H5G_iter_visit_ud_t udata; /* User data for callback */
H5O_linfo_t linfo; /* Link info message */
htri_t linfo_exists; /* Whether the link info message exists */
- hid_t gid = (-1); /* Group ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
H5G_t *grp = NULL; /* Group opened */
- H5G_loc_t loc; /* Location of group passed in */
H5G_loc_t start_loc; /* Location of starting group */
unsigned rc; /* Reference count of object */
herr_t ret_value = FAIL; /* Return value */
@@ -1140,15 +1061,15 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!loc)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc parameter cannot be NULL")
/* Open the group to begin visiting within */
- if(NULL == (grp = H5G__open_name(&loc, group_name)))
+ if(NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
/* Register an ID for the starting group */
- if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
+ if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Get the location of the starting group */
@@ -1227,10 +1148,10 @@ done:
H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL);
/* Release the group opened */
- if(gid > 0) {
+ if(gid != H5I_INVALID_HID) {
if(H5I_dec_app_ref(gid) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
- } /* end if */
+ }
else if(grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
@@ -1239,44 +1160,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_create_plist
- *
- * Purpose: Internal routine to retrieve a group's creation property list.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: ID for a copy of the group creation property
- * list. The property list ID should be released
- * by calling H5Pclose().
- *
- * Failure: H5I_INVALID_HID
- *
- * Programmer: Quincey Koziol
- * December 17, 2017
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5G__get_create_plist(const H5G_t *grp)
-{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(grp);
-
- /* Retrieve the GCPL */
- if((ret_value = H5G_get_create_plist(grp)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_create_plist() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_get_create_plist
*
* Purpose: Private function for H5Gget_create_plist
@@ -1335,7 +1218,7 @@ H5G_get_create_plist(const H5G_t *grp)
/* Check for the group having a link info message */
if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header")
if(linfo_exists) {
/* Set the link info for the property list */
if(H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
@@ -1372,51 +1255,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_info
- *
- * Purpose: Internal routine to retrieve the info for a group.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(grp_info);
-
- /* Retrieve the group's information */
- if(H5G__obj_info(loc->oloc, grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_info() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G__get_info_by_name
*
* Purpose: Internal routine to retrieve the info for a group, by name.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 18, 2017
@@ -1432,7 +1275,7 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in
hbool_t loc_found = FALSE; /* Location at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -1457,7 +1300,7 @@ done:
if(loc_found && H5G_loc_free(&grp_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__get_info_by_name() */
@@ -1466,11 +1309,7 @@ done:
*
* Purpose: Internal routine to retrieve the info for a group, by index.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 18, 2017
@@ -1487,7 +1326,7 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
hbool_t loc_found = FALSE; /* Location at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -1512,76 +1351,6 @@ done:
if(loc_found && H5G_loc_free(&grp_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__get_info_by_idx() */
-
-/*-------------------------------------------------------------------------
- * Function: H5G__flush
- *
- * Purpose: Internal routine to flushes a group to disk.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__flush(H5G_t *grp, hid_t group_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(grp);
-
- /* Flush metadata to file */
- if(H5O_flush_common(&grp->oloc, group_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5G__flush */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__refresh
- *
- * Purpose: Internal routine to refresh a group.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__refresh(H5G_t *grp, hid_t group_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(grp);
-
- /* Call private function to refresh group object */
- if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5G__refresh */
-
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 509e511..82a2dcf 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -568,7 +568,7 @@ H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_
obj_path_r = H5G_build_fullpath_refstr_str(grp_full_path_r, lnk->name);
if(H5G_name_replace(lnk, H5G_NAME_DELETE, file, obj_path_r, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to replace name")
- } /* end if */
+ }
done:
if(obj_path_r)
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index f5a14a1..2dacd94 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -137,117 +137,139 @@ static herr_t H5G__loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name,
/*-------------------------------------------------------------------------
- * Function: H5G_loc
+ * Function: H5G_loc_real
*
- * Purpose: Given an object ID return a location for the object.
+ * Purpose: Utility routine to get object location
*
- * Return: Success: Group pointer.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Tuesday, September 13, 2005
+ * Returns: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5G_loc(hid_t loc_id, H5G_loc_t *loc)
+H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- switch(H5I_get_type(loc_id)) {
+ switch(type) {
case H5I_FILE:
- {
- H5F_t *f;
-
- /* Get the file struct */
- if(NULL == (f = (H5F_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID")
+ {
+ H5F_t *f = (H5F_t *)obj;
- /* Construct a group location for root group of the file */
- if(H5G_root_loc(f, loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file")
- } /* end case */
+ /* Construct a group location for root group of the file */
+ if(H5G_root_loc(f, loc) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file")
break;
-
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list")
-
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of error class, message or stack")
+ }
case H5I_GROUP:
- {
- H5G_t *group;
-
- if(NULL == (group = (H5G_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID")
- if(NULL == (loc->oloc = H5G_oloc(group)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group")
- if(NULL == (loc->path = H5G_nameof(group)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group")
- } /* end case */
+ {
+ H5G_t *group = (H5G_t *)obj;
+
+ if(NULL == (loc->oloc = H5G_oloc(group)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group")
+ if(NULL == (loc->path = H5G_nameof(group)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group")
break;
+ }
case H5I_DATATYPE:
- {
- H5T_t *dt;
-
- if(NULL == (dt = (H5T_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID")
- if(NULL == (loc->oloc = H5T_oloc(dt)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype")
- if(NULL == (loc->path = H5T_nameof(dt)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype")
- } /* end case */
- break;
+ {
+ H5T_t *dt = NULL;
- case H5I_DATASPACE:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace")
+ /* Get the actual datatype object if the VOL object is set */
+ dt = H5T_get_actual_type((H5T_t *)obj);
+
+ if(NULL == (loc->oloc = H5T_oloc(dt)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype")
+ if(NULL == (loc->path = H5T_nameof(dt)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype")
+ break;
+ }
case H5I_DATASET:
- {
- H5D_t *dset;
-
- if(NULL == (dset = (H5D_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID")
- if(NULL == (loc->oloc = H5D_oloc(dset)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset")
- if(NULL == (loc->path = H5D_nameof(dset)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset")
- } /* end case */
+ {
+ H5D_t *dset = (H5D_t *)obj;
+
+ if(NULL == (loc->oloc = H5D_oloc(dset)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset")
+ if(NULL == (loc->path = H5D_nameof(dset)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset")
break;
+ }
case H5I_ATTR:
- {
- H5A_t *attr;
-
- if(NULL == (attr = (H5A_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID")
- if(NULL == (loc->oloc = H5A_oloc(attr)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute")
- if(NULL == (loc->path = H5A_nameof(attr)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute")
- } /* end case */
+ {
+ H5A_t *attr = (H5A_t *)obj;
+
+ if(NULL == (loc->oloc = H5A_oloc(attr)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute")
+ if(NULL == (loc->path = H5A_nameof(attr)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute")
break;
+ }
case H5I_REFERENCE:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference")
+ case H5I_DATASPACE:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace")
+
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list")
+
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of error class, message or stack")
+
+ case H5I_VFL:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)")
+
+ case H5I_VOL:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) driver")
+
case H5I_UNINIT:
case H5I_BADID:
- case H5I_VFL:
case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid location ID")
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_loc_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_loc
+ *
+ * Purpose: Given an object ID return a location for the object.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_loc(hid_t loc_id, H5G_loc_t *loc)
+{
+ void *obj = NULL; /* VOL object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Get the object from the VOL */
+ if(NULL == (obj = H5VL_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Fill in the struct */
+ if(H5G_loc_real(obj, H5I_get_type(loc_id), loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to fill in location struct")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_loc() */
@@ -764,7 +786,7 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A
/* Check for existing comment message */
if((exists = H5O_msg_exists(obj_loc->oloc, H5O_NAME_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header")
/* Remove the previous comment message if any */
if(exists)
@@ -774,9 +796,9 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A
/* Add the new message */
if(udata->comment && *udata->comment) {
/* Casting away const OK -QAK */
- comment.s = (char *)udata->comment;
- if(H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message")
+ comment.s = (char *)udata->comment;
+ if(H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message")
} /* end if */
done:
@@ -854,20 +876,21 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A
/* Query object comment */
comment.s = NULL;
if(NULL == H5O_msg_read(obj_loc->oloc, H5O_NAME_ID, &comment)) {
- if(udata->comment && udata->bufsize > 0)
+ if(udata->comment && udata->bufsize > 0)
udata->comment[0] = '\0';
- udata->comment_size = 0;
- } /* end if */
+ udata->comment_size = 0;
+ }
else {
if(udata->comment && udata->bufsize)
- HDstrncpy(udata->comment, comment.s, udata->bufsize);
- udata->comment_size = (ssize_t)HDstrlen(comment.s);
- H5O_msg_reset(H5O_NAME_ID, &comment);
- } /* end else */
+ HDstrncpy(udata->comment, comment.s, udata->bufsize);
+ udata->comment_size = (ssize_t)HDstrlen(comment.s);
+ H5O_msg_reset(H5O_NAME_ID, &comment);
+ }
done:
/* Indicate that this callback didn't take ownership of the group *
- * location for the object */
+ * location for the object.
+ */
*own_loc = H5G_OWN_NONE;
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gname.c b/src/H5Gname.c
index c1156ca..f6ddeeb 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -584,21 +584,9 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
*cached = TRUE;
} /* end if */
else if(!loc->path->obj_hidden) {
- hid_t file;
-
- /* Retrieve file ID for name search */
- if((file = H5F_get_id(loc->oloc->file, FALSE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get file ID")
-
/* Search for name of object */
- if((len = H5G_get_name_by_addr(file, loc->oloc, name, size)) < 0) {
- H5I_dec_ref(file);
+ if((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name")
- } /* end if */
-
- /* Close file ID used for search */
- if(H5I_dec_ref(file) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name")
/* Indicate that the name is _not_ cached, if requested */
/* (Currently only used for testing - QAK, 2010/07/26) */
@@ -835,6 +823,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
@@ -1155,7 +1144,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
else {
/* We pass NULL as link pointer when we need to search all IDs */
search_group = search_dataset = search_datatype = TRUE;
- } /* end else */
+ }
/* Check if we need to operate on the objects affected */
if(search_group || search_dataset || search_datatype) {
@@ -1166,26 +1155,26 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
src_file = H5F_PARENT(src_file);
/* Set up common information for callback */
- names.src_file = src_file;
- names.src_full_path_r = src_full_path_r;
- names.dst_file = dst_file;
- names.dst_full_path_r = dst_full_path_r;
- names.op = op;
+ names.src_file = src_file;
+ names.src_full_path_r = src_full_path_r;
+ names.dst_file = dst_file;
+ names.dst_full_path_r = dst_full_path_r;
+ names.op = op;
/* Search through group IDs */
if(search_group)
if(H5I_iterate(H5I_GROUP, H5G_name_replace_cb, &names, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups")
/* Search through dataset IDs */
if(search_dataset)
if(H5I_iterate(H5I_DATASET, H5G_name_replace_cb, &names, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets")
/* Search through datatype IDs */
if(search_datatype)
if(H5I_iterate(H5I_DATATYPE, H5G_name_replace_cb, &names, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes")
} /* end if */
} /* end if */
@@ -1269,10 +1258,11 @@ done:
*
* Purpose: Tries to figure out the path to an object from it's address
*
- * Return: returns size of path name, and copies it into buffer
- * pointed to by name if that buffer is big enough.
- * 0 if it cannot find the path
- * negative on failure.
+ * Return: Success: Returns size of path name, and copies it into buffer
+ * pointed to by name if that buffer is big enough.
+ * 0 if it cannot find the path
+ *
+ * Failure: -1
*
* Programmer: Quincey Koziol
* November 4 2007
@@ -1280,28 +1270,27 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
- char *name, size_t size)
+H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
{
- 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 */
+ 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 */
/* Portably clear udata struct (before FUNC_ENTER) */
HDmemset(&udata, 0, sizeof(udata));
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI((-1))
- /* Construct the link info for the file's root group */
- if(H5G_loc(file, &root_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location")
+ /* 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")
/* 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, FAIL, "can't duplicate path string")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, (-1), "can't duplicate path string")
found_obj = TRUE;
} /* end if */
else {
@@ -1310,8 +1299,8 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc,
udata.path = NULL;
/* Visit all the links in the file */
- if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name")
+ if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name")
else if(status > 0)
found_obj = TRUE;
} /* end else */
@@ -1342,3 +1331,4 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_get_name_by_addr() */
+
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index e93896c..15dbd79 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -36,7 +36,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5Gpkg.h" /* Groups */
-#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
@@ -257,7 +256,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo,
* incremented if the object is added to the group directed graph.
*/
if(H5O_create(f, hdr_size, (size_t)1, gcpl_id, oloc/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
/* Check for format of group to create */
if(use_at_least_v18) {
diff --git a/src/H5Goh.c b/src/H5Goh.c
index 38570f9..f29529b 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -27,6 +27,7 @@
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -46,7 +47,7 @@
static void *H5O__group_get_copy_file_udata(void);
static void H5O__group_free_copy_file_udata(void *udata);
static htri_t H5O__group_isa(const H5O_t *loc);
-static hid_t H5O__group_open(const H5G_loc_t *obj_loc, hbool_t app_ref);
+static void *H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type);
static void *H5O__group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc);
static H5O_loc_t *H5O__group_get_oloc(hid_t obj_id);
static herr_t H5O__group_bh_info(const H5O_loc_t *loc, H5O_t *oh,
@@ -193,40 +194,40 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__group_open
+ * Function: H5O__group_open
*
- * Purpose: Open a group at a particular location
+ * Purpose: Open a group at a particular location
*
- * Return: Success: Open object identifier
- * Failure: Negative
+ * Return: Success: Pointer to group data
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, November 6, 2006
*
*-------------------------------------------------------------------------
*/
-static hid_t
-H5O__group_open(const H5G_loc_t *obj_loc, hbool_t app_ref)
+static void *
+H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type)
{
- H5G_t *grp = NULL; /* Group opened */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5G_t *grp = NULL; /* Group opened */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
HDassert(obj_loc);
+ *opened_type = H5I_GROUP;
+
/* Open the group */
if(NULL == (grp = H5G_open(obj_loc)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group")
- /* Register an ID for the group */
- if((ret_value = H5I_register(H5I_GROUP, grp, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ ret_value = (void *)grp;
done:
- if(ret_value < 0)
+ if(NULL == ret_value)
if(grp && H5G_close(grp) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release group")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__group_open() */
@@ -303,7 +304,7 @@ H5O__group_get_oloc(hid_t obj_id)
FUNC_ENTER_STATIC
/* Get the group */
- if(NULL == (grp = (H5G_t *)H5I_object(obj_id)))
+ if(NULL == (grp = (H5G_t *)H5VL_object(obj_id)))
HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID")
/* Get the group's object header location */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index f0a9aea..159b6f5 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -299,6 +299,22 @@ typedef struct H5G_copy_file_ud_t {
H5G_cache_t cache; /* Cached data for symbol table entry */
} H5G_copy_file_ud_t;
+/* Types for optional group VOL operations */
+typedef enum H5VL_group_optional_t {
+ H5VL_GROUP_ITERATE_OLD, /* HG5Giterate (deprecated routine) */
+ H5VL_GROUP_GET_OBJINFO /* HG5Gget_objinfo (deprecated routine) */
+ /* (These two enum values should have an
+ * "#ifndefH5_NO_DEPRECATED_SYMBOLS"
+ * around them, but the compiler
+ * complains about an empty enum
+ * when deprecated symbols are
+ * disabled currently. When
+ * another enum value is added,
+ * please put the #ifdef around
+ * these symbols. QAK - 2018/12/06
+ */
+} H5VL_group_optional_t;
+
/*****************************/
/* Package Private Variables */
@@ -331,17 +347,11 @@ H5FL_EXTERN(H5G_shared_t);
H5_DLL H5G_t *H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info);
H5_DLL H5G_t *H5G__create_named(const H5G_loc_t *loc, const char *name,
hid_t lcpl_id, hid_t gcpl_id);
-H5_DLL H5G_t *H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info);
H5_DLL H5G_t *H5G__open_name(const H5G_loc_t *loc, const char *name);
-H5_DLL hid_t H5G__get_create_plist(const H5G_t *grp);
-H5_DLL herr_t H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info);
H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name,
H5G_info_t *grp_info);
H5_DLL herr_t H5G__get_info_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_info_t *grp_info);
-H5_DLL herr_t H5G__flush(H5G_t *grp, hid_t group_id);
-H5_DLL herr_t H5G__refresh(H5G_t *grp, hid_t group_id);
-H5_DLL herr_t H5G__close_cb(H5G_t *grp);
/*
* Group hierarchy traversal routines
@@ -387,9 +397,6 @@ H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t
#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 */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL H5G_obj_t H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*
@@ -434,8 +441,7 @@ H5_DLL herr_t H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type
H5_DLL herr_t H5G__link_iterate_table(const H5G_link_table_t *ltable,
hsize_t skip, hsize_t *last_lnk, const H5G_lib_iterate_t op, void *op_data);
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);
+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);
@@ -455,10 +461,6 @@ H5_DLL htri_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name,
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);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL H5G_obj_t H5G__compact_get_type_by_idx(H5O_loc_t *oloc,
- const H5O_linfo_t *linfo, hsize_t idx);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Functions that understand "dense" link storage */
H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo,
@@ -483,10 +485,6 @@ 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);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo,
- hsize_t idx);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Functions that understand group objects */
H5_DLL herr_t H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info,
@@ -501,6 +499,10 @@ H5_DLL herr_t H5G__obj_iterate(const H5O_loc_t *grp_oloc,
H5_DLL herr_t H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info);
H5_DLL htri_t H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk);
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+H5_DLL herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name,
+ hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*
* These functions operate on group hierarchy names.
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 95dfef5..f149f29 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -187,7 +187,7 @@ typedef struct H5G_entry_t H5G_entry_t;
* call.
*/
H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
-H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp);
+H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp);
H5_DLL H5F_t *H5G_fileof(H5G_t *grp);
H5_DLL H5G_t *H5G_open(const H5G_loc_t *loc);
H5_DLL herr_t H5G_close(H5G_t *grp);
@@ -209,10 +209,10 @@ H5_DLL char *H5G_normalize(const char *name);
*/
H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name,
unsigned target, H5G_traverse_t op, void *op_data);
-H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name,
+H5_DLL herr_t H5G_iterate(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
const H5G_link_iterate_t *lnk_op, void *op_data);
-H5_DLL herr_t H5G_visit(hid_t loc_id, const char *group_name,
+H5_DLL herr_t H5G_visit(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data);
/*
@@ -261,13 +261,14 @@ H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_dept
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(hid_t fid, const struct H5O_loc_t *loc,
- char* name, size_t size);
+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 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,
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 64c4054..e8d38b9 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -225,14 +225,14 @@ H5G__stab_create(H5O_loc_t *grp_oloc, const H5O_ginfo_t *ginfo, H5O_stab_t *stab
/* Go create the B-tree & local heap */
if(H5G__stab_create_components(grp_oloc->file, stab, size_hint) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components")
/*
* Insert the symbol table message into the object header and the symbol
* table entry.
*/
if(H5O_msg_create(grp_oloc, H5O_STAB_ID, 0, H5O_UPDATE_TIME, stab) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
@@ -534,7 +534,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order,
/* Get the B-tree info */
if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Pin the heap down in memory */
if(NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG)))
@@ -626,7 +626,7 @@ H5G__stab_count(const H5O_loc_t *oloc, hsize_t *num_objs)
/* Get the B-tree info */
if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Iterate over the group members */
if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_sumup, num_objs) < 0)
@@ -757,7 +757,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t
/* Get the B-tree & local heap info */
if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Pin the heap down in memory */
if(NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG)))
@@ -785,11 +785,11 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t
/* Iterate over the group members */
if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed")
/* If we don't know the name now, we almost certainly went out of bounds */
if(udata.name == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound")
/* Get the length of the name */
ret_value = (ssize_t)HDstrlen(udata.name);
@@ -979,7 +979,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_
/* Get the B-tree & local heap info */
if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Pin the heap down in memory */
if(NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG)))
@@ -1007,11 +1007,11 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_
/* Iterate over the group members */
if(H5B_iterate(grp_oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed")
/* If we didn't find the link, we almost certainly went out of bounds */
if(!udata.found)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound")
done:
/* Release resources */
@@ -1103,118 +1103,3 @@ done:
} /* end H5G__stab_valid */
#endif /* H5_STRICT_FORMAT_CHECKS */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5G_stab_get_type_by_idx_cb
- *
- * Purpose: Callback for B-tree iteration 'by index' info query to
- * retrieve the type of an object
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Nov 7, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata)
-{
- H5G_bt_it_gtbi_t *udata = (H5G_bt_it_gtbi_t *)_udata;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert(ent);
- HDassert(udata);
-
- /* Check for a soft link */
- switch(ent->type) {
- case H5G_CACHED_SLINK:
- udata->type = H5G_LINK;
- break;
-
- case H5G_CACHED_ERROR:
- case H5G_NOTHING_CACHED:
- case H5G_CACHED_STAB:
- case H5G_NCACHED:
- default:
- {
- H5O_loc_t tmp_oloc; /* Temporary object location */
- H5O_type_t obj_type; /* Type of object at location */
-
- /* Build temporary object location */
- tmp_oloc.file = udata->f;
- HDassert(H5F_addr_defined(ent->header));
- tmp_oloc.addr = ent->header;
-
- /* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
- udata->type = H5G_map_obj_type(obj_type);
- }
- break;
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_stab_get_type_by_idx_cb */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__stab_get_type_by_idx
- *
- * Purpose: Private function for H5Gget_objtype_by_idx.
- * Returns the type of objects in the group by giving index.
- *
- * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3)
- *
- * Failure: UNKNOWN
- *
- * Programmer: Raymond Lu
- * Nov 20, 2002
- *
- *-------------------------------------------------------------------------
- */
-H5G_obj_t
-H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx)
-{
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */
- H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
-
- FUNC_ENTER_PACKAGE_TAG(oloc->addr)
-
- /* Sanity check */
- HDassert(oloc);
-
- /* Get the B-tree & local heap info */
- if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address")
-
- /* Set iteration information */
- udata.common.idx = idx;
- udata.common.num_objs = 0;
- udata.common.op = H5G_stab_get_type_by_idx_cb;
- udata.f = oloc->file;
- udata.type = H5G_UNKNOWN;
-
- /* Iterate over the group members */
- if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed")
-
- /* If we don't know the type now, we almost certainly went out of bounds */
- if(udata.type == H5G_UNKNOWN)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound")
-
- /* Set the return value */
- ret_value = udata.type;
-
-done:
- FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5G__stab_get_type_by_idx() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index f2f3e3a..1995015 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -28,13 +28,15 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gpkg.h" /* Groups */
-#include "H5HLprivate.h" /* Local Heaps */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gpkg.h" /* Groups */
+#include "H5HLprivate.h" /* Local Heaps */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
/****************/
/* Local Macros */
@@ -80,7 +82,7 @@
htri_t H5G__is_empty_test(gid)
hid_t gid; IN: group to check
RETURNS
- Non-negative TRUE/FALSE on success, negative on failure
+ TRUE/FALSE on success, FAIL on failure
DESCRIPTION
Checks to see if the group has no link messages and no symbol table message
and no "dense" link storage
@@ -102,7 +104,7 @@ H5G__is_empty_test(hid_t gid)
FUNC_ENTER_PACKAGE
/* Get group structure */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP)))
+ if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set API context */
@@ -114,7 +116,7 @@ H5G__is_empty_test(hid_t gid)
/* Check if the group has any link messages */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0) {
/* Sanity check that new group format shouldn't have old messages */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
@@ -127,7 +129,7 @@ H5G__is_empty_test(hid_t gid)
/* Check for a link info message */
if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(linfo_exists > 0) {
H5O_linfo_t linfo; /* Link info message */
@@ -158,7 +160,7 @@ H5G__is_empty_test(hid_t gid)
/* Check if the group has a symbol table message */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0) {
H5O_stab_t stab; /* Info about local heap & B-tree */
hsize_t nlinks; /* Number of links in the group */
@@ -202,7 +204,7 @@ done:
hid_t gid; IN: group to check
unsigned *nmsgs; OUT: # of link messages in header
RETURNS
- Non-negative TRUE/FALSE on success, negative on failure
+ TRUE/FALSE on success, FAIL on failure
DESCRIPTION
Checks to see if the group has link messages and how many.
GLOBAL VARIABLES
@@ -222,7 +224,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs)
FUNC_ENTER_PACKAGE
/* Get group structure */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP)))
+ if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set API context */
@@ -232,15 +234,15 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs)
/* Check if the group has any link messages */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists == 0)
HGOTO_DONE(FALSE)
/* Check if the group has a symbol table message */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
/* Check if we should retrieve the number of link messages */
if(nmsgs) {
@@ -269,7 +271,7 @@ done:
htri_t H5G__has_stab_test(gid)
hid_t gid; IN: group to check
RETURNS
- Non-negative TRUE/FALSE on success, negative on failure
+ TRUE/FALSE on success, FAIL on failure
DESCRIPTION
Checks to see if the group has a symbol table message.
GLOBAL VARIABLES
@@ -289,7 +291,7 @@ H5G__has_stab_test(hid_t gid)
FUNC_ENTER_PACKAGE
/* Get group structure */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP)))
+ if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set API context */
@@ -299,15 +301,15 @@ H5G__has_stab_test(hid_t gid)
/* Check if the group has a symbol table message */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists == 0)
HGOTO_DONE(FALSE)
/* Check if the group has any link messages */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
done:
if(api_ctx_pushed && H5CX_pop() < 0)
@@ -326,7 +328,7 @@ done:
htri_t H5G__is_new_dense_test(gid)
hid_t gid; IN: group to check
RETURNS
- Non-negative TRUE/FALSE on success, negative on failure
+ TRUE/FALSE on success, FAIL on failure
DESCRIPTION
Checks to see if the group is in the "new" format for groups (link messages/
fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has
@@ -348,7 +350,7 @@ H5G__is_new_dense_test(hid_t gid)
FUNC_ENTER_PACKAGE
/* Get group structure */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP)))
+ if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set API context */
@@ -358,19 +360,19 @@ H5G__is_new_dense_test(hid_t gid)
/* Check if the group has a symbol table message */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_DONE(FALSE)
/* Check if the group has any link messages */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_DONE(FALSE)
/* Check if the group has link info message */
if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0) {
H5O_linfo_t linfo; /* Link info message */
@@ -404,7 +406,7 @@ done:
hsize_t *name_count; OUT: Number of links in name index
hsize_t *corder_count; OUT: Number of links in creation order index
RETURNS
- Non-negative on success, negative on failure
+ SUCCEED/FAIL
DESCRIPTION
Currently, just retrieves the number of links in each index and returns
them.
@@ -427,7 +429,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
FUNC_ENTER_PACKAGE
/* Get group structure */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP)))
+ if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set API context */
@@ -495,7 +497,7 @@ done:
hid_t gid; IN: group to check
size_t *lheap_size; OUT: Size of local heap
RETURNS
- Non-negative on success, negative on failure
+ SUCCEED/FAIL
DESCRIPTION
Checks the size of the local heap for a group
GLOBAL VARIABLES
@@ -515,7 +517,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size)
FUNC_ENTER_PACKAGE
/* Get group structure */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP)))
+ if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set API context */
@@ -525,11 +527,11 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size)
/* Make certain the group has a symbol table message */
if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message")
/* Check the size of the local heap for the group */
if(H5HL_get_size(grp->oloc.file, stab.heap_addr, lheap_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size")
done:
if(api_ctx_pushed && H5CX_pop() < 0)
@@ -551,7 +553,7 @@ done:
size_t *user_path_len; OUT: Size of user path
unsigned *obj_hidden; OUT: Whether object is hidden
RETURNS
- Non-negative on success, negative on failure
+ SUCCEED/FAIL
DESCRIPTION
Retrieves the user path for an ID. A zero for the length is returned in
the case of no user path.
@@ -576,7 +578,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
HDassert(obj_hidden);
/* Get pointer to object for ID */
- if(NULL == (obj_ptr = H5I_object(obj_id)))
+ if(NULL == (obj_ptr = H5VL_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID")
/* Set API context */
@@ -609,6 +611,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
@@ -648,15 +651,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__verify_cached_stab_test
+ * Function: H5G__verify_cached_stab_test
*
* Purpose: Check that a that the provided group entry contains a
* cached symbol table entry, that the entry matches that in
* the provided group's object header, and check that the
* addresses are valid.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Neil Fortner
* Mar 31, 2009
@@ -666,9 +668,9 @@ done:
herr_t
H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent)
{
- H5O_stab_t stab; /* Symbol table */
- H5HL_t *heap = NULL; /* Pointer to local heap */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_stab_t stab; /* Symbol table */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr)
@@ -681,7 +683,8 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent)
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message")
/* Verify that the cached symbol table info matches the symbol table message
- * in the object header */
+ * in the object header.
+ */
if((ent->cache.stab.btree_addr != stab.btree_addr)
|| (ent->cache.stab.heap_addr != stab.heap_addr))
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header")
@@ -711,7 +714,7 @@ done:
* group with a symbol table, and that that information is
* correct.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: H5_ITER_STOP/H5_ITER_CONT/H5_ITER_ERROR
*
* Programmer: Neil Fortner
* Apr 8, 2011
@@ -732,9 +735,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key,
FUNC_ENTER_STATIC
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
@@ -749,7 +750,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key,
targ_oloc.holding_file = FALSE;
/* Iterate over entries */
- for(i=0; i<sn->nsyms; i++) {
+ for(i = 0; i < sn->nsyms; i++) {
/* Update oloc address */
targ_oloc.addr = sn->entry[i].header;
@@ -773,7 +774,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key,
if((sn->entry[i].cache.stab.btree_addr != stab.btree_addr)
|| (sn->entry[i].cache.stab.heap_addr != stab.heap_addr))
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "cached symbol table information is incorrect")
- } /* end if */
+ }
else if(sn->entry[i].type == H5G_CACHED_STAB)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached")
@@ -831,7 +832,7 @@ H5G__verify_cached_stabs_test(hid_t gid)
HDassert(gid >= 0);
/* Check args */
- if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP)))
+ if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Set up metadata tagging */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 37b6292..d029bea 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -32,18 +32,17 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5Gpkg.h" /* Groups */
-#include "H5HLprivate.h" /* Local Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Ppublic.h" /* Property Lists */
-#include "H5WBprivate.h" /* Wrapped Buffers */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Ppublic.h" /* Property Lists */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
@@ -198,7 +197,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
/* Create a group ID to pass to the user-defined callback */
if(NULL == (grp = H5G_open(&grp_loc_copy)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if((cur_grp = H5I_register(H5I_GROUP, grp, FALSE)) < 0)
+ if((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* User-defined callback function */
@@ -324,7 +323,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
/* Traverse the link */
if(H5G__traverse_real(&tmp_grp_loc, lnk->u.soft.name, target, H5G__traverse_slink_cb, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
/* Pass back information about whether the object exists */
*obj_exists = udata.exists;
@@ -359,8 +358,7 @@ done:
*/
herr_t
H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
- unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc,
- hbool_t *obj_exists)
+ unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists)
{
size_t nlinks; /* # of soft / UD links left to traverse */
herr_t ret_value = SUCCEED; /* Return value */
@@ -372,13 +370,13 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
HDassert(lnk);
HDassert(obj_loc);
- /*
- * If we found a symbolic link then we should follow it. But if this
+ /* If we found a symbolic link then we should follow it. But if this
* is the last component of the name and the H5G_TARGET_SLINK bit of
* TARGET is set then we don't follow it.
*/
if(H5L_TYPE_SOFT == lnk->type &&
(0 == (target & H5G_TARGET_SLINK) || !last_comp)) {
+
/* Get the # of soft / UD links left to traverse */
if(H5CX_get_nlinks(&nlinks) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
@@ -403,6 +401,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
*/
if(lnk->type >= H5L_TYPE_UD_MIN &&
(0 == (target & H5G_TARGET_UDLINK) || !last_comp) ) {
+
/* Get the # of soft / UD links left to traverse */
if(H5CX_get_nlinks(&nlinks) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
@@ -830,20 +829,21 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver
if(!op)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided")
- /* Retrieve the original # of soft / UD links that are able to be traversed */
- /* (So that multiple calls to H5G_traverse don't incorrectly look
- * like they've traversed too many. Nested calls, like in H5L__move(),
+ /* Retrieve the original # of soft / UD links that are able to be traversed
+ * (So that multiple calls to H5G_traverse don't incorrectly look
+ * like they've traversed too many. Nested calls, like in H5L_move(),
* may need their own mechanism to set & reset the # of links to traverse)
*/
if(H5CX_get_nlinks(&orig_nlinks) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
/* Set up invalid tag. This is a precautionary step only. Setting an invalid
- tag here will ensure that no metadata accessed while doing the traversal
- is given an improper tag, unless another one is specifically set up
- first. This will ensure we're not accidentally tagging something we
- shouldn't be during the traversal. Note that for best tagging assertion
- coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */
+ * tag here will ensure that no metadata accessed while doing the traversal
+ * is given an improper tag, unless another one is specifically set up
+ * first. This will ensure we're not accidentally tagging something we
+ * shouldn't be during the traversal. Note that for best tagging assertion
+ * coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised.
+ */
H5_BEGIN_TAG(H5AC__INVALID_TAG);
/* Go perform "real" traversal */
diff --git a/src/H5HF.c b/src/H5HF.c
index b7a6244..3df7e7b 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -167,7 +167,7 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam)
/* Create shared fractal heap header */
if(HADDR_UNDEF == (fh_addr = H5HF_hdr_create(f, cparam)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header")
/* Allocate fractal heap wrapper */
if(NULL == (fh = H5FL_MALLOC(H5HF_t)))
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index 70dfeed..fc437dc 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -395,7 +395,7 @@ H5HF_hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
/* Load the fractal heap header */
if(NULL == (hdr = H5HF__hdr_protect(f, addr, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
/* Print the information about the heap's header */
H5HF_hdr_print(hdr, FALSE, stream, indent, fwidth);
@@ -531,13 +531,13 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/* Load the fractal heap header */
if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
/*
* Load the heap direct block
*/
if(NULL == (dblock = H5HF__man_dblock_protect(hdr, addr, block_size, NULL, 0, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block")
/* Print opening message */
HDfprintf(stream, "%*sFractal Heap Direct Block...\n", indent, "");
@@ -788,13 +788,13 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/* Load the fractal heap header */
if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
/*
* Load the heap indirect block
*/
if(NULL == (iblock = H5HF__man_iblock_protect(hdr, addr, nrows, NULL, 0, FALSE, H5AC__READ_ONLY_FLAG, &did_protect)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block")
/* Print the information about the heap's indirect block */
H5HF_iblock_print(iblock, FALSE, stream, indent, fwidth);
@@ -878,8 +878,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent,
- int fwidth)
+H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, int fwidth)
{
H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */
herr_t ret_value = SUCCEED; /* Return value */
@@ -897,7 +896,7 @@ H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent,
/* Load the fractal heap header */
if(NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header")
/* Initialize the free space information for the heap */
if(H5HF__space_start(hdr, FALSE) < 0)
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 8166d88..b014017 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -484,7 +484,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam)
/* Second phase of header final initialization */
/* (needs ID and filter lengths set up) */
if(H5HF_hdr_finish_init_phase2(hdr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization")
/* Extra checking for possible gap between max. direct block size minus
* overhead and "huge" object size */
@@ -494,11 +494,11 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam)
/* Allocate space for the header on disk */
if(HADDR_UNDEF == (hdr->heap_addr = H5MF_alloc(f, H5FD_MEM_FHEAP_HDR, (hsize_t)hdr->heap_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header")
/* Cache the new fractal heap header */
if(H5AC_insert_entry(f, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache")
/* Set address of heap header to return */
ret_value = hdr->heap_addr;
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index e5c2559..20a62b7 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -256,52 +256,52 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock)
/* Check for last reference to block */
if(iblock->rc == 0) {
- /* If this indirect block has a parent, reset it's child iblock pointer */
- if(iblock->parent) {
- H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */
- unsigned indir_idx; /* Index in parent's child iblock pointer array */
-
- /* Sanity check */
- HDassert(par_iblock->child_iblocks);
- HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows
- * iblock->hdr->man_dtable.cparam.width));
-
- /* Compute index in parent's child iblock pointer array */
- indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows
- * iblock->hdr->man_dtable.cparam.width);
-
- /* Reset pointer to pinned child indirect block in parent */
- HDassert(par_iblock->child_iblocks[indir_idx]);
- par_iblock->child_iblocks[indir_idx] = NULL;
- } /* end if */
- else {
- /* Check for root indirect block */
- if(iblock->block_off == 0) {
- /* Sanity check - shouldn't be recursively unpinning root indirect block */
- HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED);
-
- /* Check if we should reset the root iblock pointer */
- if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) {
- HDassert(NULL != iblock->hdr->root_iblock);
- iblock->hdr->root_iblock = NULL;
- } /* end if */
-
- /* Indicate that the root indirect block is unpinned */
- iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED));
- } /* end if */
- } /* end else */
-
- /* Check if the block is still in the cache */
- if(!iblock->removed_from_cache) {
- /* Unpin the indirect block, making it evictable again */
- if(H5HF__iblock_unpin(iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block")
- } /* end if */
- else {
- /* Destroy the indirect block */
- if(H5HF_man_iblock_dest(iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block")
- } /* end else */
+ /* If this indirect block has a parent, reset it's child iblock pointer */
+ if(iblock->parent) {
+ H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */
+ unsigned indir_idx; /* Index in parent's child iblock pointer array */
+
+ /* Sanity check */
+ HDassert(par_iblock->child_iblocks);
+ HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows
+ * iblock->hdr->man_dtable.cparam.width));
+
+ /* Compute index in parent's child iblock pointer array */
+ indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows
+ * iblock->hdr->man_dtable.cparam.width);
+
+ /* Reset pointer to pinned child indirect block in parent */
+ HDassert(par_iblock->child_iblocks[indir_idx]);
+ par_iblock->child_iblocks[indir_idx] = NULL;
+ } /* end if */
+ else {
+ /* Check for root indirect block */
+ if(iblock->block_off == 0) {
+ /* Sanity check - shouldn't be recursively unpinning root indirect block */
+ HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED);
+
+ /* Check if we should reset the root iblock pointer */
+ if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) {
+ HDassert(NULL != iblock->hdr->root_iblock);
+ iblock->hdr->root_iblock = NULL;
+ } /* end if */
+
+ /* Indicate that the root indirect block is unpinned */
+ iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED));
+ } /* end if */
+ } /* end else */
+
+ /* Check if the block is still in the cache */
+ if(!iblock->removed_from_cache) {
+ /* Unpin the indirect block, making it evictable again */
+ if(H5HF__iblock_unpin(iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block")
+ } /* end if */
+ else {
+ /* Destroy the indirect block */
+ if(H5HF_man_iblock_dest(iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block")
+ } /* end else */
} /* end if */
done:
@@ -408,13 +408,13 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size)
dblock->parent = iblock;
dblock->par_entry = 0;
- /* Destroy flush dependency between direct block and header */
- if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0)
+ /* Destroy flush dependency between direct block and header */
+ if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
dblock->fd_parent = NULL;
- /* Create flush dependency between direct block and new root indirect block */
- if(H5AC_create_flush_dependency(iblock, dblock) < 0)
+ /* Create flush dependency between direct block and new root indirect block */
+ if(H5AC_create_flush_dependency(iblock, dblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
dblock->fd_parent = iblock;
@@ -1059,14 +1059,14 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock,
iblock->block_off += hdr->man_dtable.row_block_off[par_entry / hdr->man_dtable.cparam.width];
iblock->block_off += hdr->man_dtable.row_block_size[par_entry / hdr->man_dtable.cparam.width] * (par_entry % hdr->man_dtable.cparam.width);
- /* Set indirect block parent as flush dependency parent */
- iblock->fd_parent = par_iblock;
+ /* Set indirect block parent as flush dependency parent */
+ iblock->fd_parent = par_iblock;
} /* end if */
else {
iblock->block_off = 0; /* Must be the root indirect block... */
- /* Set heap header as flush dependency parent */
- iblock->fd_parent = hdr;
+ /* Set heap header as flush dependency parent */
+ iblock->fd_parent = hdr;
} /* end else */
/* Update indirect block's statistics */
@@ -1430,69 +1430,69 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry)
if(H5HF__man_iblock_root_revert(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't convert root indirect block back to root direct block")
- /* If the indirect block wasn't removed already (by reverting it) */
- if(!iblock->removed_from_cache) {
- /* Check for reducing size of root indirect block */
- if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0
- && entry > iblock->max_child) {
- unsigned max_child_row; /* Row for max. child entry */
-
- /* Compute information needed for determining whether to reduce size of root indirect block */
- max_child_row = iblock->max_child / hdr->man_dtable.cparam.width;
-
- /* Check if the root indirect block should be reduced */
- if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2))
- if(H5HF__man_iblock_root_halve(iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block")
- } /* end if */
- } /* end if */
+ /* If the indirect block wasn't removed already (by reverting it) */
+ if(!iblock->removed_from_cache) {
+ /* Check for reducing size of root indirect block */
+ if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0
+ && entry > iblock->max_child) {
+ unsigned max_child_row; /* Row for max. child entry */
+
+ /* Compute information needed for determining whether to reduce size of root indirect block */
+ max_child_row = iblock->max_child / hdr->man_dtable.cparam.width;
+
+ /* Check if the root indirect block should be reduced */
+ if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2))
+ if(H5HF__man_iblock_root_halve(iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block")
+ } /* end if */
+ } /* end if */
} /* end if */
/* If the indirect block wasn't removed already (by reverting it) */
if(!iblock->removed_from_cache) {
- /* Mark indirect block as modified */
- if(H5HF_iblock_dirty(iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty")
-
- /* Check for last child being removed from indirect block */
- if(iblock->nchildren == 0) {
- hbool_t did_protect = FALSE; /* Whether the indirect block was protected */
-
- /* If this indirect block's refcount is >1, then it's being deleted
- * from the fractal heap (since its nchildren == 0), but is still
- * referred to from free space sections in the heap (refcount >1).
- * Its space in the file needs to be freed now, and it also needs
- * to be removed from the metadata cache now, in case the space in
- * the file is reused by another piece of metadata that is inserted
- * into the cache before the indirect block's entry is evicted
- * (having two entries at the same address would be an error, from
- * the cache's perspective).
- */
- /* Lock indirect block for deletion */
- if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block")
- HDassert(did_protect == TRUE);
-
- /* Check for deleting root indirect block (and no root direct block) */
- if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0)
- /* Reset header information back to "empty heap" state */
- if(H5HF__hdr_empty(hdr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty")
-
- /* Detach from parent indirect block */
- if(iblock->parent) {
- /* Destroy flush dependency between indirect block and parent */
- if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
- iblock->fd_parent = NULL;
-
- /* Detach from parent indirect block */
- if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block")
- iblock->parent = NULL;
- iblock->par_entry = 0;
- } /* end if */
- } /* end if */
+ /* Mark indirect block as modified */
+ if(H5HF_iblock_dirty(iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty")
+
+ /* Check for last child being removed from indirect block */
+ if(iblock->nchildren == 0) {
+ hbool_t did_protect = FALSE; /* Whether the indirect block was protected */
+
+ /* If this indirect block's refcount is >1, then it's being deleted
+ * from the fractal heap (since its nchildren == 0), but is still
+ * referred to from free space sections in the heap (refcount >1).
+ * Its space in the file needs to be freed now, and it also needs
+ * to be removed from the metadata cache now, in case the space in
+ * the file is reused by another piece of metadata that is inserted
+ * into the cache before the indirect block's entry is evicted
+ * (having two entries at the same address would be an error, from
+ * the cache's perspective).
+ */
+ /* Lock indirect block for deletion */
+ if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block")
+ HDassert(did_protect == TRUE);
+
+ /* Check for deleting root indirect block (and no root direct block) */
+ if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0)
+ /* Reset header information back to "empty heap" state */
+ if(H5HF__hdr_empty(hdr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty")
+
+ /* Detach from parent indirect block */
+ if(iblock->parent) {
+ /* Destroy flush dependency between indirect block and parent */
+ if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
+ iblock->fd_parent = NULL;
+
+ /* Detach from parent indirect block */
+ if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block")
+ iblock->parent = NULL;
+ iblock->par_entry = 0;
+ } /* end if */
+ } /* end if */
} /* end if */
/* Decrement the reference count on this indirect block if we're not deleting it */
@@ -1501,48 +1501,48 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry)
* not being deleted)
*/
if(H5HF__iblock_decr(iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
iblock = NULL;
/* Delete indirect block from cache, if appropriate */
if(del_iblock) {
- unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */
- hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */
-
- /* If the refcount is still >0, unpin the block and take ownership
- * from the cache, otherwise let the cache destroy it.
- */
- if(del_iblock->rc > 0) {
- cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG);
- cache_flags |= H5AC__UNPIN_ENTRY_FLAG;
- took_ownership = TRUE;
- } /* end if */
- else {
- /* Entry should be removed from the cache */
- cache_flags |= H5AC__DELETED_FLAG;
-
- /* If the indirect block is in real file space, tell
- * the cache to free its file space as well.
- */
- if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr))
- cache_flags |= H5AC__FREE_FILE_SPACE_FLAG;
- } /* end else */
-
- /* Unprotect the indirect block, with appropriate flags */
- if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
-
- /* if took ownership, free file space & mark block as removed from cache */
- if(took_ownership) {
- /* Free indirect block disk space, if it's in real space */
- if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr))
- if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space")
- del_iblock->addr = HADDR_UNDEF;
-
- /* Mark block as removed from the cache */
- del_iblock->removed_from_cache = TRUE;
- } /* end if */
+ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */
+ hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */
+
+ /* If the refcount is still >0, unpin the block and take ownership
+ * from the cache, otherwise let the cache destroy it.
+ */
+ if(del_iblock->rc > 0) {
+ cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG);
+ cache_flags |= H5AC__UNPIN_ENTRY_FLAG;
+ took_ownership = TRUE;
+ } /* end if */
+ else {
+ /* Entry should be removed from the cache */
+ cache_flags |= H5AC__DELETED_FLAG;
+
+ /* If the indirect block is in real file space, tell
+ * the cache to free its file space as well.
+ */
+ if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr))
+ cache_flags |= H5AC__FREE_FILE_SPACE_FLAG;
+ } /* end else */
+
+ /* Unprotect the indirect block, with appropriate flags */
+ if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
+
+ /* if took ownership, free file space & mark block as removed from cache */
+ if(took_ownership) {
+ /* Free indirect block disk space, if it's in real space */
+ if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr))
+ if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space")
+ del_iblock->addr = HADDR_UNDEF;
+
+ /* Mark block as removed from the cache */
+ del_iblock->removed_from_cache = TRUE;
+ } /* end if */
} /* end if */
done:
@@ -1633,24 +1633,24 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr,
if(H5F_addr_defined(iblock->ents[entry].addr)) {
/* Are we in a direct or indirect block row */
if(row < hdr->man_dtable.max_direct_rows) {
- hsize_t dblock_size; /* Size of direct block on disk */
+ hsize_t dblock_size; /* Size of direct block on disk */
- /* Check for I/O filters on this heap */
- if(hdr->filter_len > 0)
- dblock_size = iblock->filt_ents[entry].size;
- else
- dblock_size = hdr->man_dtable.row_block_size[row];
+ /* Check for I/O filters on this heap */
+ if(hdr->filter_len > 0)
+ dblock_size = iblock->filt_ents[entry].size;
+ else
+ dblock_size = hdr->man_dtable.row_block_size[row];
/* Delete child direct block */
if(H5HF__man_dblock_delete(hdr->f, iblock->ents[entry].addr, dblock_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap child direct block")
} /* end if */
else {
- hsize_t row_block_size; /* The size of blocks in this row */
+ hsize_t row_block_size; /* The size of blocks in this row */
unsigned child_nrows; /* Number of rows in new indirect block */
- /* Get the row's block size */
- row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row];
+ /* Get the row's block size */
+ row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row];
/* Compute # of rows in next child indirect block to use */
child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, row_block_size);
@@ -1733,30 +1733,30 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr,
/* Indirect entries in this indirect block */
if(iblock->nrows > hdr->man_dtable.max_direct_rows) {
- unsigned first_row_bits; /* Number of bits used bit addresses in first row */
+ unsigned first_row_bits; /* Number of bits used bit addresses in first row */
unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */
unsigned entry; /* Current entry in row */
size_t u; /* Local index variable */
entry = hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width;
- first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) +
- H5VM_log2_of2(hdr->man_dtable.cparam.width);
+ first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) +
+ H5VM_log2_of2(hdr->man_dtable.cparam.width);
num_indirect_rows =
- (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1;
+ (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1;
for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++, num_indirect_rows++) {
size_t v; /* Local index variable */
- for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++)
- if(H5F_addr_defined(iblock->ents[entry].addr))
- if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block")
+ for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++)
+ if(H5F_addr_defined(iblock->ents[entry].addr))
+ if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block")
} /* end for */
} /* end if */
done:
/* Release the indirect block */
if(iblock && H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
iblock = NULL;
FUNC_LEAVE_NOAPI(ret_value)
@@ -1810,17 +1810,17 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off,
*/
prev_par_block_off = par_block_off = 0;
while(row >= hdr->man_dtable.max_direct_rows) {
- /* Retain previous parent block offset */
- prev_par_block_off = par_block_off;
+ /* Retain previous parent block offset */
+ prev_par_block_off = par_block_off;
/* Compute the new parent indirect block's offset in the heap's address space */
/* (based on previous block offset) */
par_block_off += hdr->man_dtable.row_block_off[row];
par_block_off += hdr->man_dtable.row_block_size[row] * col;
- /* Preserve current row & column */
- prev_row = row;
- prev_col = col;
+ /* Preserve current row & column */
+ prev_row = row;
+ prev_col = col;
/* Look up row & column in new indirect block for object */
if(H5HF_dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0)
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 394bcff..7f90f49 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -140,6 +140,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
/* Check for row section */
if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ||
sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) {
+
/* Allocate 'single' selection out of 'row' selection */
if(H5HF__man_iblock_alloc_row(hdr, &sec_node) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section")
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 5086afb..4eec1c1 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -25,9 +25,6 @@
#ifndef _H5HFprivate_H
#define _H5HFprivate_H
-/* Include package's public header */
-#include "H5HFpublic.h"
-
/* Private headers needed by this file */
#include "H5Fprivate.h" /* File access */
#include "H5Oprivate.h" /* Object headers */
@@ -110,15 +107,13 @@ H5_DLL H5HF_t *H5HF_create(H5F_t *f, const H5HF_create_t *cparam);
H5_DLL H5HF_t *H5HF_open(H5F_t *f, haddr_t fh_addr);
H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/);
H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/);
-H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj,
- void *id/*out*/);
+H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id/*out*/);
H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, const void *id, size_t *obj_len_p/*out*/);
H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p/*out*/);
H5_DLL herr_t H5HF_read(H5HF_t *fh, const void *id, void *obj/*out*/);
H5_DLL herr_t H5HF_write(H5HF_t *fh, void *id, hbool_t *id_changed,
const void *obj);
-H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op,
- void *op_data);
+H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, void *op_data);
H5_DLL herr_t H5HF_remove(H5HF_t *fh, const void *id);
H5_DLL herr_t H5HF_close(H5HF_t *fh);
H5_DLL herr_t H5HF_delete(H5F_t *f, haddr_t fh_addr);
@@ -128,11 +123,9 @@ H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats);
H5_DLL herr_t H5HF_size(const H5HF_t *fh, hsize_t *heap_size/*out*/);
/* Debugging routines */
-H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream,
- int indent, int fwidth);
+H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, int indent, int fwidth);
#ifdef H5HF_DEBUGGING
-H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
- int fwidth);
+H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth);
#endif /* H5HF_DEBUGGING */
#endif /* _H5HFprivate_H */
diff --git a/src/H5HFpublic.h b/src/H5HFpublic.h
deleted file mode 100644
index 82cfc21..0000000
--- a/src/H5HFpublic.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5HFpublic.h
- * Feb 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Public declarations for the fractal heap package.
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef _H5HFpublic_H
-#define _H5HFpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
-/*****************/
-/* Public Macros */
-/*****************/
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H5HFpublic_H */
-
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 66c8414..36e966e 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -692,8 +692,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect,
*-------------------------------------------------------------------------
*/
herr_t
-H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
- size_t amt)
+H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2094,8 +2093,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__sect_row_debug(const H5FS_section_info_t *_sect,
- FILE *stream, int indent, int fwidth)
+H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, int fwidth)
{
const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Section to dump info */
@@ -2666,8 +2664,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock,
- unsigned start_entry, unsigned nentries)
+H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries)
{
H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */
H5HF_free_section_t *first_row_sect = NULL; /* First row section in new indirect section */
@@ -2841,8 +2838,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
- H5HF_indirect_t *sect_iblock)
+H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indirect_t *sect_iblock)
{
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5HFspace.c b/src/H5HFspace.c
index 5260ae2..37a0502 100644
--- a/src/H5HFspace.c
+++ b/src/H5HFspace.c
@@ -311,7 +311,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr)
/* Only need to scan the sections if the free space has been initialized */
if(hdr->fspace)
- /* Iterate over all sections, resetting the parent pointers in 'single' sections */
+ /* Iterate over all sections, resetting the parent pointers in 'single' sections */
if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers")
@@ -404,7 +404,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock)
/* Only need to scan the sections if the free space has been initialized */
if(hdr->fspace)
- /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */
+ /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */
if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_create_root_cb, root_iblock) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers")
@@ -602,8 +602,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
- uint16_t new_class)
+H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5HG.c b/src/H5HG.c
index 53f1b2a..df1c82d 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -83,7 +83,7 @@
/********************/
static haddr_t H5HG__create(H5F_t *f, size_t size);
-
+static size_t H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr);
/*********************/
/* Package Variables */
@@ -204,11 +204,11 @@ H5HG__create(H5F_t *f, size_t size)
/* Add this heap to the beginning of the CWFS list */
if(H5F_cwfs_add(f, heap) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS")
/* Add the heap to the cache */
if(H5AC_insert_entry(f, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection")
ret_value = addr;
@@ -223,7 +223,7 @@ done:
/* Check if the heap object was allocated */
if(heap)
/* Destroy the heap object */
- if(H5HG_free(heap) < 0)
+ if(H5HG__free(heap) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection")
} /* end if */
} /* end if */
@@ -275,7 +275,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HG_alloc
+ * Function: H5HG__alloc
*
* Purpose: Given a heap with enough free space, this function will split
* the free space to make a new empty heap object and initialize
@@ -293,14 +293,14 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
+H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
{
size_t idx;
uint8_t *p;
size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
size_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(heap);
@@ -363,27 +363,27 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
heap->obj[0].begin = NULL;
} /* end if */
else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) {
- /*
- * Some free space remains and it's larger than a heap object header,
- * so write the new free heap object header to the heap.
- */
- heap->obj[0].size -= need;
- heap->obj[0].begin += need;
- p = heap->obj[0].begin;
- UINT16ENCODE(p, 0); /*id*/
- UINT16ENCODE(p, 0); /*nrefs*/
- UINT32ENCODE(p, 0); /*reserved*/
- H5F_ENCODE_LENGTH (f, p, heap->obj[0].size);
- HDassert(H5HG_ISALIGNED(heap->obj[0].size));
+ /*
+ * Some free space remains and it's larger than a heap object header,
+ * so write the new free heap object header to the heap.
+ */
+ heap->obj[0].size -= need;
+ heap->obj[0].begin += need;
+ p = heap->obj[0].begin;
+ UINT16ENCODE(p, 0); /*id*/
+ UINT16ENCODE(p, 0); /*nrefs*/
+ UINT32ENCODE(p, 0); /*reserved*/
+ H5F_ENCODE_LENGTH (f, p, heap->obj[0].size);
+ HDassert(H5HG_ISALIGNED(heap->obj[0].size));
} /* end else-if */
else {
- /*
- * Some free space remains but it's smaller than a heap object header,
- * so we don't write the header.
- */
- heap->obj[0].size -= need;
- heap->obj[0].begin += need;
- HDassert(H5HG_ISALIGNED(heap->obj[0].size));
+ /*
+ * Some free space remains but it's smaller than a heap object header,
+ * so we don't write the header.
+ */
+ heap->obj[0].size -= need;
+ heap->obj[0].begin += need;
+ HDassert(H5HG_ISALIGNED(heap->obj[0].size));
}
/* Mark the heap as dirty */
@@ -394,7 +394,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5HG_alloc() */
+} /* end H5HG__alloc() */
/*-------------------------------------------------------------------------
@@ -522,7 +522,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
HDassert(hobj);
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Find a large enough collection on the CWFS list */
need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
@@ -548,7 +548,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
/* Split the free space to make room for the new object */
- if(0 == (idx = H5HG_alloc(f, heap, size, &heap_flags)))
+ if(0 == (idx = H5HG__alloc(f, heap, size, &heap_flags)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object")
/* Copy data into the heap */
@@ -608,7 +608,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size)
/* Load the heap */
if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap")
HDassert(hobj->idx < heap->nused);
HDassert(heap->obj[hobj->idx].begin);
@@ -617,7 +617,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size)
/* Allocate a buffer for the object read in, if the user didn't give one */
if(!object && NULL == (object = H5MM_malloc(size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(object, p, size);
/*
@@ -678,7 +678,7 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust)
HDassert(f);
HDassert(hobj);
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Load the heap */
if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET)))
@@ -785,7 +785,14 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
HDassert(hobj->idx < heap->nused);
- HDassert(heap->obj[hobj->idx].begin);
+
+ /* When the application selects the same location to rewrite the VL element by using H5Sselect_elements,
+ * it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of
+ * the entry and let the second rewrite happen (see HDFFV-10635). In the future, it'd be nice to handle
+ * this situation in H5T_conv_vlen in H5Tconv.c instead of this level (HDFFV-10648). */
+ if(heap->obj[hobj->idx].nrefs == 0 && heap->obj[hobj->idx].size == 0 && !heap->obj[hobj->idx].begin)
+ HGOTO_DONE(ret_value)
+
obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */
need = H5HG_ALIGN(heap->obj[hobj->idx].size) + H5HG_SIZEOF_OBJHDR(f);
@@ -839,11 +846,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HG_free
+ * Function: H5HG__free
*
- * Purpose: Destroys a global heap collection in memory
+ * Purpose: Destroys a global heap collection in memory
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, January 15, 2003
@@ -851,7 +858,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HG_free(H5HG_heap_t *heap)
+H5HG__free(H5HG_heap_t *heap)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -872,5 +879,5 @@ H5HG_free(H5HG_heap_t *heap)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5HG_free() */
+} /* H5HG__free() */
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index 3a770ae..beaea7b 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -374,7 +374,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata,
done:
if(!ret_value && heap)
- if(H5HG_free(heap) < 0)
+ if(H5HG__free(heap) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection")
FUNC_LEAVE_NOAPI(ret_value)
@@ -485,7 +485,7 @@ H5HG__cache_heap_free_icr(void *_thing)
HDassert(heap->cache_info.type == H5AC_GHEAP);
/* Destroy global heap collection */
- if(H5HG_free(heap) < 0)
+ if(H5HG__free(heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection")
done:
diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h
index a735ba0..4ed9b10 100644
--- a/src/H5HGpkg.h
+++ b/src/H5HGpkg.h
@@ -137,7 +137,7 @@ struct H5HG_heap_t {
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5HG_free(H5HG_heap_t *heap);
+H5_DLL herr_t H5HG__free(H5HG_heap_t *heap);
H5_DLL H5HG_heap_t *H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags);
#endif /* _H5HGpkg_H */
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index a7d7a80..1c609e2 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -18,9 +18,6 @@
#ifndef _H5HGprivate_H
#define _H5HGprivate_H
-/* Include package's public header */
-#include "H5HGpublic.h"
-
/* Private headers needed by this file. */
#include "H5Fprivate.h" /* File access */
diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c
index e4e6fa8..edb0261 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -76,10 +76,10 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth))
"Data bytes allocated for heap:",
h->dblk_size);
- /*
- * Traverse the free list and check that all free blocks fall within
+ /* Traverse the free list and check that all free blocks fall within
* the heap and that no two free blocks point to the same region of
- * the heap. */
+ * the heap.
+ */
if(NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
@@ -88,35 +88,30 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth))
char temp_str[32];
HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block);
- HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9),
- temp_str,
- freelist->offset, freelist->size);
- if((freelist->offset + freelist->size) > h->dblk_size)
- HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n");
- else {
+ HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), temp_str, freelist->offset, freelist->size);
+ if((freelist->offset + freelist->size) > h->dblk_size)
+ HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n");
+ else {
int overlap = 0;
size_t i;
- for(i = 0; i < freelist->size; i++) {
- 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 for */
+ for(i = 0; i < freelist->size; i++) {
+ 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));
+ 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));
- /*
- * Print the data in a VMS-style octal dump.
- */
+ /* 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
@@ -127,3 +122,4 @@ CATCH
H5E_THROW(H5E_CANTFREE, "can't free marker buffer");
END_FUNC(PRIV) /* end H5HL_debug() */
+
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 4001ef1..7a53b25 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -24,9 +24,6 @@
#ifndef _H5HLprivate_H
#define _H5HLprivate_H
-/* Include package's public header */
-#include "H5HLpublic.h"
-
/* Private headers needed by this file. */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
diff --git a/src/H5I.c b/src/H5I.c
index 4df7b7e..68cbe55 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -26,28 +26,24 @@
*/
#include "H5Imodule.h" /* This source code file is part of the H5I module */
+#define H5T_FRIEND /* Suppress error about including H5Tpkg */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
#include "H5SLprivate.h" /* Skip Lists */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
-/* Define this to compile in support for dumping ID information */
-/* #define H5I_DEBUG_OUTPUT */
-#ifndef H5I_DEBUG_OUTPUT
-#include "H5Gprivate.h" /* Groups */
-#else /* H5I_DEBUG_OUTPUT */
-#define H5G_FRIEND /* Suppress error about including H5Gpkg */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Tprivate.h" /* Datatypes */
-#endif /* H5I_DEBUG_OUTPUT */
/* Local Macros */
@@ -80,11 +76,24 @@ typedef struct {
void *ret_obj; /* Object to return */
} H5I_search_ud_t;
+typedef struct {
+ H5I_iterate_func_t op; /* Application's callback routine */
+ void *op_data; /* Application's user data */
+} H5I_iterate_pub_ud_t;
+
+/* User data for iterator callback for retrieving an ID corresponding to an object pointer */
+typedef struct {
+ const void *object; /* object pointer to search for */
+ H5I_type_t obj_type; /* type of object we are searching for */
+ hid_t ret_id; /* ID returned */
+} H5I_get_id_ud_t;
+
/* User data for iterator callback for ID iteration */
typedef struct {
H5I_search_func_t user_func; /* 'User' function to invoke */
void *user_udata; /* User data to pass to 'user' function */
hbool_t app_ref; /* Whether this is an appl. ref. call */
+ H5I_type_t obj_type; /* Type of object we are iterating over */
} H5I_iterate_ud_t;
/* User data for H5I__clear_type_cb */
@@ -119,7 +128,10 @@ H5FL_DEFINE_STATIC(H5I_id_type_t);
/* Declare a free list to manage the H5I_class_t struct */
H5FL_DEFINE_STATIC(H5I_class_t);
+H5FL_EXTERN(H5VL_object_t);
+
/*--------------------- Local function prototypes ---------------------------*/
+static void *H5I__unwrap(void *obj_ptr, H5I_type_t type);
static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata);
static int H5I__destroy_type(H5I_type_t type);
static void *H5I__remove_verify(hid_t id, H5I_type_t id_type);
@@ -128,11 +140,9 @@ static int H5I__inc_type_ref(H5I_type_t type);
static int H5I__get_type_ref(H5I_type_t type);
static int H5I__search_cb(void *obj, hid_t id, void *_udata);
static H5I_id_info_t *H5I__find_id(hid_t id);
-static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size);
-#ifdef H5I_DEBUG_OUTPUT
-static int H5I__debug_cb(void *_item, void *_key, void *_udata);
-static herr_t H5I__debug(H5I_type_t type);
-#endif /* H5I_DEBUG_OUTPUT */
+static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata);
+static int H5I__find_id_cb(void *_item, void *_key, void *_udata);
+static int H5I__id_dump_cb(void *_item, void *_key, void *_udata);
/*-------------------------------------------------------------------------
@@ -145,7 +155,7 @@ static herr_t H5I__debug(H5I_type_t type);
* Return: Success: Positive if any action was taken that might
* affect some other interface; zero otherwise.
*
- * Failure: Negative.
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
@@ -443,6 +453,50 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5I__unwrap
+ *
+ * Purpose: Unwraps the object pointer for the 'item' that corresponds
+ * to an ID.
+ *
+ * Return: Pointer to the unwrapped pointer (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 19, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5I__unwrap(void *obj_ptr, H5I_type_t type)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(obj_ptr);
+
+ /* The stored object pointer might be an H5VL_object_t, in which
+ * case we'll need to get the wrapped object struct (H5F_t *, etc.).
+ */
+ if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
+ const H5VL_object_t *vol_obj;
+
+ vol_obj = (const H5VL_object_t *)obj_ptr;
+ ret_value = H5VL_object_data(vol_obj);
+ } /* end if */
+ else if(H5I_DATATYPE == type) {
+ H5T_t *dt = (H5T_t *)obj_ptr;
+
+ ret_value = (void *)H5T_get_actual_type(dt);
+ } /* end if */
+ else
+ ret_value = obj_ptr;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__unwrap() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Iclear_type
*
* Purpose: Removes all objects from the type, calling the free
@@ -538,6 +592,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata)
FUNC_ENTER_STATIC_NOERR
+ /* Sanity checks */
HDassert(id);
HDassert(udata);
HDassert(udata->type_ptr);
@@ -547,12 +602,11 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata)
*/
if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) {
/* Check for a 'free' function and call it, if it exists */
- /* (Casting away const OK -QAK) */
- if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) {
+ if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */
if(udata->force) {
#ifdef H5I_DEBUG
if(H5DEBUG(I)) {
- fprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx "
+ HDfprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx "
"failure ignored\n",
(int)udata->type_ptr->cls->type_id,
(unsigned long)(id->obj_ptr));
@@ -755,7 +809,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I_register_with_id
+ * Function: H5I_register_using_existing_id
*
* Purpose: Registers an OBJECT in a TYPE with the supplied ID for it.
* This routine will check to ensure the supplied ID is not already
@@ -764,12 +818,16 @@ done:
* registered (thus, it is possible to register one object under
* multiple IDs).
*
+ * NOTE: Intended for use in refresh calls, where we have to close
+ * and re-open the underlying data, then hook the object back
+ * up to the original ID.
+ *
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id)
+H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id)
{
H5I_id_type_t *type_ptr; /* ptr to the type */
H5I_id_info_t *id_ptr; /* ptr to the new ID information */
@@ -781,7 +839,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t
HDassert(object);
/* Make sure ID is not already in use */
- if(NULL != (id_ptr = H5I__find_id(id)))
+ if(NULL != (id_ptr = H5I__find_id(existing_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use")
/* Make sure type number is valid */
@@ -795,7 +853,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* Make sure requested ID belongs to object's type */
- if(H5I_TYPE(id) != type)
+ if(H5I_TYPE(existing_id) != type)
HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID")
/* Allocate new structure to house this ID */
@@ -803,7 +861,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t
HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the struct & insert requested ID */
- id_ptr->id = id;
+ id_ptr->id = existing_id;
id_ptr->count = 1; /* initial reference count*/
id_ptr->app_count = !!app_ref;
id_ptr->obj_ptr = object;
@@ -815,7 +873,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_register_with_id() */
+} /* end H5I_register_using_existing_id() */
/*-------------------------------------------------------------------------
@@ -845,8 +903,7 @@ H5I_subst(hid_t id, const void *new_object)
HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count")
/* Get the old object pointer to return */
- /* (Casting away const OK -QAK) */
- ret_value = (void *)id_ptr->obj_ptr;
+ ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */
/* Set the new object pointer for the ID */
id_ptr->obj_ptr = new_object;
@@ -1851,6 +1908,91 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5I__iterate_pub_cb
+ *
+ * Purpose: Callback routine for H5Iiterate, when it calls
+ * H5I_iterate. Calls "user" callback search function, and
+ * then sets return value, based on the result of that
+ * callback.
+ *
+ * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1)
+ * Failure: H5_ITER_ERROR (-1)
+ *
+ * Programmer: Neil Fortner
+ * Friday, October 11, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata)
+{
+ H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */
+ herr_t cb_ret_val; /* User callback return value */
+ int ret_value = H5_ITER_ERROR; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Invoke the callback */
+ cb_ret_val = (*udata->op)(id, udata->op_data);
+
+ /* Set the return value based on the callback's return value */
+ if(cb_ret_val > 0)
+ ret_value = H5_ITER_STOP; /* terminate iteration early */
+ else if(cb_ret_val < 0)
+ ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__iterate_pub_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Iiterate
+ *
+ * Purpose: Call the callback funciton op for each member of the id
+ * type type. op takes as parameters the id and a
+ * passthrough of op_data, and returns an herr_t. A positive
+ * return from op will cause the iteration to stop and
+ * H5Iiterate will return the value returned by op. A
+ * negative return from op will cause the iteration to stop
+ * and H5Iiterate will return failure. A zero return from op
+ * will allow iteration to continue, as long as there are
+ * other ids remaining in type.
+ *
+ * Limitation: Currently there is no way to start searching from where a
+ * previous search left off.
+ *
+ * Return: The last value returned by op
+ *
+ * Programmer: Neil Fortner
+ * Friday, October 11, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data)
+{
+ H5I_iterate_pub_ud_t int_udata; /* Internal user data */
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "Itx*x", type, op, op_data);
+
+ /* Set up udata struct */
+ int_udata.op = op;
+ int_udata.op_data = op_data;
+
+ /* Note that H5I_iterate returns an error code. We ignore it
+ * here, as we can't do anything with it without revising the API.
+ */
+ if ((ret_value = H5I_iterate(type, H5I__iterate_pub_cb, &int_udata, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "can't iterate over ids")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Iiterate() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5I__iterate_cb
*
* Purpose: Callback routine for H5I_iterate, invokes "user" callback
@@ -1875,17 +2017,24 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
* its reference count is positive.
*/
if((!udata->app_ref) || (item->app_count > 0)) {
+ H5I_type_t type = udata->obj_type;
+ const void *obj_ptr = NULL;
herr_t cb_ret_val;
+ /* The stored object pointer might be an H5VL_object_t, in which
+ * case we'll need to get the wrapped object struct (H5F_t *, etc.).
+ */
+ obj_ptr = H5I__unwrap((void *)item->obj_ptr, type);
+
/* Invoke callback function */
- cb_ret_val = (*udata->user_func)((void *)item->obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */
+ cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */
/* Set the return value based on the callback's return value */
if(cb_ret_val > 0)
ret_value = H5_ITER_STOP; /* terminate iteration early */
else if(cb_ret_val < 0)
ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I__iterate_cb() */
@@ -1938,11 +2087,12 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re
iter_udata.user_func = func;
iter_udata.user_udata = udata;
iter_udata.app_ref = app_ref;
+ iter_udata.obj_type = type;
/* Iterate over IDs */
if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1996,6 +2146,9 @@ done:
*
* Failure: -1
*
+ * NOTE: Not safe for arbitrary VOL connectors as it relies on
+ * private H5G calls.
+ *
* Comments: Public function
* If 'name' is non-NULL then write up to 'size' bytes into that
* buffer and always return the length of the entry name.
@@ -2011,65 +2164,36 @@ done:
ssize_t
H5Iget_name(hid_t id, char *name/*out*/, size_t size)
{
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
H5G_loc_t loc; /* Object location */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", id, name, size);
- /* Get object location */
- if(H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
-
- /* Call internal routine to retrieve object's name */
- if((ret_value = H5I__get_name(&loc, name, size)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Iget_name() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5I__get_name
- *
- * Purpose: Internal routine to retrieve the name for an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: The length of the name
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * January 9, 2018
- *
- *-------------------------------------------------------------------------
- */
-static ssize_t
-H5I__get_name(const H5G_loc_t *loc, char *name, size_t size)
-{
- ssize_t ret_value = -1; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
+ /* Get the object pointer */
+ if(NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
- /* Check arguments */
- HDassert(loc);
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(id);
/* Retrieve object's name */
- if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5I__get_name() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Iget_name() */
/*-------------------------------------------------------------------------
* Function: H5Iget_file_id
*
- * Purpose: The public version of H5I_get_file_id(), obtains the file
- * ID given an object ID. User has to close this ID.
+ * Purpose: Obtains the file ID given an object ID. The user has to
+ * close this ID.
*
* Return: Success: The file ID associated with the object
*
@@ -2091,9 +2215,9 @@ H5Iget_file_id(hid_t obj_id)
/* Call internal function */
if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- if ((ret_value = H5I_get_file_id(obj_id, type)) < 0)
+ if ((ret_value = H5F_get_file_id(obj_id, type)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID")
- }
+ } /* end if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object")
@@ -2103,52 +2227,94 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I_get_file_id
+ * Function: H5I__find_id_cb
*
- * Purpose: The private version of H5Iget_file_id(), obtains the file
- * ID given an object ID.
+ * Purpose: Callback for searching for an ID with a specific pointer
*
- * Return: Success: The file ID associated with the object
- * Failure: H5I_INVALID_HID
+ * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1)
+ * Failure: H5_ITER_ERROR (-1)
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5I_get_file_id(hid_t obj_id, H5I_type_t type)
+static int
+H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */
+ H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */
+ H5I_type_t type = udata->obj_type;
+ const void *obj_ptr = NULL;
+ int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
- /* Process based on object type */
- if (type == H5I_FILE) {
- /* Increment reference count on file ID */
- if(H5I_inc_ref(obj_id, TRUE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed")
+ /* Sanity check */
+ HDassert(item);
+ HDassert(udata);
- /* Set return value */
- ret_value = obj_id;
- }
- else {
- H5G_loc_t loc; /* Location of object */
+ /* Get a pointer to the VOL connector's data */
+ obj_ptr = H5I__unwrap(item->obj_ptr, type);
- /* Get the object location information */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get object location")
+ /* Check for a match */
+ if (obj_ptr == udata->object) {
+ udata->ret_id = item->id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
- /* Get the file ID for the object */
- if((ret_value = H5F_get_id(loc.oloc->file, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get file ID")
- }
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__find_id_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_find_id
+ *
+ * Purpose: Return the ID of an object by searching through the ID list
+ * for the type.
+ *
+ * Return: SUCCEED/FAIL
+ * (id will be set to H5I_INVALID_HID on errors or not found)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
+{
+ H5I_id_type_t *type_ptr; /* Pointer to the type */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(id);
+
+ *id = H5I_INVALID_HID;
+
+ type_ptr = H5I_id_type_list_g[type];
+ if (!type_ptr || type_ptr->init_count <= 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
+
+ /* Only iterate through ID list if it is initialized and there are IDs in type */
+ if (type_ptr->init_count > 0 && type_ptr->id_count > 0) {
+ H5I_get_id_ud_t udata; /* User data */
+ herr_t iter_status; /* Iteration status */
+
+ /* Set up iterator user data */
+ udata.object = object;
+ udata.obj_type = type;
+ udata.ret_id = H5I_INVALID_HID;
+
+ /* Iterate over IDs for the ID type */
+ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__find_id_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
+
+ *id = udata.ret_id;
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_get_file_id() */
+} /* end H5I_find_id() */
-#ifdef H5I_DEBUG_OUTPUT
/*-------------------------------------------------------------------------
- * Function: H5I__debug_cb
+ * Function: H5I__id_dump_cb
*
* Purpose: Dump the contents of an ID to stderr for debugging.
*
@@ -2157,11 +2323,12 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
+H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */
H5I_type_t type = *(H5I_type_t *)_udata; /* User data */
H5G_name_t *path = NULL; /* Path to file object */
+ const void *obj_ptr = NULL; /* Pointer to VOL connector object */
FUNC_ENTER_STATIC_NOERR
@@ -2173,19 +2340,33 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
switch (type) {
case H5I_GROUP:
{
- path = H5G_nameof((H5G_t*)item->obj_ptr);
+ const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
+
+ obj_ptr = H5VL_object_data(vol_obj);
+ if(H5_VOL_NATIVE == vol_obj->connector->cls->value)
+ path = H5G_nameof((const H5G_t *)obj_ptr);
break;
}
+
case H5I_DATASET:
{
- path = H5D_nameof((H5D_t*)item->obj_ptr);
+ const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
+
+ obj_ptr = H5VL_object_data(vol_obj);
+ if(H5_VOL_NATIVE == vol_obj->connector->cls->value)
+ path = H5D_nameof((const H5D_t *)obj_ptr);
break;
}
+
case H5I_DATATYPE:
{
- path = H5T_nameof((H5T_t*)item->obj_ptr);
+ const H5T_t *dt = (const H5T_t *)item->obj_ptr;
+
+ obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
+ path = H5T_nameof((const H5T_t *)obj_ptr);
break;
}
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
@@ -2193,6 +2374,7 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
@@ -2211,11 +2393,11 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
}
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
-} /* end H5I__debug_cb() */
+} /* end H5I__id_dump_cb() */
/*-------------------------------------------------------------------------
- * Function: H5I__debug
+ * Function: H5I_dump_ids_for_type
*
* Purpose: Dump the contents of a type to stderr for debugging.
*
@@ -2223,27 +2405,33 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5I__debug(H5I_type_t type)
+herr_t
+H5I_dump_ids_for_type(H5I_type_t type)
{
- H5I_id_type_t *type_ptr;
+ H5I_id_type_t *type_ptr = NULL;
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_NOAPI_NOERR
HDfprintf(stderr, "Dumping ID type %d\n", (int)type);
type_ptr = H5I_id_type_list_g[type];
- /* Header */
- HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count);
- HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved);
- HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count);
- HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid);
+ if(type_ptr) {
+
+ /* Header */
+ HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count);
+ HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved);
+ HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count);
+ HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid);
- /* List */
- HDfprintf(stderr, " List:\n");
- H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type);
+ /* List */
+ if(type_ptr->id_count > 0) {
+ HDfprintf(stderr, " List:\n");
+ H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type);
+ }
+ }
+ else
+ HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n");
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5I__debug() */
-#endif /* H5I_DEBUG_OUTPUT */
+} /* end H5I_dump_ids_for_type() */
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 3bfde93..9068b5f 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -25,6 +25,7 @@
/* Private headers needed by this file */
#include "H5private.h"
+#include "H5VLprivate.h"
/**************************/
/* Library Private Macros */
@@ -66,14 +67,7 @@ typedef struct H5I_class_t {
H5_DLL herr_t H5I_register_type(const H5I_class_t *cls);
H5_DLL int64_t H5I_nmembers(H5I_type_t type);
H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref);
-H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref);
-H5_DLL herr_t H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id);
-H5_DLL void *H5I_subst(hid_t id, const void *new_object);
-H5_DLL void *H5I_object(hid_t id);
-H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type);
H5_DLL H5I_type_t H5I_get_type(hid_t id);
-H5_DLL hid_t H5I_get_file_id(hid_t obj_id, H5I_type_t id_type);
-H5_DLL void *H5I_remove(hid_t id);
H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref);
H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref);
H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref);
@@ -81,6 +75,30 @@ H5_DLL int H5I_dec_ref(hid_t id);
H5_DLL int H5I_dec_app_ref(hid_t id);
H5_DLL int H5I_dec_app_ref_always_close(hid_t id);
H5_DLL int H5I_dec_type_ref(H5I_type_t type);
+H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*out*/);
+
+/* NOTE: The object and ID functions below deal in non-VOL objects (i.e.;
+ * H5S_t, etc.). Similar VOL calls exist in H5VLprivate.h. Use
+ * the H5VL calls with objects that go through the VOL, such as
+ * datasets and groups, and the H5I calls with objects
+ * that do not, such as property lists and dataspaces. Datatypes
+ * are can be either named, where they will use the VOL, or not,
+ * and thus require special treatment. See the datatype docs for
+ * how to handle this.
+ */
+
+/* Functions that manipulate objects */
+H5_DLL void *H5I_object(hid_t id);
+H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type);
+H5_DLL void *H5I_remove(hid_t id);
+H5_DLL void *H5I_subst(hid_t id, const void *new_object);
+
+/* ID registration functions */
+H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref);
+H5_DLL herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id);
+
+/* Debugging functions */
+H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type);
#endif /* _H5Iprivate_H */
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index c737bbe..f4b5cc9 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -44,6 +44,7 @@ typedef enum H5I_type_t {
H5I_ATTR, /* type ID for Attribute objects */
H5I_REFERENCE, /* *DEPRECATED* type ID for Reference objects */
H5I_VFL, /* type ID for virtual file layer */
+ H5I_VOL, /* type ID for virtual object layer */
H5I_GENPROP_CLS, /* type ID for generic property list classes */
H5I_GENPROP_LST, /* type ID for generic property lists */
H5I_ERROR_CLASS, /* type ID for error classes */
@@ -66,11 +67,14 @@ typedef int64_t hid_t;
* can be removed from the ID type. If the function returns negative
* (failure) then the object will remain in the ID type.
*/
-typedef herr_t (*H5I_free_t)(void*);
+typedef herr_t (*H5I_free_t)(void *);
/* Type of the function to compare objects & keys */
typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key);
+/* Type of the H5Iiterate callback function */
+typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata);
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -93,6 +97,7 @@ H5_DLL int H5Iinc_type_ref(H5I_type_t type);
H5_DLL int H5Idec_type_ref(H5I_type_t type);
H5_DLL int H5Iget_type_ref(H5I_type_t type);
H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
+H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data);
H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members);
H5_DLL htri_t H5Itype_exists(H5I_type_t type);
H5_DLL htri_t H5Iis_valid(hid_t id);
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 4b54835..79bc482 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -78,26 +78,41 @@
ssize_t
H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
{
+ H5VL_object_t *vol_obj; /* Object token of id */
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 */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_PACKAGE
- /* Get object location */
- if(H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
-
/* Set API context */
if(H5CX_push() < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context")
api_ctx_pushed = TRUE;
+ /* Get the object pointer */
+ if(NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Get object location */
+ if(H5G_loc(id, &loc) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
+
/* Call internal group routine to retrieve object's name */
if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_ATOM, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context")
diff --git a/src/H5L.c b/src/H5L.c
index b26a8c4..9506e7d 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -21,18 +21,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "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 "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "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 */
@@ -63,7 +65,7 @@ typedef struct {
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 */
+ 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 */
@@ -102,70 +104,40 @@ static herr_t H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
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__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);
-static herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc,
- const char *link_name, 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(const H5G_loc_t *loc, const char *name,
- void *buf/*out*/, size_t size);
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__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);
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(const H5G_loc_t *loc, const char *name);
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__delete_by_idx(const H5G_loc_t *loc, const char *name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
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__move(const H5G_loc_t *src_loc, const char *src_name,
- H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id);
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 htri_t H5L__exists(const H5G_loc_t *loc, const char *name);
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(const H5G_loc_t *loc, const char *name,
- H5L_info_t *linfo/*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_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_info_t *linfo /*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 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);
-static herr_t H5L__iterate(hid_t grp_id, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
- H5L_iterate_t op, void *op_data);
-static herr_t H5L__visit(hid_t grp_id, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op,
- void *op_data);
-
/*********************/
/* Package Variables */
@@ -282,16 +254,16 @@ H5L_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5Lmove
+ * Function: H5Lmove
*
- * Purpose: Renames an object within an HDF5 file and moves it to a new
+ * Purpose: Renames an object within an HDF5 file and moves it to a new
* group. The original name SRC is unlinked from the group graph
* and then inserted with the new name DST (which can specify a
* new path for the object) as an atomic operation. The names
- * are interpreted relative to SRC_LOC_ID and
- * DST_LOC_ID, which are either file IDs or group ID.
+ * are interpreted relative to SRC_LOC_ID and DST_LOC_ID,
+ * which are either file IDs or group ID.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* Wednesday, March 29, 2006
@@ -302,9 +274,11 @@ herr_t
H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5G_loc_t src_loc, *src_loc_p;
- H5G_loc_t dst_loc, *dst_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
+ H5VL_loc_params_t loc_params2;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id,
@@ -313,10 +287,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Check arguments */
if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
- if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!src_name || !*src_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!dst_name || !*dst_name)
@@ -324,22 +294,44 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
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")
+ /* Check the link create property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC,
((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Set up src & dst location pointers */
- src_loc_p = &src_loc;
- dst_loc_p = &dst_loc;
- if(src_loc_id == H5L_SAME_LOC)
- src_loc_p = dst_loc_p;
- else if(dst_loc_id == H5L_SAME_LOC)
- dst_loc_p = src_loc_p;
+ /* Set location paramter for source object */
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.loc_data.loc_by_name.name = src_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params1.obj_type = H5I_get_type(src_loc_id);
+
+ /* Set location paramter for destination object */
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.loc_data.loc_by_name.name = dst_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params2.obj_type = H5I_get_type(dst_loc_id);
+
+ if (H5L_SAME_LOC != src_loc_id)
+ /* Get the location object */
+ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if (H5L_SAME_LOC != dst_loc_id)
+ /* Get the location object */
+ if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
/* Move the link */
- if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+ if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
done:
FUNC_LEAVE_API(ret_value)
@@ -347,13 +339,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcopy
+ * Function: H5Lcopy
*
- * Purpose: Creates an identical copy of a link with the same creation
+ * Purpose: Creates an identical copy of a link with the same creation
* time and target. The new link can have a different name
* and be in a different location than the original.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* Wednesday, March 29, 2006
@@ -364,9 +356,12 @@ herr_t
H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5G_loc_t src_loc, *src_loc_p;
- H5G_loc_t dst_loc, *dst_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
+ H5VL_loc_params_t loc_params2;
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id,
@@ -375,10 +370,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Check arguments */
if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
- if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!src_name || !*src_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!dst_name || !*dst_name)
@@ -391,17 +382,43 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Set up src & dst location pointers */
- src_loc_p = &src_loc;
- dst_loc_p = &dst_loc;
- if(src_loc_id == H5L_SAME_LOC)
- src_loc_p = dst_loc_p;
- else if(dst_loc_id == H5L_SAME_LOC)
- dst_loc_p = src_loc_p;
+ /* Check the link create property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
+ /* Set location paramter for source object */
+ loc_params1.type = H5VL_OBJECT_BY_NAME;
+ loc_params1.loc_data.loc_by_name.name = src_name;
+ loc_params1.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params1.obj_type = H5I_get_type(src_loc_id);
+
+ /* Set location paramter for destination object */
+ loc_params2.type = H5VL_OBJECT_BY_NAME;
+ loc_params2.loc_data.loc_by_name.name = dst_name;
+ loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params2.obj_type = H5I_get_type(dst_loc_id);
+
+ if(H5L_SAME_LOC != src_loc_id)
+ /* Get the location object */
+ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if(H5L_SAME_LOC != dst_loc_id)
+ /* Get the location object */
+ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
+
+ /* 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);
/* Copy the link */
- if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+ if(H5VL_link_copy(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link")
done:
FUNC_LEAVE_API(ret_value)
@@ -409,17 +426,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_soft
+ * Function: H5Lcreate_soft
*
- * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET.
+ * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET.
*
- * LINK_TARGET can be anything and is interpreted at lookup
+ * LINK_TARGET can be anything and is interpreted at lookup
* time relative to the group which contains the final component
* of LINK_NAME. For instance, if LINK_TARGET is `./foo' and
* LINK_NAME is `./x/y/bar' and a request is made for `./x/y/bar'
* then the actual object looked up is `./x/y/./foo'.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -427,32 +444,60 @@ done:
*-------------------------------------------------------------------------
*/
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)
+H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name,
+ hid_t lcpl_id, hid_t lapl_id)
{
- H5G_loc_t link_loc; /* Group location for new link */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id);
/* Check arguments */
- if(H5G_loc(link_loc_id, &link_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!link_target || !*link_target)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified")
- if(!link_name || !*link_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ if(link_loc_id == H5L_SAME_LOC)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link location id should not be H5L_SAME_LOC")
+ if(!link_target)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL")
+ if(!*link_target)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string")
+ if(!link_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be NULL")
+ if(!*link_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_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")
+ /* Check the group access property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
+ /* Set location fields */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = link_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params.obj_type = H5I_get_type(link_loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &link_target) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
+
/* Verify access property list and set up collective metadata if appropriate */
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")
/* Create the link */
- if(H5L__create_soft(link_target, &link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
FUNC_LEAVE_API(ret_value)
@@ -460,15 +505,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_hard
+ * Function: H5Lcreate_hard
*
- * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
+ * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
*
- * CUR_NAME must name an existing object. CUR_NAME and
+ * CUR_NAME must name an existing object. CUR_NAME and
* NEW_NAME are interpreted relative to CUR_LOC_ID and
* NEW_LOC_ID, which are either file IDs or group IDs.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -479,9 +524,13 @@ herr_t
H5Lcreate_hard(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)
{
- H5G_loc_t cur_loc, *cur_loc_p;
- H5G_loc_t new_loc, *new_loc_p;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj1 = NULL; /* Object token of cur_loc_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object token of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id,
@@ -490,34 +539,67 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
/* Check arguments */
if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
- if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!cur_name || !*cur_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
- if(!new_name || !*new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL")
+ if(!*new_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")
+ /* Check the link create property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
/* Verify access property list and set up collective metadata if appropriate */
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 pointers */
- cur_loc_p = &cur_loc;
- new_loc_p = &new_loc;
- if(cur_loc_id == H5L_SAME_LOC)
- cur_loc_p = new_loc_p;
- else if(new_loc_id == H5L_SAME_LOC)
- new_loc_p = cur_loc_p;
- else if(cur_loc_p->oloc->file != new_loc_p->oloc->file)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
+ /* 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;
+
+ 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)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if(H5L_SAME_LOC != new_loc_id)
+ /* Get the new location object */
+ if(NULL == (vol_obj2 = (H5VL_object_t *)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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
+
+ /* Get the link creation plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_LINK, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET, (vol_obj1 ? &(vol_obj1->data) : NULL)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target id")
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name")
+
+ /* Construct a temporary VOL object */
+ tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL);
+ tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
/* Create the link */
- if(H5L__create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
FUNC_LEAVE_API(ret_value)
@@ -525,23 +607,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lcreate_ud
+ * Function: H5Lcreate_ud
*
- * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME
+ * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME
* with user-specified data UDATA.
*
- * The format of the information pointed to by UDATA is
+ * The format of the information pointed to by UDATA is
* defined by the user. UDATA_SIZE holds the size of this buffer.
*
- * LINK_NAME is interpreted relative to LINK_LOC_ID.
+ * LINK_NAME is interpreted relative to LINK_LOC_ID.
*
- * The property list specified by LCPL_ID holds properties used
+ * The property list specified by LCPL_ID holds properties used
* to create the link.
*
* The link class of the new link must already be registered
* with the library.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* Tuesday, December 13, 2005
@@ -552,28 +634,53 @@ 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)
{
- H5G_loc_t link_loc;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
+ 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);
/* Check arguments */
- if(H5G_loc(link_loc_id, &link_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!link_name || !*link_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
+ /* Check the group access property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
/* Verify access property list and set up collective metadata if appropriate */
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")
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = link_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params.obj_type = H5I_get_type(link_loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
+ if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
+ if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
+
/* Create external link */
- if(H5L__create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ if(H5VL_link_create(H5VL_LINK_CREATE_UD, 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:
FUNC_LEAVE_API(ret_value)
@@ -581,16 +688,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ldelete
+ * Function: H5Ldelete
*
- * Purpose: Removes the specified NAME from the group graph and
- * decrements the link count for the object to which NAME
- * points. If the link count reaches zero then all file-space
- * associated with the object will be reclaimed (but if the
- * object is open, then the reclamation of the file space is
- * delayed until all handles to the object are closed).
+ * Purpose: Removes the specified NAME from the group graph and
+ * decrements the link count for the object to which NAME
+ * points. If the link count reaches zero then all file-space
+ * associated with the object will be reclaimed (but if the
+ * object is open, then the reclamation of the file space is
+ * delayed until all handles to the object are closed).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -600,25 +707,34 @@ done:
herr_t
H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*si", loc_id, name, lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Verify access property list and set up collective metadata if appropriate */
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")
+ /* Fill in the 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 = name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+
+ /* 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")
+
/* Unlink */
- if(H5L__delete(&loc, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
FUNC_LEAVE_API(ret_value)
@@ -648,29 +764,40 @@ 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)
{
- H5G_loc_t loc; /* Group's location */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ 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(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, 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 = group_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 location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Delete the link */
- if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
FUNC_LEAVE_API(ret_value)
@@ -700,25 +827,33 @@ herr_t
H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Group location for location to query */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Verify access property list and set up collective metadata if appropriate */
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")
+ 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 */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Get the link value */
- if(H5L__get_val(&loc, name, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
@@ -748,7 +883,8 @@ 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)
{
- H5G_loc_t loc; /* Group location for location to query */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -756,22 +892,32 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ 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(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, 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 = group_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 location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Get the link value */
- if(H5L__get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for")
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value")
done:
FUNC_LEAVE_API(ret_value)
@@ -779,12 +925,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lexists
+ * Function: H5Lexists
*
- * Purpose: Checks if a link of a given name exists in a group
+ * Purpose: Checks if a link of a given name exists in a group
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: Success: TRUE/FALSE/FAIL
*
* Programmer: Quincey Koziol
* Friday, March 16, 2007
@@ -794,24 +939,35 @@ done:
htri_t
H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc;
- htri_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* 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 = name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+
+ /* 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")
+
/* Check for the existence of the link */
- if((ret_value = H5L__exists(&loc, name)) < 0)
+ if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -837,25 +993,33 @@ herr_t
H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
hid_t lapl_id)
{
- H5G_loc_t loc;
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Verify access property list and set up collective metadata if appropriate */
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")
+ 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 */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Get the link information */
- if(H5L__get_info(&loc, name, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
FUNC_LEAVE_API(ret_value)
@@ -881,7 +1045,8 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5L_info_t *linfo /*out*/, hid_t lapl_id)
{
- H5G_loc_t loc; /* Group location for group to query */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -889,22 +1054,32 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ 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(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, 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 = group_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 location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Get the link information */
- if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
FUNC_LEAVE_API(ret_value)
@@ -991,11 +1166,11 @@ H5Lunregister(H5L_type_t id)
/* Check args */
if(id < 0 || id > H5L_TYPE_MAX)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
/* Do it */
if(H5L_unregister(id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type")
done:
FUNC_LEAVE_API(ret_value)
@@ -1003,14 +1178,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lis_registered
+ * Function: H5Lis_registered
*
- * Purpose: Tests whether a user-defined link class has been registered
+ * Purpose: Tests whether a user-defined link class has been registered
* or not.
*
- * Return: Positive if the link class has been registered
- * Zero if it is unregistered
- * Negative on error (if the class is not a valid UD class ID)
+ * Return: TRUE if the link class has been registered
+ * FALSE if it is unregistered
+ * FAIL on error (if the class is not a valid UD class ID)
*
* Programmer: James Laird
* Monday, July 10, 2006
@@ -1032,7 +1207,7 @@ H5Lis_registered(H5L_type_t id)
/* Is the link class already registered? */
for(i = 0; i < H5L_table_used_g; i++)
- if(H5L_table_g[i].id == id) {
+ if(H5L_table_g[i].id == id) {
ret_value = TRUE;
break;
} /* end if */
@@ -1043,16 +1218,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lget_name_by_idx
+ * Function: H5Lget_name_by_idx
*
- * Purpose: Gets name for a link, according to the order within an
+ * Purpose: Gets name for a link, according to the order within an
* index.
*
* Same pattern of behavior as H5Iget_name.
*
- * Return: Success: Non-negative length of name, with information
- * in NAME buffer
- * Failure: Negative
+ * Return: Success: Non-negative length of name, with information
+ * in NAME buffer
+ *
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Saturday, November 11, 2006
@@ -1064,30 +1240,42 @@ 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)
{
- H5G_loc_t loc; /* Location of group */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size,
lapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
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")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info")
+
+ /* Fill in 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;
+ 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 location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get the link information */
- if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name")
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name")
done:
FUNC_LEAVE_API(ret_value)
@@ -1113,17 +1301,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
+H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx_p, H5L_iterate_t op, void *op_data)
{
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data);
+ H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data);
/* Check arguments */
- id_type = H5I_get_type(grp_id);
+ id_type = H5I_get_type(group_id);
if (!(H5I_GROUP == id_type || H5I_FILE == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -1133,9 +1323,17 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
if (!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
+ /* Get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(group_id);
+
/* Iterate over the links */
- if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+ 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)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1143,20 +1341,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Literate_by_name
+ * Function: H5Literate_by_name
*
- * Purpose: Iterates over links in a group, with user callback routine,
+ * Purpose: Iterates over links in a group, with user callback routine,
* according to the order within an index.
*
* Same pattern of behavior as H5Giterate.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
*
* Programmer: Quincey Koziol
@@ -1169,29 +1367,43 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
H5L_iterate_t op, void *op_data, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op,
op_data, lapl_id);
/* Check arguments */
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
/* Verify access property list and set up collective metadata if appropriate */
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")
+ /* 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 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 = group_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+
/* Iterate over the links */
- if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+ 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)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1199,9 +1411,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lvisit
+ * Function: H5Lvisit
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1213,13 +1425,13 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@@ -1227,29 +1439,39 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
+H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
H5L_iterate_t op, void *op_data)
{
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "iIiIox*x", grp_id, idx_type, order, op, op_data);
+ H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data);
/* Check args */
- id_type = H5I_get_type(grp_id);
+ id_type = H5I_get_type(group_id);
if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
- /* Call internal routine */
- if((ret_value = H5L__visit(grp_id, ".", idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(group_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* 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)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1257,9 +1479,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lvisit_by_name
+ * Function: H5Lvisit_by_name
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1271,13 +1493,13 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 3 2007
@@ -1288,19 +1510,23 @@ herr_t
H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data,
lapl_id);
/* Check args */
- if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(!group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL")
+ if(!*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
@@ -1308,9 +1534,19 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
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")
- /* Call internal routine */
- if((ret_value = H5L__visit(loc_id, group_name, idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+ /* 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 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 = group_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+
+ /* 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)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1502,8 +1738,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc,
- hid_t lcpl_id)
+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 */
@@ -1688,7 +1923,7 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
/* 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 = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
+ 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 */
@@ -1895,50 +2130,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__create_hard
+ * Function: H5L_create_soft
*
- * Purpose: Internal routine to create a hard link
+ * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 25, 2017
- *
- *-------------------------------------------------------------------------
- */
-static 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)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(cur_loc);
- HDassert(cur_name);
- HDassert(link_loc);
- HDassert(link_name);
-
- /* Create the link */
- if(H5L_create_hard(cur_loc, cur_name, link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__create_hard() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5L_create_soft
- *
- * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
- *
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Monday, April 6, 1998
@@ -1982,44 +2178,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__create_soft
- *
- * Purpose: Internal routine to create a soft link
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 25, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc,
- const char *link_name, hid_t lcpl_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(target_path);
- HDassert(link_loc);
- HDassert(link_name);
-
- /* Create the link */
- if(H5L_create_soft(target_path, link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__create_soft() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__create_ud
*
* Purpose: Creates a user-defined link. See H5Lcreate_ud for
@@ -2039,7 +2197,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name,
H5O_link_t lnk; /* Link to insert */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX);
@@ -2073,7 +2231,7 @@ done:
/* Free the link's udata buffer if it's been allocated */
H5MM_xfree(lnk.u.ud.udata);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__create_ud() */
@@ -2216,42 +2374,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_val
- *
- * Purpose: Internal routine to query a link value
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Get the link value */
- if(H5L_get_val(loc, name, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__get_val() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__get_val_by_idx_cb
*
* Purpose: Callback for retrieving a link's value according to an
@@ -2303,30 +2425,26 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_val_by_idx
+ * Function: H5L_get_val_by_idx
*
* Purpose: Internal routine to query a link value according to the
- * index within a group
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
+ * index within a group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 27, 2017
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+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_STATIC_VOL
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(loc);
@@ -2344,8 +2462,8 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n)
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__get_val_by_idx() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_val_by_idx() */
/*-------------------------------------------------------------------------
@@ -2386,7 +2504,7 @@ H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk
/* 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")
+ 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 *
@@ -2439,42 +2557,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__delete
- *
- * Purpose: Internal routine to delete a link
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__delete(const H5G_loc_t *loc, const char *name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Delete the link */
- if(H5L_delete(loc, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link: %s", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__delete() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__delete_by_idx_cb
*
* Purpose: Callback for removing a link according to an index's order.
@@ -2514,32 +2596,28 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__delete_by_idx
+ * Function: H5L_delete_by_idx
*
* Purpose: Internal routine to delete a link according to its index
- * within a group.
+ * within a group.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 27, 2017
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+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_STATIC_VOL
+ FUNC_ENTER_NOAPI(FAIL)
- /* Check arguments */
+ /* Sanity check */
HDassert(loc);
HDassert(name && *name);
@@ -2553,8 +2631,8 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_delete_by_idx() */
/*-------------------------------------------------------------------------
@@ -2630,7 +2708,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
/* 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 = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
+ 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) {
@@ -2728,7 +2806,7 @@ H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
/* 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")
+ 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) {
@@ -2856,7 +2934,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
/* 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")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2864,45 +2942,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__move
- *
- * Purpose: Internal routine to move / copy a link
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 25, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__move(const H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc,
- const char *dst_name, hbool_t copy_flag, hid_t lcpl_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(src_loc);
- HDassert(src_name);
- HDassert(dst_loc);
- HDassert(dst_name);
-
- /* Move the link */
- if(H5L_move(src_loc, src_name, dst_loc, dst_name, copy_flag, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__move() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__exists_final_cb
*
* Purpose: Callback for checking whether a link exists, as the final
@@ -3063,7 +3102,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__exists
+ * Function: H5L_exists
*
* Purpose: Returns whether a link exists in a group
*
@@ -3078,12 +3117,12 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5L__exists(const H5G_loc_t *loc, const char *name)
+H5L_exists(const H5G_loc_t *loc, const char *name)
{
H5L_trav_le_t udata; /* User data for traversal */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_NOAPI(FAIL)
/* A path of "/" will always exist in a file */
if(0 == HDstrcmp(name, "/"))
@@ -3098,8 +3137,8 @@ H5L__exists(const H5G_loc_t *loc, const char *name)
ret_value = (htri_t)udata.exists;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5L__exists() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5L_exists() */
/*-------------------------------------------------------------------------
@@ -3173,42 +3212,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_info
- *
- * Purpose: Internal routine to retrieve link info
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Get the link information */
- if(H5L_get_info(loc, name, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info for: '%s'", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__get_info() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__get_info_by_idx_cb
*
* Purpose: Callback for retrieving a link's metadata according to an
@@ -3260,30 +3263,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_info_by_idx
+ * Function: H5L_get_info_by_idx
*
* Purpose: Internal routine to retrieve link info according to an
* index's order.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+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_info_t *linfo /*out*/)
{
H5L_trav_gibi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(loc);
@@ -3298,11 +3294,11 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type
/* 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")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__get_info_by_idx() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_info_by_idx() */
/*-------------------------------------------------------------------------
@@ -3346,31 +3342,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_name_by_idx
+ * Function: H5L_get_name_by_idx
*
* Purpose: Internal routine to retrieve link name according to an
* index's order.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static ssize_t
-H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
+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_STATIC_VOL
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(loc);
@@ -3392,97 +3381,8 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
ret_value = udata.name_len;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__get_name_by_idx() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5L__iterate
- *
- * Purpose: Internal routine to iterate over links
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_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_STATIC_VOL
-
- /* Check arguments */
- 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(grp_id, 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_VOL(ret_value)
-} /* end H5L__iterate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5L__visit
- *
- * Purpose: Internal routine to visit links
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__visit(hid_t grp_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, H5L_iterate_t op, void *op_data)
-{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(group_name);
- HDassert(op);
-
- /* Call internal group visitation routine */
- if((ret_value = H5G_visit(grp_id, group_name, idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__visit() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_get_name_by_idx() */
/*-------------------------------------------------------------------------
@@ -3615,3 +3515,49 @@ done:
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_iterate_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/H5Lexternal.c b/src/H5Lexternal.c
index 7c32309..0f3296f 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -33,6 +33,7 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Opublic.h" /* File objects */
#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -102,7 +103,7 @@ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{
* link access property list, appends that prefix to the
* filename being opened.
*
- * Return: ID of the opened object on success/Negative on failure
+ * Return: ID of the opened object on success/H5I_INVALID_HID on failure
*
* Programmer: James Laird
* Monday, July 10, 2006
@@ -125,12 +126,14 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
unsigned intent; /* File access permissions */
H5L_elink_cb_t cb_info; /* Callback info struct */
hid_t fapl_id = -1; /* File access property list for external link's file */
- hid_t ext_obj = -1; /* ID for external link's object */
+ void *ext_obj = NULL; /* External link's object */
+ hid_t ext_obj_id = H5I_INVALID_HID; /* ID for external link's object */
+ H5I_type_t opened_type; /* ID type of external link's object */
char *parent_group_name = NULL;/* Temporary pointer to group name */
char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */
H5P_genplist_t *fa_plist; /* File access property list pointer */
- H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */
- char *elink_prefix; /* Pointer to elink prefix */
+ H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */
+ char *elink_prefix = NULL; /* Pointer to elink prefix */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -140,9 +143,9 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* Check external link version & flags */
if(((*p >> 4) & 0x0F) > H5L_EXT_VERSION)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad version number for external link")
if((*p & 0x0F) & ~H5L_EXT_FLAGS_ALL)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad flags for external link")
p++;
/* Gather some information from the external link's user data */
@@ -152,19 +155,19 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* Get the fapl_id set for lapl_id if any */
if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get fapl for links")
/* Get the location for the group holding the external link */
if(H5G_loc(cur_group, &loc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get object location")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get object location")
/* get the access flags set for lapl_id if any */
if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, &intent) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file access flags")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink file access flags")
/* get the file access mode flags for the parent file, if they were not set
* on lapl_id */
@@ -172,15 +175,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
intent = H5F_INTENT(loc.oloc->file);
if((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0))
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get parent's file access property list")
/* Get callback_info */
if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink callback info")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink callback info")
/* Get file access property list */
if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* Make callback if it exists */
if(cb_info.func) {
@@ -192,7 +195,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* Query length of parent group name */
if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name")
/* Account for null terminator */
group_name_len++;
@@ -200,59 +203,64 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* 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)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %zd", 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)
} /* 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)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name")
/* Make callback */
if((cb_info.func)(parent_file_name, parent_group_name, file_name, obj_name, &intent, fapl_id, cb_info.user_data) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "traversal operator failed")
+ HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, H5I_INVALID_HID, "traversal operator failed")
/* Check access flags */
if((intent & H5F_ACC_TRUNC) || (intent & H5F_ACC_EXCL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags")
} /* end if */
/* Set file close degree for new file to "weak" */
if(H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree")
/* Get the current elink prefix */
if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &elink_prefix) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix")
/* Search for the target file */
if(NULL == (ext_file = H5F_prefix_open_file(loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name, intent, fapl_id)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s'", file_name)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open external file, external link file name = '%s'", file_name)
/* Retrieve the "group location" for the file's root group */
if(H5G_root_loc(ext_file, &root_loc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "unable to create location for file")
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, H5I_INVALID_HID, "unable to create location for file")
/* Open the object referenced in the external file */
- if((ext_obj = H5O_open_name(&root_loc, obj_name, FALSE)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ if(NULL == (ext_obj = H5O_open_name(&root_loc, obj_name, &opened_type)))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+
+ /* Get an ID for the external link's object */
+ if((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object")
/* Set return value */
- ret_value = ext_obj;
+ ret_value = ext_obj_id;
done:
+/* XXX (VOL MERGE): Probably also want to consider closing ext_obj here on failures */
/* Release resources */
if(fapl_id > 0 && H5I_dec_ref(fapl_id) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
+ HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for file access property list")
if(ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "problem closing external file")
+ HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file")
if(parent_group_name && parent_group_name != local_group_name)
parent_group_name = (char *)H5MM_xfree(parent_group_name);
if(ret_value < 0) {
/* Close object if it's open and something failed */
- if(ext_obj >= 0 && H5I_dec_ref(ext_obj) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for external object")
+ if(ext_obj_id >= 0 && H5I_dec_ref(ext_obj_id) < 0)
+ HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for external object")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -312,7 +320,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Lcreate_external
*
- * Purpose: Creates an external link from LINK_NAME to OBJ_NAME.
+ * Purpose: Creates an external link from LINK_NAME to OBJ_NAME.
*
* External links are links to objects in other HDF5 files. They
* are allowed to "dangle" like soft links internal to a file.
@@ -322,9 +330,9 @@ done:
* LINK_NAME is interpreted relative to LINK_LOC_ID, which is
* either a file ID or a group ID.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Wednesday, May 18, 2005
*
*-------------------------------------------------------------------------
@@ -333,13 +341,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)
{
- H5G_loc_t link_loc; /* Group location to create link */
- char *norm_obj_name = NULL; /* Pointer to normalized current name */
+ H5VL_object_t *vol_obj = NULL; /* Object token 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 */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5L_type_t link_type = H5L_TYPE_EXTERNAL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -351,11 +362,13 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified")
if(!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name specified")
- if(H5G_loc(link_loc_id, &link_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!link_name || !*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
+ /* Check the group access property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
/* Get normalized copy of the link target */
if(NULL == (norm_obj_name = H5G_normalize(obj_name)))
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name")
@@ -378,9 +391,30 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
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")
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = link_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params.obj_type = H5I_get_type(link_loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
+ if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &ext_link_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
+ if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &buf_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
+
/* Create an external link */
- if(H5L__create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ if(H5VL_link_create(H5VL_LINK_CREATE_UD, 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:
H5MM_xfree(ext_link_buf);
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 3bbb6b6..fa3c097 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -122,12 +122,27 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name,
const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag,
hid_t lcpl_id);
H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name);
+H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name,
H5L_info_t *linkbuf/*out*/);
H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name);
+H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ H5L_info_t *linfo /*out*/);
+H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ char *name /*out*/, size_t size);
H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/,
size_t size);
+H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ void *buf/*out*/, size_t size);
H5_DLL herr_t H5L_register_external(void);
+H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
+ H5L_iterate_t op, void *op_data);
/* User-defined link functions */
H5_DLL herr_t H5L_register(const H5L_class_t *cls);
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index e6fd37c..7bdb001 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -41,10 +41,10 @@
#define H5L_SAME_LOC (hid_t)0
/* Current version of the H5L_class_t struct */
-#define H5L_LINK_CLASS_T_VERS 1
+#define H5L_LINK_CLASS_T_VERS 1
/* Previous versions of the H5L_class_t struct */
-#define H5L_LINK_CLASS_T_VERS_0 0
+#define H5L_LINK_CLASS_T_VERS_0 0
#ifdef __cplusplus
extern "C" {
diff --git a/src/H5MF.c b/src/H5MF.c
index 65b27db..0d368d4 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -2291,6 +2291,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, NULL);
curr_ring = needed_ring;
@@ -2320,6 +2321,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, &curr_ring);
curr_ring = needed_ring;
@@ -2435,6 +2437,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
needed_ring = H5AC_RING_MDFSM;
else
needed_ring = H5AC_RING_RDFSM;
+
if(needed_ring != curr_ring) {
H5AC_set_ring(needed_ring, &curr_ring);
curr_ring = needed_ring;
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 58e5054..bd57f05 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -60,8 +60,7 @@ 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 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);
diff --git a/src/H5O.c b/src/H5O.c
index 9b832f1..2ea8c10 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -75,9 +75,9 @@
/*-------------------------------------------------------------------------
- * Function: H5Oopen
+ * Function: H5Oopen
*
- * Purpose: Opens an object within an HDF5 file.
+ * Purpose: Opens an object within an HDF5 file.
*
* This function opens an object in the same way that H5Gopen2,
* H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require
@@ -88,8 +88,9 @@
* The opened object should be closed again with H5Oclose
* or H5Gclose, H5Tclose, or H5Dclose.
*
- * Return: Success: An open object identifier
- * Failure: Negative
+ * Return: Success: An open object identifier
+ *
+ * Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 14 2006
@@ -99,25 +100,42 @@
hid_t
H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
- hid_t ret_value = FAIL;
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5I_type_t opened_type;
+ void *opened_obj = NULL;
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Set location struct fields */
+ 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 = lapl_id;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
/* Open the object */
- if((ret_value = H5O__open_name(&loc, name)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+
+ /* Get an atom for the object */
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -140,7 +158,7 @@ done:
* or H5Gclose, H5Tclose, or H5Dclose.
*
* Return: Success: An open object identifier
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* November 20 2006
@@ -151,29 +169,45 @@ 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)
{
- H5G_loc_t loc; /* Location of group */
- hid_t ret_value = FAIL;
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5I_type_t opened_type;
+ void *opened_obj = NULL;
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE6("i", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ 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;
+ 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 location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
/* Open the object */
- if((ret_value = H5O__open_by_idx(&loc, group_name, idx_type, order, n)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -208,7 +242,7 @@ done:
* map this to an address on disk for the filesystem.
*
* Return: Success: An open object identifier
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
* Programmer: James Laird
* July 14 2006
@@ -218,21 +252,30 @@ done:
hid_t
H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
{
- H5G_loc_t loc; /* Location within file */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5I_type_t opened_type;
+ void *opened_obj = NULL;
+ H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "ia", loc_id, addr);
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if(!H5F_addr_defined(addr))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied")
+ loc_params.type = H5VL_OBJECT_BY_ADDR;
+ loc_params.loc_data.loc_by_addr.addr = addr;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the object */
- if((ret_value = H5O__open_by_addr(&loc, addr)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+
+ /* Register the dataset ID */
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -264,20 +307,20 @@ herr_t
H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
hid_t lapl_id)
{
- H5G_loc_t new_loc; /* Location of group to link from */
- H5G_loc_t obj_loc; /* Location of object to link to */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */
+ H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ H5VL_loc_params_t loc_params1;
+ H5VL_loc_params_t loc_params2;
+ H5P_genplist_t *plist; /* Property list pointer */
+ 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);
/* Check arguments */
- if(H5G_loc(obj_id, &obj_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(new_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot use H5L_SAME_LOC when only one location is specified")
- if(H5G_loc(new_loc_id, &new_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Avoid compiler warning on 32-bit machines */
@@ -288,13 +331,53 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
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")
+ /* Check the group access property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
/* Verify access property list and set up collective metadata if appropriate */
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;
+
+ 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")
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
+ if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
+
+ /* 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);
+
/* Create a link to the object */
- if(H5O__create_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link")
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
@@ -324,22 +407,26 @@ done:
herr_t
H5Oincr_refcount(hid_t object_id)
{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
- /* Get the object's oloc so we can adjust its link count */
- if((oloc = H5O_get_loc(object_id)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(object_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Change the object's refcount */
- if(H5O__link(oloc, 1) < 0)
+ /* 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)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -370,22 +457,26 @@ done:
herr_t
H5Odecr_refcount(hid_t object_id)
{
- H5O_loc_t *oloc; /* Object location */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
- /* Get the object's oloc so we can adjust its link count */
- if((oloc = H5O_get_loc(object_id)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(object_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Change the object's refcount */
- if(H5O__link(oloc, -1) < 0)
+ /* 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)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -394,12 +485,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oexists_by_name
+ * Function: H5Oexists_by_name
*
- * Purpose: Determine if a linked-to object exists
+ * Purpose: Determine if a linked-to object exists
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: Success: TRUE/FALSE
+ * Failure: FAIL
*
* Programmer: Quincey Koziol
* February 2 2010
@@ -409,24 +500,35 @@ done:
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location info */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set the location struct fields */
+ 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 = lapl_id;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
/* Check if the object exists */
- if((ret_value = H5O__exists_by_name(&loc, name)) < 0)
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
done:
@@ -441,8 +543,7 @@ done:
*
* NOTE: Add a parameter "fields" to indicate selection of object info.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Neil Fortner
* July 7 2010
@@ -452,22 +553,29 @@ done:
herr_t
H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*xIu", loc_id, oinfo, fields);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -475,38 +583,38 @@ done:
} /* end H5Oget_info2() */
- /*-------------------------------------------------------------------------
- * Function: H5Oget_info_by_name2
- *
- * Purpose: Retrieve information about an object.
- *
- * NOTE: Add a parameter "fields" to indicate selection of object info.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Neil Fortner
- * July 7 2010
- *
- *-------------------------------------------------------------------------
- */
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_name2
+ *
+ * Purpose: Retrieve information about an object
+ *
+ * NOTE: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Neil Fortner
+ * July 7 2010
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
unsigned fields, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
@@ -514,8 +622,18 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
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")
+ /* 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 = lapl_id;
+ 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")
+
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
@@ -543,7 +661,8 @@ herr_t
H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -551,8 +670,6 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
fields, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -568,8 +685,20 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
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")
+ 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;
+ 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 location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Retrieve the object's information */
- if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, fields) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -578,16 +707,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oset_comment
+ * Function: H5Oset_comment
*
* Purpose: Gives the specified object a comment. The COMMENT string
- * should be a null terminated string. An object can have only
- * one comment at a time. Passing NULL for the COMMENT argument
- * will remove the comment property from the object.
+ * should be a null terminated string. An object can have only
+ * one comment at a time. Passing NULL for the COMMENT argument
+ * will remove the comment property from the object.
*
- * Note: Deprecated in favor of using attributes on objects
+ * Note: Deprecated in favor of using attributes on objects
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -597,22 +726,27 @@ done:
herr_t
H5Oset_comment(hid_t obj_id, const char *comment)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", obj_id, comment);
- /* Check args */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
/* (Re)set the object's comment */
- if(H5O__set_comment_by_name(&loc, ".", comment) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
done:
@@ -621,16 +755,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oset_comment_by_name
+ * Function: H5Oset_comment_by_name
*
* Purpose: Gives the specified object a comment. The COMMENT string
- * should be a null terminated string. An object can have only
- * one comment at a time. Passing NULL for the COMMENT argument
- * will remove the comment property from the object.
+ * should be a null terminated string. An object can have only
+ * one comment at a time. Passing NULL for the COMMENT argument
+ * will remove the comment property from the object.
*
- * Note: Deprecated in favor of using attributes on objects
+ * Note: Deprecated in favor of using attributes on objects
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -641,15 +775,14 @@ herr_t
H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ 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);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
@@ -657,8 +790,18 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Fill in location struct fields */
+ 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 = lapl_id;
+ 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")
+
/* (Re)set the object's comment */
- if(H5O__set_comment_by_name(&loc, name, comment) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name)
done:
@@ -667,15 +810,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oget_comment
+ * Function: H5Oget_comment
*
- * Purpose: Retrieve comment for an object.
+ * Purpose: Retrieve comment for an object.
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
+ * Return: Success: Number of bytes in the comment excluding the
+ * null terminator. Zero if the object has no
+ * comment.
*
- * Failure: Negative
+ * Failure: -1
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -685,19 +828,24 @@ done:
ssize_t
H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
{
- H5G_loc_t loc; /* Location of group */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize);
- /* Check args */
- if(H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ /* Get the object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+
+ /* Set fields in the location struct */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(obj_id);
/* Retrieve the object's comment */
- if((ret_value = H5O__get_comment_by_name(&loc, ".", comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object")
done:
FUNC_LEAVE_API(ret_value)
@@ -705,15 +853,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oget_comment_by_name
+ * Function: H5Oget_comment_by_name
*
- * Purpose: Retrieve comment for an object.
+ * Purpose: Retrieve comment for an object.
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
+ * Return: Success: Number of bytes in the comment excluding the
+ * null terminator. Zero if the object has no
+ * comment.
*
- * Failure: Negative
+ * Failure: -1
*
* Programmer: Quincey Koziol
* August 30 2007
@@ -724,25 +872,34 @@ ssize_t
H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name")
/* Verify access property list and set up collective metadata if appropriate */
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")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info")
+
+ /* Fill in location struct fields */
+ 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 = lapl_id;
+ 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, (-1), "invalid location identifier")
/* Retrieve the object's comment */
- if((ret_value = H5O__get_comment_by_name(&loc, name, comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
@@ -750,9 +907,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ovisit2
+ * Function: H5Ovisit2
*
- * Purpose: Recursively visit an object and all the objects reachable
+ * Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
* linked to from that group will be visited. Links within
* each group are visited according to the order within the
@@ -772,12 +929,12 @@ done:
* object info to be retrieved to the callback "op".
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
* Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 25 2007
@@ -788,7 +945,9 @@ herr_t
H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate_t op, void *op_data, unsigned fields)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields);
@@ -803,9 +962,17 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
if(fields & ~H5O_INFO_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, fields)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Visit the objects */
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -813,7 +980,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ovisit_by_name2
+ * Function: H5Ovisit_by_name2
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@@ -835,12 +1002,12 @@ done:
* object info to be retrieved to the callback "op".
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@@ -851,15 +1018,19 @@ herr_t
H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data,
fields, lapl_id);
/* Check args */
- if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL")
+ if(!*obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
@@ -873,9 +1044,19 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
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")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, fields)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location 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);
+
+ /* Visit the objects */
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -883,17 +1064,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oclose
+ * Function: H5Oclose
*
- * Purpose: Close an open file object.
+ * Purpose: Close an open file object.
*
* This is the companion to H5Oopen. It is used to close any
* open object in an HDF5 file (but not IDs are that not file
* objects, such as property lists and dataspaces). It has
* the same effect as calling H5Gclose, H5Dclose, or H5Tclose.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: James Laird
* July 14 2006
@@ -926,6 +1106,7 @@ H5Oclose(hid_t object_id)
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 570e16d..23dd928 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -57,9 +57,9 @@
/* Local Prototypes */
/********************/
-static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno,
+static herr_t H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno,
hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size);
-static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied,
+static herr_t H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied,
H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size);
static herr_t H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
const H5O_msg_class_t *new_type, void *new_native, size_t new_size);
@@ -70,10 +70,10 @@ static herr_t H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size
static herr_t H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size,
size_t *new_idx);
static herr_t H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx);
-static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u);
-static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh);
-static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh);
-static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh);
+static htri_t H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u);
+static htri_t H5O__move_msgs_forward(H5F_t *f, H5O_t *oh);
+static htri_t H5O__merge_null(H5F_t *f, H5O_t *oh);
+static htri_t H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh);
static herr_t H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno);
@@ -97,7 +97,7 @@ H5FL_EXTERN(H5O_cont_t);
/*-------------------------------------------------------------------------
- * Function: H5O_add_gap
+ * Function: H5O__add_gap
*
* Purpose: Add a gap to a chunk
*
@@ -110,14 +110,14 @@ H5FL_EXTERN(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied,
+H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied,
size_t idx, uint8_t *new_gap_loc, size_t new_gap_size)
{
hbool_t merged_with_null; /* Whether the gap was merged with a null message */
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -150,7 +150,7 @@ if(chunkno > 0) {
HDassert(oh->chunk[chunkno].gap == 0);
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0)
+ if(H5O__eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk")
/* Set flag to indicate that the gap was handled */
@@ -178,7 +178,7 @@ if(chunkno > 0) {
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Increment new gap size */
@@ -212,11 +212,11 @@ if(chunkno > 0) {
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_add_gap() */
+} /* H5O__add_gap() */
/*-------------------------------------------------------------------------
- * Function: H5O_eliminate_gap
+ * Function: H5O__eliminate_gap
*
* Purpose: Eliminate a gap in a chunk with a null message.
*
@@ -236,13 +236,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
+H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
uint8_t *gap_loc, size_t gap_size)
{
uint8_t *move_start, *move_end; /* Pointers to area of messages to move */
hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(oh);
@@ -319,7 +319,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
*chk_dirtied = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5O_eliminate_gap() */
+} /* H5O__eliminate_gap() */
/*-------------------------------------------------------------------------
@@ -369,7 +369,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
alloc_msg->raw_size = new_size;
/* Add the gap to the chunk */
- if(H5O_add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0)
+ if(H5O__add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
else {
@@ -378,7 +378,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
/* Check if we need to extend message table to hold the new null message */
if(oh->nmesgs >= oh->alloc_nmesgs) {
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */
@@ -402,7 +402,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx,
unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &chk_dirtied, null_msg,
+ if(H5O__eliminate_gap(oh, &chk_dirtied, null_msg,
((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)),
oh->chunk[null_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -432,7 +432,7 @@ done:
/*-------------------------------------------------------------------------
*
- * Function: H5O_alloc_msgs
+ * Function: H5O__alloc_msgs
*
* Purpose: Allocate more messages for a header
*
@@ -445,14 +445,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_alloc_msgs(H5O_t *oh, size_t min_alloc)
+H5O__alloc_msgs(H5O_t *oh, size_t min_alloc)
{
size_t old_alloc; /* Old number of messages allocated */
size_t na; /* New number of messages allocated */
H5O_mesg_t *new_mesg; /* Pointer to new message array */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh);
@@ -474,7 +474,7 @@ H5O_alloc_msgs(H5O_t *oh, size_t min_alloc)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_alloc_msgs() */
+} /* H5O__alloc_msgs() */
/*-------------------------------------------------------------------------
@@ -590,7 +590,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Determine whether the chunk can be extended */
was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, oh->chunk[chunkno].addr, (hsize_t)(oh->chunk[chunkno].size), (hsize_t)(delta + extra_prfx_size));
@@ -618,7 +618,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
else {
/* Create a new null message */
if(oh->nmesgs >= oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Set extension message */
@@ -690,7 +690,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size,
} /* end for */
/* Resize the chunk in the cache */
- if(H5O_chunk_resize(oh, chk_proxy) < 0)
+ if(H5O__chunk_resize(oh, chk_proxy) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk")
/* Set new message index */
@@ -958,7 +958,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null,
* that could be generated below.
*/
if(oh->nmesgs + 3 > oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)3) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)3) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Check if we need to move multiple messages, in order to make room for the new message */
@@ -1361,7 +1361,7 @@ done:
/*-------------------------------------------------------------------------
*
- * Function: H5O_release_mesg
+ * Function: H5O__release_mesg
*
* Purpose: Convert a message into a null message
*
@@ -1374,13 +1374,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
+H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -1395,7 +1395,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, mesg->chunkno)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
/* Free any native information */
H5O__msg_free_mesg(mesg);
@@ -1415,7 +1415,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link)
/* Check if chunk has a gap currently */
if(oh->chunk[mesg->chunkno].gap) {
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &chk_dirtied, mesg,
+ if(H5O__eliminate_gap(oh, &chk_dirtied, mesg,
((oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)),
oh->chunk[mesg->chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -1427,11 +1427,11 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_release_mesg() */
+} /* H5O__release_mesg() */
/*-------------------------------------------------------------------------
- * Function: H5O_move_cont
+ * Function: H5O__move_cont
*
* Purpose: Check and move message(s) forward into a continuation message
*
@@ -1444,7 +1444,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
+H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that continuation message is in */
H5O_mesg_t *cont_msg; /* Pointer to the continuation message */
@@ -1452,7 +1452,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(f);
@@ -1500,7 +1500,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
/* Convert continuation message into a null message. Do not delete
* the target chunk yet, so we can still copy messages from it. */
- if(H5O_release_mesg(f, oh, cont_msg, FALSE) < 0)
+ if(H5O__release_mesg(f, oh, cont_msg, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message")
/* Protect chunk */
@@ -1549,7 +1549,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u)
/* Check if there is space that should be a gap */
if(gap_size > 0) {
/* Convert remnant into gap in chunk */
- if(H5O_add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0)
+ if(H5O__add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
@@ -1594,12 +1594,12 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_move_cont() */
+} /* H5O__move_cont() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_move_msgs_forward
+ * Function: H5O__move_msgs_forward
*
* Purpose: Move messages toward first chunk
*
@@ -1612,7 +1612,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
+H5O__move_msgs_forward(H5F_t *f, H5O_t *oh)
{
H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */
H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */
@@ -1623,7 +1623,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
hbool_t did_packing = FALSE; /* Whether any messages were packed */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -1706,7 +1706,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
if(H5O_CONT_ID == curr_msg->type->id) {
htri_t status; /* Status from moving messages */
- if((status = H5O_move_cont(f, oh, u)) < 0)
+ if((status = H5O__move_cont(f, oh, u)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message")
else if(status > 0) { /* Message(s) got moved into "continuation" message */
packed_msg = TRUE;
@@ -1818,7 +1818,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Check for gap in null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &null_chk_dirtied, null_msg,
+ if(H5O__eliminate_gap(oh, &null_chk_dirtied, null_msg,
((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)),
oh->chunk[old_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -1845,7 +1845,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
null_chk_dirtied = TRUE;
/* Add the gap to the chunk */
- if(H5O_add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0)
+ if(H5O__add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
/* Re-use message # for new null message taking place of non-null message */
@@ -1862,7 +1862,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Create new null message for previous location of non-null message */
if(oh->nmesgs >= oh->alloc_nmesgs) {
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */
@@ -1893,7 +1893,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh)
/* Check for gap in new null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
- if(H5O_eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg],
+ if(H5O__eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg],
((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)),
oh->chunk[old_chunkno].gap) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk")
@@ -1945,12 +1945,12 @@ done:
HDassert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_move_msgs_forward() */
+} /* H5O__move_msgs_forward() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_merge_null
+ * Function: H5O__merge_null
*
* Purpose: Merge neighboring null messages in an object header
*
@@ -1963,13 +1963,13 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_merge_null(H5F_t *f, H5O_t *oh)
+H5O__merge_null(H5F_t *f, H5O_t *oh)
{
hbool_t merged_msg; /* Flag to indicate that messages were merged */
hbool_t did_merging = FALSE; /* Whether any messages were merged */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh != NULL);
@@ -2051,7 +2051,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh)
oh->nmesgs--;
/* The merge null message might span the entire chunk: scan for empty chunk to remove */
- if((result = H5O_remove_empty_chunks(f, oh)) < 0)
+ if((result = H5O__remove_empty_chunks(f, oh)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
else if(result > 0)
/* Get out of loop */
@@ -2084,12 +2084,12 @@ H5O_merge_null(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_merge_null() */
+} /* H5O__merge_null() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_remove_empty_chunks
+ * Function: H5O__remove_empty_chunks
*
* Purpose: Attempt to eliminate empty chunks from object header.
*
@@ -2106,13 +2106,13 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
+H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh)
{
hbool_t deleted_chunk; /* Whether to a chunk was deleted */
hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh != NULL);
@@ -2173,7 +2173,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
deleted_chunkno = null_msg->chunkno;
/* Convert continuation message into a null message */
- if(H5O_release_mesg(f, oh, cont_msg, TRUE) < 0)
+ if(H5O__release_mesg(f, oh, cont_msg, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message")
/*
@@ -2273,12 +2273,12 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_remove_empty_chunks() */
+} /* H5O__remove_empty_chunks() */
/*-------------------------------------------------------------------------
*
- * Function: H5O_condense_header
+ * Function: H5O__condense_header
*
* Purpose: Attempt to eliminate empty chunks from object header.
*
@@ -2291,13 +2291,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_condense_header(H5F_t *f, H5O_t *oh)
+H5O__condense_header(H5F_t *f, H5O_t *oh)
{
hbool_t rescan_header; /* Whether to rescan header */
htri_t result; /* Result from packing/merging/etc */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh != NULL);
@@ -2308,33 +2308,33 @@ H5O_condense_header(H5F_t *f, H5O_t *oh)
rescan_header = FALSE;
/* Scan for messages that can be moved earlier in chunks */
- result = H5O_move_msgs_forward(f, oh);
+ result = H5O__move_msgs_forward(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward")
if(result > 0)
rescan_header = TRUE;
/* Scan for adjacent null messages & merge them */
- result = H5O_merge_null(f, oh);
+ result = H5O__merge_null(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack null header messages")
if(result > 0)
rescan_header = TRUE;
/* Scan for empty chunks to remove */
- result = H5O_remove_empty_chunks(f, oh);
+ result = H5O__remove_empty_chunks(f, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
if(result > 0)
rescan_header = TRUE;
} while(rescan_header);
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_condense_header() */
+} /* H5O__condense_header() */
/*-------------------------------------------------------------------------
@@ -2523,7 +2523,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno)
HDassert(new_size <= old_size);
/* Resize the chunk in the cache */
- if(H5O_chunk_resize(oh, chk_proxy) < 0)
+ if(H5O__chunk_resize(oh, chk_proxy) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk")
/* Free the unused space in the file */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index a62a3a3..c93bf32 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -44,48 +44,48 @@ static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream,
int indent, int fwidth);
/* Set up & include shared message "interface" info */
-#define H5O_SHARED_TYPE H5O_MSG_ATTR
-#define H5O_SHARED_DECODE H5O_attr_shared_decode
-#define H5O_SHARED_DECODE_REAL H5O_attr_decode
-#define H5O_SHARED_ENCODE H5O_attr_shared_encode
-#define H5O_SHARED_ENCODE_REAL H5O_attr_encode
-#define H5O_SHARED_SIZE H5O_attr_shared_size
-#define H5O_SHARED_SIZE_REAL H5O_attr_size
-#define H5O_SHARED_DELETE H5O__attr_shared_delete
-#define H5O_SHARED_DELETE_REAL H5O__attr_delete
-#define H5O_SHARED_LINK H5O__attr_shared_link
-#define H5O_SHARED_LINK_REAL H5O__attr_link
-#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file
-#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file
-#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file
-#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file
+#define H5O_SHARED_TYPE H5O_MSG_ATTR
+#define H5O_SHARED_DECODE H5O_attr_shared_decode
+#define H5O_SHARED_DECODE_REAL H5O_attr_decode
+#define H5O_SHARED_ENCODE H5O_attr_shared_encode
+#define H5O_SHARED_ENCODE_REAL H5O_attr_encode
+#define H5O_SHARED_SIZE H5O_attr_shared_size
+#define H5O_SHARED_SIZE_REAL H5O_attr_size
+#define H5O_SHARED_DELETE H5O__attr_shared_delete
+#define H5O_SHARED_DELETE_REAL H5O__attr_delete
+#define H5O_SHARED_LINK H5O__attr_shared_link
+#define H5O_SHARED_LINK_REAL H5O__attr_link
+#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file
+#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file
+#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file
+#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file
#undef H5O_SHARED_POST_COPY_FILE_UPD
-#define H5O_SHARED_DEBUG H5O_attr_shared_debug
-#define H5O_SHARED_DEBUG_REAL H5O__attr_debug
+#define H5O_SHARED_DEBUG H5O_attr_shared_debug
+#define H5O_SHARED_DEBUG_REAL H5O__attr_debug
#include "H5Oshared.h" /* Shared Object Header Message Callbacks */
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_ATTR[1] = {{
- H5O_ATTR_ID, /* message id number */
- "attribute", /* message name for debugging */
- sizeof(H5A_t), /* native message size */
- H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
- H5O_attr_shared_decode, /* decode message */
- H5O_attr_shared_encode, /* encode message */
- H5O_attr_copy, /* copy the native value */
- H5O_attr_shared_size, /* size of raw message */
- H5O__attr_reset, /* reset method */
- H5O__attr_free, /* free method */
- H5O__attr_shared_delete, /* file delete method */
- H5O__attr_shared_link, /* link method */
- NULL, /*set share method */
- NULL, /*can share method */
- H5O_attr_pre_copy_file, /* pre copy native value to file */
- H5O__attr_shared_copy_file, /* copy native value to file */
- H5O_attr_shared_post_copy_file, /* post copy native value to file */
- H5O_attr_get_crt_index, /* get creation index */
- H5O_attr_set_crt_index, /* set creation index */
- H5O_attr_shared_debug /* debug the message */
+ H5O_ATTR_ID, /* message id number */
+ "attribute", /* message name for debugging */
+ sizeof(H5A_t), /* native message size */
+ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
+ H5O_attr_shared_decode, /* decode message */
+ H5O_attr_shared_encode, /* encode message */
+ H5O_attr_copy, /* copy the native value */
+ H5O_attr_shared_size, /* size of raw message */
+ H5O__attr_reset, /* reset method */
+ H5O__attr_free, /* free method */
+ H5O__attr_shared_delete, /* file delete method */
+ H5O__attr_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /* can share method */
+ H5O_attr_pre_copy_file, /* pre copy native value to file */
+ H5O__attr_shared_copy_file, /* copy native value to file */
+ H5O_attr_shared_post_copy_file, /* post copy native value to file */
+ H5O_attr_get_crt_index, /* get creation index */
+ H5O_attr_set_crt_index, /* set creation index */
+ H5O_attr_shared_debug /* debug the message */
}};
/* Flags for attribute flag encoding */
@@ -474,7 +474,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg)
* Purpose: Frees resources within a attribute message, but doesn't free
* the message itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
@@ -491,11 +491,11 @@ H5O__attr_reset(void H5_ATTR_UNUSED *_mesg)
/*-------------------------------------------------------------------------
- * Function: H5O__attr_free
+ * Function: H5O__attr_free
*
- * Purpose: Frees the message
+ * Purpose: Frees the message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 18, 2004
@@ -525,7 +525,7 @@ done:
*
* Purpose: Free file space referenced by message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -563,7 +563,7 @@ done:
* Purpose: Increment reference count on any objects referenced by
* message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -604,9 +604,7 @@ done:
* Purpose: Perform any necessary actions before copying message between
* files for attribute messages.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, June 26, 2006
@@ -628,7 +626,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src,
HDassert(cpy_info->file_dst);
/* Check to ensure that the version of the message to be copied does not exceed
- the message version allowed by the destination file's high bound */
+ * the message version allowed by the destination file's high bound.
+ */
if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
@@ -649,7 +648,6 @@ done:
* Purpose: Copies a message from _MESG to _DEST in file
*
* Return: Success: Ptr to _DEST
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -695,7 +693,7 @@ done:
* an object may have a reference attribute that points to the
* object itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* March 6, 2005
@@ -719,12 +717,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_get_crt_index
+ * Function: H5O_attr_get_crt_index
*
- * Purpose: Get creation index from the message
+ * Purpose: Get creation index from the message
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007
@@ -749,12 +746,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/)
/*-------------------------------------------------------------------------
- * Function: H5O_attr_set_crt_index
+ * Function: H5O_attr_set_crt_index
*
- * Purpose: Set creation index from the message
+ * Purpose: Set creation index from the message
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 640d1c7..6e135c5 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Oattribute.c
- * Dec 11 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Oattribute.c
*
- * Purpose: Object header attribute routines.
+ * Purpose: Object header attribute routines.
*
*-------------------------------------------------------------------------
*/
@@ -26,21 +24,21 @@
/* Module Setup */
/****************/
-#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5A_FRIEND /* Suppress error about including H5Apkg.h */
#include "H5Omodule.h" /* This source code file is part of the H5O module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Fprivate.h" /* File */
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Fprivate.h" /* File */
/****************/
@@ -129,8 +127,24 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
-static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
+static herr_t H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static htri_t H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
const char* name_to_open);
+static herr_t H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
+ unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
+static herr_t H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr);
+static herr_t H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static herr_t H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
+static herr_t H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static herr_t H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo);
+static herr_t H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata);
+static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg,
+ unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata);
/*********************/
/* Package Variables */
@@ -149,12 +163,12 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
/*-------------------------------------------------------------------------
- * Function: H5O_attr_to_dense_cb
+ * Function: H5O__attr_to_dense_cb
*
- * Purpose: Object header iterator callback routine to convert compact
+ * Purpose: Object header iterator callback routine to convert compact
* attributes to dense attributes
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -163,14 +177,14 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */
H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -186,7 +200,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Convert message into a null message in the header */
/* (don't delete attribute's space in the file though) */
- if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
@@ -194,15 +208,15 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_to_dense_cb() */
+} /* end H5O__attr_to_dense_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_create
+ * Function: H5O__attr_create
*
- * Purpose: Create a new attribute in the object header.
+ * Purpose: Create a new attribute in the object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, December 8, 2006
@@ -283,7 +297,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
/* Iterate over existing attributes, moving them to dense storage */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_to_dense_cb;
+ op.u.lib_op = H5O__attr_to_dense_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, "error converting attributes to dense storage")
} /* end if */
@@ -337,7 +351,8 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
/* Increment reference count for shared attribute object for the
* object handle created by the caller function H5A__create. The count
* for the cached object header has been incremented in the step above
- * (in H5O__msg_append_real). The dense storage doesn't need a count. */
+ * (in H5O__msg_append_real). The dense storage doesn't need a count.
+ */
attr->shared->nrefs += 1;
/* Was new attribute shared? */
@@ -392,12 +407,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_open_cb
+ * Function: H5O__attr_open_cb
*
- * Purpose: Object header iterator callback routine to open an
+ * Purpose: Object header iterator callback routine to open an
* attribute stored compactly.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -406,13 +421,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
+H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -437,15 +452,15 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_open_cb() */
+} /* end H5O__attr_open_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_open_by_name
+ * Function: H5O__attr_open_by_name
*
- * Purpose: Open an existing attribute in an object header.
+ * Purpose: Open an existing attribute in an object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -470,7 +485,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -483,7 +498,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* If found the attribute is already opened, make a copy of it to share the
* object information. If not, open attribute as a new object
*/
- if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0)
+ if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute")
else if(found_open_attr == TRUE) {
if(NULL == (opened_attr = H5A__copy(NULL, exist_attr)))
@@ -506,7 +521,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
/* Iterate over attributes, to locate correct one to open */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_open_cb;
+ op.u.lib_op = H5O__attr_open_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute")
@@ -541,12 +556,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_open_by_idx_cb
+ * Function: H5O__attr_open_by_idx_cb
*
- * Purpose: Callback routine opening an attribute by index
+ * Purpose: Callback routine opening an attribute by index
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -555,12 +569,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
+H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
{
H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */
herr_t ret_value = H5_ITER_STOP; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(attr);
@@ -572,16 +586,16 @@ H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_open_by_idx_cb() */
+} /* end H5O__attr_open_by_idx_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_open_by_idx
+ * Function: H5O__attr_open_by_idx
*
- * Purpose: Open an existing attribute in an object header according to
+ * Purpose: Open an existing attribute in an object header according to
* an index.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 18, 2006
@@ -605,7 +619,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_LIB;
- attr_op.u.lib_op = H5O_attr_open_by_idx_cb;
+ attr_op.u.lib_op = H5O__attr_open_by_idx_cb;
/* Iterate over attributes to locate correct one */
if(H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0)
@@ -615,7 +629,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
* and make a copy of the already opened object to share the object info.
*/
if(opened_attr) {
- if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0)
+ if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute")
/* If found that the attribute is already opened, make a copy of it
@@ -647,12 +661,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_find_opened_attr
+ * Function: H5O__attr_find_opened_attr
*
- * Purpose: Find out whether an attribute has been opened by giving
+ * Purpose: Find out whether an attribute has been opened by giving
* the name. Return the pointer to the object if found.
*
- * Return: TRUE: found the already opened object
+ * Return: TRUE: found the already opened object
* FALSE: didn't find the opened object
* FAIL: function failed.
*
@@ -662,14 +676,14 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open)
+H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open)
{
hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */
unsigned long loc_fnum; /* File serial # for object */
size_t num_open_attr; /* Number of opened attributes */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Get file serial number for the location of attribute */
if(H5F_get_fileno(loc->file, &loc_fnum) < 0)
@@ -691,15 +705,15 @@ H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_t
/* Retrieve the IDs of all opened attributes */
if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, &check_num_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes")
- if(check_num_attr != num_open_attr)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch")
+ if(check_num_attr != num_open_attr)
+ HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch")
/* Iterate over the attributes */
for(u = 0; u < num_open_attr; u++) {
unsigned long attr_fnum; /* Attributes file serial number */
/* Get pointer to attribute */
- if(NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[u], H5I_ATTR)))
+ if(NULL == (*attr = (H5A_t *)H5VL_object_verify(attr_id_list[u], H5I_ATTR)))
HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "not an attribute")
/* Get file serial number for attribute */
@@ -724,15 +738,15 @@ done:
H5MM_free(attr_id_list);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_find_opened_attr */
+} /* end H5O__attr_find_opened_attr() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_update_shared
+ * Function: H5O__attr_update_shared
*
- * Purpose: Update a shared attribute.
+ * Purpose: Update a shared attribute.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -802,25 +816,21 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_write_cb
+ * Function: H5O__attr_write_cb
*
- * Purpose: Object header iterator callback routine to update an
+ * Purpose: Object header iterator callback routine to update an
* attribute stored compactly.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Dec 4 2006
*
- * Modification:Raymond Lu
- * 4 June 2008
- * Took out the data copying part because the attribute data
- * is shared between attribute handle and object header.
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */
@@ -828,7 +838,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -885,15 +895,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_write_cb() */
+} /* end H5O__attr_write_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_write
+ * Function: H5O__attr_write
*
- * Purpose: Write a new value to an attribute.
+ * Purpose: Write a new value to an attribute.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 4, 2006
@@ -915,7 +925,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr)
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -942,7 +952,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr)
/* Iterate over attributes, to locate correct one to update */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_write_cb;
+ op.u.lib_op = H5O__attr_write_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@@ -964,12 +974,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_rename_chk_cb
+ * Function: H5O__attr_rename_chk_cb
*
- * Purpose: Object header iterator callback routine to check for
+ * Purpose: Object header iterator callback routine to check for
* duplicate name during rename
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -978,13 +988,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(oh);
@@ -1001,21 +1011,21 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_rename_chk_cb() */
+} /* end H5O__attr_rename_chk_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_rename_mod_cb
+ * Function: H5O__attr_rename_mod_cb
*
- * Purpose: Object header iterator callback routine to change name of
+ * Purpose: Object header iterator callback routine to change name of
* attribute during rename
*
- * Note: This routine doesn't currently allow an attribute to change
+ * Note: This routine doesn't currently allow an attribute to change
* its "shared" status, if the name change would cause a size
* difference that would put it into a different category.
* Something for later...
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1024,7 +1034,7 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
@@ -1032,7 +1042,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -1096,7 +1106,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* (doesn't decrement the link count on shared components because
* the "native" pointer has been reset)
*/
- if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute")
*oh_modified = H5O_MODIFY_CONDENSE;
@@ -1130,15 +1140,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_rename_mod_cb() */
+} /* end H5O__attr_rename_mod_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_rename
+ * Function: H5O__attr_rename
*
- * Purpose: Rename an attribute.
+ * Purpose: Rename an attribute.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -1162,7 +1172,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1190,7 +1200,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Iterate over attributes, to check if "new name" exists already */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_rename_chk_cb;
+ op.u.lib_op = H5O__attr_rename_chk_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@@ -1200,7 +1210,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
/* Iterate over attributes again, to actually rename attribute with old name */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_rename_mod_cb;
+ op.u.lib_op = H5O__attr_rename_mod_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute")
@@ -1218,15 +1228,15 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5O__attr_rename */
+} /* end H5O__attr_rename() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_iterate_real
+ * Function: H5O_attr_iterate_real
*
- * Purpose: Internal routine to iterate over attributes for an object.
+ * Purpose: Internal routine to iterate over attributes for an object.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -1294,7 +1304,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type,
/* Iterate over attributes in table */
if((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0)
- HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed");
+ HERROR(H5E_ATTR, H5E_BADITER, "iteration operator failed");
} /* end else */
done:
@@ -1309,11 +1319,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__attr_iterate
+ * Function: H5O__attr_iterate
*
- * Purpose: Iterate over attributes for an object.
+ * Purpose: Iterate over attributes for an object.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 5, 2006
@@ -1322,8 +1332,7 @@ done:
*/
herr_t
H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op,
- void *op_data)
+ hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data)
{
H5G_loc_t loc; /* Object location */
herr_t ret_value = FAIL; /* Return value */
@@ -1347,11 +1356,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_remove_update
+ * Function: H5O__attr_remove_update
*
- * Purpose: Check for reverting from dense to compact attribute storage
+ * Purpose: Check for reverting from dense to compact attribute storage
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, February 14, 2007
@@ -1367,12 +1376,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
+H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
{
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@@ -1427,7 +1436,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Insert attribute message into object header (Will increment
reference count on shared attributes) */
/* Find out whether the attribute has been opened */
- if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0)
+ if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute")
/* If found the attribute is already opened, use the opened message to insert.
@@ -1450,7 +1459,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Update the message after removing the attribute */
/* This is particularly needed when removing the last attribute that is
- accessed via fractal heap/v2 B-tree (HDFFV-9277) */
+ * accessed via fractal heap/v2 B-tree (HDFFV-9277)
+ */
if(H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message")
@@ -1468,16 +1478,16 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_remove_update() */
+} /* end H5O__attr_remove_update() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_remove_cb
+ * Function: H5O__attr_remove_cb
*
- * Purpose: Object header iterator callback routine to remove an
+ * Purpose: Object header iterator callback routine to remove an
* attribute stored compactly.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1486,13 +1496,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(oh);
@@ -1502,7 +1512,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Check for correct attribute message to modify */
if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
/* Convert message into a null message (i.e. delete it) */
- if(H5O_release_mesg(udata->f, oh, mesg, TRUE) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
@@ -1517,15 +1527,15 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_remove_cb() */
+} /* end H5O__attr_remove_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_remove
+ * Function: H5O__attr_remove
*
- * Purpose: Delete an attribute on an object.
+ * Purpose: Delete an attribute on an object.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -1548,7 +1558,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1575,7 +1585,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_remove_cb;
+ op.u.lib_op = H5O__attr_remove_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute")
@@ -1586,7 +1596,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name)
/* Update the attribute information after removing an attribute */
if(ainfo_exists)
- if(H5O_attr_remove_update(loc, oh, &ainfo) < 0)
+ if(H5O__attr_remove_update(loc, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info")
/* Update the modification time, if any */
@@ -1602,12 +1612,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__attr_remove_by_idx
+ * Function: H5O__attr_remove_by_idx
*
- * Purpose: Delete an attribute on an object, according to an order within
- * an index.
+ * Purpose: Delete an attribute on an object, according to an order within
+ * an index.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Wednesday, February 14, 2007
@@ -1631,7 +1641,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1666,7 +1676,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Iterate over attributes, to locate correct one to delete */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_remove_cb;
+ op.u.lib_op = H5O__attr_remove_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute")
@@ -1677,7 +1687,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Update the attribute information after removing an attribute */
if(ainfo_exists)
- if(H5O_attr_remove_update(loc, oh, &ainfo) < 0)
+ if(H5O__attr_remove_update(loc, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info")
/* Update the modification time, if any */
@@ -1695,11 +1705,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_count_real
+ * Function: H5O__attr_count_real
*
- * Purpose: Determine the # of attributes on an object
+ * Purpose: Determine the # of attributes on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, March 9, 2007
@@ -1707,11 +1717,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
+H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_TAG(oh->cache_info.addr)
+ FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr)
/* Check arguments */
HDassert(f);
@@ -1745,16 +1755,16 @@ H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs)
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5O_attr_count_real */
+} /* end H5O__attr_count_real */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_exists_cb
+ * Function: H5O__attr_exists_cb
*
- * Purpose: Object header iterator callback routine to check for an
+ * Purpose: Object header iterator callback routine to check for an
* attribute stored compactly, by name.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1763,13 +1773,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
+H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(mesg);
@@ -1785,15 +1795,15 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_exists_cb() */
+} /* end H5O__attr_exists_cb() */
/*-------------------------------------------------------------------------
- * Function: H5O__attr_exists
+ * Function: H5O__attr_exists
*
- * Purpose: Determine if an attribute with a particular name exists on an object
+ * Purpose: Determine if an attribute with a particular name exists on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -1815,7 +1825,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1842,7 +1852,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name)
/* Iterate over existing attributes, checking for attribute with same name */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5O_attr_exists_cb;
+ op.u.lib_op = H5O__attr_exists_cb;
if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute")
@@ -1863,7 +1873,7 @@ done:
*
* Purpose: For 1.8 attribute, returns storage amount for btree and fractal heap
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* June 19, 2007
@@ -1943,11 +1953,11 @@ done:
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5O__attr_count
+ * Function: H5O__attr_count
*
- * Purpose: Determine the # of attributes on an object
+ * Purpose: Determine the # of attributes on an object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, December 11, 2006
@@ -1968,10 +1978,10 @@ H5O__attr_count(const H5O_loc_t *loc)
/* Protect the object header to iterate over */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Retrieve # of attributes on object */
- if(H5O_attr_count_real(loc->file, oh, &nattrs) < 0)
+ if(H5O__attr_count_real(loc->file, oh, &nattrs) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Set return value */
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index 92fd218..fbf04f2 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -75,7 +75,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
0, /*native message size */
0, /* messages are sharable? */
H5O__bogus_decode, /*decode message */
- H5O__bogus_encode, /*encode message */
+ H5O_bogus_encode, /*encode message */
NULL, /*copy the native value */
H5O_bogus_size, /*raw message size */
NULL, /*free internal memory */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 59e1705..fba4f6e 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -437,7 +437,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
HDassert(oh->cache_info.type == H5AC_OHDR);
HDassert(oh->chunk[0].size == len);
#ifdef H5O_DEBUG
- H5O_assert(oh);
+ H5O__assert(oh);
#endif /* H5O_DEBUG */
/* Point to raw data 'image' for first chunk, which
@@ -1430,9 +1430,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check for combining two adjacent 'null' messages */
if((udata->file_intent & H5F_ACC_RDWR) &&
- H5O_NULL_ID == id && oh->nmesgs > 0 &&
- H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
- oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
+ H5O_NULL_ID == id && oh->nmesgs > 0 &&
+ H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
+ oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
size_t mesgno; /* Current message to operate on */
@@ -1448,7 +1448,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check if we need to extend message table to hold the new message */
if(oh->nmesgs >= oh->alloc_nmesgs)
- if(H5O_alloc_msgs(oh, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages")
/* Get pointer to message to set up */
@@ -1470,9 +1470,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* (Usually from future versions of the library) */
if(id >= H5O_UNKNOWN_ID ||
#ifdef H5O_ENABLE_BOGUS
- id == H5O_BOGUS_VALID_ID ||
+ id == H5O_BOGUS_VALID_ID ||
#endif
- NULL == H5O_msg_class_g[id]) {
+ NULL == H5O_msg_class_g[id]) {
H5O_unknown_t *unknown; /* Pointer to "unknown" message info */
@@ -1491,9 +1491,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check for "fail if unknown" message flags */
if(((udata->file_intent & H5F_ACC_RDWR) &&
- (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE))
- || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS))
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found")
+ (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE))
+ || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS))
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found")
/* Check for "mark if unknown" message flag, etc. */
else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) &&
!(flags & H5O_MSG_FLAG_WAS_UNKNOWN) &&
@@ -1619,7 +1619,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
done:
if(ret_value < 0 && udata->cont_msg_info->msgs) {
- udata->cont_msg_info->msgs = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs);
+ udata->cont_msg_info->msgs = H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs);
udata->cont_msg_info->alloc_nmsgs = 0;
}
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 205515a..94301b3 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -77,12 +77,11 @@ H5FL_DEFINE(H5O_chunk_proxy_t);
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_add
+ * Function: H5O__chunk_add
*
- * Purpose: Add new chunk for object header to metadata cache
+ * Purpose: Add new chunk for object header to metadata cache
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -107,7 +106,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno)
/* Allocate space for the object header data structure */
if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Increment reference count on object header */
if(H5O__inc_rc(oh) < 0)
@@ -128,6 +127,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno)
/* Insert the chunk proxy into the cache */
if(H5AC_insert_entry(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")
+
chk_proxy = NULL;
done:
@@ -146,12 +146,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_protect
+ * Function: H5O_chunk_protect
*
- * Purpose: Protect an object header chunk for modifications
+ * Purpose: Protect an object header chunk for modifications
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -221,12 +220,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_unprotect
+ * Function: H5O__chunk_unprotect
*
- * Purpose: Unprotect an object header chunk after modifications
+ * Purpose: Unprotect an object header chunk after modifications
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -273,12 +271,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_chunk_resize
+ * Function: H5O__chunk_resize
*
- * Purpose: Resize an object header chunk
+ * Purpose: Resize an object header chunk
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -287,11 +284,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
+H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(oh);
@@ -311,16 +308,15 @@ H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_chunk_resize() */
+} /* end H5O__chunk_resize() */
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_update_idx
+ * Function: H5O__chunk_update_idx
*
- * Purpose: Update the chunk index for a chunk proxy
+ * Purpose: Update the chunk index for a chunk proxy
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -367,12 +363,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_delete
+ * Function: H5O__chunk_delete
*
- * Purpose: Notify metadata cache that a chunk has been deleted
+ * Purpose: Notify metadata cache that a chunk has been deleted
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -413,12 +408,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__chunk_dest
+ * Function: H5O__chunk_dest
*
- * Purpose: Destroy a chunk proxy object
+ * Purpose: Destroy a chunk proxy object
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index 2eb27d6..ad54272 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -36,10 +36,10 @@
/* PRIVATE PROTOTYPES */
-static void *H5O_cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
+static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
unsigned *ioflags, size_t p_size, const uint8_t *p);
-static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
-static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
+static herr_t H5O__cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
+static size_t H5O__cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__cont_free(void *mesg);
static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static herr_t H5O__cont_debug(H5F_t *f, const void *_mesg, FILE * stream,
@@ -51,10 +51,10 @@ const H5O_msg_class_t H5O_MSG_CONT[1] = {{
"hdr continuation", /*message name for debugging */
sizeof(H5O_cont_t), /*native message size */
0, /* messages are sharable? */
- H5O_cont_decode, /*decode message */
- H5O_cont_encode, /*encode message */
+ H5O__cont_decode, /*decode message */
+ H5O__cont_encode, /*encode message */
NULL, /*no copy method */
- H5O_cont_size, /*size of header continuation */
+ H5O__cont_size, /*size of header continuation */
NULL, /*reset method */
H5O__cont_free, /* free method */
H5O__cont_delete, /* file delete method */
@@ -74,7 +74,7 @@ H5FL_DEFINE(H5O_cont_t);
/*-------------------------------------------------------------------------
- * Function: H5O_cont_decode
+ * Function: H5O__cont_decode
*
* Purpose: Decode the raw header continuation message.
*
@@ -89,14 +89,14 @@ H5FL_DEFINE(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static void *
-H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
+H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_cont_t *cont = NULL;
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -116,11 +116,11 @@ H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_cont_decode() */
+} /* end H5O__cont_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_cont_encode
+ * Function: H5O__cont_encode
*
* Purpose: Encodes a continuation message.
*
@@ -133,11 +133,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_cont_t *cont = (const H5O_cont_t *) _mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@@ -151,11 +151,11 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
H5F_ENCODE_LENGTH(f, p, cont->size);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_cont_encode() */
+} /* end H5O__cont_encode() */
/*-------------------------------------------------------------------------
- * Function: H5O_cont_size
+ * Function: H5O__cont_size
*
* Purpose: Returns the size of the raw message in bytes not counting
* the message type or size fields, but only the data fields.
@@ -172,18 +172,18 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
*-------------------------------------------------------------------------
*/
static size_t
-H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
+H5O__cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
{
size_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Set return value */
ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */
H5F_SIZEOF_SIZE(f)); /* Continuation header length */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_cont_size() */
+} /* end H5O__cont_size() */
/*-------------------------------------------------------------------------
@@ -256,8 +256,6 @@ done:
* matzke@llnl.gov
* Aug 6 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 2e628f4..a3d4884 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Ocopy.c
- * Nov 6 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Ocopy.c
*
- * Purpose: Object copying routines.
+ * Purpose: Object copying routines.
*
*-------------------------------------------------------------------------
*/
@@ -32,19 +30,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5HGprivate.h" /* Global Heaps */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Lprivate.h" /* Links */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5HGprivate.h" /* Global Heaps */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Lprivate.h" /* Links */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -79,8 +78,6 @@ typedef struct H5O_copy_search_comm_dt_ud_t {
/* Local Prototypes */
/********************/
-static herr_t H5O__copy(const H5G_loc_t *loc, const char *src_name,
- H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
static herr_t H5O__copy_free_addrmap_cb(void *item, void *key, void *op_data);
static herr_t H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata);
@@ -195,19 +192,18 @@ H5FL_DEFINE(haddr_t);
* hid_t lcpl_id IN: Properties which apply to the new hard link
*
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Peter Cao
- * June 4, 2005
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
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)
+ const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id)
{
- H5G_loc_t loc; /* Source group group location */
- H5G_loc_t dst_loc; /* Destination group location */
+ H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */
+ H5VL_loc_params_t loc_params1;
+ H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */
+ H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -215,21 +211,43 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
ocpypl_id, lcpl_id);
/* Check arguments */
- if(H5G_loc(src_loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(H5G_loc(dst_loc_id, &dst_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!src_name || !*src_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified")
if(!dst_name || !*dst_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified")
+
+ /* Get correct property lists */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list")
+
+ /* Get object copy property list */
+ if (H5P_DEFAULT == ocpypl_id)
+ ocpypl_id = H5P_OBJECT_COPY_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(src_loc_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine to copy object */
- if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0)
+ /* get the object */
+ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ loc_params1.type = H5VL_OBJECT_BY_SELF;
+ loc_params1.obj_type = H5I_get_type(src_loc_id);
+
+ /* get the object */
+ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ loc_params2.type = H5VL_OBJECT_BY_SELF;
+ loc_params2.obj_type = H5I_get_type(dst_loc_id);
+
+ /* Copy the object */
+ if(H5VL_object_copy(vol_obj1, &loc_params1, src_name, vol_obj2, &loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
@@ -238,23 +256,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__copy
- *
- * Purpose: Internal routine to copy an object
+ * Function: H5O_copy
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
+ * Purpose: Private version of H5Ocopy
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 29, 2017
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
+herr_t
+H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id)
{
H5G_loc_t src_loc; /* Source object group location */
@@ -263,9 +277,9 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
htri_t dst_exists; /* Does destination name exist already? */
hbool_t loc_found = FALSE; /* Location at 'name' found */
hbool_t obj_open = FALSE; /* Entry at 'name' found */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_NOAPI_NOINIT
/* Check arguments */
HDassert(loc);
@@ -275,7 +289,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
/* Check if destination name already exists */
if((dst_exists = H5L_exists_tolerant(dst_loc, dst_name)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists")
if(TRUE == dst_exists)
HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists")
@@ -294,24 +308,6 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
obj_open = TRUE;
- /* Get correct property lists */
- if(H5P_DEFAULT == lcpl_id) {
- if((lcpl_id = H5P_get_default(H5P_CLS_LCRT)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default lcpl")
- } /* end if */
- else
- if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list")
-
- /* Get object copy property list */
- if(H5P_DEFAULT == ocpypl_id) {
- if((ocpypl_id = H5P_get_default(H5P_CLS_OCPY)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default ocpypl")
- } /* end if */
- else
- if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list")
-
/* Do the actual copying of the object */
if(H5O__copy_obj(&src_loc, dst_loc, dst_name, ocpypl_id, lcpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
@@ -322,8 +318,8 @@ done:
if(obj_open && H5O_close(&src_oloc, NULL) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__copy() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_copy() */
/*-------------------------------------------------------------------------
@@ -442,7 +438,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
} /* end if */
/* Flush any dirty messages in source object header to update the header chunks */
- if(H5O_flush_msgs(oloc_src->file, oh_src) < 0)
+ if(H5O__flush_msgs(oloc_src->file, oh_src) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages")
/* Allocate the destination object header and fill in header fields */
@@ -777,7 +773,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Make sure we have enough space for new NULL message */
if(oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs)
- if(H5O_alloc_msgs(oh_dst, (size_t)1) < 0)
+ if(H5O__alloc_msgs(oh_dst, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Create null message for [rest of] space in new chunk */
@@ -1226,7 +1222,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name,
/* Insert the new object in the destination file's group */
if(H5L_link(dst_loc, dst_name, &new_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
entry_inserted = TRUE;
done:
@@ -1544,7 +1540,7 @@ H5O_copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get attribute datatype")
/* Check if the datatype is committed and search the skip list if so */
- if(H5T_committed(dt)) {
+ if(H5T_is_named(dt)) {
/* Allocate key */
if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
@@ -1661,9 +1657,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc,
if(NULL == (key->dt = (H5T_t *)H5O_msg_read(obj_oloc, H5O_DTYPE_ID, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message")
- /* Check if the datatype is committed and search the skip list if so
- */
- if(H5T_committed(key->dt)) {
+ /* Check if the datatype is committed and search the skip list if so */
+ if(H5T_is_named(key->dt)) {
/* Get datatype object fileno */
H5F_GET_FILENO(obj_oloc->file, key->fileno);
@@ -1800,7 +1795,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src,
HDassert(oh_src);
HDassert(oloc_dst);
HDassert(oloc_dst->file);
- HDassert(H5F_FILE_ID(oloc_dst->file) >= 0);
+ HDassert(H5F_ID_EXISTS(oloc_dst->file));
HDassert(cpy_info);
/* Allocate key */
@@ -1910,7 +1905,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src,
/* Traverse the destination file, adding committed datatypes to the skip
* list */
- if(H5G_visit(H5F_FILE_ID(oloc_dst->file), "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0)
+ if(H5G_visit(&dst_root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
cpy_info->dst_dt_list_complete = TRUE;
} /* end if */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 1fc95dd..b8190ae 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -76,12 +76,12 @@
#ifdef H5O_DEBUG
/*-------------------------------------------------------------------------
- * Function: H5O_assert
+ * Function: H5O__assert
*
- * Purpose: Sanity check the information for an object header data
+ * Purpose: Sanity check the information for an object header data
* structure.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED (Doesn't fail, just crashes)
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -90,7 +90,7 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5O_assert(const H5O_t *oh)
+H5O__assert(const H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message to examine */
H5O_mesg_t *tmp_msg; /* Pointer to temporary message to examine */
@@ -101,7 +101,7 @@ H5O_assert(const H5O_t *oh)
size_t hdr_size; /* Size of header's chunks */
unsigned u, v; /* Local index variables */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Initialize the tracking variables */
hdr_size = 0;
@@ -223,7 +223,7 @@ H5O_assert(const H5O_t *oh)
HDassert(hdr_size == (free_space + meta_space + mesg_space));
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_assert() */
+} /* end H5O__assert() */
#endif /* H5O_DEBUG */
@@ -270,31 +270,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_debug_real
+ * Function: H5O__debug_real
*
- * Purpose: Prints debugging info about an object header.
+ * Purpose: Prints debugging info about an object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Aug 6 1997
*
- * Modifications:
- * Feb. 2009: Vailin Choi
- * Fixed bug in the accumulation of chunk_total
- * Used the appropriate flag when printing creation order tracked/indexed
*-------------------------------------------------------------------------
*/
herr_t
-H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth)
+H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth)
{
size_t mesg_total = 0, chunk_total = 0, gap_total = 0;
unsigned *sequence = NULL;
unsigned i; /* Local index variable */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -323,16 +319,16 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
/* Extra information for later versions */
if(oh->version > H5O_VERSION_1) {
/* Display object's status flags */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute creation order tracked:",
(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No");
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute creation order indexed:",
(oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No");
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Attribute storage phase change values:",
(oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default");
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Timestamps:",
(oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled");
if(oh->flags & ~H5O_HDR_ALL_FLAGS)
@@ -385,14 +381,14 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
for(i = 0, chunk_total = 0; i < oh->nchunks; i++) {
size_t chunk_size;
- HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
+ HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
- HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
"Address:",
oh->chunk[i].addr);
/* Decrement chunk 0's size by the object header prefix size */
- if(0 == i) {
+ if(0 == i) {
if(H5F_addr_ne(oh->chunk[i].addr, addr))
HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n");
chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh);
@@ -401,54 +397,53 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
chunk_size = oh->chunk[i].size;
/* Accumulate chunk's size to total */
- chunk_total += chunk_size;
- gap_total += oh->chunk[i].gap;
+ chunk_total += chunk_size;
+ gap_total += oh->chunk[i].gap;
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Size in bytes:",
chunk_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Gap:",
oh->chunk[i].gap);
} /* end for */
/* debug each message */
if(NULL == (sequence = (unsigned *)H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for(i = 0, mesg_total = 0; i < oh->nmesgs; i++) {
const H5O_msg_class_t *debug_type; /* Type of message to use for callbacks */
unsigned chunkno; /* Chunk for message */
/* Accumulate message's size to total */
- mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
+ mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
- /* For version 2 object header, add size of "OCHK" for continuation chunk */
- if (oh->mesg[i].type->id == H5O_CONT_ID)
- mesg_total += H5O_SIZEOF_CHKHDR_OH(oh);
+ /* For version 2 object header, add size of "OCHK" for continuation chunk */
+ if(oh->mesg[i].type->id == H5O_CONT_ID)
+ mesg_total += H5O_SIZEOF_CHKHDR_OH(oh);
- HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
+ HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
- /* check for bad message id */
- if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) {
- HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n",
- oh->mesg[i].type->id);
- continue;
- } /* end if */
+ /* check for bad message id */
+ if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) {
+ HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", oh->mesg[i].type->id);
+ continue;
+ } /* end if */
- /* message name and size */
- HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n",
+ /* message name and size */
+ HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n",
indent + 3, "", MAX(0, fwidth - 3),
"Message ID (sequence number):",
(unsigned) (oh->mesg[i].type->id),
oh->mesg[i].type->name,
sequence[oh->mesg[i].type->id]++);
- HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3),
"Dirty:",
oh->mesg[i].dirty);
HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX (0, fwidth - 3),
"Message flags:");
- if(oh->mesg[i].flags) {
+ if(oh->mesg[i].flags) {
hbool_t flag_printed = FALSE;
/* Sanity check that all flags in format are covered below */
@@ -497,39 +492,40 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
} /* end if */
else
HDfprintf(stream, "<none>\n");
- HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3),
+
+ HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3),
"Chunk number:",
oh->mesg[i].chunkno);
- chunkno = oh->mesg[i].chunkno;
- if(chunkno >= oh->nchunks)
- HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
- HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
+ chunkno = oh->mesg[i].chunkno;
+ if(chunkno >= oh->nchunks)
+ HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
+ HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
"Raw message data (offset, size) in chunk:",
(size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image),
oh->mesg[i].raw_size);
- /* check the size */
- if((oh->mesg[i].raw + oh->mesg[i].raw_size >
+ /* check the size */
+ if((oh->mesg[i].raw + oh->mesg[i].raw_size >
oh->chunk[chunkno].image + oh->chunk[chunkno].size) ||
(oh->mesg[i].raw < oh->chunk[chunkno].image))
- HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
+ HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
- /* decode the message */
- debug_type = oh->mesg[i].type;
- if(NULL == oh->mesg[i].native && debug_type->decode)
+ /* decode the message */
+ debug_type = oh->mesg[i].type;
+ if(NULL == oh->mesg[i].native && debug_type->decode)
H5O_LOAD_NATIVE(f, H5O_DECODEIO_NOCHANGE, oh, &oh->mesg[i], FAIL)
- /* print the message */
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
+ /* print the message */
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
"Message Information:");
- if(debug_type->debug && oh->mesg[i].native != NULL)
- (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6));
- else
- HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, "");
+ if(debug_type->debug && oh->mesg[i].native != NULL)
+ (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6));
+ else
+ HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, "");
} /* end for */
if((mesg_total + gap_total) != chunk_total)
- HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
+ HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n");
done:
/* Release resources */
@@ -537,7 +533,7 @@ done:
sequence = (unsigned *)H5MM_xfree(sequence);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_debug_real() */
+} /* end H5O__debug_real() */
/*-------------------------------------------------------------------------
@@ -575,14 +571,15 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
loc.holding_file = FALSE;
if(NULL == (oh = H5O_protect(&loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* debug */
- H5O_debug_real(f, oh, addr, stream, indent, fwidth);
+ if(H5O__debug_real(f, oh, addr, stream, indent, fwidth) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "debug dump call failed")
done:
if(oh && H5O_unprotect(&loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_debug() */
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 876579d..93fc18a 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -31,9 +31,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Opkg.h" /* Object headers */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
/****************/
@@ -87,20 +89,27 @@
herr_t
H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", loc_id, oinfo);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
+
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
@@ -121,26 +130,37 @@ done:
herr_t
H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
if(!oinfo)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
- /* Verify access property list and set up collective metadata if appropriate */
+ /* Verify access property list and set up collective metadata if appropriate */
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")
+ /* 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 = lapl_id;
+ 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")
+
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
@@ -166,11 +186,8 @@ herr_t
H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
- 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 */
- hbool_t loc_found = FALSE; /* Entry at 'name' found */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -178,8 +195,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
lapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -193,15 +208,23 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
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")
+ 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;
+ 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 location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
/* Retrieve the object's information */
- if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, H5O_INFO_ALL) < 0)
+ if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
- /* Release the object location */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_info_by_idx1() */
@@ -242,7 +265,9 @@ herr_t
H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate_t op, void *op_data)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data);
@@ -255,8 +280,16 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Visit the objects */
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -300,15 +333,19 @@ herr_t
H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id)
{
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data,
lapl_id);
/* Check args */
- if(!obj_name || !*obj_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL")
+ if(!*obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
@@ -320,8 +357,18 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
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")
- /* Call internal object visitation routine */
- if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location 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);
+
+ /* Visit the objects */
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 8060398..28970d1 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -15,13 +15,13 @@
#define H5T_FRIEND /*prevent warning from including H5Tpkg */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Gprivate.h" /* Groups */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#include "H5Tpkg.h" /* Datatypes */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -1485,7 +1485,7 @@ H5O_dtype_can_share(const void *_mesg)
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable")
/* Don't share committed datatypes */
- if((tri_ret = H5T_committed(mesg)) > 0)
+ if((tri_ret = H5T_is_named(mesg)) > 0)
HGOTO_DONE(FALSE)
else if(tri_ret < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is shared")
@@ -1619,14 +1619,15 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc,
FUNC_ENTER_STATIC
if(dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
- HDassert(H5T_committed(dt_dst));
+ HDassert(H5T_is_named(dt_dst));
if(H5O_loc_reset(&(dt_dst->oloc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location")
dt_dst->oloc.file = dt_dst->sh_loc.file;
dt_dst->oloc.addr = dt_dst->sh_loc.u.loc.oh_addr;
} /* end if */
- else
- HDassert(!H5T_committed(dt_dst));
+ else {
+ HDassert(!H5T_is_named(dt_dst));
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 8a6004d..125da36 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -344,12 +344,12 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh,
if((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read object header")
if(exists) {
- if((dt = H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL)) < 0)
+ if(NULL == (dt = (H5T_t *)H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message")
/* Verify size */
- if(fill->size != H5T_GET_SIZE(dt))
+ if(fill->size != (ssize_t)H5T_GET_SIZE(dt))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size")
- }
+ } /* end if */
if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
@@ -754,8 +754,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
} /* end if */
fill->size = 0;
if(fill->type) {
- (void)H5T_close_real(fill->type);
- fill->type = NULL;
+ (void)H5T_close_real(fill->type);
+ fill->type = NULL;
} /* end if */
done:
@@ -1008,7 +1008,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed)
* Can we convert between source and destination data types?
*/
if(NULL == (tpath = H5T_path_find(fill->type, dset_type)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
/* Don't bother doing anything if there will be no actual conversion */
if(!H5T_path_noop(tpath)) {
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index e8e077e..3e1ae46 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -27,6 +27,7 @@
/****************/
#include "H5Omodule.h" /* This source code file is part of the H5O module */
+#define H5T_FRIEND /* Suppress error about including H5Tpkg */
/***********/
/* Headers */
@@ -40,16 +41,14 @@
#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Objects */
-
+#include "H5Tpkg.h" /* Datatypes */
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5O__flush(hid_t obj_id);
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(hid_t obj_id);
/*************/
@@ -59,11 +58,11 @@ static herr_t H5O__refresh(hid_t obj_id);
/*-------------------------------------------------------------------------
- * Function: H5Oflush
+ * Function: H5Oflush
*
- * Purpose: Flushes all buffers associated with an object to disk.
+ * Purpose: Flushes all buffers associated with an object to disk.
*
- * Return: Non-negative on success, negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Mike McGreevy
* May 19, 2010
@@ -73,17 +72,27 @@ static herr_t H5O__refresh(hid_t obj_id);
herr_t
H5Oflush(hid_t obj_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", obj_id);
+ /* Check args */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(obj_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call internal routine */
- if(H5O__flush(obj_id) < 0)
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Flush the object */
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
done:
@@ -92,6 +101,49 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_flush
+ *
+ * Purpose: Internal routine to flush an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * December 29, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_flush(H5O_loc_t *oloc, hid_t obj_id)
+{
+ void *obj_ptr; /* Pointer to object */
+ const H5O_obj_class_t *obj_class; /* Class of object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Get the object pointer */
+ if(NULL == (obj_ptr = H5VL_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Get the object class */
+ if(NULL == (obj_class = H5O__obj_class(oloc)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class")
+
+ /* Flush the object of this class */
+ if(obj_class->flush && obj_class->flush(obj_ptr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
+
+ /* Flush the object metadata and invoke flush callback */
+ if(H5O_flush_common(oloc, obj_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_flush() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_flush_common
*
* Purpose: Flushes the object's metadata
@@ -121,7 +173,7 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id)
/* Check to invoke callback */
if(H5F_object_flush_cb(oloc->file, obj_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -129,57 +181,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__flush
- *
- * Purpose: Internal routine to flush an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 29, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O__flush(hid_t obj_id)
-{
- H5O_loc_t *oloc; /* Object location */
- void *obj_ptr; /* Pointer to object */
- const H5O_obj_class_t *obj_class; /* Class of object */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check args */
- if(NULL == (oloc = H5O_get_loc(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
-
- /* Get the object pointer */
- if(NULL == (obj_ptr = H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
-
- /* Get the object class */
- if(NULL == (obj_class = H5O__obj_class(oloc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class")
-
- /* Flush the object of this class */
- if(obj_class->flush && obj_class->flush(obj_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
-
- /* Flush the object metadata and invoke flush callback */
- if(H5O_flush_common(oloc, obj_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__flush() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O__oh_tag
*
* Purpose: Get object header's address--tag value for the object
@@ -223,9 +224,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Orefresh
*
- * Purpose: Refreshes all buffers associated with an object.
+ * Purpose: Refreshes all buffers associated with an object.
*
- * Return: Non-negative on success, negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Mike McGreevy
* July 28, 2010
@@ -235,17 +236,27 @@ done:
herr_t
H5Orefresh(hid_t oid)
{
- herr_t ret_value = SUCCEED; /* Return value */
-
+ H5VL_object_t *vol_obj = NULL; /* Object token */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
+
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", oid);
+ /* Check args */
+ if(NULL == (vol_obj = H5VL_vol_object(oid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(oid) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(oid);
- /* Call internal routine */
- if(H5O__refresh(oid) < 0)
+ /* Refresh the object */
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
done:
@@ -276,6 +287,7 @@ done:
herr_t
H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
{
+ 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 */
herr_t ret_value = SUCCEED; /* Return value */
@@ -286,6 +298,8 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
H5G_loc_t obj_loc;
H5O_loc_t obj_oloc;
H5G_name_t obj_path;
+ H5O_shared_t cached_H5O_shared;
+ H5VL_t *connector = NULL;
/* Create empty object location */
obj_loc.oloc = &obj_oloc;
@@ -298,13 +312,40 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
H5F_incr_nopen_objs(oloc.file);
objs_incr = TRUE;
+ /* Save important datatype state */
+ if(H5I_get_type(oid) == H5I_DATATYPE)
+ if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state")
+
+ /* Get the VOL object from the ID and cache a pointer to the connector.
+ * The vol_obj will disappear when the underlying object is closed, so
+ * we can't use that directly.
+ */
+ if(NULL == (vol_obj = H5VL_vol_object(oid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ connector = vol_obj->connector;
+
+ /* Bump the number of references on the VOL connector.
+ * If you don't do this, VDS refreshes can accidentally close the connector.
+ */
+ connector->nrefs++;
+
/* Close object & evict its metadata */
if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 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, 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 */
+ connector->nrefs--;
+
+ /* Restore important datatype state */
+ if(H5I_get_type(oid) == H5I_DATATYPE)
+ if(H5T_restore_refresh_state(oid, &cached_H5O_shared) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to restore datatype state")
+
} /* end if */
done:
@@ -351,10 +392,10 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
H5G_loc_copy(obj_loc, &tmp_loc, H5_COPY_DEEP);
} /* end if */
- /* Get object's type */
+ /* Handle close for multiple dataset opens */
if(H5I_get_type(oid) == H5I_DATASET)
- if(H5D_mult_refresh_close(oid) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
+ if(H5D_mult_refresh_close(oid) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
/* Retrieve tag for object */
if(H5O__oh_tag(&oloc, &tag) < 0)
@@ -378,8 +419,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
/* Re-cork object with tag */
if(corked)
- if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object")
+ if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object")
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -401,14 +442,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
+H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector, hbool_t start_swmr)
{
- void *object = NULL; /* Dataset for this operation */
+ void *object = NULL; /* Object for this operation */
H5I_type_t type; /* Type of object for the ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
+ /* Sanity check */
+ HDassert(obj_loc);
+ HDassert(vol_connector);
+
/* Get object's type */
type = H5I_get_type(oid);
@@ -416,13 +461,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
case H5I_GROUP:
/* Re-open the group */
if(NULL == (object = H5G_open(obj_loc)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open group")
break;
case H5I_DATATYPE:
/* Re-open the named datatype */
if(NULL == (object = H5T_open(obj_loc)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype")
break;
case H5I_DATASET:
@@ -431,7 +476,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
if(!start_swmr) /* No need to handle multiple opens when H5Fstart_swmr_write() */
if(H5D_mult_refresh_reopen((H5D_t *)object) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset")
break;
case H5I_UNINIT:
@@ -441,6 +486,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
@@ -448,52 +494,15 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr)
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
break;
} /* end switch */
/* Re-register ID for the object */
- if((H5I_register_with_id(type, object, TRUE, oid)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object atom")
+ if((H5VL_register_using_existing_id(type, object, vol_connector, TRUE, oid)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh")
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5O_refresh_metadata_reopen() */
-
-/*-------------------------------------------------------------------------
- * Function: H5O__refresh
- *
- * Purpose: Internal routine to refresh an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 29, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O__refresh(hid_t obj_id)
-{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check args */
- if(NULL == (oloc = H5O_get_loc(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
-
- /* Private function */
- if(H5O_refresh_metadata(obj_id, *oloc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__refresh() */
-
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index b75a9c5..4b34a52 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -113,7 +113,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* Allocate space for message */
if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Get the flags for the group */
flags = *p++;
@@ -231,7 +231,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(ginfo);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_ginfo_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
*dest = *ginfo;
diff --git a/src/H5Oint.c b/src/H5Oint.c
index b543d1b..aa96cb4 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -42,7 +42,7 @@
#include "H5MMprivate.h" /* Memory management */
#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -664,28 +664,28 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_open_name
+ * Function: H5O_open_name
*
- * Purpose: Opens an object within an HDF5 file.
+ * Purpose: Opens an object by name
*
- * Return: Success: An open object identifier
- * Failure: Negative
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* March 5 2007
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref)
+void *
+H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type)
{
H5G_loc_t obj_loc; /* Location used to open group */
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
- hid_t ret_value = H5I_INVALID_HID;
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+ FUNC_ENTER_NOAPI(NULL)
/* Check args */
HDassert(loc);
@@ -698,85 +698,46 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref)
/* Find the object's location */
if(H5G_loc_find(loc, name, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "object not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "object not found")
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O__open_by_loc(&obj_loc, app_ref)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
- if(ret_value < 0 && loc_found)
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location")
+ if(NULL == ret_value)
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_open_name() */
/*-------------------------------------------------------------------------
- * Function: H5O__open_name
- *
- * Purpose: Internal routine to open an object by name
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5O__open_name(const H5G_loc_t *loc, const char *name)
-{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name);
-
- /* Open the object */
- if((ret_value = H5O_open_name(loc, name, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__open_name() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O__open_by_idx
+ * Function: H5O_open_by_idx
*
* Purpose: Internal routine to open an object by index within group
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* December 28, 2017
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n)
+void *
+H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type)
{
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 */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
HDassert(loc);
@@ -788,48 +749,45 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
/* Find the object's location, according to the order in the index */
if(H5G_loc_find_by_idx(loc, name, idx_type, order, n, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "group not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "group not found")
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
/* Release the object location if we failed after copying it */
- if(ret_value < 0 && loc_found)
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location")
+ if(NULL == ret_value)
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__open_by_idx() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_open_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5O__open_by_addr
+ * Function: H5O_open_by_addr
*
* Purpose: Internal routine to open an object by its address
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* December 28, 2017
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
+void *
+H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type)
{
H5G_loc_t obj_loc; /* Location used to open group */
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
HDassert(loc);
@@ -843,87 +801,49 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */
/* Open the object */
- if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__open_by_addr() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_open_by_addr() */
/*-------------------------------------------------------------------------
- * Function: H5O__open_by_loc
+ * Function: H5O_open_by_loc
*
- * Purpose: Opens an object and returns an ID given its group loction.
+ * Purpose: Opens an object
*
- * Return: Success: Open object identifier
- * Failure: Negative
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
* Programmer: James Laird
* July 25 2006
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
+void *
+H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type)
{
const H5O_obj_class_t *obj_class; /* Class of object for location */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(NULL)
HDassert(obj_loc);
/* Get the object class for this location */
if(NULL == (obj_class = H5O__obj_class(obj_loc->oloc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "unable to determine object class")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object class")
/* Call the object class's 'open' routine */
HDassert(obj_class->open);
- if((ret_value = obj_class->open(obj_loc, app_ref)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = obj_class->open(obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__open_by_loc() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O__create_link
- *
- * Purpose: Internal routine to create a link from a group to an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__create_link(const H5G_loc_t *new_loc, const char *new_name,
- H5G_loc_t *obj_loc, hid_t lcpl_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(new_loc);
- HDassert(new_name && *new_name);
- HDassert(obj_loc);
-
- /* Link to the object */
- if(H5L_link(new_loc, new_name, obj_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__create_link() */
+} /* end H5O_open_by_loc() */
/*-------------------------------------------------------------------------
@@ -964,11 +884,10 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
#ifdef H5O_DEBUG
if(H5DEBUG(O)) {
- if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file))
- HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
- loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
- else
- HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
+ if(FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file))
+ HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
+ else
+ HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
}
#endif
@@ -991,14 +910,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__link_oh
+ * Function: H5O__link_oh
*
- * Purpose: Adjust the link count for an open object header by adding
- * ADJUST to the link count.
+ * Purpose: Adjust the link count for an open object header by adding
+ * ADJUST to the link count.
*
- * Return: Success: New link count
+ * Return: Success: New link count
*
- * Failure: Negative
+ * Failure: -1
*
* Programmer: Robb Matzke
* matzke@llnl.gov
@@ -1024,14 +943,14 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(adjust < 0) {
/* Check for too large of an adjustment */
if((unsigned)(-adjust) > oh->nlink)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, (-1), "link count would be negative")
/* Adjust the link count for the object header */
oh->nlink = (unsigned)((int)oh->nlink + adjust);
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty")
/* Check if the object should be deleted */
if(oh->nlink == 0) {
@@ -1039,7 +958,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(H5FO_opened(f, addr) != NULL) {
/* Flag the object to be deleted when it's closed */
if(H5FO_mark(f, addr, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion")
} /* end if */
else {
/* Mark the object header for deletion */
@@ -1054,7 +973,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
if(H5FO_marked(f, addr)) {
/* Remove "delete me" flag on the object */
if(H5FO_mark(f, addr, FALSE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion")
} /* end if */
} /* end if */
@@ -1063,7 +982,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty")
} /* end if */
/* Check for operations on refcount message */
@@ -1073,7 +992,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
/* Check for removing refcount message */
if(oh->nlink <= 1) {
if(H5O__msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "unable to delete refcount message")
oh->has_refcount_msg = FALSE;
} /* end if */
/* Update refcount message with new link count */
@@ -1081,7 +1000,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
H5O_refcount_t refcount = oh->nlink;
if(H5O__msg_write_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message")
} /* end else */
} /* end if */
else {
@@ -1090,7 +1009,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
H5O_refcount_t refcount = oh->nlink;
if(H5O__msg_append_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, (-1), "unable to create new refcount message")
oh->has_refcount_msg = TRUE;
} /* end if */
} /* end else */
@@ -1154,41 +1073,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__link
- *
- * Purpose: Internal routine to change the refcount for an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__link(const H5O_loc_t *oloc, int adjust)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(oloc);
-
- /* Change the object's refcount */
- if(H5O_link(oloc, adjust) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__link() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_protect
*
* Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
@@ -1326,7 +1210,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks)
} /* end if */
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
/* Pin the other chunks also when requested, so that the object header
@@ -1590,8 +1474,9 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
chk_dirtied = TRUE;
} /* end if */
else {
- /* XXX: For now, update access time & change fields in the object header */
- /* (will need to add some code to update modification time appropriately) */
+ /* XXX: For now, update access time & change fields in the object header
+ * (will need to add some code to update modification time appropriately)
+ */
oh->atime = oh->ctime = now;
/* Mark object header as dirty in cache */
@@ -1691,25 +1576,25 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
H5O_bogus_t *bogus; /* Pointer to the bogus information */
/* Allocate the native message in memory */
- if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
+ if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
/* Update the native value */
bogus->u = H5O_BOGUS_VALUE;
- if(bogus_id == H5O_BOGUS_VALID_ID)
- type = H5O_MSG_BOGUS_VALID;
- else if(bogus_id == H5O_BOGUS_INVALID_ID)
- type = H5O_MSG_BOGUS_INVALID;
- else
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
+ if(bogus_id == H5O_BOGUS_VALID_ID)
+ type = H5O_MSG_BOGUS_VALID;
+ else if(bogus_id == H5O_BOGUS_INVALID_ID)
+ type = H5O_MSG_BOGUS_INVALID;
+ else
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
/* Allocate space in the object header for bogus message */
- if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
+ if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
/* Point to "bogus" information (take it over) */
- oh->mesg[idx].native = bogus;
+ oh->mesg[idx].native = bogus;
/* Set the appropriate flags for the message */
oh->mesg[idx].flags = mesg_flags;
@@ -1899,23 +1784,23 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type)
/* Set type to "unknown" */
*obj_type = H5O_TYPE_UNKNOWN;
- } /* end if */
+ }
else {
/* Set object type */
*obj_type = obj_class->type;
- } /* end else */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__obj_type_real() */
/*-------------------------------------------------------------------------
- * Function: H5O__obj_class
+ * Function: H5O__obj_class
*
- * Purpose: Returns the class of object pointed to by `loc'.
+ * Purpose: Returns the class of object pointed to by 'loc'.
*
- * Return: Success: An object class
- * Failure: NULL
+ * Return: Success: An object class
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, November 6, 2006
@@ -1928,7 +1813,7 @@ H5O__obj_class(const H5O_loc_t *loc)
H5O_t *oh = NULL; /* Object header for location */
const H5O_obj_class_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC_TAG(loc->addr)
+ FUNC_ENTER_PACKAGE_TAG(loc->addr)
/* Load the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
@@ -1940,7 +1825,7 @@ H5O__obj_class(const H5O_loc_t *loc)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O__obj_class() */
@@ -1979,7 +1864,7 @@ H5O__obj_class_real(const H5O_t *oh)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
else if(isa)
HGOTO_DONE(H5O_obj_class_g[i - 1])
- } /* end for */
+ }
if(0 == i)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
@@ -2032,6 +1917,7 @@ H5O_get_loc(hid_t object_id)
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
@@ -2201,42 +2087,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__exists_by_name
- *
- * Purpose: Internal routine to check if an object exists
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5O__exists_by_name(const H5G_loc_t *loc, const char *name)
-{
- htri_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Check if the object exists */
- if((ret_value = H5G_loc_exists(loc, name)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__exists_by_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_get_hdr_info
*
* Purpose: Retrieve the object header information for an object
@@ -2413,7 +2263,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
/* Set the object's reference count */
oinfo->rc = oh->nlink;
- }
+ } /* end if */
/* Get time information, if requested */
if(fields & H5O_INFO_TIME) {
@@ -2465,7 +2315,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
/* Retrieve # of attributes */
if(fields & H5O_INFO_NUM_ATTRS)
- if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0)
+ if(H5O__attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Get B-tree & heap metadata storage size, if requested */
@@ -2492,52 +2342,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__get_info_by_name
- *
- * Purpose: Internal routine to retrieve an object's info
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Note: Add a parameter "fields" to indicate selection of object info.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
- HDassert(oinfo);
-
- /* Retrieve the object's information */
- if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__get_info_by_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O__get_info_by_idx
*
* Purpose: Internal routine to retrieve an object's info according to
* an index within a group.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
*
* Note: Add a parameter "fields" to indicate selection of object info.
*
@@ -2559,7 +2368,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id
hbool_t loc_found = FALSE; /* Entry at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -2585,85 +2394,11 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__get_info_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5O__set_comment_by_name
- *
- * Purpose: Internal routine to set an object's "comment"
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name,
- const char *comment)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* (Re)set the object's comment */
- if(H5G_loc_set_comment(loc, name, comment) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__set_comment_by_name() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O__get_comment_by_name
- *
- * Purpose: Internal routine to retrieve an object's "comment"
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-ssize_t
-H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name,
- char *comment, size_t bufsize)
-{
- ssize_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Retrieve the object's comment */
- if((ret_value = H5G_loc_get_comment(loc, name, comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__get_comment_by_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_get_create_plist
*
* Purpose: Retrieve the object creation properties for an object
@@ -3053,7 +2788,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__visit
+ * Function: H5O__visit
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@@ -3074,12 +2809,12 @@ done:
* Note: Add a parameter "fields" to indicate selection of object info.
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
* Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * library, or the negative value returned by one
+ * of the operators.
*
* Programmer: Quincey Koziol
* November 24 2007
@@ -3087,27 +2822,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields)
{
H5O_iter_visit_ud_t udata; /* User data for callback */
- H5G_loc_t loc; /* Location of reference object */
H5G_loc_t obj_loc; /* Location used to open object */
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
H5O_info_t oinfo; /* Object info struct */
- hid_t obj_id = (-1); /* ID of object */
+ void *obj = NULL; /* Object */
+ H5I_type_t opened_type; /* ID type of object */
+ hid_t obj_id = H5I_INVALID_HID; /* ID of object */
herr_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Portably initialize user data struct to zeros */
HDmemset(&udata, 0, sizeof(udata));
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HDassert(loc);
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -3115,7 +2850,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
+ if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
@@ -3125,9 +2860,13 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Open the object */
/* (Takes ownership of the obj_loc information) */
- if((obj_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0)
+ if(NULL == (obj = H5O_open_by_loc(&obj_loc, &opened_type)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ /* Get an ID for the visited object */
+ if((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object")
+
/* Make callback for starting object */
if((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects")
@@ -3139,6 +2878,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Check for object being a group */
if(oinfo.type == H5O_TYPE_GROUP) {
H5G_loc_t start_loc; /* Location of starting group */
+ H5G_loc_t vis_loc; /* Location of visited group */
/* Get the location of the starting group */
if(H5G_loc(obj_id, &start_loc) < 0)
@@ -3171,24 +2911,30 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Add to list of visited objects */
if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list")
- } /* end if */
+ }
+
+ /* Get the location of the visited group */
+ if(H5G_loc(obj_id, &vis_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
/* Call internal group visitation routine */
- if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
+ if((ret_value = H5G_visit(&vis_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end if */
done:
- if(obj_id > 0) {
+/* XXX (VOL MERGE): Probably also want to consider closing obj here on failures */
+ if(obj_id != H5I_INVALID_HID) {
if(H5I_dec_app_ref(obj_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
- } /* end if */
+ }
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+
if(udata.visited)
H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__visit() */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 5f16837..2b65e0c 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -243,9 +243,15 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));
/* Chunk dimensions */
- for(u = 0; u < mesg->u.chunk.ndims; u++)
+ for(u = 0; u < mesg->u.chunk.ndims; u++) {
UINT32DECODE(p, mesg->u.chunk.dim[u]);
+ /* Just in case that something goes very wrong, such as file corruption. */
+ if(mesg->u.chunk.dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u",
+ u, mesg->u.chunk.dim[u])
+ } /* end for */
+
/* Compute chunk size */
for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
mesg->u.chunk.size *= mesg->u.chunk.dim[u];
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 4903d9f..9827b6a 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -44,13 +44,13 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void
static herr_t H5O__linfo_free(void *_mesg);
static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src,
- H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
- H5O_copy_t *cpy_info, void *udata);
+ H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
+ H5O_copy_t *cpy_info, void *udata);
static herr_t H5O__linfo_post_copy_file(const H5O_loc_t *parent_src_oloc,
- const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
- unsigned *mesg_flags, H5O_copy_t *cpy_info);
-static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg,
- FILE * stream, int indent, int fwidth);
+ const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
+ unsigned *mesg_flags, H5O_copy_t *cpy_info);
+static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, FILE * stream,
+ int indent, int fwidth);
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 6447936..55e1aee 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -612,6 +612,7 @@ herr_t
H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
{
H5O_link_t *lnk = (H5O_link_t *)_mesg;
+ hid_t file_id = -1; /* ID for the file the link is located in (passed to user callback) */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -645,25 +646,21 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
/* Check for delete callback */
if(link_class->del_func) {
- hid_t file_id; /* ID for the file the link is located in (passed to user callback) */
-
/* Get a file ID for the file the link is in */
- if((file_id = H5F_get_id(f, FALSE)) < 0)
+ if((file_id = H5F_get_id(f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID")
/* Call user-defined link's 'delete' callback */
- if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) {
- H5I_dec_ref(file_id);
+ if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
- } /* end if */
-
- /* Release the file ID */
- if(H5I_dec_ref(file_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
} /* end if */
} /* end if */
done:
+ /* Release the file ID */
+ if(file_id > 0 && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_delete() */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index e156dcd..d6e3dce 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -127,11 +127,11 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Go append message to object header */
if(H5O_msg_append_oh(loc->file, oh, type_id, mesg_flags, update_flags, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
done:
if(oh && H5O_unpin(oh) < 0)
@@ -225,7 +225,7 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message")
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
@@ -276,7 +276,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" modify routine */
if(H5O__msg_write_real(loc->file, oh, type, mesg_flags, update_flags, mesg) < 0)
@@ -384,7 +384,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
/* Check for modifying a constant message */
if(!(update_flags & H5O_UPDATE_FORCE) && (idx_msg->flags & H5O_MSG_FLAG_CONSTANT))
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
/* This message is shared, but it's being modified. */
else if((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) {
htri_t status; /* Status of "try share" call */
@@ -427,7 +427,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message")
#ifdef H5O_DEBUG
-H5O_assert(oh);
+H5O__assert(oh);
#endif /* H5O_DEBUG */
done:
@@ -474,15 +474,15 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
/* Call the "real" read routine */
if(NULL == (ret_value = H5O_msg_read_oh(loc->file, oh, type_id, mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message")
+ HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message")
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_msg_read() */
@@ -616,12 +616,12 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native)
HDassert(type);
if(native) {
- if(type->reset) {
- if((type->reset)(native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
- } /* end if */
+ if(type->reset) {
+ if((type->reset)(native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
+ } /* end if */
else
- HDmemset(native, 0, type->native_size);
+ HDmemset(native, 0, type->native_size);
} /* end if */
done:
@@ -658,7 +658,7 @@ H5O_msg_free(unsigned type_id, void *mesg)
HDassert(type);
/* Call the "real" free routine */
- ret_value = H5O__msg_free_real(type, mesg);
+ ret_value = H5O_msg_free_real(type, mesg);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_free() */
@@ -667,7 +667,7 @@ H5O_msg_free(unsigned type_id, void *mesg)
/*-------------------------------------------------------------------------
* Function: H5O__msg_free_mesg
*
- * Purpose: Call H5O__msg_free_real() on a message.
+ * Purpose: Call H5O_msg_free_real() on a message.
*
* Return: Non-negative on success/Negative on failure
*
@@ -685,14 +685,14 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg)
HDassert(mesg);
/* Free any native information */
- mesg->native = H5O__msg_free_real(mesg->type, mesg->native);
+ mesg->native = H5O_msg_free_real(mesg->type, mesg->native);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__msg_free_mesg() */
/*-------------------------------------------------------------------------
- * Function: H5O__msg_free_real
+ * Function: H5O_msg_free_real
*
* Purpose: Similar to H5O_msg_reset() except it also frees the message
* pointer.
@@ -706,9 +706,9 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg)
*-------------------------------------------------------------------------
*/
void *
-H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native)
+H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native)
{
- FUNC_ENTER_PACKAGE_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
HDassert(type);
@@ -722,7 +722,7 @@ H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native)
} /* end if */
FUNC_LEAVE_NOAPI(NULL)
-} /* end H5O__msg_free_real() */
+} /* end H5O_msg_free_real() */
/*-------------------------------------------------------------------------
@@ -798,22 +798,22 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id)
/* Load the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Count the messages of the correct type */
- msg_count = H5O_msg_count_real(oh, type);
+ msg_count = H5O__msg_count_real(oh, type);
H5_CHECKED_ASSIGN(ret_value, int, msg_count, unsigned);
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_count() */
/*-------------------------------------------------------------------------
- * Function: H5O_msg_count_real
+ * Function: H5O__msg_count_real
*
* Purpose: Counts the number of messages in an object header which are a
* certain type.
@@ -828,12 +828,12 @@ done:
*-------------------------------------------------------------------------
*/
unsigned
-H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
+H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
{
unsigned u; /* Local index variable */
unsigned ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(oh);
@@ -841,11 +841,11 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type)
/* Loop over all messages, counting the ones of the type looked for */
for(u = ret_value = 0; u < oh->nmesgs; u++)
- if(oh->mesg[u].type == type)
+ if(oh->mesg[u].type == type)
ret_value++;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_msg_count_real() */
+} /* end H5O__msg_count_real() */
/*-------------------------------------------------------------------------
@@ -976,11 +976,11 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" remove routine */
if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
done:
if(oh && H5O_unpin(oh) < 0)
@@ -1028,11 +1028,11 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
/* Pin the object header */
if(NULL == (oh = H5O_pin(loc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
/* Call the "real" remove routine */
if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
done:
if(oh && H5O_unpin(oh) < 0)
@@ -1090,7 +1090,7 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
* (OK to remove constant messages - QAK)
*/
/* Convert message into a null message */
- if(H5O_release_mesg(udata->f, oh, mesg, udata->adj_link) < 0)
+ if(H5O__release_mesg(udata->f, oh, mesg, udata->adj_link) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message")
/* Indicate that the object header was modified */
@@ -1315,8 +1315,8 @@ done:
* message removal)
*/
if(oh_modified & H5O_MODIFY_CONDENSE)
- if(H5O_condense_header(f, oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
+ if(H5O__condense_header(f, oh) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
/* Mark object header as changed */
if(H5O_touch_oh(f, oh, FALSE) < 0)
@@ -1973,7 +1973,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type,
/* Protect chunk */
if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, idx_msg->chunkno)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk")
/* Reset existing native information for the header's message */
H5O__msg_reset_real(type, idx_msg->native);
@@ -1991,7 +1991,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type,
/* Release chunk */
if(H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
chk_proxy = NULL;
/* Update the modification time, if requested */
@@ -2197,7 +2197,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_flush_msgs
+ * Function: H5O__flush_msgs
*
* Purpose: Flushes messages for object header.
*
@@ -2210,13 +2210,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_flush_msgs(H5F_t *f, H5O_t *oh)
+H5O__flush_msgs(H5F_t *f, H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -2240,7 +2240,7 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_flush_msgs() */
+} /* end H5O__flush_msgs() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index db1d8d7..172f9ab 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -442,8 +442,6 @@ H5O__mtime_free(void *mesg)
* matzke@llnl.gov
* Jul 24 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -454,7 +452,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream,
struct tm *tm;
char buf[128];
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 616f96b..dbc8089 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -63,7 +63,7 @@
)
#define H5O_ALIGN_OH(O, X) \
H5O_ALIGN_VERS((O)->version, X)
-#define H5O_ALIGN_F(F, X) \
+#define H5O_ALIGN_F(F, X) \
H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X)
/* Size of checksum (on disk) */
@@ -339,7 +339,7 @@ typedef struct H5O_obj_class_t {
void *(*get_copy_file_udata)(void); /*retrieve user data for 'copy file' operation */
void (*free_copy_file_udata)(void *); /*free user data for 'copy file' operation */
htri_t (*isa)(const H5O_t *); /*if a header matches an object class */
- hid_t (*open)(const H5G_loc_t *, hbool_t ); /*open an object of this class */
+ void *(*open)(const H5G_loc_t *, H5I_type_t *); /*open an object of this class */
void *(*create)(H5F_t *, void *, H5G_loc_t *); /*create an object of this class */
H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */
herr_t (*bh_info)(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */
@@ -414,7 +414,6 @@ typedef struct H5O_chk_cache_ud_t {
H5O_common_cache_ud_t common; /* Common object header cache callback info */
} H5O_chk_cache_ud_t;
-
/* Header message ID to class mapping */
H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES];
@@ -555,26 +554,11 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
/* Package-local function prototypes */
-H5_DLL hid_t H5O__open_name(const H5G_loc_t *loc, const char *name);
-H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr);
-H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref);
-H5_DLL herr_t H5O__create_link(const H5G_loc_t *new_loc, const char *new_name,
- H5G_loc_t *obj_loc, hid_t lcpl_id);
H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc);
H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted);
-H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust);
-H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name);
-H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name,
- H5O_info_t *oinfo, unsigned fields);
H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields);
-H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name,
- const char *comment);
-H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name,
- char *comment, size_t bufsize);
-H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields);
H5_DLL herr_t H5O__inc_rc(H5O_t *oh);
H5_DLL herr_t H5O__dec_rc(H5O_t *oh);
@@ -587,9 +571,8 @@ H5_DLL herr_t H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL herr_t H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
unsigned mesg_flags, unsigned update_flags, void *mesg);
-H5_DLL void *H5O__msg_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL herr_t H5O__msg_free_mesg(H5O_mesg_t *mesg);
-H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type);
+H5_DLL unsigned H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type);
H5_DLL herr_t H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link);
H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
@@ -597,17 +580,15 @@ H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata);
H5_DLL herr_t H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
const H5O_mesg_operator_t *op, void *op_data);
-H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
-H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
+H5_DLL herr_t H5O__flush_msgs(H5F_t *f, H5O_t *oh);
H5_DLL herr_t H5O__delete_mesg(H5F_t *f, H5O_t *open_oh, H5O_mesg_t *mesg);
/* Object header chunk routines */
H5_DLL herr_t H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno);
H5_DLL H5O_chunk_proxy_t *H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx);
-H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy,
- hbool_t chk_dirtied);
+H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied);
H5_DLL herr_t H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx);
-H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy);
+H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy);
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);
@@ -615,20 +596,20 @@ H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy);
H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info);
/* Object header allocation routines */
-H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc);
+H5_DLL herr_t H5O__alloc_msgs(H5O_t *oh, size_t min_alloc);
H5_DLL herr_t H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size,
size_t found_null, const H5O_msg_alloc_info_t *found_msg, size_t *new_idx);
H5_DLL herr_t H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
const void *mesg, size_t *mesg_idx);
-H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh);
-H5_DLL herr_t H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg,
+H5_DLL herr_t H5O__condense_header(H5F_t *f, H5O_t *oh);
+H5_DLL herr_t H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg,
hbool_t adj_link);
/* Shared object operators */
-H5_DLL void * H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
+H5_DLL void * H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const uint8_t *buf, const H5O_msg_class_t *type);
-H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
-H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg);
+H5_DLL herr_t H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
+H5_DLL size_t H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__shared_delete(H5F_t *f, H5O_t *open_oh,
const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__shared_link(H5F_t *f, H5O_t *open_oh,
@@ -640,17 +621,18 @@ H5_DLL herr_t H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
H5_DLL herr_t H5O__shared_post_copy_file (H5F_t *f,
const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src,
H5O_shared_t *shared_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info);
-H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream,
+H5_DLL herr_t H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream,
int indent, int fwidth);
/* Attribute message operators */
H5_DLL herr_t H5O__attr_reset(void *_mesg);
H5_DLL herr_t H5O__attr_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
H5_DLL herr_t H5O__attr_link(H5F_t *f, H5O_t *open_oh, void *_mesg);
-H5_DLL herr_t H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs);
+H5_DLL herr_t H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs);
/* Arrays of versions for:
- Object header, Attribute/Fill value/Filter pipeline messages */
+ * Object header, Attribute/Fill value/Filter pipeline messages
+ */
/* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */
H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS];
H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS];
@@ -659,24 +641,22 @@ H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS];
/* Testing functions */
#ifdef H5O_TESTING
-H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid);
-H5_DLL htri_t H5O_is_attr_dense_test(hid_t oid);
-H5_DLL herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs);
-H5_DLL herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count);
-H5_DLL herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val);
-H5_DLL herr_t H5O_expunge_chunks_test(const H5O_loc_t *oloc);
-H5_DLL herr_t H5O_get_rc(const H5O_loc_t *oloc, unsigned *rc);
-H5_DLL herr_t H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type,
- unsigned *chunk_num);
-H5_DLL herr_t H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type);
+H5_DLL htri_t H5O__is_attr_empty_test(hid_t oid);
+H5_DLL htri_t H5O__is_attr_dense_test(hid_t oid);
+H5_DLL herr_t H5O__num_attrs_test(hid_t oid, hsize_t *nattrs);
+H5_DLL herr_t H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count);
+H5_DLL herr_t H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val);
+H5_DLL herr_t H5O__expunge_chunks_test(const H5O_loc_t *oloc);
+H5_DLL herr_t H5O__get_rc_test(const H5O_loc_t *oloc, unsigned *rc);
+H5_DLL herr_t H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num);
+H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type);
#endif /* H5O_TESTING */
/* Object header debugging routines */
#ifdef H5O_DEBUG
-H5_DLL herr_t H5O_assert(const H5O_t *oh);
+H5_DLL herr_t H5O__assert(const H5O_t *oh);
#endif /* H5O_DEBUG */
-H5_DLL herr_t H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream,
- int indent, int fwidth);
+H5_DLL herr_t H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth);
#endif /* _H5Opkg_H */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index f8154c4..db19503 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -43,6 +43,7 @@ typedef struct H5O_fill_t H5O_fill_t;
#include "H5HGprivate.h" /* Global Heaps */
#include "H5SLprivate.h" /* Skip lists */
#include "H5Tprivate.h" /* Datatype functions */
+#include "H5VLprivate.h"
#include "H5Zprivate.h" /* I/O pipeline filters */
/* Forward references of package typedefs */
@@ -856,6 +857,12 @@ typedef struct {
} u;
} H5O_mesg_operator_t;
+/* Types for object optional VOL operations */
+typedef enum H5VL_object_optional_t {
+ H5VL_OBJECT_GET_COMMENT, /* get object comment */
+ H5VL_OBJECT_GET_INFO, /* get object info */
+ H5VL_OBJECT_SET_COMMENT /* set object comment */
+} H5VL_object_optional_t;
/* Typedef for abstract object creation */
typedef struct {
@@ -875,10 +882,13 @@ H5_DLL H5O_t *H5O__create_ohdr(H5F_t *f, hid_t ocpl_id);
H5_DLL herr_t H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id,
size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out);
H5_DLL herr_t H5O_open(H5O_loc_t *loc);
+H5_DLL void *H5O_open_by_idx(const H5G_loc_t *loc, const char *name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type/*out*/);
+H5_DLL void *H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type/*out*/);
+H5_DLL void *H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type/*out*/);
H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/);
H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust);
-H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags,
- hbool_t pin_all_chunks);
+H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks);
H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc);
H5_DLL herr_t H5O_unpin(H5O_t *oh);
H5_DLL herr_t H5O_dec_rc_by_loc(const H5O_loc_t *loc);
@@ -893,7 +903,7 @@ H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, H5O_hdr_info_t *hdr);
H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, H5O_info_t *oinfo, unsigned fields);
H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type);
H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, struct H5P_genplist_t *oc_plist);
-H5_DLL hid_t H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref);
+H5_DLL void *H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type/*out*/);
H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hsize_t *nlinks);
H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc);
H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh);
@@ -912,10 +922,12 @@ H5_DLL herr_t H5O_msg_write(const H5O_loc_t *loc, unsigned type_id,
unsigned mesg_flags, unsigned update_flags, void *mesg);
H5_DLL herr_t H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id,
unsigned mesg_flags, unsigned update_flags, void *mesg);
+H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg);
H5_DLL void *H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg);
H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native);
H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg);
+H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst);
H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id);
H5_DLL htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id);
@@ -949,9 +961,10 @@ H5_DLL herr_t H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id,
H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags);
/* 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_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr);
+H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr);
/* Object copying routines */
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
@@ -960,6 +973,8 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst
H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref,
H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type,
H5O_copy_t *cpy_info);
+H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name,
+ H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
/* Debugging routines */
H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidth);
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 328ba4b..4fc0488 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -69,6 +69,10 @@
/********************/
/* Local Prototypes */
/********************/
+static void *H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
+ const H5O_shared_t *shared, const H5O_msg_class_t *type);
+static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh,
+ const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust);
/*********************/
@@ -88,14 +92,14 @@
/*-------------------------------------------------------------------------
- * Function: H5O_shared_read
+ * Function: H5O__shared_read
*
- * Purpose: Reads a message referred to by a shared message.
+ * Purpose: Reads a message referred to by a shared message.
*
- * Return: Success: Ptr to message in native format. The message
- * should be freed by calling H5O_msg_reset().
+ * Return: Success: Ptr to message in native format. The message
+ * should be freed by calling H5O_msg_reset().
*
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -104,7 +108,7 @@
*-------------------------------------------------------------------------
*/
static void *
-H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
+H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const H5O_shared_t *shared, const H5O_msg_class_t *type)
{
H5HF_t *fheap = NULL;
@@ -112,7 +116,7 @@ H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
uint8_t mesg_buf[H5O_MESG_BUF_SIZE]; /* Buffer for deserializing messages */
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -194,13 +198,13 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_read() */
+} /* end H5O__shared_read() */
/*-------------------------------------------------------------------------
- * Function: H5O__shared_link_adj
+ * Function: H5O__shared_link_adj
*
- * Purpose: Changes the link count for the object referenced by a shared
+ * Purpose: Changes the link count for the object referenced by a shared
* message.
*
* This function changes the object header link count and is
@@ -209,8 +213,7 @@ done:
* reference count is stored in the file-wide shared message
* index and is changed in a different place in the code.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -294,11 +297,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_shared_decode
+ * Function: H5O__shared_decode
*
- * Purpose: Decodes a shared object message
+ * Purpose: Decodes a shared object message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: A buffer containing the decoded shared object
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Monday, January 22, 2007
@@ -306,14 +310,14 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
+H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
const H5O_msg_class_t *type)
{
H5O_shared_t sh_mesg; /* Shared message info */
unsigned version; /* Shared message version */
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(f);
@@ -373,20 +377,20 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu
sh_mesg.msg_type_id = type->id;
/* Retrieve actual message, through decoded shared message info */
- if(NULL == (ret_value = H5O_shared_read(f, open_oh, ioflags, &sh_mesg, type)))
+ if(NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_decode() */
+} /* end H5O__shared_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_shared_encode
+ * Function: H5O__shared_encode
*
- * Purpose: Encodes message _MESG into buffer BUF.
+ * Purpose: Encodes message _MESG into buffer BUF.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Thursday, April 2, 1998
@@ -394,11 +398,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg)
+H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg)
{
unsigned version;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(f);
@@ -427,15 +431,15 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me
H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_shared_encode() */
+} /* end H5O__shared_encode() */
/*-------------------------------------------------------------------------
- * Function: H5O_set_shared
+ * Function: H5O_set_shared
*
- * Purpose: Sets the shared component for a message.
+ * Purpose: Sets the shared component for a message.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -460,12 +464,12 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
/*-------------------------------------------------------------------------
- * Function: H5O_shared_size
+ * Function: H5O__shared_size
*
- * Purpose: Returns the length of a shared object message.
+ * Purpose: Returns the length of a shared object message.
*
- * Return: Success: Length
- * Failure: 0
+ * Return: Success: Length
+ * Failure: 0
*
* Programmer: Robb Matzke
* Thursday, April 2, 1998
@@ -473,26 +477,26 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
*-------------------------------------------------------------------------
*/
size_t
-H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
+H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
{
size_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) {
- ret_value = (size_t)1 + /*version */
- (size_t)1 + /*the type field */
- (size_t)H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */
+ ret_value = (size_t)1 + /* Version */
+ (size_t)1 + /* Type field */
+ (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */
} /* end if */
else {
HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM);
- ret_value = 1 + /*version */
- 1 + /*the type field */
- H5O_FHEAP_ID_LEN; /* Shared in the heap */
+ ret_value = 1 + /* Version */
+ 1 + /* Type field */
+ H5O_FHEAP_ID_LEN; /* Shared in the heap */
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_size() */
+} /* end H5O__shared_size() */
/*-------------------------------------------------------------------------
@@ -500,7 +504,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
*
* Purpose: Free file space referenced by message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -521,7 +525,7 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
/*
* Committed datatypes increment the OH of the original message when they
- * are written (in H5O__shared_link) and decrement it here.
+ * are written (in H5O_shared_link) and decrement it here.
* SOHMs in the heap behave differently; their refcount is incremented
* during H5SM_share when they are going to be written (in H5O_msg_append
* or H5O_msg_write). Their refcount in the SOHM indexes still needs to
@@ -543,7 +547,7 @@ done:
* Purpose: Increment reference count on any objects referenced by
* message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -558,7 +562,7 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
FUNC_ENTER_PACKAGE
- /* check args */
+ /* Check args */
HDassert(f);
HDassert(sh_mesg);
@@ -576,8 +580,7 @@ done:
*
* Purpose: Copies a message from _MESG to _DEST in file
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* January 22, 2007
@@ -647,7 +650,7 @@ done:
* to complish that is to delete the old message and write the
* new message with the correct values.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* xcao@hdfgroup.org
@@ -696,7 +699,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_shared_debug
+ * Function: H5O__shared_debug
*
* Purpose: Prints debugging info for the message
*
@@ -708,9 +711,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
+H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(mesg);
@@ -756,5 +759,5 @@ H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth)
} /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_shared_debug() */
+} /* end H5O__shared_debug() */
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 2960fef..8040a6a 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -66,7 +66,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
/* Check for shared message */
if(mesg_flags & H5O_MSG_FLAG_SHARED) {
/* Retrieve native message info indirectly through shared message */
- if(NULL == (ret_value = H5O_shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE)))
+ if(NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
/* We currently do not support automatically fixing shared messages */
@@ -129,13 +129,13 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Encode shared message into buffer */
- if(H5O_shared_encode(f, p, sh_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
+ if(H5O__shared_encode(f, p, sh_mesg) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
} /* end if */
else {
/* Encode native message directly */
if(H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message")
} /* end else */
done:
@@ -181,13 +181,13 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg)
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Retrieve encoded size of shared message */
- if(0 == (ret_value = H5O_shared_size(f, sh_mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
+ if(0 == (ret_value = H5O__shared_size(f, sh_mesg)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
} /* end if */
else {
/* Retrieve size of native message directly */
if(0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message")
} /* end else */
done:
@@ -232,13 +232,13 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg)
if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Decrement the reference count on the shared message/object */
if(H5O__shared_delete(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_DELETE_REAL
else {
/* Decrement the reference count on the native message directly */
if(H5O_SHARED_DELETE_REAL(f, open_oh, _mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message")
} /* end else */
#endif /* H5O_SHARED_DELETE_REAL */
@@ -284,13 +284,13 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg)
if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Increment the reference count on the shared message/object */
if(H5O__shared_link(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_LINK_REAL
else {
/* Increment the reference count on the native message directly */
if(H5O_SHARED_LINK_REAL(f, open_oh, _mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message")
} /* end else */
#endif /* H5O_SHARED_LINK_REAL */
@@ -473,7 +473,7 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent,
/* Check for message stored elsewhere */
if(H5O_IS_STORED_SHARED(sh_mesg->type)) {
/* Print shared message information */
- if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0)
+ if(H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info")
} /* end if */
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 87fb771..0f14a4b 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -37,9 +37,9 @@
/* PRIVATE PROTOTYPES */
static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags,
unsigned *ioflags, size_t p_size, const uint8_t *p);
-static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
-static void *H5O_stab_copy(const void *_mesg, void *_dest);
-static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
+static herr_t H5O__stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
+static void *H5O__stab_copy(const void *_mesg, void *_dest);
+static size_t H5O__stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O__stab_free(void *_mesg);
static herr_t H5O__stab_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
static void *H5O__stab_copy_file(H5F_t *file_src, void *native_src,
@@ -58,9 +58,9 @@ const H5O_msg_class_t H5O_MSG_STAB[1] = {{
sizeof(H5O_stab_t), /*native message size */
0, /* messages are sharable? */
H5O__stab_decode, /*decode message */
- H5O_stab_encode, /*encode message */
- H5O_stab_copy, /*copy the native value */
- H5O_stab_size, /*size of symbol table entry */
+ H5O__stab_encode, /*encode message */
+ H5O__stab_copy, /*copy the native value */
+ H5O__stab_size, /*size of symbol table entry */
NULL, /*default reset method */
H5O__stab_free, /* free method */
H5O__stab_delete, /* file delete method */
@@ -111,7 +111,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* decode */
if(NULL == (stab = H5FL_CALLOC(H5O_stab_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
H5F_addr_decode(f, &p, &(stab->btree_addr));
H5F_addr_decode(f, &p, &(stab->heap_addr));
@@ -129,7 +129,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_stab_encode
+ * Function: H5O__stab_encode
*
* Purpose: Encodes a symbol table message.
*
@@ -142,11 +142,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@@ -158,11 +158,11 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
H5F_addr_encode(f, &p, stab->heap_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
-}
+} /* end H5O__stab_encode() */
/*-------------------------------------------------------------------------
- * Function: H5O_stab_copy
+ * Function: H5O__stab_copy
*
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
* necessary.
@@ -178,18 +178,18 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
*-------------------------------------------------------------------------
*/
static void *
-H5O_stab_copy(const void *_mesg, void *_dest)
+H5O__stab_copy(const void *_mesg, void *_dest)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
H5O_stab_t *dest = (H5O_stab_t *) _dest;
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(stab);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
/* copy */
*dest = *stab;
@@ -199,11 +199,11 @@ H5O_stab_copy(const void *_mesg, void *_dest)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_stab_copy() */
+} /* end H5O__stab_copy() */
/*-------------------------------------------------------------------------
- * Function: H5O_stab_size
+ * Function: H5O__stab_size
*
* Purpose: Returns the size of the raw message in bytes not counting
* the message type or size fields, but only the data fields.
@@ -220,17 +220,17 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
+H5O__stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg)
{
size_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Set return value */
ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f));
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_stab_size() */
+} /* end H5O__stab_size() */
/*-------------------------------------------------------------------------
@@ -327,14 +327,14 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
/* Get the old local heap's size and use that as the hint for the new heap */
if(H5HL_get_size(file_src, stab_src->heap_addr, &size_hint) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
/* Set copy metadata tag */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Create components of symbol table message */
if(H5G__stab_create_components(file_dst, stab_dst, size_hint) < 0)
- HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components")
+ HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components")
/* Reset metadata tag */
H5_END_TAG
diff --git a/src/H5Otest.c b/src/H5Otest.c
index 32b31f2..df08ff7 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -75,11 +75,11 @@
/*--------------------------------------------------------------------------
NAME
- H5O_is_attr_dense_test
+ H5O__is_attr_dense_test
PURPOSE
Determine whether attributes for an object are stored "densely"
USAGE
- htri_t H5O_is_attr_dense_test(oid)
+ htri_t H5O__is_attr_dense_test(oid)
hid_t oid; IN: object to check
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
@@ -93,7 +93,7 @@
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5O_is_attr_dense_test(hid_t oid)
+H5O__is_attr_dense_test(hid_t oid)
{
H5O_t *oh = NULL; /* Object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
@@ -101,7 +101,7 @@ H5O_is_attr_dense_test(hid_t oid)
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location for object */
if(NULL == (loc = H5O_get_loc(oid)))
@@ -114,7 +114,7 @@ H5O_is_attr_dense_test(hid_t oid)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -127,7 +127,7 @@ H5O_is_attr_dense_test(hid_t oid)
/* Check if dense storage is being used */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Check for any messages in object header */
- HDassert(H5O_msg_count_real(oh, H5O_MSG_ATTR) == 0);
+ HDassert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0);
ret_value = TRUE;
} /* end if */
@@ -136,21 +136,21 @@ H5O_is_attr_dense_test(hid_t oid)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_is_attr_dense_test() */
+} /* H5O__is_attr_dense_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_is_attr_empty_test
+ H5O__is_attr_empty_test
PURPOSE
Determine whether there are any attributes for an object
USAGE
- htri_t H5O_is_attr_empty_test(oid)
+ htri_t H5O__is_attr_empty_test(oid)
hid_t oid; IN: object to check
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
@@ -163,7 +163,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5O_is_attr_empty_test(hid_t oid)
+H5O__is_attr_empty_test(hid_t oid)
{
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
@@ -174,7 +174,7 @@ H5O_is_attr_empty_test(hid_t oid)
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location for object */
if(NULL == (loc = H5O_get_loc(oid)))
@@ -187,7 +187,7 @@ H5O_is_attr_empty_test(hid_t oid)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
if(oh->version > H5O_VERSION_1) {
@@ -197,7 +197,7 @@ H5O_is_attr_empty_test(hid_t oid)
} /* end if */
/* Retrieve the number of attribute messages in header */
- nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR);
+ nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR);
/* Check for later version of object header format & attribute info available */
if(oh->version > H5O_VERSION_1) {
@@ -237,21 +237,21 @@ done:
if(bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_is_attr_empty_test() */
+} /* H5O__is_attr_empty_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_num_attrs_test
+ H5O__num_attrs_test
PURPOSE
Determine whether there are any attributes for an object
USAGE
- herr_t H5O_num_attrs_test(oid, nattrs)
+ herr_t H5O__num_attrs_test(oid, nattrs)
hid_t oid; IN: object to check
hsize_t *nattrs; OUT: Number of attributes on object
RETURNS
@@ -265,7 +265,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
+H5O__num_attrs_test(hid_t oid, hsize_t *nattrs)
{
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
@@ -275,7 +275,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location for object */
if(NULL == (loc = H5O_get_loc(oid)))
@@ -288,7 +288,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -299,7 +299,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
} /* end if */
/* Retrieve the number of attribute messages in header */
- obj_nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR);
+ obj_nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR);
/* Check for later version of object header format */
if(oh->version > H5O_VERSION_1) {
@@ -335,21 +335,21 @@ done:
if(bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_num_attrs_test() */
+} /* H5O__num_attrs_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_attr_dense_info_test
+ H5O__attr_dense_info_test
PURPOSE
Retrieve information about the state of the "dense" storage for attributes
USAGE
- herr_t H5O_attr_dense_info_test(oid, name_count, corder_count)
+ herr_t H5O__attr_dense_info_test(oid, name_count, corder_count)
hid_t oid; IN: Object to check
hsize_t *name_count; OUT: Number of attributes in name index
hsize_t *corder_count; OUT: Number of attributes in creation order index
@@ -365,7 +365,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
+H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
{
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
@@ -375,7 +375,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location for object */
if(NULL == (loc = H5O_get_loc(oid)))
@@ -391,7 +391,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -438,22 +438,22 @@ done:
if(bt2_corder && H5B2_close(bt2_corder) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_attr_dense_info_test() */
+} /* H5O__attr_dense_info_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_check_msg_marked_test
+ H5O__check_msg_marked_test
PURPOSE
Check if an unknown message with the "mark if unknown" flag actually gets
marked.
USAGE
- herr_t H5O_check_msg_marked_test(oid, flag_val)
+ herr_t H5O__check_msg_marked_test(oid, flag_val)
hid_t oid; IN: Object to check
hbool_t flag_val; IN: Desired flag value
RETURNS
@@ -468,7 +468,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
+H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val)
{
H5O_t *oh = NULL; /* Object header */
H5O_loc_t *loc; /* Pointer to object's location */
@@ -476,7 +476,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
unsigned idx; /* Index of message */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location for object */
if(NULL == (loc = H5O_get_loc(oid)))
@@ -484,11 +484,11 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Locate "unknown" message */
for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++)
- if(idx_msg->type->id == H5O_UNKNOWN_ID) {
+ if(idx_msg->type->id == H5O_UNKNOWN_ID) {
/* Check for "unknown" message having the correct flags */
if(((idx_msg->flags & H5O_MSG_FLAG_WAS_UNKNOWN) > 0) != flag_val)
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "'unknown' message has incorrect 'was unknown' flag value")
@@ -503,15 +503,15 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_check_msg_marked_test() */
+} /* H5O__check_msg_marked_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_expunge_chunks_test
+ H5O__expunge_chunks_test
PURPOSE
Expunge all the chunks for an object header from the cache.
USAGE
@@ -529,7 +529,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5O_expunge_chunks_test(const H5O_loc_t *loc)
+H5O__expunge_chunks_test(const H5O_loc_t *loc)
{
H5O_t *oh = NULL; /* Object header */
haddr_t chk_addr[16]; /* Array of chunk addresses */
@@ -537,11 +537,11 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc)
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Safety check */
nchunks = oh->nchunks;
@@ -553,7 +553,7 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc)
/* Release the object header */
if(H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header")
/* Iterate over all the saved chunk addresses, evicting them from the cache */
/* (in reverse order, so that chunk #0 is unpinned) */
@@ -563,16 +563,16 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_expunge_chunks_test() */
+} /* H5O__expunge_chunks_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_get_rc
+ H5O__get_rc_test
PURPOSE
Retrieve the refcount for the object header
USAGE
- herr_t H5O_expunge_chunks_test(loc, rc)
+ herr_t H5O__get_rc_test(loc, rc)
const H5O_loc_t *loc; IN: Object location for object header to query
unsigned *rc; OUT: Pointer to refcount for object header
RETURNS
@@ -587,12 +587,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5O_get_rc(const H5O_loc_t *loc, unsigned *rc)
+H5O__get_rc_test(const H5O_loc_t *loc, unsigned *rc)
{
H5O_t *oh = NULL; /* Object header */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(loc);
@@ -600,7 +600,7 @@ H5O_get_rc(const H5O_loc_t *loc, unsigned *rc)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Save the refcount for the object header */
*rc = oh->nlink;
@@ -608,19 +608,19 @@ H5O_get_rc(const H5O_loc_t *loc, unsigned *rc)
done:
/* Release the object header */
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_expunge_chunks_test() */
+} /* H5O__get_rc_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_msg_get_chunkno_test
+ H5O__msg_get_chunkno_test
PURPOSE
Retrieve the chunk number for an object header message of a given type.
USAGE
- herr_t H5O_check_msg_marked_test(oid, chunk_num)
+ herr_t H5O__msg_get_chunkno_test(oid, msg_type, chunk_num)
hid_t oid; IN: Object to check
unsigned msg_type; IN: Object header message type to check
unsigned *chunk_num; OUT: Object header chunk that the message is in
@@ -636,7 +636,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num)
+H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num)
{
H5O_t *oh = NULL; /* Object header */
H5O_loc_t *loc; /* Pointer to object's location */
@@ -645,7 +645,7 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num)
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location for object */
if(NULL == (loc = H5O_get_loc(oid)))
@@ -658,11 +658,11 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Locate first message of given type */
for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++)
- if(idx_msg->type->id == msg_type) {
+ if(idx_msg->type->id == msg_type) {
/* Set the chunk number for the message */
*chunk_num = idx_msg->chunkno;
@@ -676,21 +676,21 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_msg_get_chunkno_test() */
+} /* H5O__msg_get_chunkno_test() */
/*--------------------------------------------------------------------------
NAME
- H5O_msg_move_to_new_chunk_test
+ H5O__msg_move_to_new_chunk_test
PURPOSE
Move a message into a new chunk
USAGE
- herr_t H5O_msg_move_to_new_chunk_test(oid, msg_type)
+ herr_t H5O__msg_move_to_new_chunk_test(oid, msg_type)
hid_t oid; IN: Object to check
unsigned msg_type; IN: Object header message type to check
RETURNS
@@ -704,7 +704,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type)
+H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type)
{
H5O_t *oh = NULL; /* Object header */
H5O_loc_t *loc; /* Pointer to object's location */
@@ -713,7 +713,7 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type)
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Get object location for object */
if(NULL == (loc = H5O_get_loc(oid)))
@@ -726,11 +726,11 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type)
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Locate first message of given type */
for(idx = 0, curr_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, curr_msg++)
- if(curr_msg->type->id == msg_type) {
+ if(curr_msg->type->id == msg_type) {
H5O_msg_alloc_info_t found_msg; /* Information about message to move */
unsigned msg_chunkno = curr_msg->chunkno; /* Chunk that the message is in */
uint8_t *end_chunk_data = (oh->chunk[msg_chunkno].image + oh->chunk[msg_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[msg_chunkno].gap); /* End of message data in chunk */
@@ -784,10 +784,10 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_msg_get_chunkno_test() */
+} /* H5O__msg_get_chunkno_test() */
diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c
index dbab28c..89c00ad 100644
--- a/src/H5Ounknown.c
+++ b/src/H5Ounknown.c
@@ -63,11 +63,11 @@ H5FL_DEFINE(H5O_unknown_t);
/*-------------------------------------------------------------------------
- * Function: H5O__unknown_free
+ * Function: H5O__unknown_free
*
- * Purpose: Frees the message
+ * Purpose: Frees the message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, May 1, 2007
diff --git a/src/H5P.c b/src/H5P.c
index 733af42..72d7ae8 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -82,7 +82,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
hid_t id; IN: Property list or class ID to copy
RETURNS
Success: valid property list ID on success (non-negative)
- Failure: negative
+ Failure: H5I_INVALID_HID (negative)
DESCRIPTION
Copy a property list or class and return the ID. This routine calls the
class 'copy' callback after any property 'copy' callbacks are called
@@ -97,37 +97,37 @@ hid_t
H5Pcopy(hid_t id)
{
void *obj; /* Property object to copy */
- hid_t ret_value=FALSE; /* return value */
+ hid_t ret_value = H5I_INVALID_HID; /* return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", id);
- if(H5P_DEFAULT==id)
+ if(H5P_DEFAULT == id)
HGOTO_DONE(H5P_DEFAULT);
/* Check arguments. */
if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property object");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not property object");
if(NULL == (obj = H5I_object(id)))
- HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist");
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "property object doesn't exist");
/* Compare property lists */
if(H5I_GENPROP_LST == H5I_get_type(id)) {
if((ret_value = H5P_copy_plist((H5P_genplist_t *)obj, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list");
} /* end if */
/* Must be property classes */
else {
H5P_genclass_t *copy_class; /* Copy of class */
/* Copy the class */
- if((copy_class = H5P_copy_pclass((H5P_genclass_t *)obj)) == NULL)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property class");
+ if((copy_class = H5P__copy_pclass((H5P_genclass_t *)obj)) == NULL)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property class");
/* Get an atom for the copied class */
if((ret_value = H5I_register(H5I_GENPROP_CLS, copy_class, TRUE)) < 0) {
- H5P_close_class(copy_class);
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class");
+ H5P__close_class(copy_class);
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class");
} /* end if */
} /* end else */
@@ -162,7 +162,7 @@ done:
void *close_data; IN: Pointer to user data to pass along to class
close callback.
RETURNS
- Returns a valid property list class ID on success, NULL on failure.
+ Returns a valid property list class ID on success, H5I_INVALID_HID on failure.
DESCRIPTION
Allocates memory and attaches a class to the property list class hierarchy.
GLOBAL VARIABLES
@@ -179,39 +179,39 @@ H5Pcreate_class(hid_t parent, const char *name,
{
H5P_genclass_t *par_class = NULL; /* Pointer to the parent class */
H5P_genclass_t *pclass = NULL; /* Property list class created */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE8("i", "i*sx*xx*xx*x", parent, name, cls_create, create_data, cls_copy,
copy_data, cls_close, close_data);
/* Check arguments. */
if(H5P_DEFAULT!=parent && (H5I_GENPROP_CLS!=H5I_get_type(parent)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid class name")
if((create_data != NULL && cls_create == NULL)
|| (copy_data != NULL && cls_copy == NULL)
|| (close_data != NULL && cls_close == NULL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data specified, but no callback provided")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "data specified, but no callback provided")
/* Get the pointer to the parent class */
if(parent == H5P_DEFAULT)
par_class = NULL;
else if(NULL == (par_class = (H5P_genclass_t *)H5I_object(parent)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve parent class")
/* Create the new property list class */
- if(NULL == (pclass = H5P_create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class")
+ if(NULL == (pclass = H5P__create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list class")
/* Get an atom for the class */
if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class")
done:
- if(ret_value < 0 && pclass)
- H5P_close_class(pclass);
+ if(H5I_INVALID_HID == ret_value && pclass)
+ H5P__close_class(pclass);
FUNC_LEAVE_API(ret_value)
} /* H5Pcreate_class() */
@@ -226,7 +226,7 @@ done:
hid_t H5Pcreate(cls_id)
hid_t cls_id; IN: Property list class create list from
RETURNS
- Returns a valid property list ID on success, FAIL on failure.
+ Returns a valid property list ID on success, H5I_INVALID_HID on failure.
DESCRIPTION
Creates a property list of a given class. If a 'create' callback
exists for the property list class, it is called before the
@@ -243,18 +243,18 @@ hid_t
H5Pcreate(hid_t cls_id)
{
H5P_genclass_t *pclass; /* Property list class to modify */
- hid_t ret_value; /* return value */
+ hid_t ret_value = H5I_INVALID_HID; /* return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", cls_id);
/* Check arguments. */
if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class");
/* Create the new property list */
if((ret_value = H5P_create_id(pclass, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list");
done:
FUNC_LEAVE_API(ret_value)
@@ -440,7 +440,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value,
/* Create the new property list class */
orig_pclass = pclass;
- if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0)
+ if((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class")
/* Check if the property class changed and needs to be substituted in the ID */
@@ -453,7 +453,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value,
HDassert(old_pclass == orig_pclass);
/* Close the previous class */
- if(H5P_close_class(old_pclass) < 0)
+ if(H5P__close_class(old_pclass) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution")
} /* end if */
@@ -738,7 +738,7 @@ H5Pexist(hid_t id, const char *name)
if(H5I_GENPROP_CLS == H5I_get_type(id)) {
if(NULL == (pclass = (H5P_genclass_t *)H5I_object(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class");
- if((ret_value = H5P_exist_pclass(pclass, name)) < 0)
+ if((ret_value = H5P__exist_pclass(pclass, name)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property does not exist in class");
} /* end if */
else
@@ -795,7 +795,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Check the property size */
- if((ret_value = H5P_get_size_plist(plist, name, size)) < 0)
+ if((ret_value = H5P__get_size_plist(plist, name, size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist");
} /* end if */
else
@@ -804,7 +804,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Check the property size */
- if((ret_value = H5P_get_size_pclass(pclass, name, size)) < 0)
+ if((ret_value = H5P__get_size_pclass(pclass, name, size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist");
} /* end if */
else
@@ -867,8 +867,8 @@ done:
hid_t H5Pdecode(buf)
void *buf; IN: buffer that holds the encoded plist
RETURNS
- Returns non-negative ID of new property list object on success, negative
- on failure.
+ Success: ID of new property list object
+ Failure: H5I_INVALID_HID (negative)
DESCRIPTION
Decodes a property list from a binary buffer. The contents of the buffer
contain the values for the correponding properties of the plist. The decode
@@ -884,14 +884,14 @@ done:
hid_t
H5Pdecode(const void *buf)
{
- hid_t ret_value = SUCCEED; /* return value */
+ hid_t ret_value = H5I_INVALID_HID; /* return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*x", buf);
/* Call the internal decode routine */
if((ret_value = H5P__decode(buf)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "unable to decode property list");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, H5I_INVALID_HID, "unable to decode property list");
done:
FUNC_LEAVE_API(ret_value)
@@ -908,7 +908,7 @@ done:
hid_t plist_id; IN: Property list to query
RETURNS
Success: ID of class object
- Failure: negative
+ Failure: H5I_INVALID_HID (negative)
DESCRIPTION
This routine retrieves the class of a property list.
@@ -923,30 +923,30 @@ H5Pget_class(hid_t plist_id)
{
H5P_genplist_t *plist; /* Property list to query */
H5P_genclass_t *pclass=NULL; /* Property list class */
- hid_t ret_value=FAIL; /* return value */
+ hid_t ret_value = H5I_INVALID_HID; /* return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", plist_id);
/* 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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list");
/* Retrieve the property list class */
if((pclass = H5P_get_class(plist)) == NULL)
- HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list");
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list");
/* Increment the outstanding references to the class object */
- if(H5P_access_class(pclass, H5P_MOD_INC_REF) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count");
+ if(H5P__access_class(pclass, H5P_MOD_INC_REF) < 0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID,"Can't increment class ID ref count");
/* Get an atom for the class */
if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class");
done:
- if(ret_value<0 && pclass)
- H5P_close_class(pclass);
+ if(H5I_INVALID_HID == ret_value && pclass)
+ H5P__close_class(pclass);
FUNC_LEAVE_API(ret_value)
} /* H5Pget_class() */
@@ -994,7 +994,7 @@ H5Pget_nprops(hid_t id, size_t *nprops)
if(H5I_GENPROP_LST == H5I_get_type(id)) {
if(NULL == (plist = (H5P_genplist_t *)H5I_object(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
- if(H5P_get_nprops_plist(plist, nprops) < 0)
+ if(H5P__get_nprops_plist(plist, nprops) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query # of properties in plist");
} /* end if */
else
@@ -1054,7 +1054,7 @@ H5Pequal(hid_t id1, hid_t id2)
if(H5I_GENPROP_LST == H5I_get_type(id1)) {
int cmp_ret = 0;
- if(H5P_cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0)
+ if(H5P__cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOMPARE, FAIL, "can't compare property lists")
/* Set return value */
@@ -1062,7 +1062,7 @@ H5Pequal(hid_t id1, hid_t id2)
} /* end if */
/* Must be property classes */
else {
- if(H5P_cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0)
+ if(H5P__cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0)
ret_value = TRUE;
} /* end else */
@@ -1236,13 +1236,13 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
if(H5I_GENPROP_LST == H5I_get_type(id)) {
/* Iterate over a property list */
- if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
+ if((ret_value = H5P__iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list");
} /* end if */
else
if(H5I_GENPROP_CLS == H5I_get_type(id)) {
/* Iterate over a property class */
- if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
+ if((ret_value = H5P__iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class");
} /* end if */
else
@@ -1419,12 +1419,12 @@ H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name)
/* Compare property lists */
if(H5I_GENPROP_LST == src_id_type) {
- if(H5P_copy_prop_plist(dst_id, src_id, name) < 0)
+ if(H5P__copy_prop_plist(dst_id, src_id, name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between lists")
} /* end if */
/* Must be property classes */
else {
- if(H5P_copy_prop_pclass(dst_id, src_id, name) < 0)
+ if(H5P__copy_prop_pclass(dst_id, src_id, name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes")
} /* end else */
@@ -1470,7 +1470,7 @@ H5Punregister(hid_t pclass_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name");
/* Remove the property list from class */
- if((ret_value = H5P_unregister(pclass, name)) < 0)
+ if((ret_value = H5P__unregister(pclass, name)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to remove property from class");
done:
@@ -1575,7 +1575,7 @@ done:
hid_t pclass_id; IN: Property class to query
RETURNS
Success: ID of parent class object
- Failure: NULL
+ Failure: H5I_INVALID_HID (negative)
DESCRIPTION
This routine retrieves an ID for the parent class of a property class.
@@ -1589,30 +1589,30 @@ H5Pget_class_parent(hid_t pclass_id)
{
H5P_genclass_t *pclass; /* Property class to query */
H5P_genclass_t *parent = NULL; /* Parent's property class */
- hid_t ret_value; /* return value */
+ hid_t ret_value = H5I_INVALID_HID; /* return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", pclass_id);
/* Check arguments. */
if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property class")
/* Retrieve the property class's parent */
- if(NULL == (parent = H5P_get_class_parent(pclass)))
- HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list")
+ if(NULL == (parent = H5P__get_class_parent(pclass)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list")
/* Increment the outstanding references to the class object */
- if(H5P_access_class(parent, H5P_MOD_INC_REF) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count")
+ if(H5P__access_class(parent, H5P_MOD_INC_REF) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID,"Can't increment class ID ref count")
/* Get an atom for the class */
if((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class")
done:
- if(ret_value < 0 && parent)
- H5P_close_class(parent);
+ if(H5I_INVALID_HID == ret_value && parent)
+ H5P__close_class(parent);
FUNC_LEAVE_API(ret_value)
} /* H5Pget_class_parent() */
diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h
index aef87e1..b94b845 100644
--- a/src/H5PBprivate.h
+++ b/src/H5PBprivate.h
@@ -91,10 +91,8 @@ H5_DLL herr_t H5PB_dest(H5F_t *f);
H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr);
H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf);
H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr);
-H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- void *buf/*out*/);
-H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- const void *buf);
+H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/);
+H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf);
/* Statistics routines */
H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf);
diff --git a/src/H5PLint.c b/src/H5PLint.c
index b190746..bbe71fe 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -235,7 +235,7 @@ done:
*-------------------------------------------------------------------------
*/
const void *
-H5PL_load(H5PL_type_t type, H5PL_key_t key)
+H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
{
H5PL_search_params_t search_params; /* Plugin search parameters */
hbool_t found = FALSE; /* Whether the plugin was found */
@@ -250,6 +250,10 @@ H5PL_load(H5PL_type_t type, 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_ERROR:
case H5PL_TYPE_NONE:
default:
@@ -258,7 +262,7 @@ H5PL_load(H5PL_type_t type, H5PL_key_t key)
/* Set up the search parameters */
search_params.type = type;
- search_params.key.id = key.id;
+ search_params.key.id = key->id;
/* Search in the table of already loaded plugin libraries */
if(H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0)
@@ -303,7 +307,8 @@ done:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
herr_t
-H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info)
+H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key,
+ hbool_t *success, const void **plugin_info)
{
H5PL_HANDLE handle = NULL;
H5PL_get_plugin_info_t get_plugin_info = NULL;
@@ -345,13 +350,44 @@ H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success,
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin")
/* If the filter IDs match, we're done. Set the output parameters. */
- if (filter_info->id == key.id) {
+ if (filter_info->id == key->id) {
*plugin_info = (const void *)filter_info;
*success = TRUE;
}
break;
}
+
+ case H5PL_TYPE_VOL:
+ {
+ const H5VL_class_t *cls;
+
+ /* Get the plugin info */
+ if(NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)()))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL driver info from plugin")
+
+ /* Which kind of key are we looking for? */
+ if(key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
+ /* If the plugin names match, we're done. Set the output parameters. */
+ if(cls->name && !HDstrcmp(cls->name, key->vol.u.name)) {
+ *plugin_info = (const void *)cls;
+ *success = TRUE;
+ } /* end if */
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE);
+
+ /* If the plugin values match, we're done. Set the output parameters. */
+ if(cls->value == key->vol.u.value) {
+ *plugin_info = (const void *)cls;
+ *success = TRUE;
+ } /* end if */
+ } /* end else */
+
+ break;
+ }
+
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index 972f1d0..d53007b 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -689,7 +689,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
@@ -755,7 +755,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h
index dfaa4af..d60da82 100644
--- a/src/H5PLpkg.h
+++ b/src/H5PLpkg.h
@@ -134,13 +134,15 @@ H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask /*out*/);
H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask);
/* Plugin search and manipulation */
-H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, H5PL_key_t key, hbool_t *success /*out*/, const void **plugin_info /*out*/);
+H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key,
+ hbool_t *success /*out*/, const void **plugin_info /*out*/);
H5_DLL herr_t H5PL__close(H5PL_HANDLE handle);
/* Plugin cache calls */
H5_DLL herr_t H5PL__create_plugin_cache(void);
H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed /*out*/);
-H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle);
+H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key,
+ H5PL_HANDLE handle);
H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/);
/* Plugin search path calls */
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index e905ac2..7fe676d 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -216,7 +216,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle)
+H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, H5PL_HANDLE handle)
{
herr_t ret_value = SUCCEED;
@@ -229,7 +229,7 @@ H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle)
/* Store the plugin info and bump the # of plugins */
H5PL_cache_g[H5PL_num_plugins_g].type = type;
- H5PL_cache_g[H5PL_num_plugins_g].key = key;
+ H5PL_cache_g[H5PL_num_plugins_g].key = *key;
H5PL_cache_g[H5PL_num_plugins_g].handle = handle;
H5PL_num_plugins_g++;
diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h
index cc2e258..5ce9b87 100644
--- a/src/H5PLprivate.h
+++ b/src/H5PLprivate.h
@@ -21,7 +21,8 @@
#include "H5PLpublic.h"
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/**************************/
@@ -35,7 +36,14 @@
/* The key that will be used to find the plugin */
typedef union H5PL_key_t {
- int id; /* filters */
+ 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;
} H5PL_key_t;
@@ -49,7 +57,7 @@ typedef union H5PL_key_t {
/***************************************/
/* Internal API routines */
-H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, H5PL_key_t key);
+H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, const H5PL_key_t *key);
#endif /* _H5PLprivate_H */
diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h
index fe5bdfb..8e022cc 100644
--- a/src/H5PLpublic.h
+++ b/src/H5PLpublic.h
@@ -32,11 +32,13 @@
typedef enum H5PL_type_t {
H5PL_TYPE_ERROR = -1, /* Error */
H5PL_TYPE_FILTER = 0, /* Filter */
- H5PL_TYPE_NONE = 1 /* This must be last! */
+ H5PL_TYPE_VOL = 1, /* VOL driver */
+ H5PL_TYPE_NONE = 2 /* This must be last! */
} H5PL_type_t;
/* 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_ALL_PLUGIN 0xFFFF
#ifdef __cplusplus
diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c
index 4368dd6..2322c76 100644
--- a/src/H5Pacpl.c
+++ b/src/H5Pacpl.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Pacpl.c
- * January 2 2006
- * James Laird <jlaird@ncsa.uiuc.edu>
+ * Created: H5Pacpl.c
*
- * Purpose: Attribute creation property list class routines
+ * Purpose: Attribute creation property list class routines
*
*-------------------------------------------------------------------------
*/
@@ -32,15 +30,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Ppkg.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Ppkg.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
+/* Definitions for locations parameters */
+#define H5A_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t)
+#define H5A_CRT_LOCATION_DEF H5I_BADID
+
/******************/
/* Local Typedefs */
@@ -56,6 +59,9 @@
/* Local Prototypes */
/********************/
+/* Property class callbacks */
+static herr_t H5P_acrt_reg_prop(H5P_genclass_t *pclass);
+
/*********************/
/* Package Variables */
@@ -63,21 +69,21 @@
/* Attribute creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_ACRT[1] = {{
- "attribute create", /* Class name for debugging */
- H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */
-
- &H5P_CLS_STRING_CREATE_g, /* Parent class */
- &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */
- &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */
- &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */
- NULL, /* Default property registration routine */
-
- NULL, /* Class creation callback */
- NULL, /* Class creation callback info */
- NULL, /* Class copy callback */
- NULL, /* Class copy callback info */
- NULL, /* Class close callback */
- NULL /* Class close callback info */
+ "attribute create", /* Class name for debugging */
+ H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */
+
+ &H5P_CLS_STRING_CREATE_g, /* Parent class */
+ &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */
+ &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */
+ &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */
+ H5P_acrt_reg_prop, /* Default property registration routine */
+
+ NULL, /* Class creation callback */
+ NULL, /* Class creation callback info */
+ NULL, /* Class copy callback */
+ NULL, /* Class copy callback info */
+ NULL, /* Class close callback */
+ NULL /* Class close callback info */
}};
@@ -85,4 +91,44 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{
/* Library Private Variables */
/*****************************/
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_acrt_reg_prop
+ *
+ * Purpose: Register the attribute creation property list class's properties
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P_acrt_reg_prop(H5P_genclass_t *pclass)
+{
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Register the type ID property*/
+ if(H5P__register_real(pclass, H5VL_PROP_ATTR_TYPE_ID, sizeof(hid_t), &type_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the space ID property */
+ if(H5P__register_real(pclass, H5VL_PROP_ATTR_SPACE_ID, sizeof(hid_t), &space_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the lcpl ID property */
+ HDmemset(&loc_params, 0, sizeof(H5VL_loc_params_t));
+ loc_params.obj_type = H5A_CRT_LOCATION_DEF;
+ if(H5P__register_real(pclass, H5VL_PROP_ATTR_LOC_PARAMS, H5A_CRT_LOCATION_SIZE, &loc_params,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_acrt_reg_prop() */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index da06297..00e598f 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -204,46 +204,46 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register the size of raw data chunk cache (elements) */
- if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots,
+ if(H5P__register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots,
NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
- if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,
+ if(H5P__register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,
NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
- if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,
+ if(H5P__register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,
NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the VDS view option */
- if(H5P_register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view,
+ if(H5P__register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view,
NULL, NULL, NULL, H5D_ACS_VDS_VIEW_ENC, H5D_ACS_VDS_VIEW_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the VDS printf gap */
- if(H5P_register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &printf_gap,
+ if(H5P__register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &printf_gap,
NULL, NULL, NULL, H5D_ACS_VDS_PRINTF_GAP_ENC, H5D_ACS_VDS_PRINTF_GAP_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for vds prefix */
- if(H5P_register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g,
+ if(H5P__register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g,
NULL, H5D_ACS_VDS_PREFIX_SET, H5D_ACS_VDS_PREFIX_GET, H5D_ACS_VDS_PREFIX_ENC, H5D_ACS_VDS_PREFIX_DEC,
H5D_ACS_VDS_PREFIX_DEL, H5D_ACS_VDS_PREFIX_COPY, H5D_ACS_VDS_PREFIX_CMP, H5D_ACS_VDS_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register info for append flush */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g,
+ if(H5P__register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external file prefix */
- if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g,
+ if(H5P__register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g,
NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC,
H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index a1799ad..adb63c7 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Pdcpl.c
- * February 26 1998
- * Robb Matzke <matzke@llnl.gov>
+ * Created: H5Pdcpl.c
*
- * Purpose: Dataset creation property list class routines
+ * Purpose: Dataset creation property list class routines
*
*-------------------------------------------------------------------------
*/
@@ -33,19 +31,19 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Ppkg.h" /* Property lists */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5Tprivate.h" /* Datatypes */
-#include "H5VMprivate.h" /* Vectors and arrays */
-#include "H5Zprivate.h" /* Data filters */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Ppkg.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5Zprivate.h" /* Data filters */
/****************/
@@ -248,36 +246,39 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE;
static herr_t
H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register the storage layout property */
- if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g,
+ if(H5P__register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g,
NULL, H5D_CRT_LAYOUT_SET, H5D_CRT_LAYOUT_GET, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC,
H5D_CRT_LAYOUT_DEL, H5D_CRT_LAYOUT_COPY, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the fill value property */
- if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g,
+ if(H5P__register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g,
NULL, H5D_CRT_FILL_VALUE_SET, H5D_CRT_FILL_VALUE_GET, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC,
H5D_CRT_FILL_VALUE_DEL, H5D_CRT_FILL_VALUE_COPY, H5D_CRT_FILL_VALUE_CMP, H5D_CRT_FILL_VALUE_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the space allocation time state property */
- if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g,
+ if(H5P__register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g,
NULL, NULL, NULL, H5D_CRT_ALLOC_TIME_STATE_ENC, H5D_CRT_ALLOC_TIME_STATE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the external file list property */
- if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g,
+ if(H5P__register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g,
NULL, H5D_CRT_EXT_FILE_LIST_SET, H5D_CRT_EXT_FILE_LIST_GET, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC,
H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the object header minimization property */
- if (0 > H5P_register_real(
+ if (0 > H5P__register_real(
pclass, /* class */
H5D_CRT_MIN_DSET_HDR_SIZE_NAME, /* name */
H5D_CRT_MIN_DSET_HDR_SIZE_SIZE, /* size */
@@ -296,6 +297,21 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
"can't insert property into class")
}
+ /* Register the type ID property*/
+ if(H5P__register_real(pclass, H5VL_PROP_DSET_TYPE_ID, sizeof(hid_t), &type_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the space ID property */
+ if(H5P__register_real(pclass, H5VL_PROP_DSET_SPACE_ID, sizeof(hid_t), &space_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the lcpl ID property */
+ if(H5P__register_real(pclass, H5VL_PROP_DSET_LCPL_ID, sizeof(hid_t), &lcpl_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_reg_prop() */
@@ -3232,10 +3248,10 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
H5T_path_t *tpath; /* Conversion information */
/* Retrieve pointer to datatype */
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- /* Set the fill value */
+ /* Set the fill value */
if(NULL == (fill.type = H5T_copy(type, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy datatype")
fill.size = (ssize_t)H5T_get_size(type);
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index 226d206..4a63b36 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -242,7 +242,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value,
/* Create the new property list class */
orig_pclass = pclass;
- if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0)
+ if((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class");
/* Check if the property class changed and needs to be substituted in the ID */
@@ -255,7 +255,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value,
HDassert(old_pclass == orig_pclass);
/* Close the previous class */
- if(H5P_close_class(orig_pclass) < 0)
+ if(H5P__close_class(orig_pclass) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution")
} /* end if */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index e6eed32..bfc1d93 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -271,131 +271,131 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register the max. temp buffer size property */
- if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g,
+ if(H5P__register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g,
NULL, NULL, NULL, H5D_XFER_MAX_TEMP_BUF_ENC, H5D_XFER_MAX_TEMP_BUF_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the type conversion buffer property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g,
+ if(H5P__register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the background buffer property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g,
+ if(H5P__register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the background buffer type property */
- if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g,
+ if(H5P__register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g,
NULL, NULL, NULL, H5D_XFER_BKGR_BUF_TYPE_ENC, H5D_XFER_BKGR_BUF_TYPE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the B-Tree node splitting ratios property */
- if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g,
+ if(H5P__register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g,
NULL, NULL, NULL, H5D_XFER_BTREE_SPLIT_RATIO_ENC, H5D_XFER_BTREE_SPLIT_RATIO_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen allocation function property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g,
+ if(H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen allocation information property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g,
+ if(H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen free function property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g,
+ if(H5P__register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen free information property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g,
+ if(H5P__register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vector size property */
- if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g,
+ if(H5P__register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g,
NULL, NULL, NULL, H5D_XFER_HYPER_VECTOR_SIZE_ENC, H5D_XFER_HYPER_VECTOR_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the I/O transfer mode properties */
- if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g,
+ if(H5P__register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g,
NULL, NULL, NULL, H5D_XFER_IO_XFER_MODE_ENC, H5D_XFER_IO_XFER_MODE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g,
+ if(H5P__register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g,
NULL, NULL, NULL, H5D_XFER_MPIO_COLLECTIVE_OPT_ENC, H5D_XFER_MPIO_COLLECTIVE_OPT_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g,
+ if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g,
NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC, H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g,
+ if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g,
NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC, H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g,
+ if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g,
NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC, H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the chunk optimization mode property. */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g,
+ if(H5P__register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the actual I/O mode property. */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g,
+ if(H5P__register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the local cause of broken collective I/O */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g,
+ if(H5P__register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the global cause of broken collective I/O */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g,
+ if(H5P__register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the EDC property */
- if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g,
+ if(H5P__register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g,
NULL, NULL, NULL, H5D_XFER_EDC_ENC, H5D_XFER_EDC_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the filter callback property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g,
+ if(H5P__register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the type conversion callback property */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g,
+ if(H5P__register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data transform property */
- if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g,
+ if(H5P__register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g,
NULL, H5D_XFER_XFORM_SET, H5D_XFER_XFORM_GET, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC,
H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
index 73c48d7..8b9962f 100644
--- a/src/H5Pencdec.c
+++ b/src/H5Pencdec.c
@@ -428,7 +428,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf,
/* Iterate over all properties in property list, encoding them */
idx = 0;
- if(H5P_iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0)
+ if(H5P__iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADITER, FAIL, "can't iterate over properties")
/* Encode a terminator for list of properties */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 7ba9c11..923c792 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -39,14 +39,18 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory Management */
#include "H5Ppkg.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
-/* Includes needed to set as default file driver */
-#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
+/* Includes needed to set default file driver */
+#include "H5FDsec2.h" /* POSIX unbuffered I/O */
#include "H5FDstdio.h" /* Standard C buffered I/O */
#ifdef H5_HAVE_WINDOWS
#include "H5FDwindows.h" /* Win32 I/O */
#endif
+/* Includes needed to set default VOL connector */
+#include "H5VLnative.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -131,10 +135,11 @@
* property only used by h5repart */
#define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t)
#define H5F_ACS_FAMILY_NEWSIZE_DEF 0
-/* Definition for whether to convert family to sec2 driver. It's private
- * property only used by h5repart */
-#define H5F_ACS_FAMILY_TO_SEC2_SIZE sizeof(hbool_t)
-#define H5F_ACS_FAMILY_TO_SEC2_DEF FALSE
+/* Definition for whether to convert family to a single-file driver.
+ * It's a private property only used by h5repart.
+ */
+#define H5F_ACS_FAMILY_TO_SINGLE_SIZE sizeof(hbool_t)
+#define H5F_ACS_FAMILY_TO_SINGLE_DEF FALSE
/* Definition for data type in multi file driver */
#define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t)
#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT
@@ -258,6 +263,16 @@
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned
+/* Definition for file VOL connector properties (ID, etc.) */
+#define H5F_ACS_VOL_CONN_SIZE sizeof(H5VL_connector_prop_t)
+#define H5F_ACS_VOL_CONN_DEF {H5_DEFAULT_VOL, NULL}
+#define H5F_ACS_VOL_CONN_CRT H5P__facc_vol_create
+#define H5F_ACS_VOL_CONN_SET H5P__facc_vol_set
+#define H5F_ACS_VOL_CONN_GET H5P__facc_vol_get
+#define H5F_ACS_VOL_CONN_DEL H5P__facc_vol_del
+#define H5F_ACS_VOL_CONN_COPY H5P__facc_vol_copy
+#define H5F_ACS_VOL_CONN_CMP H5P__facc_vol_cmp
+#define H5F_ACS_VOL_CONN_CLOSE H5P__facc_vol_close
/******************/
@@ -320,6 +335,15 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c
static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size);
static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value);
+/* VOL connector callbacks */
+static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value);
+static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P__facc_vol_del(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P__facc_vol_copy(const char *name, size_t size, void *value);
+static int H5P__facc_vol_cmp(const void *value1, const void *value2, size_t size);
+static herr_t H5P__facc_vol_close(const char *name, size_t size, void *value);
+
/*********************/
/* Package Variables */
@@ -368,7 +392,7 @@ static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF;
static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */
static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */
static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */
-static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */
+static const hbool_t H5F_def_family_to_single_g = H5F_ACS_FAMILY_TO_SINGLE_DEF; /* Default ?? for family VFD */
static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */
static const H5F_libver_t H5F_def_libver_low_bound_g = H5F_ACS_LIBVER_LOW_BOUND_DEF; /* Default setting for "low" bound of format version */
@@ -398,7 +422,7 @@ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF;
static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */
static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer mininum raw data size */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_reg_prop
*
@@ -414,115 +438,116 @@ static herr_t
H5P__facc_reg_prop(H5P_genclass_t *pclass)
{
const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */
+ const H5VL_connector_prop_t def_vol_prop = H5F_ACS_VOL_CONN_DEF; /* Default VOL connector ID & info (initialized from a variable) */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register the initial metadata cache resize configuration */
- if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g,
+ if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g,
NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC,
NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache (elements) */
- if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g,
+ if(H5P__register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g,
NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
- if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g,
+ if(H5P__register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g,
NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
- if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g,
+ if(H5P__register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g,
NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the threshold for alignment */
- if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g,
+ if(H5P__register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g,
NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the alignment */
- if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g,
+ if(H5P__register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g,
NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum metadata allocation block size */
- if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g,
+ if(H5P__register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g,
NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the maximum sieve buffer size */
- if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g,
+ if(H5P__register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g,
NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum "small data" allocation block size */
- if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g,
+ if(H5P__register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g,
NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the garbage collection reference */
- if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g,
+ if(H5P__register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g,
NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver ID & info */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop,
+ if(H5P__register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop,
H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL,
H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file close degree */
- if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g,
+ if(H5P__register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g,
NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the offset of family driver info */
- if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g,
+ if(H5P__register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g,
NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of new family file size. It's used by h5repart only. */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g,
+ if(H5P__register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */
+ /* Register the private property of whether convert family to a single-file driver. It's used by h5repart only. */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g,
+ if(H5P__register_real(pclass, H5F_ACS_FAMILY_TO_SINGLE_NAME, H5F_ACS_FAMILY_TO_SINGLE_SIZE, &H5F_def_family_to_single_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data type of multi driver info */
- if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g,
+ if(H5P__register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g,
NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 'low' bound of library format versions */
- if(H5P_register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g,
+ if(H5P__register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g,
NULL, NULL, NULL, H5F_ACS_LIBVER_LOW_BOUND_ENC, H5F_ACS_LIBVER_LOW_BOUND_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 'high' bound of library format versions */
- if(H5P_register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g,
+ if(H5P__register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g,
NULL, NULL, NULL, H5F_ACS_LIBVER_HIGH_BOUND_ENC, H5F_ACS_LIBVER_HIGH_BOUND_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -530,125 +555,132 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
/* Register the private property of whether to retrieve the file descriptor from the core VFD */
/* (used internally to the library only) */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g,
+ if(H5P__register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the external file cache size */
- if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g,
+ if(H5P__register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g,
NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the initial file image info */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g,
+ if(H5P__register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g,
NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL,
H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the core VFD backing store write tracking flag */
- if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g,
+ if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g,
NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the core VFD backing store page size */
- if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g,
+ if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g,
NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the # of read attempts */
- if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g,
+ if(H5P__register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g,
NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register object flush callback */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g,
+ if(H5P__register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether to clear the superblock status_flags. It's used by h5clear only. */
- if(H5P_register_real(pclass, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, H5F_ACS_CLEAR_STATUS_FLAGS_SIZE, &H5F_def_clear_status_flags_g,
+ if(H5P__register_real(pclass, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, H5F_ACS_CLEAR_STATUS_FLAGS_SIZE, &H5F_def_clear_status_flags_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether to skip EOF check. It's used by h5clear only. */
- if(H5P_register_real(pclass, H5F_ACS_SKIP_EOF_CHECK_NAME, H5F_ACS_SKIP_EOF_CHECK_SIZE, &H5F_def_skip_eof_check_g,
+ if(H5P__register_real(pclass, H5F_ACS_SKIP_EOF_CHECK_NAME, H5F_ACS_SKIP_EOF_CHECK_SIZE, &H5F_def_skip_eof_check_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether to drop free-space to the floor. It's used by h5clear only. */
- if(H5P_register_real(pclass, H5F_ACS_NULL_FSM_ADDR_NAME, H5F_ACS_NULL_FSM_ADDR_SIZE, &H5F_def_null_fsm_addr_g,
+ if(H5P__register_real(pclass, H5F_ACS_NULL_FSM_ADDR_NAME, H5F_ACS_NULL_FSM_ADDR_SIZE, &H5F_def_null_fsm_addr_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the metadata cache logging flag. */
- if(H5P_register_real(pclass, H5F_ACS_USE_MDC_LOGGING_NAME, H5F_ACS_USE_MDC_LOGGING_SIZE, &H5F_def_use_mdc_logging_g,
+ if(H5P__register_real(pclass, H5F_ACS_USE_MDC_LOGGING_NAME, H5F_ACS_USE_MDC_LOGGING_SIZE, &H5F_def_use_mdc_logging_g,
NULL, NULL, NULL, H5F_ACS_USE_MDC_LOGGING_ENC, H5F_ACS_USE_MDC_LOGGING_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the metadata cache log location. */
- if(H5P_register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g,
+ if(H5P__register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g,
NULL, NULL, NULL, H5F_ACS_MDC_LOG_LOCATION_ENC, H5F_ACS_MDC_LOG_LOCATION_DEC,
H5F_ACS_MDC_LOG_LOCATION_DEL, H5F_ACS_MDC_LOG_LOCATION_COPY, H5F_ACS_MDC_LOG_LOCATION_CMP, H5F_ACS_MDC_LOG_LOCATION_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the flag that indicates whether mdc logging starts on file access. */
- if(H5P_register_real(pclass, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE, &H5F_def_start_mdc_log_on_access_g,
+ if(H5P__register_real(pclass, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE, &H5F_def_start_mdc_log_on_access_g,
NULL, NULL, NULL, H5F_ACS_START_MDC_LOG_ON_ACCESS_ENC, H5F_ACS_START_MDC_LOG_ON_ACCESS_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the evict on close flag */
- if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g,
+ if(H5P__register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g,
NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
#ifdef H5_HAVE_PARALLEL
/* Register the metadata collective read flag */
- if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g,
+ if(H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g,
NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the metadata collective write flag */
- if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g,
+ if(H5P__register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g,
NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
#endif /* H5_HAVE_PARALLEL */
/* Register the initial metadata cache image configuration */
- if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g,
+ if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g,
NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC,
NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the page buffer size */
- if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g,
+ if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g,
NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the page buffer minimum metadata size */
- if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g,
+ if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g,
NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the page buffer minimum raw data size */
- if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g,
+ if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g,
NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the file VOL connector ID & info */
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if(H5P__register_real(pclass, H5F_ACS_VOL_CONN_NAME, H5F_ACS_VOL_CONN_SIZE, &def_vol_prop,
+ H5F_ACS_VOL_CONN_CRT, H5F_ACS_VOL_CONN_SET, H5F_ACS_VOL_CONN_GET, NULL, NULL,
+ H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_reg_prop() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_alignment
*
@@ -706,7 +738,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_alignment
*
@@ -747,7 +779,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_alignment() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_set_driver
*
@@ -795,7 +827,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_set_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_driver
*
@@ -838,7 +870,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_peek_driver
*
@@ -882,7 +914,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_peek_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_driver
*
@@ -923,7 +955,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_peek_driver_info
*
@@ -965,7 +997,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_peek_driver_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_driver_info
*
@@ -1005,7 +1037,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_driver_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_driver_copy
*
@@ -1071,7 +1103,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_driver_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_driver_free
*
@@ -1123,7 +1155,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_driver_free() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_create
*
@@ -1152,7 +1184,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_create() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_set
*
@@ -1185,7 +1217,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_set() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_get
*
@@ -1218,7 +1250,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_get() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_del
*
@@ -1247,7 +1279,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_copy
*
@@ -1276,7 +1308,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_cmp
*
@@ -1335,7 +1367,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_close
*
@@ -1364,7 +1396,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_family_offset
*
@@ -1403,7 +1435,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_family_offset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_family_offset
*
@@ -1444,7 +1476,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_family_offset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_multi_type
*
@@ -1483,7 +1515,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_multi_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_multi_type
*
@@ -1524,7 +1556,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_multi_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_cache
*
@@ -1578,7 +1610,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_cache() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_cache
*
@@ -1630,7 +1662,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_cache() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_image_config
*
@@ -1674,7 +1706,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_mdc_image_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_image_config
*
@@ -1725,7 +1757,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_mdc_image_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_config
*
@@ -1769,7 +1801,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_mdc_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_config
*
@@ -1820,7 +1852,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_mdc_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_gc_references
*
@@ -1873,7 +1905,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_gc_references
*
@@ -1916,7 +1948,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_fclose_degree
*
@@ -1952,7 +1984,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fclose_degree() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_fclose_degree
*
@@ -1987,7 +2019,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fclose_degree() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_meta_block_size
*
@@ -2038,7 +2070,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_meta_block_size
*
@@ -2082,7 +2114,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_sieve_buf_size
*
@@ -2133,7 +2165,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_sieve_buf_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_sieve_buf_size
*
@@ -2176,7 +2208,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_sieve_buf_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_small_data_block_size
*
@@ -2222,7 +2254,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_small_data_block_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_small_data_block_size
*
@@ -2261,7 +2293,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_small_data_block_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_libver_bounds
*
@@ -2403,14 +2435,14 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_libver_bounds() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_libver_bounds
*
- * Purpose: Returns the current settings for the library version format bounds
- * from a file access property list.
+ * Purpose: Returns the current settings for the library version format bounds
+ * from a file access property list.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Thursday, January 3, 2008
@@ -2446,7 +2478,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_libver_bounds() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_elink_file_cache_size
*
@@ -2484,7 +2516,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_elink_file_cache_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_elink_file_cache_size
*
@@ -2523,7 +2555,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_elink_file_cache_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_image
*
@@ -2604,7 +2636,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_file_image() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_file_image
*
@@ -2693,7 +2725,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_file_image */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_image_callbacks
*
@@ -2770,7 +2802,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_file_image_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_file_image_callbacks
*
@@ -2826,7 +2858,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_file_image_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_image_info_copy
*
@@ -2904,7 +2936,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_image_info_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_image_info_free
*
@@ -2959,7 +2991,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_image_info_free() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_cmp
*
@@ -3002,7 +3034,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_image_config_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_enc
*
@@ -3048,7 +3080,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_cache_image_config_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_dec
*
@@ -3100,7 +3132,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_image_config_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_set
*
@@ -3133,7 +3165,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_set() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_get
*
@@ -3166,7 +3198,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_get() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_del
*
@@ -3197,7 +3229,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_copy
*
@@ -3227,7 +3259,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_cmp
*
@@ -3286,7 +3318,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_close
*
@@ -3316,7 +3348,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_cmp
*
@@ -3428,7 +3460,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_config_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_enc
*
@@ -3573,7 +3605,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_cache_config_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_dec
*
@@ -3708,7 +3740,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_config_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_fclose_degree_enc
*
@@ -3746,7 +3778,7 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_fclose_degree_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_fclose_degree_dec
*
@@ -3781,7 +3813,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_fclose_degree_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_multi_type_enc
*
@@ -3819,7 +3851,7 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_multi_type_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_multi_type_dec
*
@@ -3854,7 +3886,7 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_multi_type_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_libver_type_enc
*
@@ -3966,7 +3998,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_core_write_tracking() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_core_write_tracking
*
@@ -4008,7 +4040,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_core_write_tracking() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_metadata_read_attempts
*
@@ -4051,7 +4083,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_metadata_read_attempts() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_metadata_read_attempts
*
@@ -4092,7 +4124,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_metadata_read_attempts() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_obj_flush_cb
*
@@ -4136,7 +4168,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_obj_flush_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_obj_flush_cb
*
@@ -4177,7 +4209,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_obj_flush_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_log_options
*
@@ -4229,7 +4261,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_mdc_log_options() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_log_options
*
@@ -4284,7 +4316,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mdc_log_options() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_enc
*
@@ -4337,7 +4369,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_dec
*
@@ -4391,7 +4423,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_facc_mdc_log_location_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_del
*
@@ -4414,7 +4446,7 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_copy
*
@@ -4436,7 +4468,7 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_cmp
*
@@ -4468,7 +4500,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_facc_mdc_log_location_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_close
*
@@ -4491,7 +4523,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_evict_on_close
*
@@ -4539,7 +4571,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_evict_on_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_evict_on_close
*
@@ -4583,7 +4615,7 @@ done:
} /* end H5Pget_evict_on_close() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5P__encode_coll_md_read_flag_t
*
@@ -4621,7 +4653,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__encode_coll_md_read_flag_t() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__decode_coll_md_read_flag_t
*
@@ -4655,7 +4687,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__decode_coll_md_read_flag_t() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_all_coll_metadata_ops
*
@@ -4714,7 +4746,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_all_coll_metadata_ops() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_all_coll_metadata_ops
*
@@ -4772,7 +4804,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_all_coll_metadata_ops */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_coll_metadata_write
*
@@ -4811,7 +4843,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_coll_metadata_write() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_coll_metadata_write
*
@@ -4849,7 +4881,7 @@ done:
} /* end H5Pget_coll_metadata_write() */
#endif /* H5_HAVE_PARALLEL */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_page_buffer_size
*
@@ -4897,7 +4929,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_page_buffer_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_page_buffer_size
*
@@ -4939,3 +4971,408 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_page_buffer_size() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_set_vol
+ *
+ * Purpose: Set the VOL connector for a file access property list
+ * (PLIST_ID). The VOL properties will
+ * be copied into the property list and the reference count on
+ * the VOL will be incremented.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if(NULL == H5I_object_verify(vol_id, H5I_VOL))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ H5VL_connector_prop_t vol_prop; /* Property for VOL ID & info */
+
+ /* Prepare the VOL connector property */
+ vol_prop.connector_id = vol_id;
+ vol_prop.connector_info = vol_info;
+
+ /* Set the connector ID & info property */
+ if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_set_vol() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_vol
+ *
+ * Purpose: Set the file VOL connector (VOL_ID) for a file access
+ * property list (PLIST_ID)
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ii*x", plist_id, new_vol_id, new_vol_info);
+
+ /* 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(NULL == H5I_object_verify(new_vol_id, H5I_VOL))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID")
+
+ /* Set the VOL */
+ if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_vol() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_vol_id
+ *
+ * Purpose: Returns the ID of the current VOL connector.
+ * This ID should be closed with H5VLclose().
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_vol_id(hid_t plist_id, hid_t *vol_id)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*i", plist_id, vol_id);
+
+ /* 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 current VOL ID */
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+
+ /* 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 info")
+
+ /* Increment the VOL ID's ref count */
+ if(H5I_inc_ref(connector_prop.connector_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID")
+
+ /* Set the connector ID to return */
+ *vol_id = connector_prop.connector_id;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_vol_info
+ *
+ * Purpose: Returns a copy of the VOL info for a connector.
+ * This information should be freed with H5VLfree_connector_info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_vol_info(hid_t plist_id, void **vol_info)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i**x", plist_id, vol_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 current VOL info */
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ void *new_connector_info = NULL; /* Copy of connector info */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+
+ /* 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")
+
+ /* Copy connector info, if it exists */
+ if(connector_prop.connector_info) {
+ 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")
+
+ /* Allocate and copy connector info */
+ if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed")
+ } /* end if */
+
+ /* Set the connector info */
+ *vol_info = new_connector_info;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_vol_create
+ *
+ connectorose: Create callback for the VOL connector ID & info property.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Make copy of the VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_vol_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_vol_set
+ *
+ * Purpose: Copies a VOL connector property when it's set for a property list
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
+ size_t H5_ATTR_UNUSED size, void *value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(value);
+
+ /* Make copy of VOL connector ID & info */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_vol_set() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_vol_get
+ *
+ * Purpose: Copies a VOL connector property when it's retrieved from a property list
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
+ size_t H5_ATTR_UNUSED size, void *value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(value);
+
+ /* Make copy of VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_vol_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_vol_del
+ *
+ * Purpose: Frees memory used to store the VOL connector ID & info property
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Free the VOL connector ID & info */
+ if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_vol_del() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_vol_copy
+ *
+ * Purpose: Copy callback for the VOL connector ID & info property.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Make copy of VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_vol_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_vol_cmp
+ *
+ * Purpose: Callback routine which is called whenever the VOL connector
+ * ID & info property in the file access property list
+ * is compared.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if
+ * VALUE2 is greater than VALUE1 and zero if VALUE1 and
+ * VALUE2 are equal.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size)
+{
+ const H5VL_connector_prop_t *info1 = (const H5VL_connector_prop_t *)_info1; /* Create local aliases for values */
+ const H5VL_connector_prop_t *info2 = (const H5VL_connector_prop_t *)_info2;
+ H5VL_class_t *cls1, *cls2; /* connector class for each property */
+ int cmp_value = 0; /* Value from comparison */
+ herr_t status; /* Status from info comparison */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(info1);
+ HDassert(info2);
+ HDassert(size == sizeof(H5VL_connector_prop_t));
+
+ /* Compare connectors */
+ if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->connector_id)))
+ HGOTO_DONE(-1)
+ if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id)))
+ HGOTO_DONE(1)
+ status = H5VL_cmp_connector_cls(&cmp_value, cls1, cls2);
+ HDassert(status >= 0);
+ if(cmp_value != 0)
+ HGOTO_DONE(cmp_value);
+
+ /* At this point, we should be able to assume that we are dealing with
+ * the same connector class struct (or a copies of the same class struct)
+ */
+
+
+ /* Use one of the classes (cls1) info comparison routines to compare the
+ * info objects
+ */
+ HDassert(cls1->info_cmp == cls2->info_cmp);
+ status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info);
+ HDassert(status >= 0);
+
+ /* Set return value */
+ ret_value = cmp_value;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_vol_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_vol_close
+ *
+ * Purpose: Close callback for the VOL connector ID & info property.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Free the VOL connector */
+ if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_vol_close() */
+
+
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index f90dae5..56af8b1 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -36,7 +36,6 @@
#include "H5Bprivate.h" /* B-tree subclass names */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
-#include "H5SMprivate.h" /* Shared object header messages */
#include "H5Ppkg.h" /* Property lists */
@@ -213,85 +212,85 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_NOAPI_NOINIT
/* Register the user block size */
- if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g,
+ if(H5P__register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g,
NULL, NULL, NULL, H5F_CRT_USER_BLOCK_ENC, H5F_CRT_USER_BLOCK_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for symbol table leaf nodes */
- if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g,
+ if(H5P__register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g,
NULL, NULL, NULL, H5F_CRT_SYM_LEAF_ENC, H5F_CRT_SYM_LEAF_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for btree internal nodes */
- if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g,
+ if(H5P__register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g,
NULL, NULL, NULL, H5F_CRT_BTREE_RANK_ENC, H5F_CRT_BTREE_RANK_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for an address */
- if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g,
+ if(H5P__register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g,
NULL, NULL, NULL, H5F_CRT_ADDR_BYTE_NUM_ENC, H5F_CRT_ADDR_BYTE_NUM_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for object size */
- if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g,
+ if(H5P__register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g,
NULL, NULL, NULL, H5F_CRT_OBJ_BYTE_NUM_ENC, H5F_CRT_OBJ_BYTE_NUM_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the superblock version number */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g,
+ if(H5P__register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH message information */
- if(H5P_register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g,
+ if(H5P__register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_NINDEXES_ENC, H5F_CRT_SHMSG_NINDEXES_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g,
+ if(H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_TYPES_ENC, H5F_CRT_SHMSG_INDEX_TYPES_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g,
+ if(H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_MINSIZE_ENC, H5F_CRT_SHMSG_INDEX_MINSIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH cutoff size information */
- if(H5P_register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g,
+ if(H5P__register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_LIST_MAX_ENC, H5F_CRT_SHMSG_LIST_MAX_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g,
+ if(H5P__register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g,
NULL, NULL, NULL, H5F_CRT_SHMSG_BTREE_MIN_ENC, H5F_CRT_SHMSG_BTREE_MIN_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file space handling strategy */
- if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g,
+ if(H5P__register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g,
NULL, NULL, NULL, H5F_CRT_FILE_SPACE_STRATEGY_ENC, H5F_CRT_FILE_SPACE_STRATEGY_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free-space persist flag */
- if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g,
+ if(H5P__register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g,
NULL, NULL, NULL, H5F_CRT_FREE_SPACE_PERSIST_ENC, H5F_CRT_FREE_SPACE_PERSIST_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free space section threshold */
- if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g,
+ if(H5P__register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g,
NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file space page size */
- if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g,
+ if(H5P__register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g,
NULL, NULL, NULL, H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC, H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c
index e858a79..1e39749 100644
--- a/src/H5Pfmpl.c
+++ b/src/H5Pfmpl.c
@@ -124,7 +124,7 @@ H5P_fmnt_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_NOAPI_NOINIT
/* Register property of whether symlinks is local to file */
- if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g,
+ if(H5P__register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index 6f1fab1..ab289e4 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -32,12 +32,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Ppkg.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Ppkg.h" /* Property lists */
/****************/
@@ -128,22 +128,28 @@ static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Defaul
static herr_t
H5P__gcrt_reg_prop(H5P_genclass_t *pclass)
{
+ hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register group info property */
- if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g,
+ if(H5P__register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g,
NULL, NULL, NULL, H5G_CRT_GROUP_INFO_ENC, H5G_CRT_GROUP_INFO_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register link info property */
- if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g,
+ if(H5P__register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g,
NULL, NULL, NULL, H5G_CRT_LINK_INFO_ENC, H5G_CRT_LINK_INFO_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the lcpl ID property */
+ if(H5P__register_real(pclass, H5VL_PROP_GRP_LCPL_ID, sizeof(hid_t), &lcpl_id,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__gcrt_reg_prop() */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 6a0cc14..e2ae792 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -100,11 +100,23 @@ typedef herr_t (*H5P_do_pclass_op_t)(H5P_genplist_t *plist, const char *name, H5
/********************/
/* General helper routines */
-static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type);
-static herr_t H5P_free_prop(H5P_genprop_t *prop);
-static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2);
+static H5P_genplist_t *H5P__create(H5P_genclass_t *pclass);
+static H5P_genprop_t *H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type,
+ const void *value, H5P_prp_create_func_t prp_create,
+ H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
+ H5P_prp_delete_func_t prp_delete,
+ H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
+ H5P_prp_close_func_t prp_close);
+static H5P_genprop_t *H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type);
+static herr_t H5P__free_prop(H5P_genprop_t *prop);
+static int H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2);
static herr_t H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op,
H5P_do_pclass_op_t pclass_op, void *udata);
+static int H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key);
+static H5P_genprop_t *H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name);
+static herr_t H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data);
+static herr_t H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data);
/*********************/
@@ -336,7 +348,7 @@ static const H5I_class_t H5I_GENPROPCLS_CLS[1] = {{
H5I_GENPROP_CLS, /* ID class value */
0, /* Class flags */
0, /* # of reserved IDs for class */
- (H5I_free_t)H5P_close_class /* Callback routine for closing objects of this class */
+ (H5I_free_t)H5P__close_class /* Callback routine for closing objects of this class */
}};
/* Generic Property List ID class */
@@ -425,7 +437,7 @@ H5P__init_package(void)
HDassert(lib_class->par_pclass || lib_class == H5P_CLS_ROOT);
/* Allocate the new class */
- if(NULL == (*lib_class->pclass = H5P_create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
+ if(NULL == (*lib_class->pclass = H5P__create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed")
/* Call routine to register properties for class */
@@ -626,14 +638,14 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed")
/* Make a copy of the class's property */
- if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST)))
+ if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property")
/* Copy the changed value into the new property */
HDmemcpy(pcopy->value, tmp_value, prop->size);
/* Insert the changed property into the property list */
- if(H5P_add_prop(slist, pcopy) < 0)
+ if(H5P__add_prop(slist, pcopy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list")
done:
@@ -644,7 +656,7 @@ done:
/* Cleanup on failure */
if(ret_value < 0)
if(pcopy)
- H5P_free_prop(pcopy);
+ H5P__free_prop(pcopy);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__do_prop_cb1() */
@@ -652,11 +664,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_copy_pclass
+ H5P__copy_pclass
PURPOSE
Internal routine to copy a generic property class
USAGE
- hid_t H5P_copy_pclass(pclass)
+ hid_t H5P__copy_pclass(pclass)
H5P_genclass_t *pclass; IN: Property class to copy
RETURNS
Success: valid property class ID on success (non-negative)
@@ -671,13 +683,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
H5P_genclass_t *
-H5P_copy_pclass(H5P_genclass_t *pclass)
+H5P__copy_pclass(H5P_genclass_t *pclass)
{
H5P_genclass_t *new_pclass = NULL; /* Property list class copied */
H5P_genprop_t *pcopy; /* Copy of property to insert into class */
H5P_genclass_t *ret_value=NULL; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(pclass);
@@ -686,7 +698,7 @@ H5P_copy_pclass(H5P_genclass_t *pclass)
*/
/* Create the new property list class */
- if(NULL == (new_pclass = H5P_create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
+ if(NULL == (new_pclass = H5P__create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class")
/* Copy the properties registered for this class */
@@ -697,11 +709,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass)
curr_node=H5SL_first(pclass->props);
while(curr_node!=NULL) {
/* Make a copy of the class's property */
- if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS)))
+ if(NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property")
/* Insert the initialized property into the property list */
- if(H5P_add_prop(new_pclass->props,pcopy) < 0)
+ if(H5P__add_prop(new_pclass->props,pcopy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class")
/* Increment property count for class */
@@ -716,11 +728,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass)
ret_value=new_pclass;
done:
- if(ret_value==NULL && new_pclass)
- H5P_close_class(new_pclass);
+ if(NULL == ret_value && new_pclass)
+ H5P__close_class(new_pclass);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_copy_pclass() */
+} /* H5P__copy_pclass() */
/*--------------------------------------------------------------------------
@@ -733,7 +745,7 @@ done:
hid_t old_plist_id; IN: Property list ID to copy
RETURNS
Success: valid property list ID on success (non-negative)
- Failure: negative
+ Failure: H5I_INVALID_HID
DESCRIPTION
Copy a property list and return the ID. This routine calls the
class 'copy' callback after any property 'copy' callbacks are called
@@ -756,9 +768,9 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
H5SL_t *seen=NULL; /* Skip list containing properties already seen */
size_t nseen; /* Number of items 'seen' */
hbool_t has_parent_class; /* Flag to indicate that this property list's class has a parent */
- hid_t ret_value=FAIL; /* return value */
+ hid_t ret_value = H5I_INVALID_HID; /* return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
HDassert(old_plist);
@@ -768,7 +780,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
/* Allocate room for the property list */
if(NULL==(new_plist = H5FL_CALLOC(H5P_genplist_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,"memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed")
/* Set class state */
new_plist->pclass = old_plist->pclass;
@@ -777,80 +789,80 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
/* Initialize the skip list to hold the changed properties */
if((new_plist->props = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for changed properties")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for changed properties")
/* Create the skip list for deleted properties */
if((new_plist->del = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for deleted properties")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for deleted properties")
/* Create the skip list to hold names of properties already seen
* (This prevents a property in the class hierarchy from having it's
* 'create' callback called, if a property in the class hierarchy has
* already been seen)
*/
- if((seen = H5SL_create(H5SL_TYPE_STR, NULL))== NULL)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties")
+ if((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for seen properties")
nseen = 0;
/* Cycle through the deleted properties & copy them into the new list's deleted section */
- if(H5SL_count(old_plist->del)>0) {
- curr_node=H5SL_first(old_plist->del);
+ if(H5SL_count(old_plist->del) > 0) {
+ curr_node = H5SL_first(old_plist->del);
while(curr_node) {
char *new_name; /* Pointer to new name */
/* Duplicate string for insertion into new deleted property skip list */
- if((new_name=H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL)
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed")
+ if((new_name = H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed")
/* Insert property name into deleted list */
if(H5SL_insert(new_plist->del,new_name,new_name) < 0)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into deleted skip list")
/* Add property name to "seen" list */
if(H5SL_insert(seen,new_name,new_name) < 0)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list")
nseen++;
/* Get the next property node in the skip list */
- curr_node=H5SL_next(curr_node);
+ curr_node = H5SL_next(curr_node);
} /* end while */
} /* end if */
/* Cycle through the properties and copy them also */
- if(H5SL_count(old_plist->props)>0) {
- curr_node=H5SL_first(old_plist->props);
+ if(H5SL_count(old_plist->props) > 0) {
+ curr_node = H5SL_first(old_plist->props);
while(curr_node) {
/* Get a pointer to the node's property */
tmp = (H5P_genprop_t *)H5SL_item(curr_node);
/* Make a copy of the list's property */
- if(NULL == (new_prop = H5P_dup_prop(tmp, H5P_PROP_WITHIN_LIST)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property")
+ if(NULL == (new_prop = H5P__dup_prop(tmp, H5P_PROP_WITHIN_LIST)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property")
/* Call property copy callback, if it exists */
if(new_prop->copy) {
if((new_prop->copy)(new_prop->name,new_prop->size,new_prop->value) < 0) {
- H5P_free_prop(new_prop);
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property")
+ H5P__free_prop(new_prop);
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property")
} /* end if */
} /* end if */
/* Insert the initialized property into the property list */
- if(H5P_add_prop(new_plist->props,new_prop) < 0) {
- H5P_free_prop(new_prop);
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list")
+ if(H5P__add_prop(new_plist->props,new_prop) < 0) {
+ H5P__free_prop(new_prop);
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "Can't insert property into list")
} /* end if */
/* Add property name to "seen" list */
if(H5SL_insert(seen,new_prop->name,new_prop->name) < 0)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list")
nseen++;
/* Increment the number of properties in list */
new_plist->nprops++;
/* Get the next property node in the skip list */
- curr_node=H5SL_next(curr_node);
+ curr_node = H5SL_next(curr_node);
} /* end while */
} /* end if */
@@ -860,27 +872,27 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
*/
tclass=old_plist->pclass;
has_parent_class = (hbool_t)(tclass != NULL && tclass->parent != NULL && tclass->parent->nprops > 0);
- while(tclass!=NULL) {
+ while(tclass != NULL) {
if(tclass->nprops>0) {
/* Walk through the properties in the old class */
- curr_node=H5SL_first(tclass->props);
+ curr_node = H5SL_first(tclass->props);
while(curr_node!=NULL) {
/* Get pointer to property from node */
tmp = (H5P_genprop_t *)H5SL_item(curr_node);
/* Only "copy" properties we haven't seen before */
- if(nseen==0 || H5SL_search(seen,tmp->name) == NULL) {
+ if(nseen == 0 || H5SL_search(seen,tmp->name) == NULL) {
/* Call property copy callback, if it exists */
if(tmp->copy) {
/* Call the callback & insert changed value into skip list (if necessary) */
if(H5P__do_prop_cb1(new_plist->props, tmp, tmp->copy) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't create property")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't create property")
} /* end if */
/* Add property name to "seen" list, if we have other classes to work on */
if(has_parent_class) {
if(H5SL_insert(seen,tmp->name,tmp->name) < 0)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list")
nseen++;
} /* end if */
@@ -889,24 +901,24 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
} /* end if */
/* Get the next property node in the skip list */
- curr_node=H5SL_next(curr_node);
+ curr_node = H5SL_next(curr_node);
} /* end while */
} /* end if */
/* Go up to parent class */
- tclass=tclass->parent;
+ tclass = tclass->parent;
} /* end while */
/* Increment the number of property lists derived from class */
- if(H5P_access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't increment class ref count")
+ if(H5P__access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ref count")
/* Get an atom for the property list */
if((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list")
/* Save the property list ID in the property list struct, for use in the property class's 'close' callback */
- new_plist->plist_id=new_plist_id;
+ new_plist->plist_id = new_plist_id;
/* Call the class callback (if it exists) now that we have the property list ID
* (up through chain of parent classes also)
@@ -917,7 +929,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
if((tclass->copy_func)(new_plist_id, old_plist->plist_id, old_plist->pclass->copy_data) < 0) {
/* Delete ID, ignore return value */
H5I_remove(new_plist_id);
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property")
} /* end if */
} /* end if */
@@ -933,10 +945,10 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
done:
/* Release the list of 'seen' properties */
- if(seen!=NULL)
+ if(seen != NULL)
H5SL_close(seen);
- if(ret_value<0 && new_plist)
+ if(H5I_INVALID_HID == ret_value && new_plist)
H5P_close(new_plist);
FUNC_LEAVE_NOAPI(ret_value)
@@ -945,11 +957,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_dup_prop
+ H5P__dup_prop
PURPOSE
Internal routine to duplicate a property
USAGE
- H5P_genprop_t *H5P_dup_prop(oprop)
+ H5P_genprop_t *H5P__dup_prop(oprop)
H5P_genprop_t *oprop; IN: Pointer to property to copy
H5P_prop_within_t type; IN: Type of object the property will be inserted into
RETURNS
@@ -963,12 +975,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5P_genprop_t *
-H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type)
+H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type)
{
H5P_genprop_t *prop = NULL; /* Pointer to new property copied */
H5P_genprop_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(oprop);
HDassert(type != H5P_PROP_WITHIN_UNKNOWN);
@@ -1037,16 +1049,16 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_dup_prop() */
+} /* H5P__dup_prop() */
/*--------------------------------------------------------------------------
NAME
- H5P_create_prop
+ H5P__create_prop
PURPOSE
Internal routine to create a new property
USAGE
- H5P_genprop_t *H5P_create_prop(name,size,type,value,prp_create,prp_set,
+ H5P_genprop_t *H5P__create_prop(name,size,type,value,prp_create,prp_set,
prp_get,prp_delete,prp_close, prp_encode, prp_decode)
const char *name; IN: Name of property to register
size_t size; IN: Size of property in bytes
@@ -1074,7 +1086,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5P_genprop_t *
-H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type,
+H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type,
const void *value, H5P_prp_create_func_t prp_create,
H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
@@ -1085,7 +1097,7 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type,
H5P_genprop_t *prop = NULL; /* Pointer to new property copied */
H5P_genprop_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(name);
HDassert((size > 0 && value != NULL) || (size == 0));
@@ -1141,16 +1153,16 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_create_prop() */
+} /* H5P__create_prop() */
/*--------------------------------------------------------------------------
NAME
- H5P_add_prop
+ H5P__add_prop
PURPOSE
Internal routine to insert a property into a property skip list
USAGE
- herr_t H5P_add_prop(slist, prop)
+ herr_t H5P__add_prop(slist, prop)
H5SL_t *slist; IN/OUT: Pointer to skip list of properties
H5P_genprop_t *prop; IN: Pointer to property to insert
RETURNS
@@ -1163,11 +1175,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop)
+H5P__add_prop(H5SL_t *slist, H5P_genprop_t *prop)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
HDassert(slist);
HDassert(prop);
@@ -1179,7 +1191,7 @@ H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_add_prop() */
+} /* H5P__add_prop() */
/*--------------------------------------------------------------------------
@@ -1244,11 +1256,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_find_prop_pclass
+ H5P__find_prop_pclass
PURPOSE
Internal routine to check for a property in a class skip list
USAGE
- H5P_genprop_t *H5P_find_prop_class(pclass, name)
+ H5P_genprop_t *H5P__find_prop_class(pclass, name)
H5P_genclass *pclass; IN: Pointer generic property class to check
const char *name; IN: Name of property to check for
RETURNS
@@ -1261,11 +1273,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5P_genprop_t *
-H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name)
+H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name)
{
H5P_genprop_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(pclass);
HDassert(name);
@@ -1276,16 +1288,16 @@ H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_find_prop_pclass() */
+} /* H5P__find_prop_pclass() */
/*--------------------------------------------------------------------------
NAME
- H5P_free_prop
+ H5P__free_prop
PURPOSE
Internal routine to destroy a property node
USAGE
- herr_t H5P_free_prop(prop)
+ herr_t H5P__free_prop(prop)
H5P_genprop_t *prop; IN: Pointer to property to destroy
RETURNS
Returns non-negative on success, negative on failure.
@@ -1298,9 +1310,9 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5P_free_prop(H5P_genprop_t *prop)
+H5P__free_prop(H5P_genprop_t *prop)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(prop);
@@ -1315,16 +1327,16 @@ H5P_free_prop(H5P_genprop_t *prop)
prop = H5FL_FREE(H5P_genprop_t, prop);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5P_free_prop() */
+} /* H5P__free_prop() */
/*--------------------------------------------------------------------------
NAME
- H5P_free_prop_cb
+ H5P__free_prop_cb
PURPOSE
Internal routine to properties from a property skip list
USAGE
- herr_t H5P_free_prop_cb(item, key, op_data)
+ herr_t H5P__free_prop_cb(item, key, op_data)
void *item; IN/OUT: Pointer to property
void *key; IN/OUT: Pointer to property key
void *_make_cb; IN: Whether to make property callbacks or not
@@ -1339,12 +1351,12 @@ H5P_free_prop(H5P_genprop_t *prop)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data)
+H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data)
{
H5P_genprop_t *tprop=(H5P_genprop_t *)item; /* Temporary pointer to property */
hbool_t make_cb = *(hbool_t *)op_data; /* Whether to make property 'close' callback */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(tprop);
@@ -1353,19 +1365,19 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data)
(tprop->close)(tprop->name, tprop->size, tprop->value);
/* Free the property, ignoring return value, nothing we can do */
- H5P_free_prop(tprop);
+ H5P__free_prop(tprop);
FUNC_LEAVE_NOAPI(0)
-} /* H5P_free_prop_cb() */
+} /* H5P__free_prop_cb() */
/*--------------------------------------------------------------------------
NAME
- H5P_free_del_name_cb
+ H5P__free_del_name_cb
PURPOSE
Internal routine to free 'deleted' property name
USAGE
- herr_t H5P_free_del_name_cb(item, key, op_data)
+ herr_t H5P__free_del_name_cb(item, key, op_data)
void *item; IN/OUT: Pointer to deleted name
void *key; IN/OUT: Pointer to key
void *op_data; IN: Operator callback data (unused)
@@ -1379,11 +1391,11 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data)
+H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data)
{
char *del_name=(char *)item; /* Temporary pointer to deleted name */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(del_name);
@@ -1391,17 +1403,17 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *
H5MM_xfree(del_name);
FUNC_LEAVE_NOAPI(0)
-} /* H5P_free_del_name_cb() */
+} /* H5P__free_del_name_cb() */
/*--------------------------------------------------------------------------
NAME
- H5P_access_class
+ H5P__access_class
PURPOSE
- Internal routine to increment or decrement list & class dependencies on a
+ Internal routine to increment or decrement list & class dependancies on a
property list class
USAGE
- herr_t H5P_access_class(pclass,mod)
+ herr_t H5P__access_class(pclass,mod)
H5P_genclass_t *pclass; IN: Pointer to class to modify
H5P_class_mod_t mod; IN: Type of modification to class
RETURNS
@@ -1417,9 +1429,9 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod)
+H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(pclass);
HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX);
@@ -1473,27 +1485,27 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod)
if(pclass->props) {
hbool_t make_cb = FALSE;
- H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb);
+ H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb);
} /* end if */
pclass = H5FL_FREE(H5P_genclass_t, pclass);
/* Reduce the number of dependent classes on parent class also */
if(par_class != NULL)
- H5P_access_class(par_class, H5P_MOD_DEC_CLS);
+ H5P__access_class(par_class, H5P_MOD_DEC_CLS);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5P_access_class() */
+} /* H5P__access_class() */
/*--------------------------------------------------------------------------
NAME
- H5P_open_class_path_cb
+ H5P__open_class_path_cb
PURPOSE
Internal callback routine to check for duplicated names in parent class.
USAGE
- int H5P_open_class_path_cb(obj, id, key)
+ int H5P__open_class_path_cb(obj, id, key)
H5P_genclass_t *obj; IN: Pointer to class
hid_t id; IN: ID of object being looked at
const void *key; IN: Pointer to information used to compare
@@ -1509,13 +1521,13 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod)
REVISION LOG
--------------------------------------------------------------------------*/
static int
-H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key)
+H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key)
{
H5P_genclass_t *obj = (H5P_genclass_t *)_obj; /* Pointer to the class for this ID */
H5P_check_class_t *key = (H5P_check_class_t *)_key; /* Pointer to key information for comparison */
int ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(obj);
HDassert(H5I_GENPROP_CLS == H5I_get_type(id));
@@ -1531,16 +1543,16 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key)
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_open_class_path_cb() */
+} /* end H5P__open_class_path_cb() */
/*--------------------------------------------------------------------------
NAME
- H5P_create_class
+ H5P__create_class
PURPOSE
Internal routine to create a new property list class.
USAGE
- H5P_genclass_t H5P_create_class(par_class, name, type,
+ H5P_genclass_t H5P__create_class(par_class, name, type,
cls_create, create_data, cls_close, close_data)
H5P_genclass_t *par_class; IN: Pointer to parent class
const char *name; IN: Name of class we are creating
@@ -1568,7 +1580,7 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key)
REVISION LOG
--------------------------------------------------------------------------*/
H5P_genclass_t *
-H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type,
+H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data)
@@ -1576,7 +1588,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t
H5P_genclass_t *pclass = NULL; /* Property list class created */
H5P_genclass_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(NULL)
+ FUNC_ENTER_PACKAGE
HDassert(name);
/* Allow internal classes to break some rules */
@@ -1614,7 +1626,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t
/* Increment parent class's derived class value */
if(par_class != NULL) {
- if(H5P_access_class(par_class, H5P_MOD_INC_CLS) < 0)
+ if(H5P__access_class(par_class, H5P_MOD_INC_CLS) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment parent class ref count")
} /* end if */
@@ -1630,22 +1642,22 @@ done:
if(pclass->props) {
hbool_t make_cb = FALSE;
- H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb);
+ H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb);
} /* end if */
pclass = H5FL_FREE(H5P_genclass_t, pclass);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_create_class() */
+} /* H5P__create_class() */
/*--------------------------------------------------------------------------
NAME
- H5P_create
+ H5P__create
PURPOSE
Internal routine to create a new property list of a property list class.
USAGE
- H5P_genplist_t *H5P_create(class)
+ H5P_genplist_t *H5P__create(class)
H5P_genclass_t *class; IN: Property list class create list from
RETURNS
Returns a pointer to the newly created property list on success,
@@ -1665,7 +1677,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5P_genplist_t *
-H5P_create(H5P_genclass_t *pclass)
+H5P__create(H5P_genclass_t *pclass)
{
H5P_genclass_t *tclass; /* Temporary class pointer */
H5P_genplist_t *plist = NULL; /* New property list created */
@@ -1673,7 +1685,7 @@ H5P_create(H5P_genclass_t *pclass)
H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */
H5P_genplist_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(pclass);
@@ -1748,7 +1760,7 @@ H5P_create(H5P_genclass_t *pclass)
} /* end while */
/* Increment the number of property lists derived from class */
- if(H5P_access_class(plist->pclass,H5P_MOD_INC_LST) < 0)
+ if(H5P__access_class(plist->pclass,H5P_MOD_INC_LST) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment class ref count")
/* Set return value */
@@ -1766,7 +1778,7 @@ done:
if(plist->props) {
unsigned make_cb=1;
- H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb);
+ H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb);
} /* end if */
/* Close the deleted property skip list */
@@ -1779,7 +1791,7 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_create() */
+} /* H5P__create() */
/*--------------------------------------------------------------------------
@@ -1791,7 +1803,7 @@ done:
hid_t H5P_create_id(pclass)
H5P_genclass_t *pclass; IN: Property list class create list from
RETURNS
- Returns a valid property list ID on success, FAIL on failure.
+ Returns a valid property list ID on success, H5I_INVALID_HID on failure.
DESCRIPTION
Creates a property list of a given class. If a 'create' callback
exists for the property list class, it is called before the
@@ -1812,20 +1824,20 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref)
hid_t plist_id = FAIL; /* Property list ID */
hid_t ret_value = H5I_INVALID_HID; /* return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
HDassert(pclass);
/* Create the new property list */
- if((plist=H5P_create(pclass)) == NULL)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list")
+ if((plist = H5P__create(pclass)) == NULL)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list")
/* Get an atom for the property list */
if((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list")
/* Save the property list ID in the property list struct, for use in the property class's 'close' callback */
- plist->plist_id=plist_id;
+ plist->plist_id = plist_id;
/* Call the class callback (if it exists) now that we have the property list ID
* (up through chain of parent classes also)
@@ -1836,7 +1848,7 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref)
if((tclass->create_func)(plist_id, tclass->create_data) < 0) {
/* Delete ID, ignore return value */
H5I_remove(plist_id);
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property")
} /* end if */
} /* end if */
@@ -1848,10 +1860,10 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref)
plist->class_init = TRUE;
/* Set the return value */
- ret_value=plist_id;
+ ret_value = plist_id;
done:
- if(ret_value<0 && plist)
+ if(H5I_INVALID_HID == ret_value && plist)
H5P_close(plist);
FUNC_LEAVE_NOAPI(ret_value)
@@ -1860,11 +1872,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_register_real
+ H5P__register_real
PURPOSE
Internal routine to register a new property in a property list class.
USAGE
- herr_t H5P_register_real(class, name, size, default, prp_create, prp_set,
+ herr_t H5P__register_real(class, name, size, default, prp_create, prp_set,
prp_get, prp_close, prp_encode, prp_decode)
H5P_genclass_t *class; IN: Property list class to modify
const char *name; IN: Name of property to register
@@ -2043,7 +2055,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
+H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size,
const 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_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
@@ -2054,7 +2066,7 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
H5P_genprop_t *new_prop = NULL; /* Temporary property pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
HDassert(pclass);
HDassert(0 == pclass->plists);
@@ -2067,13 +2079,13 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists")
/* Create property object from parameters */
- if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS,
+ if(NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_CLASS,
def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode,
prp_delete, prp_copy, prp_cmp, prp_close)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property")
/* Insert property into property list class */
- if(H5P_add_prop(pclass->props, new_prop) < 0)
+ if(H5P__add_prop(pclass->props, new_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class")
/* Increment property count for class */
@@ -2084,20 +2096,20 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
done:
if(ret_value < 0)
- if(new_prop && H5P_free_prop(new_prop) < 0)
+ if(new_prop && H5P__free_prop(new_prop) < 0)
HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_register_real() */
+} /* H5P__register_real() */
/*--------------------------------------------------------------------------
NAME
- H5P_register
+ H5P__register
PURPOSE
Internal routine to register a new property in a property list class.
USAGE
- herr_t H5P_register(class, name, size, default, prp_create, prp_set, prp_get, prp_close)
+ herr_t H5P__register(class, name, size, default, prp_create, prp_set, prp_get, prp_close)
H5P_genclass_t **class; IN: Property list class to modify
const char *name; IN: Name of property to register
size_t size; IN: Size of property in bytes
@@ -2275,7 +2287,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
+H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size,
const 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_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
@@ -2287,7 +2299,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
H5P_genclass_t *new_class = NULL; /* New class pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(ppclass);
@@ -2297,7 +2309,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
* been created since the last modification was made to the class.
*/
if(pclass->plists > 0 || pclass->classes > 0) {
- if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name,
+ if(NULL == (new_class = H5P__create_class(pclass->parent, pclass->name,
pclass->type, pclass->create_func, pclass->create_data,
pclass->copy_func, pclass->copy_data,
pclass->close_func, pclass->close_data)))
@@ -2313,11 +2325,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
H5P_genprop_t *pcopy; /* Property copy */
/* Make a copy of the class's property */
- if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS)))
+ if(NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property")
/* Insert the initialized property into the property class */
- if(H5P_add_prop(new_class->props, pcopy) < 0)
+ if(H5P__add_prop(new_class->props, pcopy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class")
/* Increment property count for class */
@@ -2333,7 +2345,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
} /* end if */
/* Really register the property in the class */
- if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get,
+ if(H5P__register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get,
prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property")
@@ -2343,11 +2355,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
done:
if(ret_value < 0)
- if(new_class && H5P_close_class(new_class) < 0)
+ if(new_class && H5P__close_class(new_class) < 0)
HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close new property class")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_register() */
+} /* H5P__register() */
/*--------------------------------------------------------------------------
@@ -2570,13 +2582,13 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
/* Ok to add to property list */
/* Create property object from parameters */
- if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL,
+ if(NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL,
prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy,
prp_cmp, prp_close)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property")
/* Insert property into property list class */
- if(H5P_add_prop(plist->props, new_prop) < 0)
+ if(H5P__add_prop(plist->props, new_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class")
/* Increment property count for class */
@@ -2584,7 +2596,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
done:
if(ret_value < 0)
- if(new_prop && H5P_free_prop(new_prop) < 0)
+ if(new_prop && H5P__free_prop(new_prop) < 0)
HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2764,20 +2776,20 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size")
/* Make a copy of the class's property */
- if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST)))
+ if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property")
HDmemcpy(pcopy->value, udata->value, pcopy->size);
/* Insert the changed property into the property list */
- if(H5P_add_prop(plist->props, pcopy) < 0)
+ if(H5P__add_prop(plist->props, pcopy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list")
done:
/* Cleanup on failure */
if(ret_value < 0)
if(pcopy)
- H5P_free_prop(pcopy);
+ H5P__free_prop(pcopy);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P__poke_pclass_cb() */
@@ -2970,13 +2982,13 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
prp_value = udata->value;
/* Make a copy of the class's property */
- if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST)))
+ if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property")
HDmemcpy(pcopy->value, prp_value, pcopy->size);
/* Insert the changed property into the property list */
- if(H5P_add_prop(plist->props, pcopy) < 0)
+ if(H5P__add_prop(plist->props, pcopy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list")
done:
@@ -2987,7 +2999,7 @@ done:
/* Cleanup on failure */
if(ret_value < 0)
if(pcopy)
- H5P_free_prop(pcopy);
+ H5P__free_prop(pcopy);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P__set_pclass_cb() */
@@ -3109,11 +3121,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_exist_pclass
+ H5P__exist_pclass
PURPOSE
Internal routine to query the existance of a property in a property class.
USAGE
- herr_t H5P_exist_pclass(pclass, name)
+ herr_t H5P__exist_pclass(pclass, name)
H5P_genclass_t *pclass; IN: Property class to check
const char *name; IN: Name of property to check for
RETURNS
@@ -3129,11 +3141,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5P_exist_pclass(H5P_genclass_t *pclass, const char *name)
+H5P__exist_pclass(H5P_genclass_t *pclass, const char *name)
{
htri_t ret_value = FAIL; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(pclass);
HDassert(name);
@@ -3159,16 +3171,16 @@ H5P_exist_pclass(H5P_genclass_t *pclass, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_exist_pclass() */
+} /* H5P__exist_pclass() */
/*--------------------------------------------------------------------------
NAME
- H5P_get_size_plist
+ H5P__get_size_plist
PURPOSE
Internal routine to query the size of a property in a property list.
USAGE
- herr_t H5P_get_size_plist(plist, name)
+ herr_t H5P__get_size_plist(plist, name)
const H5P_genplist_t *plist; IN: Property list to check
const char *name; IN: Name of property to query
size_t *size; OUT: Size of property
@@ -3185,12 +3197,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size)
+H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size)
{
H5P_genprop_t *prop; /* Temporary property pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(plist);
HDassert(name);
@@ -3205,16 +3217,16 @@ H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_get_size_plist() */
+} /* H5P__get_size_plist() */
/*--------------------------------------------------------------------------
NAME
- H5P_get_size_pclass
+ H5P__get_size_pclass
PURPOSE
Internal routine to query the size of a property in a property class.
USAGE
- herr_t H5P_get_size_pclass(pclass, name)
+ herr_t H5P__get_size_pclass(pclass, name)
H5P_genclass_t *pclass; IN: Property class to check
const char *name; IN: Name of property to query
size_t *size; OUT: Size of property
@@ -3231,36 +3243,36 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size)
+H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size)
{
H5P_genprop_t *prop; /* Temporary property pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(pclass);
HDassert(name);
HDassert(size);
/* Find property */
- if((prop=H5P_find_prop_pclass(pclass,name)) == NULL)
+ if((prop = H5P__find_prop_pclass(pclass,name)) == NULL)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
/* Get property size */
- *size=prop->size;
+ *size = prop->size;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_get_size_pclass() */
+} /* H5P__get_size_pclass() */
/*--------------------------------------------------------------------------
NAME
- H5P_get_nprops_plist
+ H5P__get_nprops_plist
PURPOSE
Internal routine to query the number of properties in a property list
USAGE
- herr_t H5P_get_nprops_plist(plist, nprops)
+ herr_t H5P__get_nprops_plist(plist, nprops)
H5P_genplist_t *plist; IN: Property list to check
size_t *nprops; OUT: Number of properties in the property list
RETURNS
@@ -3275,9 +3287,9 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops)
+H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(plist);
HDassert(nprops);
@@ -3286,7 +3298,7 @@ H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops)
*nprops = plist->nprops;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5P_get_nprops_plist() */
+} /* H5P__get_nprops_plist() */
/*--------------------------------------------------------------------------
@@ -3337,11 +3349,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_cmp_prop
+ H5P__cmp_prop
PURPOSE
Internal routine to compare two generic properties
USAGE
- int H5P_cmp_prop(prop1, prop2)
+ int H5P__cmp_prop(prop1, prop2)
H5P_genprop_t *prop1; IN: 1st property to compare
H5P_genprop_t *prop1; IN: 2nd property to compare
RETURNS
@@ -3358,12 +3370,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static int
-H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2)
+H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2)
{
int cmp_value; /* Value from comparison */
int ret_value = 0; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(prop1);
HDassert(prop2);
@@ -3432,16 +3444,16 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_cmp_prop() */
+} /* H5P__cmp_prop() */
/*--------------------------------------------------------------------------
NAME
- H5P_cmp_class
+ H5P__cmp_class
PURPOSE
Internal routine to compare two generic property classes
USAGE
- int H5P_cmp_class(pclass1, pclass2)
+ int H5P__cmp_class(pclass1, pclass2)
H5P_genclass_t *pclass1; IN: 1st property class to compare
H5P_genclass_t *pclass2; IN: 2nd property class to compare
RETURNS
@@ -3458,13 +3470,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
+H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
{
H5SL_node_t *tnode1, *tnode2; /* Temporary pointer to property nodes */
int cmp_value; /* Value from comparison */
int ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(pclass1);
HDassert(pclass2);
@@ -3528,7 +3540,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
/* Compare the two properties */
prop1 = (H5P_genprop_t *)H5SL_item(tnode1);
prop2 = (H5P_genprop_t *)H5SL_item(tnode2);
- if((cmp_value = H5P_cmp_prop(prop1, prop2)) != 0)
+ if((cmp_value = H5P__cmp_prop(prop1, prop2)) != 0)
HGOTO_DONE(cmp_value);
/* Advance the pointers */
@@ -3538,7 +3550,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_cmp_class() */
+} /* H5P__cmp_class() */
/*--------------------------------------------------------------------------
@@ -3588,7 +3600,7 @@ H5P__cmp_plist_cb(H5P_genprop_t *prop, void *_udata)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "property doesn't exist")
/* Compare the two properties */
- if((udata->cmp_value = H5P_cmp_prop(prop, prop2)) != 0)
+ if((udata->cmp_value = H5P__cmp_prop(prop, prop2)) != 0)
HGOTO_DONE(H5_ITER_STOP);
} /* end if */
else {
@@ -3604,11 +3616,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_cmp_plist
+ H5P__cmp_plist
PURPOSE
Internal routine to compare two generic property lists
USAGE
- herr_t H5P_cmp_plist(plist1, plist2, cmp_ret)
+ herr_t H5P__cmp_plist(plist1, plist2, cmp_ret)
H5P_genplist_t *plist1; IN: 1st property list to compare
H5P_genplist_t *plist2; IN: 2nd property list to compare
int *cmp_ret; OUT: Comparison value for two property lists
@@ -3627,14 +3639,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
+H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
int *cmp_ret)
{
H5P_plist_cmp_ud_t udata; /* User data for callback */
int idx = 0; /* Index of property to begin with */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(plist1);
HDassert(plist2);
@@ -3665,7 +3677,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
udata.plist2 = plist2;
/* Iterate over properties in first property list */
- if((ret_value = H5P_iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0)
+ if((ret_value = H5P__iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list")
if(ret_value != 0) {
*cmp_ret = udata.cmp_value;
@@ -3673,7 +3685,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
} /* end if */
/* Check the parent classes */
- if((*cmp_ret = H5P_cmp_class(plist1->pclass, plist2->pclass)) != 0)
+ if((*cmp_ret = H5P__cmp_class(plist1->pclass, plist2->pclass)) != 0)
HGOTO_DONE(SUCCEED);
/* Property lists must be equal, set comparison value to 0 */
@@ -3681,7 +3693,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_cmp_plist() */
+} /* H5P__cmp_plist() */
/*--------------------------------------------------------------------------
@@ -3718,7 +3730,7 @@ H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
HDassert(pclass2);
/* Compare property classes */
- if(H5P_cmp_class(pclass1, pclass2) == 0) {
+ if(H5P__cmp_class(pclass1, pclass2) == 0) {
HGOTO_DONE(TRUE);
} else {
/* Check if the class is derived, and walk up the chain, if so */
@@ -3931,11 +3943,11 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata)
/*--------------------------------------------------------------------------
NAME
- H5P_iterate_plist
+ H5P__iterate_plist
PURPOSE
Internal routine to iterate over the properties in a property list
USAGE
- int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data)
+ int H5P__iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data)
const H5P_genplist_t *plist; IN: Property list to iterate over
hbool_t iter_all_prop; IN: Whether to iterate over all properties
(TRUE), or just non-default (i.e. changed)
@@ -3984,7 +3996,7 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx,
+H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx,
H5P_iterate_int_t cb_func, void *udata)
{
H5P_genclass_t *tclass; /* Temporary class pointer */
@@ -3993,7 +4005,7 @@ H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx,
int curr_idx = 0; /* Current iteration index */
int ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(plist);
@@ -4042,7 +4054,7 @@ done:
H5SL_close(seen);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_iterate_plist() */
+} /* H5P__iterate_plist() */
/*--------------------------------------------------------------------------
@@ -4098,11 +4110,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_iterate_pclass
+ H5P__iterate_pclass
PURPOSE
Internal routine to iterate over the properties in a property class
USAGE
- herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data)
+ herr_t H5P__iterate_pclass(pclass, idx, cb_func, iter_data)
const H5P_genpclass_t *pclass; IN: Property list class to iterate over
int *idx; IN/OUT: Index of the property to begin with
H5P_iterate_t cb_func; IN: Function pointer to function to be
@@ -4148,14 +4160,14 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
+H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx,
H5P_iterate_int_t cb_func, void *udata)
{
H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */
int curr_idx = 0; /* Current iteration index */
int ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(pclass);
@@ -4178,7 +4190,7 @@ done:
*idx = curr_idx;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_iterate_pclass() */
+} /* H5P__iterate_pclass() */
/*--------------------------------------------------------------------------
@@ -4450,7 +4462,7 @@ H5P__del_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list")
/* Free the property, ignoring return value, nothing we can do */
- H5P_free_prop(prop);
+ H5P__free_prop(prop);
/* Decrement the number of properties in list */
plist->nprops--;
@@ -4586,11 +4598,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_copy_prop_plist
+ H5P__copy_prop_plist
PURPOSE
Internal routine to copy a property from one list to another
USAGE
- herr_t H5P_copy_prop_plist(dst_plist, src_plist, name)
+ herr_t H5P__copy_prop_plist(dst_plist, src_plist, name)
hid_t dst_id; IN: ID of destination property list or class
hid_t src_id; IN: ID of source property list or class
const char *name; IN: Name of property to copy
@@ -4616,7 +4628,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
+H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
{
H5P_genplist_t *dst_plist; /* Pointer to destination property list */
H5P_genplist_t *src_plist; /* Pointer to source property list */
@@ -4624,7 +4636,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
H5P_genprop_t *new_prop=NULL; /* Pointer to new property */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(name);
@@ -4642,7 +4654,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
prop = H5P__find_prop_plist(src_plist, name);
/* Make a copy of the source property */
- if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
+ if((new_prop = H5P__dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property")
/* Call property copy callback, if it exists */
@@ -4652,7 +4664,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
} /* end if */
/* Insert the initialized property into the property list */
- if(H5P_add_prop(dst_plist->props,new_prop) < 0)
+ if(H5P__add_prop(dst_plist->props,new_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list")
/* Increment the number of properties in list */
@@ -4664,7 +4676,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
prop = H5P__find_prop_plist(src_plist, name);
/* Create property object from parameters */
- if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value,
+ if(NULL == (new_prop = H5P__create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value,
prop->create, prop->set, prop->get, prop->encode, prop->decode,
prop->del, prop->copy, prop->cmp, prop->close)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property")
@@ -4676,7 +4688,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
} /* end if */
/* Insert property into property list class */
- if(H5P_add_prop(dst_plist->props, new_prop) < 0)
+ if(H5P__add_prop(dst_plist->props, new_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class")
/* Increment property count for class */
@@ -4685,22 +4697,22 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
done:
/* Cleanup, if necessary */
- if(ret_value<0) {
- if(new_prop!=NULL)
- H5P_free_prop(new_prop);
+ if(ret_value < 0) {
+ if(new_prop != NULL)
+ H5P__free_prop(new_prop);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_copy_prop_plist() */
+} /* H5P__copy_prop_plist() */
/*--------------------------------------------------------------------------
NAME
- H5P_copy_prop_pclass
+ H5P__copy_prop_pclass
PURPOSE
Internal routine to copy a property from one class to another
USAGE
- herr_t H5P_copy_prop_pclass(dst_pclass, src_pclass, name)
+ herr_t H5P__copy_prop_pclass(dst_pclass, src_pclass, name)
H5P_genclass_t *dst_pclass; IN: Pointer to destination class
H5P_genclass_t *src_pclass; IN: Pointer to source class
const char *name; IN: Name of property to copy
@@ -4724,7 +4736,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name)
+H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name)
{
H5P_genclass_t *src_pclass; /* Source property class, containing property to copy */
H5P_genclass_t *dst_pclass; /* Destination property class */
@@ -4732,7 +4744,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name)
H5P_genprop_t *prop; /* Temporary property pointer */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(name);
@@ -4744,19 +4756,19 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "destination property class object doesn't exist")
/* Get the property from the source */
- if(NULL == (prop = H5P_find_prop_pclass(src_pclass, name)))
+ if(NULL == (prop = H5P__find_prop_pclass(src_pclass, name)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property")
/* If the property exists in the destination already */
- if(H5P_exist_pclass(dst_pclass, name)) {
+ if(H5P__exist_pclass(dst_pclass, name)) {
/* Delete the old property from the destination class */
- if(H5P_unregister(dst_pclass, name) < 0)
+ if(H5P__unregister(dst_pclass, name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property")
} /* end if */
/* Register the property into the destination */
orig_dst_pclass = dst_pclass;
- if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get,
+ if(H5P__register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get,
prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property")
@@ -4770,7 +4782,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name)
HDassert(old_dst_pclass == orig_dst_pclass);
/* Close the previous class */
- if(H5P_close_class(old_dst_pclass) < 0)
+ if(H5P__close_class(old_dst_pclass) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution")
} /* end if */
@@ -4778,16 +4790,16 @@ done:
/* Cleanup, if necessary */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_copy_prop_pclass() */
+} /* H5P__copy_prop_pclass() */
/*--------------------------------------------------------------------------
NAME
- H5P_unregister
+ H5P__unregister
PURPOSE
Internal routine to remove a property from a property list class.
USAGE
- herr_t H5P_unregister(pclass, name)
+ herr_t H5P__unregister(pclass, name)
H5P_genclass_t *pclass; IN: Property list class to modify
const char *name; IN: Name of property to remove
RETURNS
@@ -4803,12 +4815,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_unregister(H5P_genclass_t *pclass, const char *name)
+H5P__unregister(H5P_genclass_t *pclass, const char *name)
{
H5P_genprop_t *prop; /* Temporary property pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(pclass);
HDassert(name);
@@ -4822,7 +4834,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name)
HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list")
/* Free the property, ignoring return value, nothing we can do */
- H5P_free_prop(prop);
+ H5P__free_prop(prop);
/* Decrement the number of registered properties in class */
pclass->nprops--;
@@ -4832,7 +4844,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_unregister() */
+} /* H5P__unregister() */
/*--------------------------------------------------------------------------
@@ -4982,18 +4994,18 @@ H5P_close(void *_plist)
} /* end while */
/* Decrement class's dependent property list value! */
- if(H5P_access_class(plist->pclass,H5P_MOD_DEC_LST) < 0)
+ if(H5P__access_class(plist->pclass,H5P_MOD_DEC_LST) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count")
/* Free the list of 'seen' properties */
H5SL_close(seen);
- seen=NULL;
+ seen = NULL;
/* Free the list of deleted property names */
- H5SL_destroy(plist->del,H5P_free_del_name_cb,NULL);
+ H5SL_destroy(plist->del, H5P__free_del_name_cb, NULL);
/* Free the properties */
- H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb);
+ H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb);
/* Destroy property list object */
plist = H5FL_FREE(H5P_genplist_t, plist);
@@ -5046,11 +5058,11 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_get_class_path
+ H5P__get_class_path
PURPOSE
Internal routine to query the full path of a generic property list class
USAGE
- char *H5P_get_class_name(pclass)
+ char *H5P__get_class_name(pclass)
H5P_genclass_t *pclass; IN: Property list class to check
RETURNS
Success: Pointer to a malloc'ed string containing the full path of class
@@ -5066,11 +5078,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
char *
-H5P_get_class_path(H5P_genclass_t *pclass)
+H5P__get_class_path(H5P_genclass_t *pclass)
{
char *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(pclass);
@@ -5079,7 +5091,7 @@ H5P_get_class_path(H5P_genclass_t *pclass)
char *par_path; /* Parent class's full path */
/* Get the parent class's path */
- par_path = H5P_get_class_path(pclass->parent);
+ par_path = H5P__get_class_path(pclass->parent);
if(par_path != NULL) {
size_t ret_str_len;
@@ -5104,16 +5116,16 @@ H5P_get_class_path(H5P_genclass_t *pclass)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_get_class_path() */
+} /* H5P__get_class_path() */
/*--------------------------------------------------------------------------
NAME
- H5P_open_class_path
+ H5P__open_class_path
PURPOSE
Internal routine to open [a copy of] a class with its full path name
USAGE
- H5P_genclass_t *H5P_open_class_path(path)
+ H5P_genclass_t *H5P__open_class_path(path)
const char *path; IN: Full path name of class to open [copy of]
RETURNS
Success: Pointer to a generic property class object
@@ -5127,7 +5139,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
H5P_genclass_t *
-H5P_open_class_path(const char *path)
+H5P__open_class_path(const char *path)
{
char *tmp_path = NULL; /* Temporary copy of the path */
char *curr_name; /* Pointer to current component of path name */
@@ -5136,7 +5148,7 @@ H5P_open_class_path(const char *path)
H5P_check_class_t check_info; /* Structure to hold the information for checking duplicate names */
H5P_genclass_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(path);
@@ -5157,8 +5169,8 @@ H5P_open_class_path(const char *path)
check_info.new_class = NULL;
/* Find the class with this name & parent by iterating over the open classes */
- if(H5I_iterate(H5I_GENPROP_CLS, H5P_open_class_path_cb, &check_info, FALSE) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes")
+ if(H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes")
else if(NULL == check_info.new_class)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class")
@@ -5175,13 +5187,13 @@ H5P_open_class_path(const char *path)
check_info.new_class = NULL;
/* Find the class with this name & parent by iterating over the open classes */
- if(H5I_iterate(H5I_GENPROP_CLS, H5P_open_class_path_cb, &check_info, FALSE) < 0)
+ if(H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes")
else if(NULL == check_info.new_class)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class")
/* Copy it */
- if(NULL == (ret_value = H5P_copy_pclass(check_info.new_class)))
+ if(NULL == (ret_value = H5P__copy_pclass(check_info.new_class)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class")
done:
@@ -5189,16 +5201,16 @@ done:
H5MM_xfree(tmp_path);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_open_class_path() */
+} /* H5P__open_class_path() */
/*--------------------------------------------------------------------------
NAME
- H5P_get_class_parent
+ H5P__get_class_parent
PURPOSE
Internal routine to query the parent class of a generic property class
USAGE
- H5P_genclass_t *H5P_get_class_parent(pclass)
+ H5P_genclass_t *H5P__get_class_parent(pclass)
H5P_genclass_t *pclass; IN: Property class to check
RETURNS
Success: Pointer to the parent class of a property class
@@ -5212,11 +5224,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
H5P_genclass_t *
-H5P_get_class_parent(const H5P_genclass_t *pclass)
+H5P__get_class_parent(const H5P_genclass_t *pclass)
{
H5P_genclass_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(pclass);
@@ -5224,16 +5236,16 @@ H5P_get_class_parent(const H5P_genclass_t *pclass)
ret_value = pclass->parent;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_get_class_parent() */
+} /* H5P__get_class_parent() */
/*--------------------------------------------------------------------------
NAME
- H5P_close_class
+ H5P__close_class
PURPOSE
Internal routine to close a property list class.
USAGE
- herr_t H5P_close_class(class)
+ herr_t H5P__close_class(class)
H5P_genclass_t *class; IN: Property list class to close
RETURNS
Returns non-negative on success, negative on failure.
@@ -5245,7 +5257,7 @@ H5P_get_class_parent(const H5P_genclass_t *pclass)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_close_class(void *_pclass)
+H5P__close_class(void *_pclass)
{
H5P_genclass_t *pclass = (H5P_genclass_t *)_pclass;
herr_t ret_value = SUCCEED; /* Return value */
@@ -5255,12 +5267,12 @@ H5P_close_class(void *_pclass)
HDassert(pclass);
/* Decrement the reference count & check if the object should go away */
- if(H5P_access_class(pclass, H5P_MOD_DEC_REF) < 0)
+ if(H5P__access_class(pclass, H5P_MOD_DEC_REF) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't decrement ID ref count")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_close_class() */
+} /* H5P__close_class() */
/*-------------------------------------------------------------------------
@@ -5269,7 +5281,7 @@ done:
* Purpose: Create a new property list, of a given type
*
* Return: Success: ID of new property list
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* Thursday, August 2, 2012
@@ -5291,9 +5303,9 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
/* Check arguments */
if(type == H5P_TYPE_USER)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't create user property list");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "can't create user property list");
if(type == H5P_TYPE_ROOT)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "shouldn't be creating root class property list");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "shouldn't be creating root class property list");
/* Instantiate a property list of the proper type */
switch(type) {
@@ -5374,11 +5386,11 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
/* Get the class object */
if(NULL == (pclass = (H5P_genclass_t *)H5I_object(class_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class")
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property class")
/* Create the new property list */
if((ret_value = H5P_create_id(pclass, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5394,7 +5406,7 @@ done:
* H5P_genplist_t data structure)
*
* Return: Success: Non-negative ID of property list.
- * Failure: negative.
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol <koziol@hdfgroup.org>
* April 22, 2014
@@ -5442,30 +5454,20 @@ H5P_get_class(const H5P_genplist_t *plist)
/*-------------------------------------------------------------------------
- * Function: H5P_get_default
- *
- * Purpose: Get the default property list ID, for a property class.
+ * Function: H5P_ignore_cmp
*
- * Return: Success: Non-negative ID of property list.
- * Failure: negative.
+ * Purpose: Callback routine to ignore comparing property values.
*
- * Programmer: Quincey Koziol <koziol@lbl.gov>
- * December 29, 2017
+ * Return: zero
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5P_get_default(const H5P_libclass_t *libclass)
+int
+H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2,
+ size_t H5_ATTR_UNUSED size)
{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
-
- HDassert(libclass);
-
- ret_value = *libclass->def_plist_id;
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_get_default() */
+ FUNC_LEAVE_NOAPI(0)
+} /* end H5P_ignore_cmp() */
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 18b81ac..bedeed9 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -194,38 +194,38 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register property for number of links traversed */
- if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g,
+ if(H5P__register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g,
NULL, NULL, NULL, H5L_ACS_NLINKS_ENC, H5L_ACS_NLINKS_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link prefix */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g,
+ if(H5P__register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g,
NULL, H5L_ACS_ELINK_PREFIX_SET, H5L_ACS_ELINK_PREFIX_GET, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC,
H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register fapl for link access */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g,
+ if(H5P__register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g,
NULL, H5L_ACS_ELINK_FAPL_SET, H5L_ACS_ELINK_FAPL_GET, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC,
H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link file access flags */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g,
+ if(H5P__register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g,
NULL, NULL, NULL, H5L_ACS_ELINK_FLAGS_ENC, H5L_ACS_ELINK_FLAGS_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link file traversal callback */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g,
+ if(H5P__register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
#ifdef H5_HAVE_PARALLEL
/* Register the metadata collective read flag */
- if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g,
+ if(H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g,
NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -569,7 +569,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_
if(obj1 && obj2) {
herr_t status;
- status = H5P_cmp_plist(obj1, obj2, &ret_value);
+ status = H5P__cmp_plist(obj1, obj2, &ret_value);
HDassert(status >= 0);
} /* end if */
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 6508a82..16be52a 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Plcpl.c
- * May 8 2006
- * Peter Cao <xcao@ncsa.uiuc.edu>
+ * Created: H5Plcpl.c
*
- * Purpose: Link creation property list class routines
+ * Purpose: Link creation property list class routines
*
*-------------------------------------------------------------------------
*/
@@ -32,11 +30,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5Ppkg.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5Ppkg.h" /* Property lists */
/****************/
@@ -50,6 +48,31 @@
#define H5L_CRT_INTERMEDIATE_GROUP_ENC H5P__encode_unsigned
#define H5L_CRT_INTERMEDIATE_GROUP_DEC H5P__decode_unsigned
+/* ======== VOL specific properties ========= */
+/* Definitions for target object ID */
+#define H5L_CRT_TARGET_SIZE sizeof(void *)
+#define H5L_CRT_TARGET_DEF NULL
+
+/* Definitions for Location params */
+#define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t)
+#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {{HADDR_UNDEF}}}
+
+/* Definitions for target object NAME */
+#define H5L_CRT_TARGET_NAME_SIZE sizeof(char *)
+#define H5L_CRT_TARGET_NAME_DEF NULL
+
+/* Definitions for link type */
+#define H5L_CRT_LINK_TYPE_SIZE sizeof(link_type)
+#define H5L_CRT_LINK_TYPE_DEF H5L_TYPE_ERROR
+
+/* Definitions for UDATA */
+#define H5L_CRT_UDATA_SIZE sizeof(void *)
+#define H5L_CRT_UDATA_DEF NULL
+
+/* Definitions for UDATA_SIZE */
+#define H5L_CRT_UDATA_SIZE_SIZE sizeof(size_t)
+#define H5L_CRT_UDATA_SIZE_DEF 0
+
/******************/
/* Local Typedefs */
/******************/
@@ -120,16 +143,46 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF;
herr_t
H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ void* target = H5L_CRT_TARGET_DEF;
+ H5VL_loc_params_t loc_params = H5L_CRT_LOCATION_DEF;
+ char *target_name = H5L_CRT_TARGET_NAME_DEF;
+ H5L_type_t link_type = H5L_CRT_LINK_TYPE_DEF;
+ void *udata = H5L_CRT_UDATA_DEF;
+ size_t udata_size = H5L_CRT_UDATA_SIZE_DEF;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Register create intermediate groups property */
- if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g,
+ if(H5P__register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g,
NULL, NULL, NULL, H5L_CRT_INTERMEDIATE_GROUP_ENC, H5L_CRT_INTERMEDIATE_GROUP_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET, H5L_CRT_TARGET_SIZE, &target,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_LOC_PARAMS, H5L_CRT_LOCATION_SIZE, &loc_params,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_NAME, H5L_CRT_TARGET_NAME_SIZE, &target_name,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ if(H5P__register_real(pclass, H5VL_PROP_LINK_TYPE, H5L_CRT_LINK_TYPE_SIZE, &link_type,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA, H5L_CRT_UDATA_SIZE, &udata,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA_SIZE, H5L_CRT_UDATA_SIZE_SIZE, &udata_size,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_lcrt_reg_prop() */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index be41e32..c2bf6cb 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -165,25 +165,25 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register max. compact attribute storage property */
- if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g,
+ if(H5P__register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g,
NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register min. dense attribute storage property */
- if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g,
+ if(H5P__register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g,
NULL, NULL, NULL, H5O_CRT_ATTR_MIN_DENSE_ENC, H5O_CRT_ATTR_MIN_DENSE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register object header flags property */
- if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g,
+ if(H5P__register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g,
NULL, NULL, NULL, H5O_CRT_OHDR_FLAGS_ENC, H5O_CRT_OHDR_FLAGS_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the pipeline property */
- if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g,
+ if(H5P__register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g,
NULL, H5O_CRT_PIPELINE_SET, H5O_CRT_PIPELINE_GET, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC,
H5O_CRT_PIPELINE_DEL, H5O_CRT_PIPELINE_COPY, H5O_CRT_PIPELINE_CMP, H5O_CRT_PIPELINE_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -899,7 +899,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
filter = &pline.filter[idx];
/* Get filter information */
- if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
+ if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
/* Set return value */
@@ -952,7 +952,7 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid")
/* Get filter information */
- if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
+ if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info")
done:
@@ -1118,7 +1118,7 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_get_filter_by_id() */
+} /* end H5P_filter_in_pline() */
/*-------------------------------------------------------------------------
@@ -1292,7 +1292,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5P_get_filter
+ * Function: H5P__get_filter
*
* Purpose: Internal component of H5Pget_filter & H5Pget_filter_id
*
@@ -1304,12 +1304,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
+H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
size_t namelen, char name[]/*out*/,
unsigned *filter_config /*out*/)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments */
HDassert(filter);
@@ -1364,7 +1364,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
H5Z_get_filter_info(filter->id, filter_config);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5P_get_filter() */
+} /* end H5P__get_filter() */
/*-------------------------------------------------------------------------
@@ -1893,7 +1893,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
filter = &pline.filter[idx];
/* Get filter information */
- if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
+ if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
/* Set return value */
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 47bba05..666a945 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -161,20 +161,20 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register copy options property */
- if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g,
+ if(H5P__register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g,
NULL, NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register merge named dtype list property */
- if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g,
+ if(H5P__register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g,
NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET, H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC,
H5O_CPY_MERGE_COMM_DT_LIST_DEL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for callback when completing the search for a matching named datatype from the named dtype list */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g,
+ if(H5P__register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 60b2363..13f3b13 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -129,48 +129,48 @@ struct H5Z_filter_info_t;
/******************************/
/* Private functions, not part of the publicly documented API */
-H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
+H5_DLL H5P_genclass_t *H5P__create_class(H5P_genclass_t *par_class,
const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data);
-H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass);
-H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size,
+H5_DLL H5P_genclass_t *H5P__copy_pclass(H5P_genclass_t *pclass);
+H5_DLL herr_t H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size,
const 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_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close);
-H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t size,
+H5_DLL herr_t H5P__register(H5P_genclass_t **pclass, const char *name, size_t size,
const 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_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode,
H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close);
-H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop);
-H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod);
-H5_DLL htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name);
-H5_DLL herr_t H5P_get_size_plist(const H5P_genplist_t *plist, const char *name,
+H5_DLL herr_t H5P__add_prop(H5SL_t *props, H5P_genprop_t *prop);
+H5_DLL herr_t H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod);
+H5_DLL htri_t H5P__exist_pclass(H5P_genclass_t *pclass, const char *name);
+H5_DLL herr_t H5P__get_size_plist(const H5P_genplist_t *plist, const char *name,
size_t *size);
-H5_DLL herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name,
+H5_DLL herr_t H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name,
size_t *size);
-H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops);
-H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
-H5_DLL herr_t H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
+H5_DLL herr_t H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops);
+H5_DLL int H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
+H5_DLL herr_t H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2,
int *cmp_ret);
-H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop,
+H5_DLL int H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop,
int *idx, H5P_iterate_int_t iter_func, void *iter_data);
-H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
+H5_DLL int H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx,
H5P_iterate_int_t iter_func, void *iter_data);
-H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name);
-H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name);
-H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
-H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass);
-H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path);
-H5_DLL H5P_genclass_t *H5P_get_class_parent(const H5P_genclass_t *pclass);
-H5_DLL herr_t H5P_close_class(void *_pclass);
+H5_DLL herr_t H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name);
+H5_DLL herr_t H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name);
+H5_DLL herr_t H5P__unregister(H5P_genclass_t *pclass, const char *name);
+H5_DLL char *H5P__get_class_path(H5P_genclass_t *pclass);
+H5_DLL H5P_genclass_t *H5P__open_class_path(const char *path);
+H5_DLL H5P_genclass_t *H5P__get_class_parent(const H5P_genclass_t *pclass);
+H5_DLL herr_t H5P__close_class(void *_pclass);
H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name);
H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type);
@@ -194,14 +194,14 @@ H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, siz
H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value);
/* Private OCPL routines */
-H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter,
+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);
/* Testing functions */
#ifdef H5P_TESTING
-H5_DLL char *H5P_get_class_path_test(hid_t pclass_id);
-H5_DLL hid_t H5P_open_class_path_test(const char *path);
+H5_DLL char *H5P__get_class_path_test(hid_t pclass_id);
+H5_DLL hid_t H5P__open_class_path_test(const char *path);
#endif /* H5P_TESTING */
#endif /* _H5Ppkg_H */
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 1a2bb95..866f088 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -177,6 +177,7 @@ 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 herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info);
H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
void *free_info);
@@ -190,7 +191,6 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id,
unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
size_t namelen, char name[], unsigned *filter_config);
H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id);
-H5_DLL hid_t H5P_get_default(const H5P_libclass_t *pclass);
/* Query internal fields of the property list struct */
H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist);
@@ -205,6 +205,8 @@ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
H5D_fill_value_t *status);
H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type,
void *value);
+H5_DLL int H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2,
+ size_t H5_ATTR_UNUSED size);
#endif /* _H5Pprivate_H */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index c2f9b4c..2f094ea 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -313,6 +313,9 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id,
const void *driver_info);
H5_DLL hid_t H5Pget_driver(hid_t plist_id);
H5_DLL const void *H5Pget_driver_info(hid_t plist_id);
+H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
+H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id);
+H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info);
H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset);
H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset);
H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type);
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index fb91356..45343c6 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -130,7 +130,7 @@ H5P__strcrt_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register character encoding */
- if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g,
+ if(H5P__register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g,
NULL, NULL, NULL, H5P_STRCRT_CHAR_ENCODING_ENC, H5P_STRCRT_CHAR_ENCODING_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
diff --git a/src/H5Ptest.c b/src/H5Ptest.c
index 475a164..114b37b 100644
--- a/src/H5Ptest.c
+++ b/src/H5Ptest.c
@@ -35,11 +35,11 @@
/*--------------------------------------------------------------------------
NAME
- H5P_get_class_path_test
+ H5P__get_class_path_test
PURPOSE
Routine to query the full path of a generic property list class
USAGE
- char *H5P_get_class_name_test(pclass_id)
+ char *H5P__get_class_name_test(pclass_id)
hid_t pclass_id; IN: Property class to query
RETURNS
Success: Pointer to a malloc'ed string containing the full path of class
@@ -51,75 +51,75 @@
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path()
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__get_class_path()
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
char *
-H5P_get_class_path_test(hid_t pclass_id)
+H5P__get_class_path_test(hid_t pclass_id)
{
H5P_genclass_t *pclass; /* Property class to query */
char *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(NULL)
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class");
/* Get the property list class path */
- if(NULL == (ret_value = H5P_get_class_path(pclass)))
+ if(NULL == (ret_value = H5P__get_class_path(pclass)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_get_class_path_test() */
+} /* H5P__get_class_path_test() */
/*--------------------------------------------------------------------------
NAME
- H5P_open_class_path_test
+ H5P__open_class_path_test
PURPOSE
Routine to open a [copy of] a class with its full path name
USAGE
- hid_t H5P_open_class_name_test(path)
+ hid_t H5P__open_class_name_test(path)
const char *path; IN: Full path name of class to open [copy of]
RETURNS
Success: ID of generic property class
- Failure: NULL
+ Failure: H5I_INVALID_HID
DESCRIPTION
This routine opens [a copy] of the class indicated by the full path.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_open_class_path()
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__open_class_path()
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
-H5P_open_class_path_test(const char *path)
+H5P__open_class_path_test(const char *path)
{
H5P_genclass_t *pclass = NULL; /* Property class to query */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
- if (NULL == path || *path=='\0')
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid class path");
+ if(NULL == path || *path=='\0')
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid class path");
/* Open the property list class */
- if ((pclass=H5P_open_class_path(path))==NULL)
- HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to find class with full path");
+ if(NULL == (pclass = H5P__open_class_path(path)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path");
/* Get an atom for the class */
- if ((ret_value=H5I_register(H5I_GENPROP_CLS, pclass, TRUE))<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class");
+ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class");
done:
- if(ret_value<0 && pclass)
- H5P_close_class(pclass);
+ if(H5I_INVALID_HID == ret_value && pclass)
+ H5P__close_class(pclass);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_open_class_path_test() */
+} /* H5P__open_class_path_test() */
diff --git a/src/H5R.c b/src/H5R.c
index 95abc32..b7866b1 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -91,9 +91,9 @@
herr_t
H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
{
- H5G_loc_t loc; /* File location */
- H5S_t *space = NULL; /* Pointer to dataspace containing region */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
@@ -101,25 +101,33 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
/* Check args */
if (ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
- if (H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if (!name || !*name)
+ if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if (ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION)
+ if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION)
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported")
- if (space_id == (-1) && ref_type == H5R_DATASET_REGION)
+ if(space_id == (-1) && ref_type == H5R_DATASET_REGION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
- if (space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the file object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Create reference */
- if((ret_value = H5R__create(ref, &loc, name, ref_type, space)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference")
done:
@@ -157,34 +165,45 @@ done:
hid_t
H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_ref)
{
- H5G_loc_t loc; /* Group location */
- H5F_t *file = NULL; /* File object */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5I_type_t opened_type;
+ void *opened_obj = NULL;
+ H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref);
/* Check args */
- if (H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if (oapl_id < 0)
+ if(oapl_id < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
- if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
- if (_ref == NULL)
+ if(_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&oapl_id, H5P_CLS_DACC, obj_id, FALSE) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Get the file pointer from the entry */
- file = loc.oloc->file;
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
- /* Create reference */
- if((ret_value = H5R__dereference(file, oapl_id, ref_type, _ref)) < 0)
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_REF;
+ loc_params.loc_data.loc_by_ref.ref_type = ref_type;
+ loc_params.loc_data.loc_by_ref._ref = _ref;
+ loc_params.loc_data.loc_by_ref.lapl_id = oapl_id;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Dereference */
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object")
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rdereference2() */
@@ -216,29 +235,31 @@ done:
hid_t
H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
{
- H5G_loc_t loc; /* Object's group location */
- H5S_t *space = NULL; /* Dataspace object */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iRt*x", id, ref_type, ref);
/* Check args */
- if (H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if (ref_type != H5R_DATASET_REGION)
+ if(ref_type != H5R_DATASET_REGION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
- if (ref == NULL)
+ if(ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(id);
+
+ /* get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+
/* Get the dataspace with the correct region selected */
- if(NULL == (space = H5R__get_region(loc.oloc->file, ref)))
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace")
- /* Atomize */
- if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
-
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_region() */
@@ -271,22 +292,29 @@ herr_t
H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
H5O_type_t *obj_type)
{
- H5G_loc_t loc; /* Object location */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type);
/* Check args */
- if (H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if (ref == NULL)
+ if(ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
- /* Get the object information */
- if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0)
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(id);
+
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ /* Get the object type */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type")
done:
@@ -331,26 +359,29 @@ ssize_t
H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name,
size_t size)
{
- H5G_loc_t loc; /* Group location */
- H5F_t *file; /* File object */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size);
/* Check args */
- if (H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location")
- if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type")
- if (_ref == NULL)
+ if(_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer")
- /* Get the file pointer from the entry */
- file = loc.oloc->file;
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(id);
+
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get name */
- if((ret_value = H5R__get_name(file, id, ref_type, _ref, name, size)) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path")
done:
diff --git a/src/H5RS.c b/src/H5RS.c
index 0a3fff0..ae500c5 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -137,7 +137,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
H5RS_str_t *
-H5RS_wrap(char *s)
+H5RS_wrap(const char *s)
{
H5RS_str_t *ret_value; /* Return value */
@@ -148,7 +148,7 @@ H5RS_wrap(char *s)
HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the internal fields */
- ret_value->s = s;
+ ret_value->s = (char *)s;
ret_value->wrapped = 1;
ret_value->n = 1;
diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h
index f69624a..1d26a18 100644
--- a/src/H5RSprivate.h
+++ b/src/H5RSprivate.h
@@ -44,7 +44,7 @@ typedef struct H5RS_str_t H5RS_str_t;
/* Private routines */
/********************/
H5_DLL H5RS_str_t *H5RS_create(const char *s);
-H5_DLL H5RS_str_t *H5RS_wrap(char *s);
+H5_DLL H5RS_str_t *H5RS_wrap(const char *s);
H5_DLL H5RS_str_t *H5RS_own(char *s);
H5_DLL herr_t H5RS_decr(H5RS_str_t *rs);
H5_DLL herr_t H5RS_incr(H5RS_str_t *rs);
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index fb62430..827506e 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -42,6 +42,7 @@
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
#include "H5Oprivate.h" /* Object headers */
#include "H5Rpkg.h" /* References */
@@ -102,7 +103,8 @@
H5G_obj_t
H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
{
- H5G_loc_t loc; /* Object location */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
H5O_type_t obj_type; /* Object type */
H5G_obj_t ret_value; /* Return value */
@@ -110,16 +112,22 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
H5TRACE3("Go", "iRt*x", id, ref_type, ref);
/* Check args */
- if (H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location")
if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type")
if (ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer")
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(id);
+
+ /* Get the vol object */
+ if (NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier")
+
/* Get the object information */
- if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type")
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type")
/* Set return value */
ret_value = H5G_map_obj_type(obj_type);
@@ -148,27 +156,38 @@ done:
hid_t
H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
{
- H5G_loc_t loc; /* Group location */
- H5F_t *file = NULL; /* File object */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5I_type_t opened_type;
+ void *opened_obj = NULL;
+ H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref);
/* Check args */
- if (H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
if (_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
- /* Get the file pointer from the entry */
- file = loc.oloc->file;
+ /* Get the VOL object */
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+
+ loc_params.type = H5VL_OBJECT_BY_REF;
+ loc_params.loc_data.loc_by_ref.ref_type = ref_type;
+ loc_params.loc_data.loc_by_ref._ref = _ref;
+ loc_params.loc_data.loc_by_ref.lapl_id = H5P_DATASET_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Dereference */
+ if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object")
- /* Create reference */
- if((ret_value = H5R__dereference(file, H5P_DATASET_ACCESS_DEFAULT, ref_type, _ref)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable dereference object")
+ /* Get an atom for the object */
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Rint.c b/src/H5Rint.c
index acf6b56..365facd 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -221,8 +221,7 @@ H5R_term_package(void)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type,
- H5S_t *space)
+H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space)
{
H5G_loc_t obj_loc; /* Group hier. location of object */
H5G_name_t path; /* Object group hier. path */
@@ -230,7 +229,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type,
hbool_t obj_found = FALSE; /* Object location found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(_ref);
HDassert(loc);
@@ -335,7 +334,7 @@ done:
if (obj_found)
H5G_loc_free(&obj_loc);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__create() */
@@ -371,8 +370,7 @@ done:
Added a check for undefined reference pointer.
--------------------------------------------------------------------------*/
hid_t
-H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
- const void *_ref)
+H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_ref)
{
H5O_loc_t oloc; /* Object location */
H5G_name_t path; /* Path of object */
@@ -381,7 +379,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
H5O_type_t obj_type; /* Type of object */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(_ref);
HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
@@ -459,7 +457,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
if((ret_value = H5I_register(H5I_GROUP, group, TRUE)) < 0) {
H5G_close(group);
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register group")
- } /* end if */
+ }
break;
}
@@ -475,7 +473,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) {
H5T_close(type);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register datatype")
- } /* end if */
+ }
break;
}
@@ -492,7 +490,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) {
H5D_close(dset);
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset")
- } /* end if */
+ }
break;
}
@@ -504,7 +502,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
} /* end switch */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__dereference() */
@@ -536,9 +534,9 @@ H5R__get_region(H5F_t *file, const void *_ref)
const uint8_t *p; /* Pointer to OID to store */
H5HG_t hobjid; /* Heap object ID */
uint8_t *buf = NULL; /* Buffer to store serialized selection in */
- H5S_t *ret_value; /* Return value */
+ H5S_t *ret_value; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(_ref);
HDassert(file);
@@ -573,8 +571,8 @@ done:
if(buf)
H5MM_xfree(buf);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5R__get_region() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__get_region() */
/*--------------------------------------------------------------------------
@@ -607,7 +605,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref,
unsigned rc; /* Reference count of object */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(file);
HDassert(_ref);
@@ -662,7 +660,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref,
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_obj_type() */
@@ -694,14 +692,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
ssize_t
-H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref,
+H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref,
char *name, size_t size)
{
- hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */
H5O_loc_t oloc; /* Object location describing object for reference */
ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(f);
@@ -731,7 +728,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref,
UINT32DECODE(p, hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
- if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL)
+ if((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information")
/* Get the object oid for the dataset */
@@ -750,19 +747,11 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref,
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)")
} /* end switch */
- /* Retrieve file ID for name search */
- if ((file_id = H5F_get_id(f, FALSE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get file ID")
-
/* Get name, length, etc. */
- if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0)
+ if((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name")
done:
- /* Close file ID used for search */
- if (file_id > 0 && H5I_dec_ref(file_id) < 0)
- HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID")
-
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_name() */
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index fbbff50..1c1c8eb 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -50,15 +50,11 @@
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name,
- H5R_type_t ref_type, H5S_t *space);
-H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type,
- const void *_ref);
+H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space);
+H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref);
H5_DLL H5S_t *H5R__get_region(H5F_t *file, const void *_ref);
-H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type,
- const void *_ref, H5O_type_t *obj_type);
-H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type,
- const void *_ref, char *name, size_t size);
+H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type);
+H5_DLL ssize_t H5R__get_name(H5F_t *file, H5R_type_t ref_type, const void *_ref, char *name, size_t size);
#endif /* _H5Rpkg_H */
diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h
index 8c0ba8f..1bf2e92 100644
--- a/src/H5Rprivate.h
+++ b/src/H5Rprivate.h
@@ -20,11 +20,6 @@
#include "H5Rpublic.h"
/* Private headers needed by this file */
-#include "H5Fprivate.h" /* Files */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspaces */
-
/**************************/
/* Library Private Macros */
@@ -45,6 +40,5 @@
/* Library Private Prototypes */
/******************************/
-
#endif /* _H5Rprivate_H */
diff --git a/src/H5S.c b/src/H5S.c
index 88c2f72..4c11268 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1974,7 +1974,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5S_set_extent
*
- * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend
+ * Purpose: Modify the dimensions of a dataspace.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -2055,7 +2055,7 @@ H5S_has_extent(const H5S_t *ds)
/*-------------------------------------------------------------------------
* Function: H5S_set_extent_real
*
- * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend
+ * Purpose: Modify the dimensions of a dataspace.
*
* Return: Success: Non-negative
* Failure: Negative
diff --git a/src/H5SM.c b/src/H5SM.c
index 1bf6301..0fa3489 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -142,7 +142,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc)
/* Initialize master table */
if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table")
table->num_indexes = H5F_SOHM_NINDEXES(f);
table->table_size = H5SM_TABLE_SIZE(f);
@@ -209,11 +209,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc)
/* Allocate space for the table on disk */
if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, (hsize_t)table->table_size)))
- HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table")
/* Cache the new table */
if(H5AC_insert_entry(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache")
/* Record the address of the master table in the file */
H5F_SET_SOHM_ADDR(f, table_addr);
@@ -386,7 +386,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id)
done:
/* Release the master SOHM table */
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM_type_shared() */
@@ -424,11 +424,11 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr)
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Look up index for message type */
if((index_num = H5SM_get_index(table, type_id)) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index")
/* Retrieve heap address for index */
*fheap_addr = table->indexes[index_num].heap_addr;
@@ -436,7 +436,7 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr)
done:
/* Release the master SOHM table */
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM_get_fheap_addr() */
@@ -648,9 +648,9 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header)
/* Allocate list in memory */
if(NULL == (list = H5FL_CALLOC(H5SM_list_t)))
- HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_CALLOC(H5SM_sohm_t, num_entries)))
- HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Initialize messages in list */
for(x = 0; x < num_entries; x++)
@@ -661,11 +661,11 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header)
/* Allocate space for the list on disk */
if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, (hsize_t)header->list_size)))
- HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Put the list into the cache */
if(H5AC_insert_entry(f, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache")
/* Set return value */
ret_value = addr;
@@ -773,7 +773,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
/* Unprotect list in cache and release heap */
if(H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
*_list = list = NULL;
/* Delete the old list index (but not its heap, which the new index is
@@ -973,7 +973,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table,
done:
/* Release the master SOHM table, if we protected it */
if(my_table && my_table != table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), my_table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM_can_share() */
@@ -1081,7 +1081,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags,
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* "complex" sharing checks */
if((tri_ret = H5SM_can_share(f, table, &index_num, type_id, mesg)) < 0)
@@ -1103,7 +1103,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags,
*/
if(H5SM__write_mesg(f, open_oh, &(table->indexes[index_num]),
(defer_flags & H5SM_DEFER) != 0, type_id, mesg, &cache_flags) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message")
/* Set flags if this message was "written" without error and wasn't a
* 'defer' attempt; it is now either fully shared or "shareable".
@@ -1130,7 +1130,7 @@ done:
/* Release the master SOHM table */
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM_try_share() */
@@ -1254,15 +1254,15 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
/* Encode the message to be written */
if((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) == 0)
- HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size")
if(NULL == (encoding_buf = H5MM_malloc(buf_size)))
- HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding")
if(H5O_msg_encode(f, type_id, TRUE, (unsigned char *)encoding_buf, mesg) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared")
/* Open the fractal heap for this index */
if(NULL == (fheap = H5HF_open(f, header->heap_addr)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up a key for the message to be written */
key.file = f;
@@ -1285,14 +1285,14 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
/* The index is a list; get it from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, defer ? H5AC__READ_ONLY_FLAG : H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* See if the message is already in the index and get its location.
* Also record the first empty list position we find in case we need it
* later.
*/
if(H5SM__find_in_list(list, &key, &empty_pos, &list_pos) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
if(defer) {
if(list_pos != UFAIL)
@@ -1503,7 +1503,7 @@ done:
/* If we got a list out of the cache, release it (it is always dirty after writing a message) */
if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, defer ? H5AC__NO_FLAGS_SET : H5AC__DIRTIED_FLAG) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
if(encoding_buf)
encoding_buf = H5MM_xfree(encoding_buf);
@@ -1557,11 +1557,11 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg)
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and try to delete from it */
if((index_num = H5SM_get_index(table, type_id)) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index")
/* If mesg_buf is not NULL, the message's reference count has reached
* zero and any file space it uses needs to be freed. mesg_buf holds the
@@ -1572,7 +1572,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg)
/* Release the master SOHM table */
if(H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
table = NULL;
/* If buf was allocated, delete the message it holds. This message may
@@ -1590,7 +1590,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg)
done:
/* Release the master SOHM table (should only happen on error) */
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
/* Release any native message we decoded */
if(native_mesg)
@@ -1794,7 +1794,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
/* Open the heap for this type of message. */
if(NULL == (fheap = H5HF_open(f, header->heap_addr)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Get the message size and encoded message for the message to be deleted,
* either from its OH or from the heap.
@@ -1813,7 +1813,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
/* Get the encoded message */
if(H5SM__read_mesg(f, &key.message, fheap, open_oh, &buf_size, &encoding_buf) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up key for message to be deleted. */
key.file = f;
@@ -1833,13 +1833,13 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
/* If the index is stored as a list, get it from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* 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)
- HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
if(list->messages[list_pos].location == H5SM_IN_HEAP)
--(list->messages[list_pos].u.heap_loc.ref_count);
@@ -1859,7 +1859,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
* If it succeeds, a copy of the modified message will be returned.
*/
if(H5B2_modify(bt2, &key, H5SM__decr_ref, &message) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Point to the message */
message_ptr = &message;
@@ -1893,7 +1893,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
/* Remove the message from the heap if it was stored in the heap*/
if(old_loc == H5SM_IN_HEAP)
if(H5HF_remove(fheap, &(message_ptr->u.heap_loc.fheap_id)) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap")
/* Return the message's encoding so anything it references can be freed */
@@ -1905,7 +1905,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
/* Unprotect cache and release heap */
if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
list = NULL;
HDassert(fheap);
@@ -1929,7 +1929,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header,
done:
/* Release the SOHM list */
if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
/* Release the fractal heap & v2 B-tree if we opened them */
if(fheap && H5HF_close(fheap) < 0)
@@ -2068,7 +2068,7 @@ done:
/* Release the master SOHM table if we took it out of the cache */
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM_get_info() */
@@ -2180,16 +2180,16 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg,
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &tbl_cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and find the message in it */
if((index_num = H5SM_get_index(table, type_id)) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index")
header = &(table->indexes[index_num]);
/* Open the heap for this message type */
if(NULL == (fheap = H5HF_open(f, header->heap_addr)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up a SOHM message to correspond to the shared message passed in */
key.message.location = H5SM_IN_HEAP;
@@ -2198,7 +2198,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg,
/* Get the encoded message */
if(H5SM__read_mesg(f, &key.message, fheap, NULL, &buf_size, &encoding_buf) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up key for message to locate */
key.file = f;
@@ -2218,13 +2218,13 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg,
/* If the index is stored as a list, get it from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* 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)
- HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Copy the message */
message = list->messages[list_pos];
@@ -2243,7 +2243,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg,
if((msg_exists = H5B2_find(bt2, &key, H5SM_get_refcount_bt2_cb, &message)) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index")
if(!msg_exists)
- HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
} /* end else */
/* Set the refcount for the message */
@@ -2253,9 +2253,9 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg,
done:
/* Release resources */
if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
if(fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
if(bt2 && H5B2_close(bt2) < 0)
@@ -2418,11 +2418,11 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
oloc.file = f;
oloc.addr = mesg->u.mesg_loc.oh_addr;
if(H5O_open(&oloc) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header")
/* Load the object header from the cache */
if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header")
} /* end if */
else
oh = open_oh;
@@ -2559,11 +2559,11 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent,
if(table_vers == UFAIL)
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");
+ HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n");
if(num_indexes == UFAIL)
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");
+ HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n");
/* Check arguments. Version must be 0, the only version implemented so far */
if(table_vers > HDF5_SHAREDHEADER_VERSION)
@@ -2576,7 +2576,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent,
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
HDfprintf(stream, "%*sShared Message Master Table...\n", indent, "");
for(x = 0; x < num_indexes; ++x) {
@@ -2604,7 +2604,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent,
done:
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM_table_debug() */
@@ -2650,7 +2650,7 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent,
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &tbl_cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Determine which index the list is part of */
index_num = table->num_indexes;
@@ -2708,11 +2708,11 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent,
done:
if(fh && H5HF_close(fh) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap")
if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM_list_debug() */
@@ -2757,7 +2757,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info)
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get SOHM header size */
*hdr_size = table->table_size;
@@ -2771,7 +2771,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info)
if(NULL == (bt2 = H5B2_open(f, table->indexes[u].index_addr, f)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
- if(H5B2_size(bt2, &(ih_info->index_size)) < 0)
+ if(H5B2_size(bt2, &(ih_info->index_size)) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
/* Close the v2 B-tree */
@@ -2792,8 +2792,8 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info)
HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Get heap storage size */
- if(H5HF_size(fheap, &(ih_info->heap_size)) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
+ if(H5HF_size(fheap, &(ih_info->heap_size)) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
/* Close the fractal heap */
if(H5HF_close(fheap) < 0)
diff --git a/src/H5SMtest.c b/src/H5SMtest.c
index 490265c..0a6149d 100644
--- a/src/H5SMtest.c
+++ b/src/H5SMtest.c
@@ -113,7 +113,7 @@ H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count)
done:
/* Release resources */
if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5SM__get_mesg_count_test() */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 28395b1..3b77b98 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -46,7 +46,7 @@ static int H5S__all_unlim_dim(const H5S_t *space);
static htri_t H5S__all_is_contiguous(const H5S_t *space);
static htri_t H5S__all_is_single(const H5S_t *space);
static htri_t H5S__all_is_regular(const H5S_t *space);
-static void H5S__all_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
@@ -785,11 +785,11 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
PURPOSE
Adjust an "all" selection by subtracting an offset
USAGE
- void H5S__all_adjust_u(space, offset)
+ herr_t H5S__all_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
- None
+ Non-negative on success, negative on failure
DESCRIPTION
Moves selection by subtracting an offset from it.
GLOBAL VARIABLES
@@ -797,7 +797,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static void
+static herr_t
H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
{
FUNC_ENTER_STATIC_NOERR
@@ -806,7 +806,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
HDassert(space);
HDassert(offset);
- FUNC_LEAVE_NOAPI_VOID
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S__all_adjust_u() */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 7a6d1be..ed3fa45 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -92,7 +92,7 @@ static herr_t H5S__hyper_num_elem_non_unlim(const H5S_t *space,
static htri_t H5S__hyper_is_contiguous(const H5S_t *space);
static htri_t H5S__hyper_is_single(const H5S_t *space);
static htri_t H5S__hyper_is_regular(const H5S_t *space);
-static void H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
@@ -4203,7 +4203,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans,
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
- None
+ Non-negative on success, negative on failure
DESCRIPTION
Moves a hyperslab selection by subtracting an offset from it.
GLOBAL VARIABLES
@@ -4211,7 +4211,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans,
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static void
+static herr_t
H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
{
FUNC_ENTER_STATIC_NOERR
@@ -4238,7 +4238,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst);
} /* end if */
- FUNC_LEAVE_NOAPI_VOID
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__hyper_adjust_u() */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 2bd275a..935d279 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -879,7 +879,14 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
}
- MPI_Type_extent (inner_type, &inner_extent);
+ /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
+ * so we're using the MPI-2 version even though we don't need the lb
+ * value.
+ */
+ {
+ MPI_Aint unused_lb_arg;
+ MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent);
+ }
stride_in_bytes = inner_extent * (MPI_Aint)d[i].strid;
/* If the element count is larger than what a 32 bit integer can hold,
@@ -1500,7 +1507,14 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
}
}
- MPI_Type_extent (old_type, &old_extent);
+ /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
+ * so we're using the MPI-2 version even though we don't need the lb
+ * value.
+ */
+ {
+ MPI_Aint unused_lb_arg;
+ MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent);
+ }
/* Set up the arguments for MPI_Type_struct constructor */
type[0] = outer_type;
diff --git a/src/H5Snone.c b/src/H5Snone.c
index a46a71a..a8aaf7e 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -47,7 +47,7 @@ static int H5S__none_unlim_dim(const H5S_t *space);
static htri_t H5S_none_is_contiguous(const H5S_t *space);
static htri_t H5S_none_is_single(const H5S_t *space);
static htri_t H5S_none_is_regular(const H5S_t *space);
-static void H5S_none_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S_none_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
@@ -744,11 +744,11 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
PURPOSE
Adjust an "none" selection by subtracting an offset
USAGE
- void H5S_none_adjust_u(space, offset)
+ herr_t H5S_none_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
- None
+ Non-negative on success, negative on failure
DESCRIPTION
Moves selection by subtracting an offset from it.
GLOBAL VARIABLES
@@ -756,7 +756,7 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static void
+static herr_t
H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -765,7 +765,7 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
HDassert(space);
HDassert(offset);
- FUNC_LEAVE_NOAPI_VOID
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_none_adjust_u() */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 6ded287..d895f40 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -161,7 +161,7 @@ typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space);
/* Method to determine if current selection is "regular" */
typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space);
/* Method to adjust a selection by an offset */
-typedef void (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
+typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
/* Method to construct single element projection onto scalar dataspace */
typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset);
/* Method to construct selection projection onto/into simple dataspace */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index fb8e311..9924920 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -48,7 +48,7 @@ static int H5S__point_unlim_dim(const H5S_t *space);
static htri_t H5S_point_is_contiguous(const H5S_t *space);
static htri_t H5S_point_is_single(const H5S_t *space);
static htri_t H5S_point_is_regular(const H5S_t *space);
-static void H5S_point_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
@@ -686,7 +686,7 @@ done:
static htri_t
H5S_point_is_valid (const H5S_t *space)
{
- H5S_pnt_node_t *curr; /* Point information nodes */
+ H5S_pnt_node_t *curr; /* Point information nodes */
unsigned u; /* Counter */
htri_t ret_value = TRUE; /* Return value */
@@ -1354,11 +1354,11 @@ H5S_point_is_regular(const H5S_t *space)
PURPOSE
Adjust a "point" selection by subtracting an offset
USAGE
- void H5S_point_adjust_u(space, offset)
+ herr_t H5S_point_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
- None
+ Non-negative on success, negative on failure
DESCRIPTION
Moves a point selection by subtracting an offset from it.
GLOBAL VARIABLES
@@ -1366,7 +1366,7 @@ H5S_point_is_regular(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static void
+static herr_t
H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
{
H5S_pnt_node_t *node; /* Point node */
@@ -1396,7 +1396,7 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
node = node->next;
} /* end while */
- FUNC_LEAVE_NOAPI_VOID
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_adjust_u() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 15ce75d..32ac51a 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -259,7 +259,7 @@ H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p);
H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
H5_DLL htri_t H5S_select_is_regular(const H5S_t *space);
-H5_DLL void H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
+H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_intersection(const H5S_t *src_space,
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 09b474a..d7a5d29 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -131,6 +131,7 @@ H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
+H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
H5_DLL herr_t H5Sselect_all(hid_t spaceid);
H5_DLL herr_t H5Sselect_none(hid_t spaceid);
H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index ec74523..ea10517 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -89,6 +89,52 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
/*--------------------------------------------------------------------------
NAME
+ H5Sselect_copy
+ PURPOSE
+ Copy a selection from one dataspace to another
+ USAGE
+ herr_t H5Sselect_copy(dst, src)
+ hid_t dst; OUT: ID of the destination dataspace
+ hid_t src; IN: ID of the source dataspace
+
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Copies all the selection information (including offset) from the source
+ dataspace to the destination dataspace.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Sselect_copy(hid_t dst_id, hid_t src_id)
+{
+ H5S_t *src;
+ H5S_t *dst;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ii", dst_id, src_id);
+
+ /* Check args */
+ if(NULL == (src = (H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (dst = (H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Copy */
+ if(H5S_select_copy(dst, src, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Sselect_copy() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S_select_copy
PURPOSE
Copy a selection from one dataspace to another
@@ -893,11 +939,11 @@ H5S_select_is_regular(const H5S_t *space)
PURPOSE
Adjust a selection by subtracting an offset
USAGE
- void H5S_select_adjust_u(space, offset)
+ herr_t H5S_select_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
- None
+ Non-negative on success, negative on failure
DESCRIPTION
Moves a selection by subtracting an offset from it.
GLOBAL VARIABLES
@@ -908,18 +954,20 @@ H5S_select_is_regular(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-void
+herr_t
H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
{
+ herr_t ret_value = FAIL; /* Return value */
+
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(space);
HDassert(offset);
- (*space->select.type->adjust_u)(space, offset);
+ ret_value = (*space->select.type->adjust_u)(space, offset);
- FUNC_LEAVE_NOAPI_VOID
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_select_adjust_u() */
diff --git a/src/H5T.c b/src/H5T.c
index fa97506..cd54183 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -28,24 +28,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tpkg.h" /* Datatypes */
-
-/* Check for header needed for SGI floating-point code */
-#ifdef H5_HAVE_SYS_FPU_H
-#include <sys/fpu.h>
-#endif /* H5_HAVE_SYS_FPU_H */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -292,17 +288,13 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src,
- H5T_t *dst, H5T_lib_conv_t func);
-static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src,
- H5T_t *dst, H5T_conv_func_t *conv);
-static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src,
- H5T_t *dst, H5T_conv_t func);
+static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_lib_conv_t func);
+static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_func_t *conv);
+static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func);
static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst);
static herr_t H5T__set_size(H5T_t *dt, size_t size);
static herr_t H5T__close_cb(H5T_t *dt);
-static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst,
- const char *name, H5T_conv_func_t *conv);
+static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv);
/*****************************/
@@ -1391,7 +1383,7 @@ H5T_top_term_package(void)
if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
- fprintf(H5DEBUG(T), "H5T: conversion function "
+ HDfprintf(H5DEBUG(T), "H5T: conversion function "
"0x%08lx failed to free private data for "
"%s (ignored)\n",
(unsigned long)(path->conv.u.app_func), path->name);
@@ -1597,6 +1589,49 @@ H5T_term_package(void)
/*-------------------------------------------------------------------------
+ * Function: H5T__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on the datatype's ID
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__close_cb(H5T_t *dt)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(dt);
+ HDassert(dt->shared);
+
+ /* If this datatype is VOL-managed (i.e.: has a VOL object),
+ * close it through the VOL connector.
+ */
+ if(NULL != dt->vol_obj) {
+ /* Close the connector-managed datatype data */
+ if(H5VL_datatype_close(dt->vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
+
+ /* Free the VOL object */
+ if(H5VL_free_object(dt->vol_obj) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ dt->vol_obj = NULL;
+ } /* end if */
+
+ /* Close the datatype */
+ if(H5T_close(dt) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__close_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Tcreate
*
* Purpose: Create a new type and initialize it to reasonable values.
@@ -1626,15 +1661,15 @@ H5Tcreate(H5T_class_t type, size_t size)
/* check args. We support string (fixed-size or variable-length) now. */
if(size <= 0 && size != H5T_VARIABLE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive")
/* create the type */
if(NULL == (dt = H5T__create(type, size)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type")
/* Get an ID for the datatype */
if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID")
done:
FUNC_LEAVE_API(ret_value)
@@ -1644,33 +1679,27 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Tcopy
*
- * Purpose: Copies a datatype. The resulting datatype is not locked.
- * The datatype should be closed when no longer needed by
- * calling H5Tclose().
+ * Purpose: Copies a datatype. The resulting datatype is not locked.
+ * The datatype should be closed when no longer needed by
+ * calling H5Tclose().
*
- * Return: Success: The ID of a new datatype.
+ * Return: Success: The ID of a new datatype
*
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
- *
- * Modifications:
- *
- * Robb Matzke, 4 Jun 1998
- * The returned type is always transient and unlocked. If the TYPE_ID
- * argument is a dataset instead of a datatype then this function
- * returns a transient, modifiable datatype which is a copy of the
- * dataset's datatype.
+ * Note: The returned type is always transient and unlocked. If the
+ * TYPE_ID argument is a dataset instead of a datatype then
+ * this function returns a transient, modifiable datatype
+ * which is a copy of the dataset's datatype.
*
*-------------------------------------------------------------------------
*/
hid_t
H5Tcopy(hid_t type_id)
{
- H5T_t *dt; /* Pointer to the datatype to copy */
- H5T_t *new_dt = NULL;
- hid_t ret_value; /* Return value */
+ H5T_t *dt = NULL; /* Pointer to the datatype to copy */
+ H5T_t *new_dt = NULL;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", type_id);
@@ -1687,7 +1716,7 @@ H5Tcopy(hid_t type_id)
H5D_t *dset; /* Dataset for datatype */
/* The argument is a dataset handle */
- if(NULL == (dset = (H5D_t *)H5I_object(type_id)))
+ if(NULL == (dset = (H5D_t *)H5VL_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset")
if(NULL == (dt = H5D_typeof(dset)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the dataset datatype")
@@ -1702,6 +1731,7 @@ H5Tcopy(hid_t type_id)
case H5I_ATTR:
case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
case H5I_ERROR_CLASS:
@@ -1714,14 +1744,14 @@ H5Tcopy(hid_t type_id)
/* Copy datatype */
if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy")
/* Atomize result */
if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(new_dt && H5T_close_real(new_dt) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info")
@@ -1835,9 +1865,9 @@ H5Tlock(hid_t type_id)
H5TRACE1("e", "i", type_id);
/* Check args */
- if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if(H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state)
+ if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named datatype")
if(H5T_lock(dt, TRUE) < 0)
@@ -1972,15 +2002,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, November 29, 2000
*
- * Modifications:
- * Raymond Lu
- * 4 December 2009
- * Added a flag as a parameter to indicate whether the caller is
- * H5Tdetect_class. I also added the check for VL string type
- * just like the public function. Because we want to tell users
- * VL string is a string type but we treat it as a VL type
- * internally, H5T_detect_class needs to know where the caller
- * is from.
*-------------------------------------------------------------------------
*/
htri_t
@@ -2213,7 +2234,7 @@ H5Tget_super(hid_t type)
{
H5T_t *dt; /* Datatype to query */
H5T_t *super = NULL; /* Supertype */
- hid_t ret_value; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", type);
@@ -2226,7 +2247,7 @@ H5Tget_super(hid_t type)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register parent datatype")
done:
- if(ret_value < 0)
+ if(H5I_INVALID_HID == ret_value)
if(super && H5T_close_real(super) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release super datatype info")
@@ -2242,30 +2263,30 @@ done:
* the return value is an integer type.
*
* Return: Success: Data type for base data type.
- *
* Failure: NULL
*
* Programmer: Raymond Lu
- * October 9, 2002
+ * October 9, 2002
+ *
*-------------------------------------------------------------------------
*/
H5T_t *
H5T_get_super(const H5T_t *dt)
{
- H5T_t *ret_value=NULL;
+ H5T_t *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
HDassert(dt);
- if (!dt->shared->parent)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type");
- if (NULL==(ret_value=H5T_copy(dt->shared->parent, H5T_COPY_ALL)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type");
+ if(!dt->shared->parent)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type")
+ if(NULL == (ret_value = H5T_copy(dt->shared->parent, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5T_get_super() */
/*-------------------------------------------------------------------------
@@ -2289,7 +2310,7 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
FUNC_ENTER_STATIC
/* Check args */
- HDassert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers);
+ HDassert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers);
HDassert(name && *name);
HDassert(src);
HDassert(dst);
@@ -2354,8 +2375,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
if(NULL == (new_path = H5T__path_find_real(src, dst, name, conv)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path")
- /*
- * Notify all other functions to recalculate private data since some
+ /* Notify all other functions to recalculate private data since some
* functions might cache a list of conversion functions. For
* instance, the compound type converter caches a list of conversion
* functions for the members, so adding a new function should cause
@@ -2445,7 +2465,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
if((old_path->conv.u.app_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) {
#ifdef H5T_DEBUG
if(H5DEBUG(T))
- fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx "
+ HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx "
"failed to free private data for %s (ignored)\n",
(unsigned long)(old_path->conv.u.app_func), old_path->name);
#endif
@@ -2455,7 +2475,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
if((old_path->conv.u.lib_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) {
#ifdef H5T_DEBUG
if(H5DEBUG(T))
- fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx "
+ HDfprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx "
"failed to free private data for %s (ignored)\n",
(unsigned long)(old_path->conv.u.lib_func), old_path->name);
#endif
@@ -2627,7 +2647,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) {
#ifdef H5T_DEBUG
if(H5DEBUG(T))
- fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed "
+ HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed "
"to free private data for %s (ignored)\n",
(unsigned long)(path->conv.u.app_func), path->name);
#endif
@@ -2637,7 +2657,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) {
#ifdef H5T_DEBUG
if(H5DEBUG(T))
- fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed "
+ HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed "
"to free private data for %s (ignored)\n",
(unsigned long)(path->conv.u.lib_func), path->name);
#endif
@@ -3035,6 +3055,8 @@ H5T_decode(size_t buf_size, const unsigned char *buf)
if(H5T_set_loc(ret_value, NULL, H5T_LOC_MEMORY) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
+ /* No VOL object */
+ ret_value->vol_obj = NULL;
done:
/* Release fake file structure */
if(f && H5F_fake_free(f) < 0)
@@ -3085,7 +3107,7 @@ H5T__create(H5T_class_t type, size_t size)
/* Copy the default string datatype */
if(NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
/* Modify the datatype */
if(H5T__set_size(dt, size) < 0)
@@ -3151,13 +3173,16 @@ H5T__create(H5T_class_t type, size_t size)
case H5T_REFERENCE:
case H5T_NCLASSES:
default:
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "unknown data type class")
} /* end switch */
/* Set the size except VL string */
if(H5T_STRING != type || H5T_VARIABLE != size)
dt->shared->size = size;
+ /* No VOL object */
+ dt->vol_obj = NULL;
+
/* Set return value */
ret_value = dt;
@@ -3166,8 +3191,8 @@ done:
if(dt) {
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
dt = H5FL_FREE(H5T_t, dt);
- } /* end if */
- } /* end if */
+ }
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__create() */
@@ -3186,27 +3211,6 @@ done:
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modifications:
- *
- * Robb Matzke, 4 Jun 1998
- * Added the METHOD argument. If it's H5T_COPY_TRANSIENT then the
- * result will be an unlocked transient type. Otherwise if it's
- * H5T_COPY_ALL then the result is a named type if the original is a
- * named type, but the result is not opened. Finally, if it's
- * H5T_COPY_REOPEN and the original type is a named type then the result
- * is a named type and the type object header is opened again. The
- * H5T_COPY_REOPEN method is used when returning a named type to the
- * application.
- *
- * Robb Matzke, 22 Dec 1998
- * Now able to copy enumeration data types.
- *
- * Robb Matzke, 20 May 1999
- * Now able to copy opaque types.
- *
- * Pedro Vicente, <pvn@ncsa.uiuc.edu> 21 Sep 2002
- * Added a deep copy of the symbol table entry
- *
*-------------------------------------------------------------------------
*/
H5T_t *
@@ -3225,13 +3229,16 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Allocate space */
if(NULL == (new_dt = H5FL_MALLOC(H5T_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if(NULL == (new_dt->shared = H5FL_MALLOC(H5T_shared_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy shared information (entry information is copied last) */
*(new_dt->shared) = *(old_dt->shared);
+ /* No VOL object */
+ new_dt->vol_obj = NULL;
+
/* Check what sort of copy we are making */
switch (method) {
case H5T_COPY_TRANSIENT:
@@ -3265,7 +3272,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Open named datatype again */
if(H5O_open(&old_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type")
/* Insert opened named datatype into opened object list for the file */
if(H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE)<0)
@@ -3329,7 +3336,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
new_dt->shared->u.compnd.memb =
(H5T_cmemb_t *)H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t));
if (NULL == new_dt->shared->u.compnd.memb)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
@@ -3347,7 +3354,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Range check against compound member's offset */
if ((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype")
/* Apply the accumulated size change to the offset of the field */
new_dt->shared->u.compnd.memb[i].offset += (size_t) accum_change;
@@ -3362,7 +3369,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* check if we couldn't find a match */
if(old_match < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted")
} /* end if */
else
old_match = (int) i;
@@ -3378,7 +3385,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* Range check against datatype size */
if ((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype")
/* Apply the accumulated size change to the size of the compound struct */
new_dt->shared->size += (size_t) accum_change;
@@ -3396,7 +3403,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
new_dt->shared->u.enumer.value =
(uint8_t *)H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size);
if(NULL == new_dt->shared->u.enumer.value)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
new_dt->shared->u.enumer.nmembs * new_dt->shared->size);
for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) {
@@ -3410,7 +3417,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) {
/* H5T_copy converts any type into a memory type */
if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end if */
break;
@@ -3498,9 +3505,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_lock (H5T_t *dt, hbool_t immutable)
+H5T_lock(H5T_t *dt, hbool_t immutable)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3511,7 +3518,8 @@ H5T_lock (H5T_t *dt, hbool_t immutable)
dt->shared->state = immutable ? H5T_STATE_IMMUTABLE : H5T_STATE_RDONLY;
break;
case H5T_STATE_RDONLY:
- if (immutable) dt->shared->state = H5T_STATE_IMMUTABLE;
+ if(immutable)
+ dt->shared->state = H5T_STATE_IMMUTABLE;
break;
case H5T_STATE_IMMUTABLE:
case H5T_STATE_NAMED:
@@ -3559,6 +3567,9 @@ H5T__alloc(void)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
dt->shared->version = H5O_DTYPE_VERSION_1;
+ /* No VOL object initially */
+ dt->vol_obj = NULL;
+
/* Assign return value */
ret_value = dt;
@@ -3601,10 +3612,8 @@ H5T__free(H5T_t *dt)
/* Free the ID to name info */
H5G_name_free(&(dt->path));
- /*
- * Don't free locked datatypes.
- */
- if(H5T_STATE_IMMUTABLE==dt->shared->state)
+ /* Don't free locked datatypes */
+ if(H5T_STATE_IMMUTABLE == dt->shared->state)
HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype")
/* Close the datatype */
@@ -3613,7 +3622,7 @@ H5T__free(H5T_t *dt)
for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name);
(void)H5T_close_real(dt->shared->u.compnd.memb[i].type);
- } /* end for */
+ }
dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb);
dt->shared->u.compnd.nmembs = 0;
break;
@@ -3661,7 +3670,8 @@ done:
*
* Purpose: Frees a datatype and all associated memory.
*
- * Hote: Does _not_ deal with open hamed datatypes, etc.
+ * Note: Does _not_ deal with open named datatypes, etc. so this
+ * should never see a type managed by a VOL connector.
*
* Return: Non-negative on success/Negative on failure
*
@@ -3683,7 +3693,7 @@ H5T_close_real(H5T_t *dt)
/* Clean up resources, depending on shared state */
if(dt->shared->state != H5T_STATE_OPEN) {
if(H5T__free(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype")
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
} /* end if */
@@ -3700,41 +3710,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T__close_cb
- *
- * Purpose: Callback routine for closing a datatype ID. Closes the datatype
- * object that was attached to the ID.
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5T__close_cb(H5T_t *dt)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* check args */
- HDassert(dt && dt->shared);
-
- /* Call actual datatype close routine */
- if(H5T_close(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype");
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5T__close_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5T_close
+ * Function: H5T_close
*
- * Purpose: Frees a data type and all associated memory. Deals with
- * open named datatypes appropriately.
+ * Purpose: Frees a data type and all associated memory. Deals with
+ * open named datatypes appropriately.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Monday, December 8, 1997
@@ -3749,7 +3730,8 @@ H5T_close(H5T_t *dt)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
- HDassert(dt && dt->shared);
+ HDassert(dt);
+ HDassert(dt->shared);
/* Named datatype cleanups */
if(dt->shared->state == H5T_STATE_OPEN) {
@@ -3761,8 +3743,7 @@ H5T_close(H5T_t *dt)
HDassert(H5F_addr_defined(dt->sh_loc.u.loc.oh_addr));
HDassert(H5F_addr_defined(dt->oloc.addr));
- /*
- * If a named type is being closed then close the object header and
+ /* If a named type is being closed then close the object header and
* remove from the list of open objects in the file.
*/
@@ -3806,7 +3787,7 @@ H5T_close(H5T_t *dt)
/* Clean up resources */
if(H5T_close_real(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3855,14 +3836,14 @@ H5T__set_size(H5T_t *dt, size_t size)
if(dt->shared->parent) {
if(H5T__set_size(dt->shared->parent, size) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type")
/* Adjust size of datatype appropriately */
if(dt->shared->type==H5T_ARRAY)
dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem;
else if(dt->shared->type!=H5T_VLEN)
dt->shared->size = dt->shared->parent->shared->size;
- } /* end if */
+ }
else {
if (H5T_IS_ATOMIC(dt->shared)) {
offset = dt->shared->u.atomic.offset;
@@ -3876,7 +3857,7 @@ H5T__set_size(H5T_t *dt, size_t size)
offset = 8 * size - prec;
if (prec > 8*size)
prec = 8 * size;
- } /* end if */
+ }
else
prec = offset = 0;
@@ -3897,7 +3878,7 @@ H5T__set_size(H5T_t *dt, size_t size)
size_t max_size;
if((num_membs = H5T_get_nmembers(dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members")
if(num_membs) {
for(i = 0; i < (unsigned)num_membs; i++) {
@@ -3911,7 +3892,7 @@ H5T__set_size(H5T_t *dt, size_t size)
max_size = H5T__get_member_size(dt, max_index);
if(size < (max_offset + max_size))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ")
} /* end if */
/* Compound must not have been packed previously */
@@ -3931,7 +3912,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Get a copy of unsigned char type as the base/parent type */
if(NULL == (base = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype")
dt->shared->parent=H5T_copy(base,H5T_COPY_ALL);
/* change this datatype into a VL string */
@@ -3957,7 +3938,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Set up VL information */
if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
} /* end if */
else {
prec = 8 * size;
@@ -3973,8 +3954,8 @@ H5T__set_size(H5T_t *dt, size_t size)
if(dt->shared->u.atomic.u.f.sign >= prec+offset ||
dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset ||
dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first");
- } /* end if */
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first")
+ }
break;
case H5T_ENUM:
@@ -4000,7 +3981,7 @@ H5T__set_size(H5T_t *dt, size_t size)
if (H5T_IS_ATOMIC(dt->shared)) {
dt->shared->u.atomic.offset = offset;
dt->shared->u.atomic.prec = prec;
- } /* end if */
+ }
} /* end if */
/* Check if the new compound type is packed */
@@ -4038,7 +4019,7 @@ H5T_get_size(const H5T_t *dt)
HDassert(dt);
FUNC_LEAVE_NOAPI(dt->shared->size)
-}
+} /* end H5T_get_size() */
/*-------------------------------------------------------------------------
@@ -4113,7 +4094,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
for(u = 0; u < dt1->shared->u.compnd.nmembs; u++)
idx1[u] = idx2[u] = u;
if(dt1->shared->u.enumer.nmembs > 1) {
@@ -4199,7 +4180,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
for(u=0; u<dt1->shared->u.enumer.nmembs; u++)
idx1[u] = u;
if(dt1->shared->u.enumer.nmembs > 1) {
@@ -4615,7 +4596,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name,
if(H5T__conv_noop((hid_t)FAIL, (hid_t)FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) {
#ifdef H5T_DEBUG
if(H5DEBUG(T))
- fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n");
+ HDfprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n");
#endif
H5E_clear_stack(NULL); /*ignore the error*/
} /* end if */
@@ -4623,8 +4604,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name,
H5T_g.npaths = 1;
} /* end if */
- /*
- * Find the conversion path. If source and destination types are equal
+ /* Find the conversion path. If source and destination types are equal
* then use entry[0], otherwise do a binary search over the
* remaining entries.
*
@@ -4663,8 +4643,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name,
*/
old_npaths = H5T_g.npaths;
- /*
- * If we didn't find the path, if the caller is an API function specifying
+ /* If we didn't find the path, if the caller is an API function specifying
* a new hard conversion function, or if the caller is a private function
* specifying a new hard conversion and the path is a soft conversion, then
* create a new path and add the new function to the path.
@@ -4686,8 +4665,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name,
else
path = table;
- /*
- * If a hard conversion function is specified and none is defined for the
+ /* If a hard conversion function is specified and none is defined for the
* path, or the caller is an API function, or the caller is a private function but
* the existing path is a soft function, then add the new conversion to the path
* and initialize its conversion data.
@@ -4793,7 +4771,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name,
if((table->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) {
#ifdef H5T_DEBUG
if(H5DEBUG(T))
- fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n",
+ HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n",
(unsigned long)(path->conv.u.app_func), path->name);
#endif
H5E_clear_stack(NULL); /*ignore the failure*/
@@ -4803,7 +4781,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name,
if((table->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) {
#ifdef H5T_DEBUG
if(H5DEBUG(T))
- fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n",
+ HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n",
(unsigned long)(path->conv.u.lib_func), path->name);
#endif
H5E_clear_stack(NULL); /*ignore the failure*/
@@ -5028,7 +5006,7 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts,
H5_timer_end(&(tpath->stats.timer), &timer);
tpath->stats.ncalls++;
tpath->stats.nelmts += nelmts;
- } /* end if */
+ }
#endif
done:
@@ -5091,7 +5069,7 @@ done:
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5T_nameof(H5T_t *dt)
+H5T_nameof(const H5T_t *dt)
{
H5G_name_t *ret_value = NULL;
@@ -5150,14 +5128,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5T_is_named
*
- * Purpose: Check if a datatype is named.
- *
- * Return: TRUE
+ * Purpose: Check if a datatype is named/committed.
*
- * FALSE
+ * Return: TRUE/FALSE/FAIL
*
- * Programmer: Pedro Vicente
- * Tuesday, Sep 3, 2002
*-------------------------------------------------------------------------
*/
htri_t
@@ -5169,8 +5143,10 @@ H5T_is_named(const H5T_t *dt)
HDassert(dt);
- if(dt->shared->state == H5T_STATE_OPEN || dt->shared->state == H5T_STATE_NAMED)
+ if(dt->vol_obj)
ret_value = TRUE;
+ else
+ ret_value = (H5T_STATE_OPEN == dt->shared->state || H5T_STATE_NAMED == dt->shared->state);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5212,6 +5188,20 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f)
if(H5G_name_free(&dt->path) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path")
+ /* If the datatype is committed through the VOL, close it */
+ if(NULL != dt->vol_obj) {
+ H5VL_object_t *vol_obj = dt->vol_obj;
+
+ /* Close the datatype through the VOL*/
+ if(H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
+
+ /* Free the datatype and set the VOL object pointer to NULL */
+ if(H5VL_free_object(vol_obj) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ dt->vol_obj = NULL;
+ } /* end if */
+
dt->shared->state = H5T_STATE_TRANSIENT;
} /* end if */
@@ -5358,7 +5348,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Mark the VL, compound or array type */
if((changed=H5T_set_loc(dt->shared->parent,f,loc))<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed>0)
ret_value=changed;
@@ -5382,7 +5372,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Range check against compound member's offset */
if ((accum_change < 0) && ((ssize_t) dt->shared->u.compnd.memb[i].offset < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
/* Apply the accumulated size change to the offset of the field */
dt->shared->u.compnd.memb[i].offset += (size_t) accum_change;
@@ -5398,7 +5388,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Mark the VL, compound, enum or array type */
if((changed = H5T_set_loc(memb_type,f,loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
@@ -5407,7 +5397,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Fail if the old_size is zero */
if (0 == old_size)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero")
/* Adjust the size of the member */
dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size;
@@ -5420,7 +5410,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Range check against datatype size */
if ((accum_change < 0) && ((ssize_t) dt->shared->size < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
/* Apply the accumulated size change to the datatype */
dt->shared->size += (size_t) accum_change;
@@ -5432,14 +5422,14 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */
if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) {
if((changed = H5T_set_loc(dt->shared->parent,f,loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
} /* end if */
/* Mark this VL sequence */
if((changed = H5T__vlen_set_loc(dt, f, loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
break;
diff --git a/src/H5TS.c b/src/H5TS.c
index d239e09..10e14d5 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -359,7 +359,6 @@ H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
ret_value = FALSE;
#endif /* H5_HAVE_CODESTACK */
- /* Set up thread local storage */
if(TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc()))
ret_value = FALSE;
@@ -428,12 +427,9 @@ H5TS_win32_process_exit(void)
/* Clean up per-process thread local storage */
TlsFree(H5TS_errstk_key_g);
-
#ifdef H5_HAVE_CODESTACK
TlsFree(H5TS_funcstk_key_g);
#endif /* H5_HAVE_CODESTACK */
-
- /* Clean up per-process thread local storage */
TlsFree(H5TS_apictx_key_g);
return;
@@ -479,7 +475,6 @@ H5TS_win32_thread_exit(void)
LocalFree((HLOCAL)lpvData);
#endif /* H5_HAVE_CODESTACK */
- /* Clean up per-thread thread local storage */
lpvData = TlsGetValue(H5TS_apictx_key_g);
if(lpvData)
LocalFree((HLOCAL)lpvData);
@@ -534,3 +529,4 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata)
} /* H5TS_create_thread */
#endif /* H5_HAVE_THREADSAFE */
+
diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h
index 8d74676..9e093a6 100644
--- a/src/H5TSprivate.h
+++ b/src/H5TSprivate.h
@@ -128,3 +128,4 @@ H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t * att
#endif /* c_plusplus || __cplusplus */
#endif /* H5TSprivate_H_ */
+
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 1719f8f..712b264 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -30,12 +30,15 @@
#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory Management */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -56,11 +59,7 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id);
-static hid_t H5T__get_create_plist(const H5T_t *type);
static H5T_t *H5T__open_oid(const H5G_loc_t *loc);
-static herr_t H5T__flush(H5T_t *dt, hid_t type_id);
-static herr_t H5T__refresh(H5T_t *dt, hid_t type_id);
/*********************/
@@ -82,18 +81,21 @@ static herr_t H5T__refresh(H5T_t *dt, hid_t type_id);
/* Local Variables */
/*******************/
+/* Declare a free list to manage the H5VL_t struct */
+H5FL_EXTERN(H5VL_t);
+
+/* Declare a free list to manage the H5VL_object_t struct */
+H5FL_EXTERN(H5VL_object_t);
+
/*-------------------------------------------------------------------------
- * Function: H5Tcommit2
+ * Function: H5Tcommit2
*
- * Purpose: Save a transient datatype to a file and turn the type handle
- * into a "named", immutable type.
+ * Purpose: Save a transient datatype to a file and turn the type handle
+ * into a "named", immutable type.
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * April 5, 2007
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -101,20 +103,25 @@ herr_t
H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
hid_t tcpl_id, hid_t tapl_id)
{
- H5G_loc_t loc; /* Location to create datatype */
- H5T_t *type; /* Datatype for ID */
+ void *data = NULL; /* VOL-managed datatype data */
+ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */
+ H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*siiii", loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(H5T_is_named(dt))
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed")
/* Get correct property list */
if(H5P_DEFAULT == lcpl_id)
@@ -124,7 +131,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list")
/* Get correct property list */
- if(H5P_DEFAULT == tcpl_id)
+ if (H5P_DEFAULT == tcpl_id)
tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
else
if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
@@ -134,9 +141,27 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the object from the loc_id */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
/* Commit the type */
- if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+ if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+
+ /* Set up VOL object */
+ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure")
+ new_obj->connector = vol_obj->connector;
+ new_obj->connector->nrefs ++;
+ new_obj->data = data;
+
+ /* Set the committed type object to the VOL connector pointer in the H5T_t struct */
+ dt->vol_obj = new_obj;
done:
FUNC_LEAVE_API(ret_value)
@@ -165,7 +190,7 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt,
H5T_state_t old_state; /* The state of the datatype before H5T__commit. */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(loc);
@@ -196,7 +221,7 @@ done:
* to return it to the state it was in before it was committed.
*/
if(ret_value < 0 && (NULL != ocrt_info.new_obj)) {
- if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
+ if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
/* Remove the datatype from the list of opened objects in the file */
if(H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
@@ -214,49 +239,49 @@ done:
/* Mark datatype as being back in memory */
if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY))
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory")
- dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
+ dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
dt->shared->state = old_state;
- } /* end if */
+ } /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__commit_named() */
/*-------------------------------------------------------------------------
- * Function: H5Tcommit_anon
+ * Function: H5Tcommit_anon
*
- * Purpose: Save a transient datatype to a file and turn the type handle
- * into a "named", immutable type.
+ * Purpose: Save a transient datatype to a file and turn the type handle
+ * into a "named", immutable type.
*
* The resulting ID should be linked into the file with
* H5Olink or it will be deleted when closed.
*
- * Note: Datatype access property list is unused currently, but is
- * checked for sanity anyway.
+ * Note: The datatype access property list is unused currently, but
+ * is checked for sanity anyway.
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Peter Cao
- * May 17, 2005
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
{
- H5G_loc_t loc; /* Group location for location */
- H5T_t *type = NULL; /* Datatype created */
+ void *dt = NULL; /* datatype object created by VOL connector */
+ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */
+ H5T_t *type = NULL; /* Datatype created */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iiii", loc_id, type_id, tcpl_id, tapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(H5T_is_named(type))
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed")
/* Get correct property list */
if(H5P_DEFAULT == tcpl_id)
@@ -269,9 +294,27 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Commit the type */
- if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the file object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ /* Commit the datatype */
+ if(NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+
+ /* Setup VOL object */
+ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure")
+ new_obj->connector = vol_obj->connector;
+ new_obj->connector->nrefs ++;
+ new_obj->data = dt;
+
+ /* Set the committed type object to the VOL connector pointer in the H5T_t struct */
+ type->vol_obj = new_obj;
done:
FUNC_LEAVE_API(ret_value)
@@ -279,24 +322,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T__commit_anon
+ * Function: H5T__commit_anon
*
- * Purpose: Create an anonymous committed datatype.
+ * Purpose: Create an anonymous committed datatype.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Tuesday, December 12, 2017
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id)
{
H5O_loc_t *oloc; /* Object location for datatype */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(file);
@@ -305,7 +348,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id)
/* Commit the type */
if(H5T__commit(file, type, tcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* Release the datatype's object header */
@@ -318,7 +361,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5T__commit_anon() */
@@ -394,9 +437,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id)
* type message and then give the object header a name.
*/
if(H5O_create(file, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
/* Copy the new object header's location into the datatype, taking ownership of it */
if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0)
@@ -444,23 +487,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Tcommitted
- *
- * Purpose: Determines if a datatype is committed or not.
+ * Function: H5Tcommitted
*
- * Return: Success: TRUE if committed, FALSE otherwise.
+ * Purpose: Determines if a datatype is committed or not.
*
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Thursday, June 4, 1998
+ * Return: TRUE/FALSE/FAIL
*
*-------------------------------------------------------------------------
*/
htri_t
H5Tcommitted(hid_t type_id)
{
- H5T_t *type; /* Datatype to query */
+ H5T_t *type; /* Datatype to query */
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -468,10 +506,10 @@ H5Tcommitted(hid_t type_id)
/* Check arguments */
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Set return value */
- ret_value = H5T_committed(type);
+ ret_value = H5T_is_named(type);
done:
FUNC_LEAVE_API(ret_value)
@@ -479,30 +517,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_committed
- *
- * Purpose: Determines if a datatype is committed or not.
- *
- * Return: Success: TRUE if committed, FALSE otherwise.
- *
- * Programmer: Quincey Koziol
- * Wednesday, September 24, 2003
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5T_committed(const H5T_t *type)
-{
- /* Use no-init for efficiency */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(type);
-
- FUNC_LEAVE_NOAPI(H5T_STATE_OPEN == type->shared->state || H5T_STATE_NAMED == type->shared->state)
-} /* end H5T_committed() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5T_link
*
* Purpose: Adjust the link count for an object header by adding
@@ -521,14 +535,14 @@ H5T_link(const H5T_t *type, int adjust)
{
int ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI((-1))
HDassert(type);
HDassert(type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED);
/* Adjust the link count on the named datatype */
if((ret_value = H5O_link(&type->oloc, adjust)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, FAIL, "unable to adjust named datatype link count")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, (-1), "unable to adjust named datatype link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -536,99 +550,118 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Topen2
+ * Function: H5Topen2
*
- * Purpose: Opens a named datatype using a Datatype Access Property
+ * Purpose: Opens a named datatype using a Datatype Access Property
* List.
*
- * Return: Success: Object ID of the named datatype.
- * Failure: Negative
+ * Return: Success: Object ID of the named datatype
*
- * Programmer: James Laird
- * Thursday July 27, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
{
- H5T_t *type = NULL; /* Datatype opened in file */
- H5G_loc_t loc; /* Group location of object to open */
+ void *dt = NULL; /* datatype token created by VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, tapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
+ if(!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
+ if(!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Open it */
- if(NULL == (type = H5T__open_name(&loc, name)))
+ /* Fill in location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+
+ /* Open the datatype */
+ if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype")
/* Register the type and return the ID */
- if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
done:
/* Cleanup on error */
- if(ret_value < 0)
- if(type != NULL)
- (void)H5T_close(type);
+ if(H5I_INVALID_HID == ret_value)
+ if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
FUNC_LEAVE_API(ret_value)
} /* end H5Topen2() */
/*-------------------------------------------------------------------------
- * Function: H5Tget_create_plist
- *
- * Purpose: Returns a copy of the datatype creation property list.
+ * Function: H5Tget_create_plist
*
- * Note: There are no datatype creation properties currently, just
- * object creation ones.
+ * Purpose: Returns a copy of the datatype creation property list.
*
- * Return: Success: ID for a copy of the datatype creation
- * property list. The property list ID should be
- * released by calling H5Pclose().
+ * Note: There are no datatype creation properties currently, just
+ * object creation ones.
*
- * Failure: FAIL
+ * Return: Success: ID for a copy of the datatype creation
+ * property list. The property list ID should be
+ * released by calling H5Pclose().
*
- * Programmer: Quincey Koziol
- * Tuesday, November 28, 2006
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
H5Tget_create_plist(hid_t dtype_id)
{
- H5T_t *type; /* Datatype object for ID */
- herr_t status; /* Generic status value */
- hid_t ret_value = FAIL; /* Return value */
+ H5T_t *type = NULL; /* Datatype object for ID */
+ htri_t is_named = FAIL; /* Is the datatype named? */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dtype_id);
/* Check arguments */
if(NULL == (type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype")
/* Check if the datatype is committed */
- if((status = H5T_committed(type)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check whether datatype is committed")
+ if(FAIL == (is_named = H5T_is_named(type)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't check whether datatype is committed")
- /* Retrieve further information, if the datatype is committed */
- if(status > 0)
- /* Retrieve datatype creation properties */
- if((ret_value = H5T__get_create_plist(type)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info")
+ /* If the datatype is not committed/named, just copy the default
+ * creation property list and return that.
+ */
+ if(FALSE == is_named) {
+ H5P_genplist_t *tcpl_plist = NULL;
+
+ /* Copy the default datatype creation property list */
+ if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list")
+ if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list")
+ } /* end if */
+ /* If the datatype is committed, retrieve further information */
+ else {
+ H5VL_object_t *vol_obj = type->vol_obj;
+
+ /* 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)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info")
+ } /* end else */
done:
FUNC_LEAVE_API(ret_value)
@@ -667,8 +700,9 @@ H5Tflush(hid_t type_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Flush metadata for named datatype */
- if(H5T__flush(dt, type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush 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)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
done:
FUNC_LEAVE_API(ret_value)
@@ -706,9 +740,10 @@ H5Trefresh(hid_t type_id)
if(H5CX_set_loc(type_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Call private function to refresh datatype object */
- if((H5T__refresh(dt, type_id)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+ /* 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)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
done:
FUNC_LEAVE_API(ret_value)
@@ -716,50 +751,50 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T__get_create_plist
+ * Function: H5T__get_create_plist
*
- * Purpose: Returns a copy of the datatype creation property list.
+ * Purpose: Returns a copy of the datatype creation property list.
*
- * Note: There are no datatype creation properties currently, just
- * object creation ones.
+ * Note: There are no datatype creation properties currently, just
+ * object creation ones.
*
- * Return: Success: ID for a copy of the datatype creation
- * property list. The property list ID should be
- * released by calling H5Pclose().
+ * Return: Success: ID for a copy of the datatype creation
+ * property list. The property list ID should be
+ * released by calling H5Pclose().
*
- * Failure: FAIL
+ * Failure: H5I_INVALID_HID
*
* Programmer: Quincey Koziol
* Wednesday, December 13, 2017
*
*-------------------------------------------------------------------------
*/
-static hid_t
+hid_t
H5T__get_create_plist(const H5T_t *type)
{
H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */
H5P_genplist_t *new_plist; /* New datatype creation property list */
hid_t new_tcpl_id = FAIL; /* New datatype creation property list */
- hid_t ret_value = FAIL; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(type);
/* Copy the default datatype creation property list */
if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get default creation property list")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list")
if((new_tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list")
/* Get property list object for new TCPL */
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_tcpl_id)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get property list")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list")
/* Retrieve any object creation properties */
if(H5O_get_create_plist(&type->oloc, new_plist) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info")
/* Set the return value */
ret_value = new_tcpl_id;
@@ -768,9 +803,9 @@ done:
if(ret_value < 0)
if(new_tcpl_id > 0)
if(H5I_dec_app_ref(new_tcpl_id) < 0)
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object")
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, "unable to close temporary object")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_create_plist() */
@@ -798,7 +833,7 @@ H5T__open_name(const H5G_loc_t *loc, const char *name)
hbool_t obj_found = FALSE; /* Object at 'name' found */
H5T_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(loc);
@@ -836,7 +871,7 @@ done:
if(H5G_loc_free(&type_loc) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__open_name() */
@@ -891,6 +926,7 @@ H5T_open(const H5G_loc_t *loc)
else {
if(NULL == (dt = H5FL_MALLOC(H5T_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype")
+ dt->vol_obj = NULL;
#if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG)
/* Clear object location */
@@ -983,11 +1019,11 @@ H5T__open_oid(const H5G_loc_t *loc)
/* Open named datatype object in file */
if(H5O_open(loc->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype")
/* Deserialize the datatype message into a datatype in memory */
if(NULL == (dt = (H5T_t *)H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header")
/* Mark the type as named and open */
dt->shared->state = H5T_STATE_OPEN;
@@ -1042,71 +1078,204 @@ H5T_update_shared(H5T_t *dt)
/*-------------------------------------------------------------------------
- * Function: H5T__flush
+ * Function: H5T_construct_datatype
*
- * Purpose: Internal routine to flushes a named datatype to disk.
+ * Purpose: Create a Library datatype with a connector specific datatype object
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
+ * Return: Success: A type structure
+ * Failure: NULL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ *-------------------------------------------------------------------------
+ */
+H5T_t *
+H5T_construct_datatype(H5VL_object_t *vol_obj)
+{
+ ssize_t nalloc;
+ void *buf = NULL;
+ H5T_t *dt = NULL; /* datatype token from VOL connector */
+ 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)
+ 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)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype")
+
+ /* 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)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype")
+
+ if(NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't decode datatype")
+
+ dt->vol_obj = vol_obj;
+
+ ret_value = dt;
+
+done:
+ if(buf)
+ buf = H5MM_xfree(buf);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_construct_datatype() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_get_named_type
*
- * Programmer: Quincey Koziol
- * December 18, 2017
+ * Purpose: Returns the VOL object for the named datatype if it exists
+ *
+ * Return: Success: Pointer to the VOL object for the datatype
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5T__flush(H5T_t *dt, hid_t type_id)
+H5VL_object_t *
+H5T_get_named_type(const H5T_t *dt)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
- /* Sanity check */
- HDassert(dt);
+ if(NULL != dt->vol_obj)
+ ret_value = dt->vol_obj;
- /* To flush metadata and invoke flush callback if there is */
- if(H5O_flush_common(&dt->oloc, type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_get_named_type() */
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5T__flush */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_get_actual_type
+ *
+ * Purpose: Returns underlying native datatype created by native connector
+ * if datatype is committed, otherwise return the datatype
+ * object associate with the ID.
+ *
+ * Return: Success: Pointer to the VOL-managed data for this datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_t *
+H5T_get_actual_type(H5T_t *dt)
+{
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check if the datatype is committed */
+ if(NULL == dt->vol_obj)
+ ret_value = dt;
+ else
+ ret_value = (H5T_t *)H5VL_object_data(dt->vol_obj);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_get_actual_type() */
/*-------------------------------------------------------------------------
- * Function: H5T__refresh
+ * Function: H5T_save_refresh_state
+ *
+ * Purpose: Save state for datatype reconstuction after a refresh.
*
- * Purpose: Internal routine to refresh a named datatype.
+ * Return: SUCCEED/FAIL
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_save_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared)
+{
+ H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */
+ H5T_t *vol_dt = NULL; /* H5T_t pointer stored in the datatype's vol_obj field */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(cached_H5O_shared);
+
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not a datatype ID")
+ vol_dt = (H5T_t *)(dt->vol_obj->data);
+ if(NULL == vol_dt)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID")
+
+ /* Increase the count on the file object */
+ vol_dt->shared->fo_count += 1;
+
+ /* Increment object count for the object in the top file */
+ if(H5FO_top_incr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't increment object count")
+
+ /* Cache the H5O_shared_t data */
+ HDmemcpy(cached_H5O_shared, &(vol_dt->sh_loc), sizeof(H5O_shared_t));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_save_refresh_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_restore_refresh_state
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Purpose: Restore state for datatype reconstuction after a refresh.
*
- * Programmer: Quincey Koziol
- * December 18, 2017
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5T__refresh(H5T_t *dt, hid_t type_id)
+herr_t
+H5T_restore_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared)
{
+ H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */
+ H5T_t *vol_dt = NULL; /* H5T_t pointer stored in the datatype's vol_obj field */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_NOAPI(FAIL)
- /* Sanity check */
- HDassert(dt);
+ HDassert(cached_H5O_shared);
+
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid not a datatype ID")
+ vol_dt = (H5T_t *)(dt->vol_obj->data);
+ if(NULL == vol_dt)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID")
+
+ /* Restore the H5O_shared_t data */
+ HDmemcpy(&(vol_dt->sh_loc), cached_H5O_shared, sizeof(H5O_shared_t));
- /* Call private function to refresh datatype object */
- if((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+ /* Decrement the ref. count for this object in the top file */
+ if(H5FO_top_decr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement object count")
+
+ /* Decrease the count on the file object */
+ vol_dt->shared->fo_count -= 1;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5T__refresh */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_restore_refresh_state() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_already_vol_managed
+ *
+ * Purpose: Check if the committed datatype is already VOL managed
+ *
+ * Return: TRUE / FALSE
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5T_already_vol_managed(const H5T_t *dt)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(dt);
+
+ FUNC_LEAVE_NOAPI( dt->vol_obj != NULL )
+} /* end H5T_already_vol_managed() */
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index feece57..d4f1008 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -202,7 +202,7 @@ done:
* modifying the returned datatype does not
* modify the member type.
*
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
@@ -221,17 +221,17 @@ H5Tget_member_type(hid_t type_id, unsigned membno)
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype")
if(membno >= dt->shared->u.compnd.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number")
/* Retrieve the datatype for the member */
if(NULL == (memb_dt = H5T_get_member_type(dt, membno, H5T_COPY_REOPEN)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type")
/* Get an ID for the datatype */
if((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom")
done:
if(ret_value < 0)
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 803a6da..e6d83bb 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2962,7 +2962,7 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
src_parent = src->shared->parent;
if(NULL == (tpath = H5T_path_find(src_parent, dst))) {
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype")
} else if(!H5T_path_noop(tpath)) {
if((src_parent_id = H5I_register(H5I_DATATYPE, H5T_copy(src_parent, H5T_COPY_ALL), FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
@@ -7480,7 +7480,7 @@ H5T__conv_llong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
*
*-------------------------------------------------------------------------
*/
-#if H5T_CONV_INTERNAL_LLONG_LDOUBLE
+#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE
herr_t
H5T__conv_llong_ldouble (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,
@@ -7548,7 +7548,7 @@ H5T__conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
*
*-------------------------------------------------------------------------
*/
-#if H5T_CONV_INTERNAL_ULLONG_LDOUBLE
+#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE
herr_t
H5T__conv_ullong_ldouble (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,
@@ -8244,7 +8244,7 @@ H5_GCC_DIAG_ON(float-equal)
*
*-------------------------------------------------------------------------
*/
-#if H5T_CONV_INTERNAL_LDOUBLE_LLONG
+#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG
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,
@@ -8295,14 +8295,6 @@ H5_GCC_DIAG_ON(float-equal)
* Programmer: Raymond Lu
* Wednesday, Jan 21, 2004
*
- * Raymond Lu
- * Wednesday, April 21, 2004
- * There is a new design for exception handling like overflow,
- * which is passed in as a transfer property.
- *
- * Raymond Lu
- * Monday, March 13, 2006
- * Added support for VAX floating-point types.
*-------------------------------------------------------------------------
*/
herr_t
@@ -9008,8 +9000,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
#endif
- /*
- * Put the data in little endian order so our loops aren't so
+ /* Put the data in little endian order so our loops aren't so
* complicated. We'll do all the conversion stuff assuming
* little endian and then we'll fix the order at the end.
*/
@@ -9022,26 +9013,23 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
}
- /*zero-set all destination bits*/
+ /* Zero-set all destination bits*/
H5T__bit_set (d, dst.offset, dst.prec, FALSE);
/* Copy source into a temporary buffer */
H5T__bit_copy(int_buf, (size_t)0, s, src.offset, src.prec);
- /*
- * Find the sign bit value of the source.
- */
+ /* Find the sign bit value of the source */
if(H5T_SGN_2 == src.u.i.sign)
sign = (size_t)H5T__bit_get_d(int_buf, src.prec - 1, (size_t)1);
- /*
- * What is the bit position(starting from 0 as first one) for the most significant
- * bit(MSB) of S which is set?
+ /* What is the bit position(starting from 0 as first one) for the most significant
+ * bit(MSB) of S which is set?
*/
if(H5T_SGN_2 == src.u.i.sign) {
sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE);
if(sign && sfirst < 0)
- /* The case 0x80...00, which is negative with maximal value */
+ /* The case 0x80...00, which is negative with maximal value */
is_max_neg = 1;
} else if(H5T_SGN_NONE == src.u.i.sign)
sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, TRUE);
@@ -9050,9 +9038,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if(!sign && sfirst < 0)
goto padding;
- /*
- * Convert source integer if it's negative
- */
+ /* Convert source integer if it's negative */
if(H5T_SGN_2 == src.u.i.sign && sign) {
if(!is_max_neg) {
/* Equivalent to ~(i - 1) */
@@ -9060,10 +9046,10 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T__bit_neg(int_buf, (size_t)0, buf_size * 8);
sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE);
} else {
- /* If it's maximal negative number 0x80...000, treat it as if it overflowed
- * (create a carry) to help conversion. i.e. a character type number 0x80
- * is treated as 0x100.
- */
+ /* If it's maximal negative number 0x80...000, treat it as if it overflowed
+ * (create a carry) to help conversion. i.e. a character type number 0x80
+ * is treated as 0x100.
+ */
sfirst = (ssize_t)(src.prec - 1);
is_max_neg = 0;
}
@@ -9072,7 +9058,8 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Sign bit has been negated if bit vector isn't 0x80...00. Set all bits in front of
* sign bit to 0 in the temporary buffer because they're all negated from the previous
- * step. */
+ * step.
+ */
H5T__bit_set(int_buf, src.prec, (buf_size * 8) - src.prec, 0);
/* Set sign bit in destination */
@@ -9081,14 +9068,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
first = (size_t)sfirst;
- /*
- * Calculate the true destination exponent by adjusting according to
+ /* Calculate the true destination exponent by adjusting according to
* the destination exponent bias. Implied and non-implied normalization
* should be the same.
*/
if (H5T_NORM_NONE==dst.u.f.norm || H5T_NORM_IMPLIED==dst.u.f.norm) {
expo = first + dst.u.f.ebias;
- } else {
+ }
+ else {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet")
}
@@ -9096,13 +9083,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if (H5T_NORM_IMPLIED==dst.u.f.norm) {
/* Imply first bit */
H5T__bit_set(int_buf, first, (size_t)1, 0);
- } else if (H5T_NORM_NONE==dst.u.f.norm) {
- first++;
+ }
+ else if (H5T_NORM_NONE==dst.u.f.norm) {
+ first++;
}
/* Roundup for mantissa */
if(first > dst.u.f.msize) {
- /* If the bit sequence is bigger than the mantissa part, there'll be some
+ /* If the bit sequence is bigger than the mantissa part, there'll be some
* precision loss. Let user's handler deal with the case if it's present
*/
if(cb_struct.func) {
@@ -9114,14 +9102,15 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if(except_ret == H5T_CONV_HANDLED) {
reverse = FALSE;
goto padding;
- } else if(except_ret == H5T_CONV_ABORT)
+ }
+ else if(except_ret == H5T_CONV_ABORT)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
- /* If user's exception handler does deal with it, we do it by dropping off the
- * extra bits at the end and do rounding. If we have .50...0(decimal) after radix
- * point, we do roundup when the least significant digit before radix is odd, we do
- * rounddown if it's even.
- */
+ /* If user's exception handler does deal with it, we do it by dropping off the
+ * extra bits at the end and do rounding. If we have .50...0(decimal) after radix
+ * point, we do roundup when the least significant digit before radix is odd, we do
+ * rounddown if it's even.
+ */
/* Check 1st dropoff bit, see if it's set. */
if(H5T__bit_get_d(int_buf, ((first - dst.u.f.msize) - 1), (size_t)1)) {
diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c
index 13d2f5f..6ee0cd7 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -43,6 +43,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Ppublic.h" /* Property Lists */
#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -79,6 +80,12 @@
/* Local Variables */
/*******************/
+/* Declare a free list to manage the H5VL_t struct */
+H5FL_EXTERN(H5VL_t);
+
+/* Declare a free list to manage the H5VL_object_t struct */
+H5FL_EXTERN(H5VL_object_t);
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -100,28 +107,48 @@
herr_t
H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id)
{
- H5G_loc_t loc; /* Location to create datatype */
- H5T_t *type; /* Datatype for ID */
+ void *data = NULL; /* VOL-managed datatype data */
+ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */
+ H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*si", loc_id, name, type_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(H5T_is_named(dt))
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Commit the datatype to the file, using default property list values */
- if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* get the object from the loc_id */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Commit the datatype */
+ if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+
+ /* Set up VOL object */
+ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure")
+ new_obj->connector = vol_obj->connector;
+ new_obj->connector->nrefs ++;
+ new_obj->data = data;
+
+ /* Set the committed type object to the VOL connector pointer in the H5T_t struct */
+ dt->vol_obj = new_obj;
done:
FUNC_LEAVE_API(ret_value)
@@ -137,7 +164,7 @@ done:
*
* Return: Success: Object ID of the named datatype.
*
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Monday, June 1, 1998
@@ -147,32 +174,38 @@ done:
hid_t
H5Topen1(hid_t loc_id, const char *name)
{
- H5T_t *type = NULL;
- H5G_loc_t loc;
- hid_t ret_value = H5I_INVALID_HID;
+ void *dt = NULL; /* Datatype token created by VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
- /* Open it */
- if(NULL == (type = H5T__open_name(&loc, name)))
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Open the datatype */
+ if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype")
/* Register the type and return the ID */
- if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
done:
/* Cleanup on error */
- if(ret_value < 0)
- if(type && H5T_close(type) < 0)
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype")
+ if(H5I_INVALID_HID == ret_value)
+ if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype")
FUNC_LEAVE_API(ret_value)
} /* end H5Topen1() */
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index ade7d08..0ed1775 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -46,8 +46,6 @@ static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name,
* Programmer: Robb Matzke
* Tuesday, December 22, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
diff --git a/src/H5Toh.c b/src/H5Toh.c
index c0139fe..b21ce72 100644
--- a/src/H5Toh.c
+++ b/src/H5Toh.c
@@ -44,7 +44,7 @@
/********************/
static htri_t H5O__dtype_isa(const H5O_t *loc);
-static hid_t H5O__dtype_open(const H5G_loc_t *obj_loc, hbool_t app_ref);
+static void *H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type);
static void *H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc);
static H5O_loc_t *H5O__dtype_get_oloc(hid_t obj_id);
@@ -125,28 +125,28 @@ done:
*
*-------------------------------------------------------------------------
*/
-static hid_t
-H5O__dtype_open(const H5G_loc_t *obj_loc, hbool_t app_ref)
+static void *
+H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type)
{
- H5T_t *type = NULL; /* Datatype opened */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5T_t *type = NULL; /* Datatype opened */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
HDassert(obj_loc);
+ *opened_type = H5I_DATATYPE;
+
/* Open the datatype */
if(NULL == (type = H5T_open(obj_loc)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open datatype")
- /* Register an ID for the datatype */
- if((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ ret_value = (void *)type;
done:
- if(ret_value < 0)
+ if(NULL == ret_value)
if(type && H5T_close(type) < 0)
- HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype")
+ HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dtype_open() */
@@ -180,7 +180,7 @@ H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc)
/* Commit the type to the file */
if(H5T__commit(f, crt_info->dt, crt_info->tcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
/* Set up the new named datatype's location */
if(NULL == (obj_loc->oloc = H5T_oloc(crt_info->dt)))
@@ -212,14 +212,17 @@ done:
static H5O_loc_t *
H5O__dtype_get_oloc(hid_t obj_id)
{
- H5T_t *type; /* Datatype opened */
+ H5T_t *type = NULL; /* Datatype opened */
+ H5T_t *dt = NULL;
H5O_loc_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Get the datatype */
- if(NULL == (type = (H5T_t *)H5I_object(obj_id)))
+ if(NULL == (dt = (H5T_t *)H5I_object(obj_id)))
HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID")
+ /* If this is a named datatype, get the VOL driver pointer to the datatype */
+ type = (H5T_t *)H5T_get_actual_type(dt);
/* Get the datatype's object header location */
if(NULL == (ret_value = H5T_oloc(type)))
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 877316d..d687d03 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -199,7 +199,7 @@ done:
herr_t
H5Tset_order(hid_t type_id, H5T_order_t order)
{
- H5T_t *dt; /* Datatype to modify */
+ H5T_t *dt = NULL; /* Datatype to modify */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -207,15 +207,17 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype")
if(order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order")
+ if(NULL != dt->vol_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed")
if(H5T_STATE_TRANSIENT != dt->shared->state)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only")
/* Call internal routine to set the order */
if(H5T_set_order(dt, order) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index e1b996c..c909f18 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -167,7 +167,7 @@ struct H5T_path_t {
char name[H5T_NAMELEN]; /*name for debugging only */
H5T_t *src; /*source datatype */
H5T_t *dst; /*destination datatype */
- H5T_conv_func_t conv; /* Conversion funcion */
+ H5T_conv_func_t conv; /* Conversion function */
hbool_t is_hard; /*is it a hard function? */
hbool_t is_noop; /*is it the noop conversion? */
hbool_t are_compounds; /*are source and dest both compounds?*/
@@ -320,6 +320,7 @@ struct H5T_t {
H5T_shared_t *shared; /* all other information */
H5O_loc_t oloc; /* Object location, if the type is a named type */
H5G_name_t path; /* group hier. path if the type is a named type */
+ H5VL_object_t *vol_obj; /* pointer to VOL object when working with committed datatypes */
};
/* The master list of soft conversion functions */
@@ -447,10 +448,12 @@ H5_DLL herr_t H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op,
H5_DLL herr_t H5T__upgrade_version(H5T_t *dt, unsigned new_version);
/* Committed / named datatype routines */
+H5_DLL herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id);
H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id);
H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name,
H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id);
H5_DLL H5T_t *H5T__open_name(const H5G_loc_t *loc, const char *name);
+H5_DLL hid_t H5T__get_create_plist(const H5T_t *type);
/* Conversion functions */
H5_DLL herr_t H5T__conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index 59bac8b..bd28fc2 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -154,6 +154,8 @@ H5Tset_precision(hid_t type_id, size_t prec)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only")
+ if (NULL != dt->vol_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is committed")
if (prec == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive")
if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0)
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 89cdcfd..6b6446f 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -30,6 +30,7 @@ typedef struct H5T_t H5T_t;
#include "H5private.h" /* Generic Functions */
#include "H5Gprivate.h" /* Groups */
#include "H5Rprivate.h" /* References */
+#include "H5VLprivate.h" /* VOL Drivers */
/* Macro for size of temporary buffers to contain a single element */
#define H5T_ELEM_BUF_SIZE 256
@@ -98,7 +99,7 @@ typedef struct H5T_subset_info_t {
} H5T_subset_info_t;
/* Forward declarations for prototype arguments */
-struct H5O_t;
+struct H5O_shared_t;
/* The native endianness of the platform */
H5_DLLVAR H5T_order_t H5T_native_order_g;
@@ -118,7 +119,7 @@ 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(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);
@@ -138,13 +139,18 @@ H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt);
H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f);
H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f);
H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
+H5_DLL H5T_t *H5T_construct_datatype(H5VL_object_t *dt_obj);
+H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt);
+H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt);
+H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared);
+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);
/* 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 htri_t H5T_committed(const H5T_t *type);
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/H5Tvlen.c b/src/H5Tvlen.c
index ba31cd1..841637d 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -204,7 +204,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
dt->shared->u.vlen.read = H5T_vlen_seq_mem_read;
dt->shared->u.vlen.write = H5T_vlen_seq_mem_write;
dt->shared->u.vlen.setnull = H5T_vlen_seq_mem_setnull;
- } /* end if */
+ }
else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) {
/* size in memory, disk size is different */
dt->shared->size = sizeof(char *);
@@ -216,9 +216,10 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
dt->shared->u.vlen.read = H5T_vlen_str_mem_read;
dt->shared->u.vlen.write = H5T_vlen_str_mem_write;
dt->shared->u.vlen.setnull = H5T_vlen_str_mem_setnull;
- } /* end else-if */
- else
+ }
+ else {
HDassert(0 && "Invalid VL type");
+ }
/* Reset file ID (since this VL is in memory) */
dt->shared->u.vlen.f = NULL;
@@ -530,7 +531,7 @@ H5T_vlen_str_mem_getlen(const void *_vl)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */
#else
- const char *s; /* Pointer to the user's string information */
+ const char *s = NULL; /* Pointer to the user's string information */
#endif
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -565,7 +566,7 @@ H5T_vlen_str_mem_getptr(void *_vl)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
char *s=*(char **)_vl; /* Pointer to the user's string information */
#else
- char *s; /* Pointer to the user's string information */
+ char *s = NULL; /* Pointer to the user's string information */
#endif
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -600,7 +601,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
char *s=*(char **)_vl; /* Pointer to the user's string information */
#else
- char *s; /* Pointer to the user's string information */
+ char *s = NULL; /* Pointer to the user's string information */
#endif
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -667,8 +668,7 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
*/
static herr_t
H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info,
- void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len,
- size_t base_size)
+ void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size)
{
char *t; /* Pointer to temporary buffer allocated */
size_t len; /* Maximum length of the string to copy */
@@ -847,10 +847,11 @@ H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len)
UINT32DECODE(vl, hobjid.idx);
/* Check if this sequence actually has any data */
- if(hobjid.addr > 0)
+ if(hobjid.addr > 0) {
/* Read the VL information from disk */
if(NULL == H5HG_read(f, &hobjid, buf, NULL))
HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information")
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -898,10 +899,11 @@ H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_all
UINT32DECODE(bg, bg_hobjid.idx);
/* Free heap object for old data */
- if(bg_hobjid.addr > 0)
+ if(bg_hobjid.addr > 0) {
/* Free heap object */
if(H5HG_remove(f, &bg_hobjid) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
+ }
} /* end if */
/* Set the length of the sequence */
@@ -1159,6 +1161,10 @@ done:
*
* Purpose: Alternative method to reclaim any VL data for a buffer element.
*
+ * Use this function when the datatype is already available, but
+ * the allocation info is needed from the context before jumping
+ * into recursion.
+ *
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mike McGreevy
@@ -1169,8 +1175,8 @@ done:
herr_t
H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt)
{
- H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */
- herr_t ret_value = SUCCEED; /* return value */
+ H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */
+ herr_t ret_value = SUCCEED; /* return value */
HDassert(dt);
HDassert(elem);
diff --git a/src/H5VL.c b/src/H5VL.c
new file mode 100644
index 0000000..eedf68d
--- /dev/null
+++ b/src/H5VL.c
@@ -0,0 +1,522 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "H5Aprivate.h" /* Attributes */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5PLprivate.h" /* Plugins */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Information needed for iterating over the registered VOL connector hid_t IDs.
+ * The name or value of the new VOL connector 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 VOL connector with the same name / value,
+ * we set the found_id field to the existing ID for return to the function.
+ */
+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;
+
+ /* OUT */
+ hid_t found_id; /* The connector ID, if we found a match */
+} H5VL_get_connector_ud_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__get_connector_cb
+ *
+ * Purpose: Callback routine to search through registered VOLs
+ *
+ * Return: Success: H5_ITER_STOP if the class and op_data name
+ * members match. H5_ITER_CONT otherwise.
+ *
+ * Failure: Can't fail
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
+{
+ H5VL_get_connector_ud_t *op_data = (H5VL_get_connector_ud_t *)_op_data; /* User data for callback */
+ H5VL_class_t *cls = (H5VL_class_t *)obj;
+ int ret_value = H5_ITER_CONT; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if(H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) {
+ if(0 == HDstrcmp(cls->name, op_data->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) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end else */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__get_connector_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLregister_connector
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE2("i", "*xi", cls, vipl_id);
+
+ /* Check arguments */
+ if (!cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL connector class pointer cannot be NULL")
+ if (!cls->name)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer")
+ if (0 == HDstrlen(cls->name))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string")
+ if (cls->info_copy && !cls->info_free)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for VOL info objects when a copy callback is provided")
+ if (cls->get_wrap_ctx && !cls->free_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided")
+
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.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)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs")
+
+ /* Increment the ref count on the existing VOL connector ID, if it's already registered */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ /* Create a new class ID */
+ if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLregister_connector() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLregister_connector_by_name
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE2("i", "*si", name, vipl_id);
+
+ /* Check arguments */
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed")
+ if (0 == HDstrlen(name))
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed")
+
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.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, TRUE) < 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 */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5VL_class_t *cls;
+
+ /* Try loading the connector */
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ key.vol.u.name = name;
+ if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
+
+ /* Register the connector we loaded */
+ if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLregister_connector_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLregister_connector_by_value
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE2("i", "VCi", value, vipl_id);
+
+ /* Check arguments */
+ if(value < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed")
+
+ op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.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)
+ 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 */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5VL_class_t *cls;
+
+ /* Try loading the connector */
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ key.vol.u.value = value;
+ if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
+
+ /* Register the connector we loaded */
+ if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLregister_connector_by_value() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLis_connector_registered
+ *
+ * Purpose: Tests whether a VOL class has been registered or not
+ *
+ * Return: Positive if the VOL class has been registered
+ *
+ * Zero if it is unregistered
+ *
+ * Negative on error (if the class is not a valid class ID)
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5VLis_connector_registered(const char *name)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("t", "*s", name);
+
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Check arguments */
+ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids")
+
+ if (op_data.found_id != H5I_INVALID_HID)
+ ret_value = TRUE;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLis_connector_registered() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLget_connector_id
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector.
+ *
+ * Return: Positive if the VOL class has been registered
+ * Negative on error (if the class is not a valid class or not registered)
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLget_connector_id(const char *name)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "*s", name);
+
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Check arguments */
+ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connector IDs")
+
+ if (op_data.found_id != H5I_INVALID_HID) {
+ if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLget_connector_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLget_connector_name
+ *
+ * Purpose: Returns the connector name for the VOL associated with the
+ * object or file ID
+ *
+ * Return: Success: The length of the connector name
+ *
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5VLget_connector_name(hid_t obj_id, char *name/*out*/, size_t size)
+{
+ ssize_t ret_value = -1;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("Zs", "ixz", obj_id, name, size);
+
+ if ((ret_value = H5VL_get_connector_name(obj_id, name, size)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLget_connector_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLclose
+ *
+ * Purpose: Closes a VOL connector ID. This in no way affects
+ * file access property lists which have been defined to use
+ * this VOL connector or files which are already opened under with
+ * this connector.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLclose(hid_t vol_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", vol_id);
+
+ /* Check args */
+ if(NULL == H5I_object_verify(vol_id, H5I_VOL))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector")
+
+ /* Decrement the ref count on the ID, possibly releasing the VOL connector */
+ if(H5I_dec_app_ref(vol_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL connector ID")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLclose() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLunregister_connector
+ *
+ * Purpose: Removes a VOL connector ID from the library. This in no way affects
+ * file access property lists which have been defined to use
+ * this VOL connector or files which are already opened under with
+ * this connector.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLunregister_connector(hid_t vol_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", vol_id);
+
+ /* Check arguments */
+ if(NULL == H5I_object_verify(vol_id, H5I_VOL))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector")
+
+ /* The H5VL_class_t struct will be freed by this function */
+ if (H5I_dec_app_ref(vol_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLunregister_connector() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLcmp_connector_cls
+ *
+ * Purpose: Compares two connector classes
+ *
+ * Return: Success: Non-negative, with *cmp set to positive if
+ * connector_id1 is greater than connector_id2, negative if connector_id2
+ * is greater than connector_id1 and zero if connector_id1 and connector_id2
+ * are equal.
+ *
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2)
+{
+ H5VL_class_t *cls1, *cls2; /* connectors for IDs */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "*Isii", cmp, connector_id1, connector_id2);
+
+ /* Check args and get class pointers */
+ if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(connector_id1, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(connector_id2, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Compare the two VOL connector classes */
+ if(H5VL_cmp_connector_cls(cmp, cls1, cls2) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLcmp_connector_cls() */
+
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
new file mode 100644
index 0000000..2828262
--- /dev/null
+++ b/src/H5VLcallback.c
@@ -0,0 +1,6535 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "H5Fprivate.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static void *H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id,
+ hid_t dxpl_id, void **req);
+static void *H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
+ void *buf, hid_t dxpl_id, 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_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, hid_t dxpl_id,
+ void **req, va_list arguments);
+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 dcpl_id, hid_t dapl_id,
+ hid_t dxpl_id, void **req);
+static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls,
+ hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id,
+ void *buf, void **req);
+static herr_t H5VL__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 plist_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,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__file_cache_connector(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);
+static void * H5VL__file_open(const H5VL_class_t *cls, const char *name,
+ unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__file_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, hid_t dxpl_id,
+ void **req, va_list arguments);
+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 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, hid_t dxpl_id,
+ void **req, va_list arguments);
+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);
+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);
+static herr_t H5VL__link_move(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);
+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);
+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, hid_t dxpl_id,
+ void **req, va_list arguments);
+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, void *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, 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);
+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, hid_t dxpl_id,
+ void **req, va_list arguments);
+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,
+ hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls,
+ uint64_t timeout, H5ES_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);
+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,
+ va_list arguments);
+static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLinitialize
+ *
+ * Purpose: Calls the connector-specific callback to initialize the connector.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLinitialize(hid_t connector_id, hid_t vipl_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "ii", connector_id, vipl_id);
+
+ /* Check args */
+ 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")
+
+ /* Invoke class' callback, if there is one */
+ if(cls->initialize && cls->initialize(vipl_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLinitialize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLterminate
+ *
+ * Purpose: Calls the connector-specific callback to terminate the connector.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLterminate(hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE1("e", "i", connector_id);
+
+ /* Check args */
+ 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")
+
+ /* Invoke class' callback, if there is one */
+ if(cls->terminate && cls->terminate() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLterminate() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_cap_flags
+ *
+ * Purpose: Retrieves the capability flag for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*Iu", connector_id, cap_flags);
+
+ /* Check args */
+ 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")
+
+ /* Retrieve capability flags */
+ if(cap_flags)
+ *cap_flags = cls->cap_flags;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_cap_flags */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_value
+ *
+ * Purpose: Retrieves the 'value' for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLget_value(hid_t connector_id, H5VL_class_value_t *value)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*VC", connector_id, value);
+
+ /* Check args */
+ 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")
+
+ /* Retrieve connector value */
+ if(value)
+ *value = cls->value;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_value */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_copy_connector_info
+ *
+ * Purpose: Copy the VOL info for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info,
+ const void *src_info)
+{
+ void *new_connector_info = NULL; /* Copy of connector info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+
+ /* Check for actual source info */
+ if(src_info) {
+ /* Allow the connector to copy or do it ourselves */
+ if(connector->info_copy) {
+ if(NULL == (new_connector_info = (connector->info_copy)(src_info)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed")
+ } /* end if */
+ else if(connector->info_size > 0) {
+ if(NULL == (new_connector_info = H5MM_malloc(connector->info_size)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed")
+ HDmemcpy(new_connector_info, src_info, connector->info_size);
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info")
+ } /* end if */
+
+ /* Set the connector info for the copy */
+ *dst_info = new_connector_info;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_copy_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLcopy_connector_info
+ *
+ * Purpose: Copies a VOL connector's info object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "i**x*x", connector_id, dst_vol_info, src_vol_info);
+
+ /* 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")
+
+ /* Copy the VOL connector's info object */
+ if(H5VL_copy_connector_info(cls, dst_vol_info, src_vol_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLcopy_connector_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_cmp_connector_info
+ *
+ * Purpose: Compare VOL info for a connector. Sets *cmp_value to
+ * positive if INFO1 is greater than INFO2, negative if
+ * INFO2 is greater than INFO1 and zero if INFO1 and
+ * INFO2 are equal.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
+ const void *info1, const void *info2)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+ HDassert(cmp_value);
+
+ /* Take care of cases where one or both pointers is NULL */
+ if(info1 == NULL && info2 != NULL) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+ if(info1 != NULL && info2 == NULL) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+ if(info1 == NULL && info2 == NULL) {
+ *cmp_value = 0;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+
+ /* Use the class's info comparison routine to compare the info objects,
+ * if there is a a callback, otherwise just compare the info objects as
+ * memory buffers
+ */
+ if(connector->info_cmp) {
+ if((connector->info_cmp)(cmp_value, info1, info2) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info")
+ } /* end if */
+ else {
+ HDassert(connector->info_size > 0);
+ *cmp_value = HDmemcmp(info1, info2, connector->info_size);
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_cmp_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLcmp_connector_info
+ *
+ * Purpose: Compares two connector info objects
+ *
+ * Note: Both info objects must be from the same VOL connector class
+ *
+ * Return: Success: Non-negative, with *cmp set to positive if
+ * info1 is greater than info2, negative if info2
+ * is greater than info1 and zero if info1 and info2
+ * are equal.
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const void *info2)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "*Isi*x*x", cmp, connector_id, info1, info2);
+
+ /* 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")
+
+ /* Compare the two VOL connector info objects */
+ if(cmp)
+ H5VL_cmp_connector_info(cls, cmp, info1, info2);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLcmp_connector_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_connector_info
+ *
+ * Purpose: Free VOL info for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_connector_info(const H5VL_class_t *connector, void *info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+
+ /* Only free info object, if it's non-NULL */
+ if(info) {
+ /* Allow the connector to free info or do it ourselves */
+ if(connector->info_free) {
+ if((connector->info_free)(info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
+ } /* end if */
+ else
+ H5MM_xfree(info);
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfree_connector_info
+ *
+ * Purpose: Free VOL connector info object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfree_connector_info(hid_t connector_id, void *info)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*x", connector_id, info);
+
+ /* 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")
+
+ /* Free the VOL connector info object */
+ if(H5VL_free_connector_info(cls, info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLfree_connector_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLconnector_info_to_str
+ *
+ * Purpose: Serialize a connector's info into a string
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xi**s", info, connector_id, str);
+
+ /* Only serialize info object, if it's non-NULL */
+ if(info) {
+ H5VL_class_t *cls; /* VOL connector's class struct */
+
+ /* 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")
+
+ /* Allow the connector to serialize info */
+ if(cls->info_to_str) {
+ if((cls->info_to_str)(info, str) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info")
+ } /* end if */
+ else
+ *str = NULL;
+ } /* end if */
+ else
+ *str = NULL;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLconnector_info_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLconnector_str_to_info
+ *
+ * Purpose: Deserialize a string into a connector's info
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*si**x", str, connector_id, info);
+
+ /* Only deserialize string, if it's non-NULL */
+ if(str) {
+ H5VL_class_t *cls; /* VOL connector's class struct */
+
+ /* 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")
+
+ /* Allow the connector to deserialize info */
+ if(cls->str_to_info) {
+ if((cls->str_to_info)(str, info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info")
+ } /* end if */
+ else
+ *info = NULL;
+ } /* end if */
+ else
+ *info = NULL;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLconnector_str_to_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_object
+ *
+ * Purpose: Retrieves an underlying object.
+ *
+ * Return: Success: Non-NULL
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+void *
+H5VLget_object(void *obj, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("*x", "*xi", obj, connector_id);
+
+ /* Check args */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Check for 'get_object' callback in connector */
+ if(cls->get_object)
+ ret_value = (cls->get_object)(obj);
+ else
+ ret_value = obj;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_object */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_get_wrap_ctx
+ *
+ * Purpose: Retrieve the VOL object wrapping context for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+ HDassert(obj);
+ HDassert(wrap_ctx);
+
+ /* Allow the connector to copy or do it ourselves */
+ if(connector->get_wrap_ctx) {
+ /* Sanity check */
+ HDassert(connector->free_wrap_ctx);
+
+ /* Invoke connector's callback */
+ if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed")
+ } /* end if */
+ else
+ *wrap_ctx = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_get_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_wrap_ctx
+ *
+ * Purpose: Get a VOL connector's object wrapping context
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xi**x", obj, connector_id, wrap_ctx);
+
+ /* 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")
+
+ /* Get the VOL connector's object wrapper */
+ if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_wrap_ctx
+ *
+ * Purpose: Free object wrapping context for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(connector);
+
+ /* Only free wrap context, if it's non-NULL */
+ if(wrap_ctx) {
+ /* Free the connector's object wrapping context */
+ if((connector->free_wrap_ctx)(wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfree_wrap_ctx
+ *
+ * Purpose: Release a VOL connector's object wrapping context
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "*xi", wrap_ctx, connector_id);
+
+ /* 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")
+
+ /* Release the VOL connector's object wrapper */
+ if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLfree_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_wrap_object
+ *
+ * Purpose: Wrap an object with connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj)
+{
+ void *ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Sanity checks */
+ HDassert(connector);
+ HDassert(obj);
+
+ /* Only wrap object if there's a wrap context */
+ if(wrap_ctx) {
+ /* Ask the connector to wrap the object */
+ if(NULL == (ret_value = (connector->wrap_object)(obj, wrap_ctx)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
+ } /* end if */
+ else
+ ret_value = obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_wrap_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLwrap_object
+ *
+ * Purpose: Asks a connector to wrap an underlying object.
+ *
+ * Return: Success: Non-NULL
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+void *
+H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("*x", "*xi*x", obj, connector_id, wrap_ctx);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Wrap the object */
+ if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLwrap_object */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_create
+ *
+ * Purpose: Creates an attribute through the VOL
+ *
+ * Return: Success: Pointer to the new attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_create
+ *
+ * Purpose: Creates an attribute through the VOL
+ *
+ * Return: Success: Pointer to the new attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_create
+ *
+ * Purpose: Creates an attribute
+ *
+ * Return: Success: Pointer to the new attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, acpl_id,
+ aapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_open
+ *
+ * Purpose: Opens an attribute through the VOL
+ *
+ * Return: Success: Pointer to the attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name,
+ hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr open' method")
+
+ /* Call the corresponding VOL open callback */
+ if(NULL == (ret_value = (cls->attr_cls.open)(obj, loc_params, name, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_open
+ *
+ * Purpose: Opens an attribute through the VOL
+ *
+ * Return: Success: Pointer to the attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_open
+ *
+ * Purpose: Opens an attribute
+ *
+ * Return: Success: Pointer to the attribute
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, aapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_read
+ *
+ * Purpose: Reads data from attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf,
+ hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.read)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr read' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->attr_cls.read)(obj, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_read
+ *
+ * Purpose: Reads data from attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf,
+ hid_t dxpl_id, void **req)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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__attr_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read 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_attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_read
+ *
+ * Purpose: Reads data from an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_write
+ *
+ * Purpose: Writes data to attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.write)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr write' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->attr_cls.write)(obj, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_write
+ *
+ * Purpose: Writes data to attr through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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__attr_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write 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_attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_write
+ *
+ * Purpose: Writes data to an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_get
+ *
+ * Purpose: Get specific information about the attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.get)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_get
+ *
+ * Purpose: Get specific information about the attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 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)
+ va_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_attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_get
+ *
+ * Purpose: Gets information about the attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVai**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_specific
+ *
+ * Purpose: Specific operation on attributes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.specific)
+ 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")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_specific
+ *
+ * Purpose: Specific operation on attributes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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, ...)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_specific
+ *
+ * Purpose: Performs a connector-specific operation on an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVbi**xx", obj, loc_params, connector_id, specific_type,
+ dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* 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")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.optional)
+ 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, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_optional(const H5VL_object_t *vol_obj, 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__attr_optional(obj, cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__attr_close
+ *
+ * Purpose: Closes an attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->attr_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->attr_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__attr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_attr_close
+ *
+ * Purpose: Closes an attribute through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_attr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLattr_close
+ *
+ * Purpose: Closes an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__attr_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLattr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_create
+ *
+ * Purpose: Creates a dataset through the VOL
+ *
+ * Return: Success: Pointer to new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_create
+ *
+ * Purpose: Creates a dataset through the VOL
+ *
+ * Return: Success: Pointer to new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_create
+ *
+ * Purpose: Creates a dataset
+ *
+ * Return: Success: Pointer to the new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, dcpl_id,
+ dapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_open
+ *
+ * Purpose: Opens a dataset through the VOL
+ *
+ * Return: Success: Pointer to dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name,
+ hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_open
+ *
+ * Purpose: Opens a dataset through the VOL
+ *
+ * Return: Success: Pointer to dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_open
+ *
+ * Purpose: Opens a dataset
+ *
+ * Return: Success: Pointer to the new dataset
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, dapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_read
+ *
+ * Purpose: Reads data from dataset through the VOL
+*
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
+ hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.read)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_read
+ *
+ * Purpose: Reads data from dataset through the VOL
+*
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
+ hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf,
+ void **req)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read 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_dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_read
+ *
+ * Purpose: Reads data from a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
+ file_space_id, plist_id, buf, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_write
+ *
+ * Purpose: Writes data from dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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 plist_id, const void *buf,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.write)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_write
+ *
+ * Purpose: Writes data from dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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 plist_id, const void *buf,
+ void **req)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write 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_dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_write
+ *
+ * Purpose: Writes data to a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_write(void *obj, 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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id,
+ file_space_id, plist_id, buf, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_get
+ *
+ * Purpose: Get specific information about the dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.get)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_get
+ *
+ * Purpose: Get specific information about the dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 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)
+ va_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_dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_get
+ *
+ * Purpose: Gets information about a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVci**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_specific
+ *
+ * Purpose: Specific operation on datasets through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_specific
+ *
+ * Purpose: Specific operation on datasets through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 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)
+ va_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_dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_specific
+ *
+ * Purpose: Performs a connector-specific operation on a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVdi**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.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, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_optional(const H5VL_object_t *vol_obj, 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Call the corresponding VOL callback */
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 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)
+ va_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_dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__dataset_close
+ *
+ * Purpose: Closes a dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->dataset_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->dataset_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_dataset_close
+ *
+ * Purpose: Closes a dataset through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ 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);
+ HDassert(vol_obj->data);
+ HDassert(vol_obj->connector);
+ HDassert(vol_obj->connector->cls);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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__dataset_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close 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_dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_close
+ *
+ * Purpose: Closes a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__dataset_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_cache_connector
+ *
+ * Purpose: Wrap varargs and reissue 'cache VOL connector' operation
+ * to file specific call
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, 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 */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Re-issue call to internal file specific callback routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__file_specific(obj, cls, H5VL_FILE_CACHE_VOL_CONN, dxpl_id, req, arguments) < 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)
+ va_end(arguments);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_cache_connector() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_create
+ *
+ * Purpose: Creates a file through the VOL
+ *
+ * Note: Does not have a 'static' version of the routine, since there's
+ * no objects in the container before this operation completes.
+ *
+ * Return: Success: Pointer to new file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_create
+ *
+ * Purpose: Creates a file through the VOL
+ *
+ * Note: Does not have a 'static' version of the routine, since there's
+ * no objects in the container before this operation completes.
+ *
+ * Return: Success: Pointer to new file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name,
+ unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL Class structure for callback info */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the connector's class */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed")
+
+ /* Cache the connector ID & info */
+ if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_create
+ *
+ * Purpose: Creates a file
+ *
+ * Return: Success: Pointer to the new file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req);
+
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info")
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_open
+ *
+ * Purpose: Opens a file through the VOL.
+ *
+ * Return: Success: Pointer to file.
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags,
+ hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_open
+ *
+ * Purpose: Opens a file through the VOL.
+ *
+ * Note: Does not have a 'static' version of the routine, since there's
+ * no objects in the container before this operation completes.
+ *
+ * Return: Success: Pointer to file.
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name,
+ unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL Class structure for callback info */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the connector's class */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
+
+ /* Cache the connector ID & info */
+ if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_open
+ *
+ * Purpose: Opens a file
+ *
+ * Return: Success: Pointer to the file
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
+ void **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req);
+
+ /* Get the VOL info from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info")
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_get
+ *
+ * Purpose: Get specific information about the file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.get)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_get
+ *
+ * Purpose: Get specific information about the file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 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)
+ va_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_file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_get
+ *
+ * Purpose: Gets information about the file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVgi**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_specific
+ *
+ * Purpose: Perform File specific operations through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.specific)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_specific
+ *
+ * Purpose: Perform File specific operations through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type,
+ 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 */
+ va_start(arguments, req);
+ arg_started = TRUE;
+
+ /* Special treatment of file access check */
+ if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
+ 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 */
+ va_copy(tmp_args, arguments);
+ fapl_id = va_arg(tmp_args, hid_t);
+ va_end(tmp_args);
+
+ /* Get the VOL info from the FAPL */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list")
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info")
+
+ /* Get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ } /* end if */
+ /* Set wrapper info in API context, for all other operations */
+ else {
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Set the VOL connector class pointer */
+ cls = vol_obj->connector->cls;
+ } /* 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_specific
+ *
+ * Purpose: Performs a connector-specific operation on a file
+ *
+ * Note: The 'obj' parameter is allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVhi**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_optional
+ *
+ * Purpose: Perform a connector specific operation
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.optional)
+ 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, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_optional
+ *
+ * Purpose: Perform a connector specific operation
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_optional(const H5VL_object_t *vol_obj, 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 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)
+ va_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_file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__file_close
+ *
+ * Purpose: Closes a file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->file_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_close
+ *
+ * Purpose: Closes a file through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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__file_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close 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_file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLfile_close
+ *
+ * Purpose: Closes a file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__file_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLfile_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_create
+ *
+ * Purpose: Creates a group through the VOL
+ *
+ * Return: Success: Pointer to new group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.create)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_create
+ *
+ * Purpose: Creates a group through the VOL
+ *
+ * Return: Success: Pointer to new group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_create
+ *
+ * Purpose: Creates a group
+ *
+ * Return: Success: Pointer to the new group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name,
+ hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, gcpl_id,
+ gapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_open
+ *
+ * Purpose: Opens a group through the VOL
+ *
+ * Return: Success: Pointer to group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_open
+ *
+ * Purpose: Opens a group through the VOL
+ *
+ * Return: Success: Pointer to group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_open
+ *
+ * Purpose: Opens a group
+ *
+ * Return: Success: Pointer to the group
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, gapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_get
+ *
+ * Purpose: Get specific information about the group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.get)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_get
+ *
+ * Purpose: Get specific information about the group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 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)
+ va_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_group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_get
+ *
+ * Purpose: Gets information about the group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVii**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_specific
+ *
+ * Purpose: Specific operation on groups through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.specific)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_specific
+ *
+ * Purpose: Specific operation on groups through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 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)
+ va_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_group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_specific
+ *
+ * Purpose: Performs a connector-specific operation on a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVji**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.optional)
+ 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, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_optional(const H5VL_object_t *vol_obj, 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__group_optional(obj, cls, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__group_close
+ *
+ * Purpose: Closes a group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->group_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->group_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_group_close
+ *
+ * Purpose: Closes a group through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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__group_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close 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_group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_close
+ *
+ * Purpose: Closes a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__group_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLgroup_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_create
+ *
+ * Purpose: Creates a link through the VOL
+ *
+ * Note: The 'obj' parameter is allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.create)
+ 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) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_create
+ *
+ * Purpose: Creates a link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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_object_t tmp_vol_obj; /* Temporary object token of */
+ 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)
+
+ /* Special case for hard links */
+ if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) {
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ /* Get the VOL data pointer from the fapl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list")
+ if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info")
+ } /* end if */
+ else
+ /* Use the VOL object passed in */
+ tmp_vol_obj.data = vol_obj->data;
+ tmp_vol_obj.connector = vol_obj->connector;
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.connector) < 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_create(create_type, 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:
+ /* 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_link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_create
+ *
+ * Purpose: Creates a link
+ *
+ * Note: The 'obj' parameter is allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE8("e", "Vk*x*xiiii**x", create_type, 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) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_copy
+ *
+ * Purpose: Copys a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.copy)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.copy)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_copy
+ *
+ * Purpose: Copys a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ const H5VL_object_t *vol_obj; /* VOL object for object with data */
+ 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)
+
+ /* Set wrapper info in API context */
+ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj);
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy 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_link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_copy
+ *
+ * Purpose: Copies a link to a new location
+ *
+ * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2,
+ 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_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_move
+ *
+ * Purpose: Moves a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_move(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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.move)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.move)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_move
+ *
+ * Purpose: Moves a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_move(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)
+{
+ const H5VL_object_t *vol_obj; /* VOL object for object with data */
+ 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)
+
+ /* Set wrapper info in API context */
+ vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj);
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move 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_link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_move
+ *
+ * Purpose: Moves a link to another location
+ *
+ * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_move(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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2,
+ 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_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_get
+ *
+ * Purpose: Get specific information about the link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.get)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_get
+ *
+ * Purpose: Get specific information about the link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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, ...)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_get
+ *
+ * Purpose: Gets information about a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id,
+ req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_specific
+ *
+ * Purpose: Specific operation on links through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.specific)
+ 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")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_specific
+ *
+ * Purpose: Specific operation on links through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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, ...)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_specific
+ *
+ * Purpose: Performs a connector-specific operation on a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVmi**xx", obj, loc_params, connector_id, specific_type,
+ dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* 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")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__link_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.optional)
+ 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, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_optional(const H5VL_object_t *vol_obj, 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 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)
+ va_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_link_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLlink_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLlink_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_open
+ *
+ * Purpose: Opens a object through the VOL
+ *
+ * Return: Success: Pointer to the object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_open
+ *
+ * Purpose: Opens a object through the VOL
+ *
+ * Return: Success: Pointer to the object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params,
+ H5I_type_t *opened_type, hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->connector->cls, opened_type, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_open
+ *
+ * Purpose: Opens an object
+ *
+ * Return: Success: Pointer to the object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, H5I_type_t *opened_type,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("*x", "*x*xi*Iti**x", obj, params, connector_id, opened_type, dxpl_id,
+ req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_copy
+ *
+ * Purpose: Copies an object to another destination through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name,
+ void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name,
+ const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.copy)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object copy' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->object_cls.copy)(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_copy
+ *
+ * Purpose: Copies an object to another destination through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
+ void **req)
+{
+ 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)
+
+ /* Make sure that the VOL connectors are the same */
+ if(src_obj->connector->cls->value != dst_obj->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL connectors and can't be copied")
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(src_obj->data, src_obj->connector) < 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_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->connector->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy 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_object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_copy
+ *
+ * Purpose: Copies an object to another location
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE11("e", "*x*x*s*x*x*siiii**x", src_obj, src_loc_params, src_name,
+ dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointers */
+ if(NULL == src_obj || NULL == dst_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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_get
+ *
+ * Purpose: Get specific information about the object through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.get)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_get
+ *
+ * Purpose: Get specific information about the object through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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, ...)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_get
+ *
+ * Purpose: Gets information about an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id,
+ req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_specific
+ *
+ * Purpose: Specific operation on objects through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* 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")
+
+ /* 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")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_specific
+ *
+ * Purpose: Specific operation on objects through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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, ...)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_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")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ va_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_object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_specific
+ *
+ * Purpose: Performs a connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("e", "*x*xiVoi**xx", obj, loc_params, connector_id, specific_type,
+ dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* 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")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->object_cls.optional)
+ 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, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_optional(const H5VL_object_t *vol_obj, 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 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)
+ va_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_object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLobject_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__object_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLobject_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_commit
+ *
+ * Purpose: Commits a datatype to the file through the VOL
+ *
+ * Return: Success: Pointer to the new datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.commit)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_commit
+ *
+ * Purpose: Commits a datatype to the file through the VOL
+ *
+ * Return: Success: Pointer to the new datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id,
+ hid_t dxpl_id, void **req)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_commit
+ *
+ * Purpose: Commits a datatype to the file
+ *
+ * Return: Success: Pointer to the new datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id,
+ hid_t tapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name,
+ type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_open
+ *
+ * Purpose: Opens a named datatype through the VOL
+ *
+ * Return: Success: Pointer to the datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.open)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback")
+
+ /* Call the corresponding VOL callback */
+ if(NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_open
+ *
+ * Purpose: Opens a named datatype through the VOL
+ *
+ * Return: Success: Pointer to the datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_open
+ *
+ * Purpose: Opens a named datatype
+ *
+ * Return: Success: Pointer to the datatype
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, tapl_id,
+ dxpl_id, req);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if(NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_get
+ *
+ * Purpose: Get specific information about the datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* 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 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")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_get
+ *
+ * Purpose: Get specific information about the datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 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)
+ va_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_datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_get
+ *
+ * Purpose: Gets information about the datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_specific
+ *
+ * Purpose: Specific operation on datatypes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.specific)
+ 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_specific
+ *
+ * Purpose: Specific operation on datatypes through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type,
+ 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 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)
+ va_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_datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_specific
+ *
+ * Purpose: Performs a connector-specific operation on a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xiVfi**xx", obj, connector_id, specific_type, dxpl_id, req,
+ arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.optional)
+ 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, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_optional(const H5VL_object_t *vol_obj, 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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 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)
+ va_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_datatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+
+ /* 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__datatype_close
+ *
+ * Purpose: Closes a datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->datatype_cls.close)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__datatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_close
+ *
+ * Purpose: Closes a datatype through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+{
+ 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)
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close 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_datatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_close
+ *
+ * Purpose: Closes a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xii**x", obj, connector_id, 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")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__datatype_close(obj, cls, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLdatatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_wait
+ *
+ * Purpose: Waits on an asychronous request through the VOL
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout,
+ H5ES_status_t *status)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(req);
+ HDassert(cls);
+ HDassert(status);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.wait)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async wait' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.wait)(req, timeout, status) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_wait
+ *
+ * Purpose: Waits on an asychronous request through the VOL
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout,
+ H5ES_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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_wait
+ *
+ * Purpose: Waits on a request
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xiUL*Es", req, connector_id, timeout, status);
+
+ /* 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_wait(req, cls, timeout, status) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb,
+ void *ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.notify)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async notify' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.notify)(req, cb, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request notify failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb,
+ void *ctx)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE4("e", "*xix*x", req, connector_id, cb, ctx);
+
+ /* 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_notify(req, cls, cb, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_cancel
+ *
+ * Purpose: Cancels an asynchronous request through the VOL
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_cancel(void *req, const H5VL_class_t *cls)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.cancel)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async cancel' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.cancel)(req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_cancel() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_cancel
+ *
+ * Purpose: Cancels an asynchronous request through the VOL
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_cancel(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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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) < 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() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_cancel
+ *
+ * Purpose: Cancels a request
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_cancel(void *req, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "*xi", req, connector_id);
+
+ /* 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_cancel(req, cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_cancel() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_specific
+ *
+ * Purpose: Specific operation on asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_specific(void *req, const H5VL_class_t *cls,
+ H5VL_request_specific_t specific_type, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_specific
+ *
+ * Purpose: Specific operation on asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_specific(const H5VL_object_t *vol_obj,
+ H5VL_request_specific_t specific_type, ...)
+{
+ 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)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, specific_type);
+ arg_started = TRUE;
+ if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 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)
+ va_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() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_specific
+ *
+ * Purpose: Performs a connector-specific operation on an asynchronous request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type,
+ va_list arguments)
+{
+ 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);
+
+ /* 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)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.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, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_optional
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_request_optional(const H5VL_object_t *vol_obj, ...)
+{
+ 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)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ va_start(arguments, vol_obj);
+ arg_started = TRUE;
+ if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, arguments)) < 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)
+ va_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() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_optional
+ *
+ * Purpose: Performs an optional connector-specific operation on an asynchronous request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xix", req, connector_id, 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((ret_value = H5VL__request_optional(req, cls, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__request_free
+ *
+ * Purpose: Frees an asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__request_free(void *req, const H5VL_class_t *cls)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(req);
+ HDassert(cls);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->request_cls.free)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async free' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->request_cls.free)(req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__request_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_request_free
+ *
+ * Purpose: Frees an asynchronous request through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+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 */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 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() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_free
+ *
+ * Purpose: Frees a request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_free(void *req, hid_t connector_id)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "*xi", req, connector_id);
+
+ /* 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_free(req, cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLrequest_free() */
+
diff --git a/src/H5VLint.c b/src/H5VLint.c
new file mode 100644
index 0000000..82886cd
--- /dev/null
+++ b/src/H5VLint.c
@@ -0,0 +1,1114 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Object wrapping context info */
+typedef struct H5VL_wrap_ctx_t {
+ unsigned rc; /* Ref. count for the # of times the context was set / reset */
+ const H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */
+ void *obj_wrap_ctx; /* "wrap context" for outermost connector */
+} H5VL_wrap_ctx_t;
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5VL__free_cls(H5VL_class_t *cls);
+static void *H5VL__wrap_obj(void *obj);
+static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object,
+ H5VL_t *vol_connector, hbool_t wrap_obj);
+static void *H5VL__object(hid_t id, H5I_type_t obj_type);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* VOL ID class */
+static const H5I_class_t H5I_VOL_CLS[1] = {{
+ H5I_VOL, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5VL__free_cls /* Callback routine for closing objects of this class */
+}};
+
+/* Declare a free list to manage the H5VL_class_t struct */
+H5FL_DEFINE_STATIC(H5VL_class_t);
+
+/* Declare a free list to manage the H5VL_t struct */
+H5FL_DEFINE(H5VL_t);
+
+/* Declare a free list to manage the H5VL_object_t struct */
+H5FL_DEFINE(H5VL_object_t);
+
+/* Declare a free list to manage the H5VL_wrap_ctx_t struct */
+H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t);
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_init
+ *
+ * Purpose: Initialize the interface from some other package
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_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 H5VL_init() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__init_package
+ *
+ * Purpose: Initialize interface-specific information
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__init_package(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Initialize the atom group for the VL IDs */
+ if (H5I_register_type(H5I_VOL_CLS) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__init_package() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_term_package
+ *
+ * Purpose: Terminate various H5VL objects
+ *
+ * Return: Success: Positive if anything was done that might
+ * affect other interfaces; zero otherwise.
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5VL_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(H5_PKG_INIT_VAR) {
+ if (H5I_nmembers(H5I_VOL) > 0) {
+ (void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
+ 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 if */
+
+ FUNC_LEAVE_NOAPI(n)
+} /* end H5VL_term_package() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__free_cls
+ *
+ * Purpose: Frees a file VOL class struct and returns an indication of
+ * success. This function is used as the free callback for the
+ * virtual object layer object identifiers
+ * (c.f.: H5VL_init_interface).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__free_cls(H5VL_class_t *cls)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(cls);
+
+ /* Shut down the VOL connector */
+ if(cls->terminate && cls->terminate() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly")
+
+ /* Release the class */
+ H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */
+ H5FL_FREE(H5VL_class_t, cls);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__free_cls() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__wrap_obj
+ *
+ * Purpose: Wraps a library object with possible VOL connector wrappers, to
+ * match the VOL connector stack for the file.
+ *
+ * Return: Success: Wrapped object pointer
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 7, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__wrap_obj(void *obj)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(obj);
+
+ /* Retrieve the VOL object wrapping context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context")
+
+ /* If there is a VOL object wrapping context, wrap the object */
+ if(vol_wrap_ctx) {
+ /* Wrap object, using the VOL callback */
+ if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
+ } /* end if */
+ else
+ ret_value = obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__wrap_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__new_vol_obj
+ *
+ * Purpose: Creates a new VOL object, to use when registering an ID.
+ *
+ * Return: Success: VOL object pointer
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 7, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5VL_object_t *
+H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t wrap_obj)
+{
+ H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */
+ H5VL_object_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(object);
+ HDassert(vol_connector);
+
+ /* Make sure type number is valid */
+ if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number")
+
+ /* Create the new VOL object */
+ if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object")
+ new_vol_obj->connector = vol_connector;
+ if(wrap_obj) {
+ if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object")
+ } /* end if */
+ else
+ new_vol_obj->data = object;
+
+ /* Bump the reference count on the VOL connector */
+ vol_connector->nrefs++;
+
+ /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
+ if(H5I_DATATYPE == type) {
+ if(NULL == (ret_value = (H5VL_object_t *)H5T_construct_datatype(new_vol_obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object")
+ } /* end if */
+ else
+ ret_value = (H5VL_object_t *)new_vol_obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__new_vol_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_conn_copy
+ *
+ * Purpose: Copy VOL connector ID & info.
+ *
+ * Note: This is an "in-place" copy.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_conn_copy(H5VL_connector_prop_t *connector_prop)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if(connector_prop) {
+ /* Copy the connector ID & info, if there is one */
+ if(connector_prop->connector_id > 0) {
+ /* Increment the reference count on connector ID and copy connector info */
+ if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID")
+
+ /* Copy connector info, if it exists */
+ if(connector_prop->connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+ void *new_connector_info = NULL; /* Copy of connector info */
+
+ /* 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")
+
+ /* Allocate and copy connector info */
+ if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed")
+
+ /* Set the connector info to the copy */
+ connector_prop->connector_info = new_connector_info;
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_conn_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_conn_free
+ *
+ * Purpose: Free VOL connector ID & info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_conn_free(const H5VL_connector_prop_t *info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if(info) {
+ /* Free the connector info (if it exists) and decrement the ID */
+ if(info->connector_id > 0) {
+ if(info->connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Free the connector info */
+ if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
+ } /* end if */
+
+ /* Decrement reference count for connector ID */
+ if(H5I_dec_ref(info->connector_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID")
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_conn_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register
+ *
+ * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t
+ * from the passed-in object and registers that. Does the right
+ * thing with datatypes, which are complicated under the VOL.
+ *
+ * Return: Success: A valid HDF5 ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref)
+{
+ H5VL_object_t *vol_obj = NULL; /* VOL object wrapper for library object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Check arguments */
+ HDassert(object);
+ HDassert(vol_connector);
+
+ /* Set up VOL object for the passed-in data */
+ /* (Does not wrap object, since it's from a VOL callback) */
+ if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_connector, FALSE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
+
+ /* Register VOL object as _object_ type, for future object API calls */
+ if((ret_value = H5I_register(type, vol_obj, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_register() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register_using_existing_id
+ *
+ * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it.
+ * This routine will check to ensure the supplied ID is not already
+ * in use, and ensure that it is a valid ID for the given type,
+ * but will NOT check to ensure the OBJECT is not already
+ * registered (thus, it is possible to register one object under
+ * multiple IDs).
+ *
+ * NOTE: Intended for use in refresh calls, where we have to close
+ * and re-open the underlying data, then hook the VOL object back
+ * up to the original ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id)
+{
+ H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ HDassert(object);
+ HDassert(vol_connector);
+
+ /* Set up VOL object for the passed-in data */
+ /* (Wraps object, since it's a library object) */
+ if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_connector, TRUE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
+
+ /* Call the underlying H5I function to complete the registration */
+ if(H5I_register_using_existing_id(type, new_vol_obj, app_ref, existing_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_register_using_existing_id() */
+
+
+/*-------------------------------------------------------------------------
+ * 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_class_t *cls = NULL;
+ H5VL_t *connector = NULL; /* VOL connector struct */
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* 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")
+
+ /* 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")
+ 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")
+
+ /* 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:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_register_using_vol_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_free_object
+ *
+ * Purpose: Wrapper to unregister an object ID with a VOL aux struct
+ * and decrement ref count on VOL connector ID
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_free_object(H5VL_object_t *vol_obj)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(SUCCEED)
+
+ /* Check arguments */
+ HDassert(vol_obj);
+
+ vol_obj->connector->nrefs --;
+
+ if(0 == vol_obj->connector->nrefs) {
+ if(H5I_dec_ref(vol_obj->connector->id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+ vol_obj->connector = H5FL_FREE(H5VL_t, vol_obj->connector);
+ } /* end if */
+
+ vol_obj = H5FL_FREE(H5VL_object_t, vol_obj);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_free_object() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register_connector
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
+{
+ const H5VL_class_t *cls = (const H5VL_class_t *)_cls;
+ H5VL_class_t *saved = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Check arguments */
+ HDassert(cls);
+
+ /* Copy the class structure so the caller can reuse or free it */
+ if (NULL == (saved = H5FL_CALLOC(H5VL_class_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector class struct")
+ HDmemcpy(saved, cls, sizeof(H5VL_class_t));
+ if(NULL == (saved->name = H5MM_strdup(cls->name)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector name")
+
+ /* Initialize the VOL connector */
+ if(cls->initialize && cls->initialize(vipl_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector")
+
+ /* Create the new class ID */
+ if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+
+done:
+ if (ret_value < 0)
+ if (saved)
+ H5FL_FREE(H5VL_class_t, saved);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_register_connector() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_get_connector_name
+ *
+ * Purpose: Private version of H5VLget_connector_name
+ *
+ * Return: Success: The length of the connector name
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size)
+{
+ H5VL_object_t *vol_obj;
+ const H5VL_class_t *cls;
+ size_t len;
+ ssize_t ret_value = -1;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* get the object pointer */
+ if (NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier")
+
+ cls = vol_obj->connector->cls;
+
+ len = HDstrlen(cls->name);
+ if(name) {
+ HDstrncpy(name, cls->name, MIN(len + 1, size));
+ if(len >= size)
+ name[size - 1] = '\0';
+ } /* end if */
+
+ /* Set the return value for the API call */
+ ret_value = (ssize_t)len;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_get_connector_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_vol_object
+ *
+ * Purpose: Utility function to return the object pointer associated with
+ * a hid_t. This routine is the same as H5I_object for all types
+ * except for named datatypes, where the vol_obj is returned that
+ * is attached to the H5T_t struct.
+ *
+ * Return: Success: object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5VL_object_t *
+H5VL_vol_object(hid_t id)
+{
+ void *obj = NULL;
+ H5I_type_t obj_type;
+ H5VL_object_t *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ obj_type = H5I_get_type(id);
+ if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type ||
+ H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) {
+ /* Get the object */
+ if (NULL == (obj = H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
+
+ /* if this is a datatype, get the VOL object attached to the H5T_t struct */
+ if (H5I_DATATYPE == obj_type)
+ if (NULL == (obj = H5T_get_named_type((H5T_t *)obj)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function")
+
+ ret_value = (H5VL_object_t *)obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_vol_object() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_data
+ *
+ * Purpose: Correctly retrieve the 'data' field for a VOL object (H5VL_object),
+ * even for nested / stacked VOL connectors.
+ *
+ * Return: Success: object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_object_data(const H5VL_object_t *vol_obj)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check for 'get_object' callback in connector */
+ if(vol_obj->connector->cls->get_object)
+ ret_value = (vol_obj->connector->cls->get_object)(vol_obj->data);
+ else
+ ret_value = vol_obj->data;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_data() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__object
+ *
+ * Purpose: Internal function to return the VOL object pointer associated
+ * with an hid_t.
+ *
+ * Return: Success: object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__object(hid_t id, H5I_type_t obj_type)
+{
+ H5VL_object_t *vol_obj = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ /* Get the underlying object */
+ switch(obj_type) {
+ case H5I_GROUP:
+ case H5I_DATASET:
+ case H5I_FILE:
+ case H5I_ATTR:
+ /* get the object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
+ break;
+
+ case H5I_DATATYPE:
+ {
+ H5T_t *dt = NULL;
+
+ /* get the object */
+ if (NULL == (dt = (H5T_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
+
+ /* Get the actual datatype object that should be the vol_obj */
+ if (NULL == (vol_obj = H5T_get_named_type(dt)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype")
+ break;
+ }
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_DATASPACE:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type")
+ } /* end switch */
+
+ /* Set the return value */
+ ret_value = H5VL_object_data(vol_obj);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__object() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object
+ *
+ * Purpose: Utility function to return the VOL object pointer associated with
+ * a hid_t.
+ *
+ * Return: Success: object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_object(hid_t id)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the underlying object */
+ if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id))))
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_object_verify
+ *
+ * Purpose: Utility function to return the VOL object pointer associated
+ * with an identifier.
+ *
+ * Return: Success: object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5VL_object_verify(hid_t id, H5I_type_t obj_type)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check of ID of correct type */
+ if(obj_type != H5I_get_type(id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier")
+
+ /* Get the underlying object */
+ if(NULL == (ret_value = H5VL__object(id, obj_type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_verify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_cmp_connector_cls
+ *
+ * Purpose: Compare VOL class for a connector
+ *
+ * Return: Positive if VALUE1 is greater than VALUE2, negative if
+ * VALUE2 is greater than VALUE1 and zero if VALUE1 and
+ * VALUE2 are equal.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cls1);
+ HDassert(cls2);
+
+ /* Compare connector "values" */
+ if(cls1->value < cls2->value) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->value > cls2->value) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ HDassert(cls1->value == cls2->value);
+
+ /* Compare connector names */
+ if(cls1->name == NULL && cls2->name != NULL) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->name != NULL && cls2->name == NULL) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(0 != (*cmp_value = HDstrcmp(cls1->name, cls2->name)))
+ HGOTO_DONE(SUCCEED)
+
+ /* Compare connector VOL API versions */
+ if(cls1->version < cls2->version) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->version > cls2->version) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ HDassert(cls1->version == cls2->version);
+
+ /* Compare connector info */
+ if(cls1->info_size < cls2->info_size) {
+ *cmp_value = -1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ if(cls1->info_size > cls2->info_size) {
+ *cmp_value = 1;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ HDassert(cls1->info_size == cls2->info_size);
+
+ /* Set comparison value to 'equal' */
+ *cmp_value = 0;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_cmp_connector_cls() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_set_vol_wrapper
+ *
+ * Purpose: Set up object wrapping context for current VOL connector
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(obj);
+ HDassert(connector);
+
+ /* Retrieve the VOL object wrap context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context")
+
+ /* Check for existing wrapping context */
+ if(NULL == vol_wrap_ctx) {
+ /* Check if the connector can create a wrap context */
+ if(connector->cls->get_wrap_ctx) {
+ /* Sanity check */
+ HDassert(connector->cls->free_wrap_ctx);
+
+ /* Get the wrap context from the connector */
+ if((connector->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context")
+ } /* end if */
+
+ /* Allocate VOL object wrapper context */
+ if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context")
+
+ /* Set up VOL object wrapper context */
+ vol_wrap_ctx->rc = 1;;
+ vol_wrap_ctx->connector = connector;
+ vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx;
+ } /* end if */
+ else
+ /* Incremeent ref count on existing wrapper context */
+ vol_wrap_ctx->rc++;
+
+ /* Save the wrapper context */
+ if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
+
+done:
+ if(ret_value < 0 && vol_wrap_ctx)
+ /* Release object wrapping context */
+ H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_set_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_reset_vol_wrapper
+ *
+ * Purpose: Reset object wrapping context for current VOL connector
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_reset_vol_wrapper(void)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Retrieve the VOL object wrap context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context")
+
+ /* Check for VOL object wrap context */
+ if(NULL == vol_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?")
+
+ /* Decrement ref count on wrapping context */
+ vol_wrap_ctx->rc--;
+
+ /* Release context if the ref count drops to zero */
+ if(0 == vol_wrap_ctx->rc) {
+ /* If there is a VOL connector object wrapping context, release it */
+ if(vol_wrap_ctx->obj_wrap_ctx) {
+ /* Release the VOL connector's object wrapping context */
+ if((*vol_wrap_ctx->connector->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context")
+ } /* end if */
+
+ /* Release object wrapping context */
+ H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx);
+
+ /* Reset the wrapper context */
+ if(H5CX_set_vol_wrap_ctx(NULL) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
+ } /* end if */
+ else {
+ /* Save the updated wrapper context */
+ if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_reset_vol_wrapper() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_wrap_register
+ *
+ * Purpose: Wrap an object and register an ID for it
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ void *new_obj; /* Newly wrapped object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Sanity check */
+ HDassert(obj);
+
+ /* If the datatype is already VOL-managed, the datatype's vol_obj
+ * field will get clobbered later, so disallow this.
+ */
+ if(type == H5I_DATATYPE)
+ if(TRUE == H5T_already_vol_managed((const H5T_t *)obj))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype")
+
+ /* Wrap the object with VOL connector info */
+ if(NULL == (new_obj = H5VL__wrap_obj(obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object")
+
+ /* Retrieve the VOL object wrapping context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context")
+ if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???")
+
+ /* Get an ID for the object */
+ if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_wrap_register() */
+
diff --git a/src/H5HLpublic.h b/src/H5VLmodule.h
index 143bb78..1ae0d61 100644
--- a/src/H5HLpublic.h
+++ b/src/H5VLmodule.h
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 *
@@ -11,27 +10,22 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*-------------------------------------------------------------------------
- *
- * Created: H5HLpublic.h
- * Jul 16 1997
- * Robb Matzke <matzke@llnl.gov>
- *
- * Purpose: Public declarations for the H5HL (local heap) package.
- *
- *-------------------------------------------------------------------------
+/*
+ * Purpose: This file contains declarations which define macros for the
+ * H5VL package. Including this header means that the source file
+ * is part of the H5VL package.
*/
-#ifndef _H5HLpublic_H
-#define _H5HLpublic_H
-/* Public headers needed by this file */
-#include "H5public.h"
+#ifndef _H5VLmodule_H
+#define _H5VLmodule_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
+ * reporting macros.
+ */
+#define H5VL_MODULE
+#define H5_MY_PKG H5VL
+#define H5_MY_PKG_ERR H5E_VOL
+#define H5_MY_PKG_INIT YES
+
+#endif /* _H5VLmodule_H */
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
new file mode 100644
index 0000000..5368d41
--- /dev/null
+++ b/src/H5VLnative.c
@@ -0,0 +1,3655 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 native VOL connector where access is to a single HDF5 file
+ * using HDF5 VFDs.
+ */
+
+#define H5A_FRIEND /* Suppress error about including H5Apkg */
+#define H5D_FRIEND /* Suppress error about including H5Dpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+#define H5G_FRIEND /* Suppress error about including H5Gpkg */
+#define H5L_FRIEND /* Suppress error about including H5Lpkg */
+#define H5O_FRIEND /* Suppress error about including H5Opkg */
+#define H5R_FRIEND /* Suppress error about including H5Rpkg */
+#define H5T_FRIEND /* Suppress error about including H5Tpkg */
+
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lpkg.h" /* Links */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Rpkg.h" /* References */
+#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative.h" /* Native VOL connector */
+
+/*
+ * The VOL connector identification number.
+ */
+static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID;
+
+
+/* Prototypes */
+static herr_t H5VL__native_term(void);
+
+/* Atrribute callbacks */
+static void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+static void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static 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);
+static herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
+
+/* Dataset callbacks */
+static void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+static void *H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req);
+static herr_t H5VL__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);
+static herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req);
+
+/* File callbacks */
+static void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
+static void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
+
+/* Group callbacks */
+static void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+static 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);
+static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
+
+/* Link callbacks */
+static herr_t H5VL__native_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);
+static 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);
+static 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);
+static 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);
+static 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);
+
+/* Object callbacks */
+static void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+static herr_t H5VL__native_object_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);
+static 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);
+static 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);
+static herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Datatype callbacks */
+static void *H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+static void *H5VL__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);
+static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
+
+/* Native VOL connector class struct */
+static H5VL_class_t H5VL_native_cls_g = {
+ H5VL_NATIVE_VERSION, /* version */
+ H5VL_NATIVE_VALUE, /* value */
+ H5VL_NATIVE_NAME, /* name */
+ 0, /* capability flags */
+ NULL, /* initialize */
+ H5VL__native_term, /* terminate */
+ (size_t)0, /* info size */
+ NULL, /* info copy */
+ NULL, /* info compare */
+ NULL, /* info free */
+ NULL, /* info to str */
+ NULL, /* str to info */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* free_wrap_ctx */
+ { /* attribute_cls */
+ H5VL__native_attr_create, /* create */
+ H5VL__native_attr_open, /* open */
+ H5VL__native_attr_read, /* read */
+ H5VL__native_attr_write, /* write */
+ H5VL__native_attr_get, /* get */
+ H5VL__native_attr_specific, /* specific */
+ H5VL__native_attr_optional, /* optional */
+ H5VL__native_attr_close /* close */
+ },
+ { /* dataset_cls */
+ H5VL__native_dataset_create, /* create */
+ H5VL__native_dataset_open, /* open */
+ H5VL__native_dataset_read, /* read */
+ H5VL__native_dataset_write, /* write */
+ H5VL__native_dataset_get, /* get */
+ H5VL__native_dataset_specific, /* specific */
+ H5VL__native_dataset_optional, /* optional */
+ H5VL__native_dataset_close /* close */
+ },
+ { /* datatype_cls */
+ H5VL__native_datatype_commit, /* commit */
+ H5VL__native_datatype_open, /* open */
+ H5VL__native_datatype_get, /* get */
+ H5VL__native_datatype_specific, /* specific */
+ NULL, /* optional */
+ H5VL__native_datatype_close /* close */
+ },
+ { /* file_cls */
+ H5VL__native_file_create, /* create */
+ H5VL__native_file_open, /* open */
+ H5VL__native_file_get, /* get */
+ H5VL__native_file_specific, /* specific */
+ H5VL__native_file_optional, /* optional */
+ H5VL__native_file_close /* close */
+ },
+ { /* group_cls */
+ H5VL__native_group_create, /* create */
+ H5VL__native_group_open, /* open */
+ H5VL__native_group_get, /* get */
+ H5VL__native_group_specific, /* specific */
+ H5VL__native_group_optional, /* optional */
+ H5VL__native_group_close /* close */
+ },
+ { /* link_cls */
+ H5VL__native_link_create, /* create */
+ H5VL__native_link_copy, /* copy */
+ H5VL__native_link_move, /* move */
+ H5VL__native_link_get, /* get */
+ H5VL__native_link_specific, /* specific */
+ NULL /* optional */
+ },
+ { /* object_cls */
+ H5VL__native_object_open, /* open */
+ H5VL__native_object_copy, /* copy */
+ H5VL__native_object_get, /* get */
+ H5VL__native_object_specific, /* specific */
+ H5VL__native_object_optional /* optional */
+ },
+ { /* request_cls */
+ NULL, /* wait */
+ NULL, /* notify */
+ NULL, /* cancel */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* free */
+ },
+ NULL /* optional */
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_native_register
+ *
+ * Purpose: Register the native VOL connector and retrieve an ID for it.
+ *
+ * Return: Success: The ID for the native connector
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_native_register(void)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Register the native VOL connector, if it isn't already */
+ if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL))
+ if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector")
+
+ /* Set return value */
+ ret_value = H5VL_NATIVE_ID_g;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_register() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_term
+ *
+ * Purpose: Shut down the native VOL
+ *
+ * Returns: SUCCEED (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_term(void)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Reset VOL ID */
+ H5VL_NATIVE_ID_g = H5I_INVALID_HID;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5VL__native_term() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_create
+ *
+ * Purpose: Creates an attribute on an object.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Object location */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ hbool_t loc_found = FALSE;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t type_id, space_id;
+ H5T_t *type, *dt; /* Datatype to use for attribute */
+ H5S_t *space; /* Dataspace to use for attribute */
+ H5A_t *attr = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* get creation properties */
+ if(H5P_get(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
+ if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+ if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file")
+
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
+ /* If this is a named datatype, get the connector's pointer to the datatype */
+ type = H5T_get_actual_type(dt);
+
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space")
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* H5Acreate */
+ /* Go do the real work for attaching the attribute to the dataset */
+ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ /* H5Acreate_by_name */
+ if(NULL == (attr = H5A__create_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name, type, space, acpl_id)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters")
+
+ ret_value = (void *)attr;
+
+done:
+ /* Release resources */
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_open
+ *
+ * Purpose: Opens an attr inside a native H5 file.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Object location */
+ H5A_t *attr = NULL; /* Attribute opened */
+ void *ret_value;
+
+ FUNC_ENTER_STATIC
+
+ /* check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* H5Aopen */
+ /* Open the attribute */
+ if(NULL == (attr = H5A__open(&loc, attr_name)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name)
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ /* H5Aopen_by_name */
+ /* 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)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute")
+ } /* end else-if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) {
+ /* H5Aopen_by_idx */
+ /* Open the attribute in 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)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters")
+
+ ret_value = (void *)attr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_read
+ *
+ * Purpose: Reads data from attribute.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5T_t *mem_type; /* Memory datatype */
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Go write the actual data to the attribute */
+ if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_write
+ *
+ * Purpose: Writes data to attribute.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5T_t *mem_type; /* Memory datatype */
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Go write the actual data to the attribute */
+ if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_get
+ *
+ * Purpose: Gets information about an attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(get_type) {
+ /* H5Aget_space */
+ case H5VL_ATTR_GET_SPACE:
+ {
+ hid_t *ret_id = va_arg(arguments, hid_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ if((*ret_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 = va_arg(arguments, hid_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ if((*ret_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 = va_arg(arguments, hid_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ if((*ret_id = H5A__get_create_plist(attr)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr")
+
+ break;
+ }
+
+ /* H5Aget_name */
+ case H5VL_ATTR_GET_NAME:
+ {
+ const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
+ size_t buf_size = va_arg(arguments, size_t);
+ char *buf = va_arg(arguments, char *);
+ ssize_t *ret_val = va_arg(arguments, ssize_t *);
+ H5A_t *attr = NULL;
+
+ 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)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
+ }
+ else if(H5VL_OBJECT_BY_IDX == loc_params->type) {
+ H5G_loc_t loc;
+
+ /* check arguments */
+ if(H5G_loc_real(obj, 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)))
+ 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);
+
+ /* 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';
+ } /* end if */
+
+ /* Release resources */
+ if(attr && H5A__close(attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
+ }
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr")
+
+ break;
+ }
+
+ /* H5Aget_info */
+ case H5VL_ATTR_GET_INFO:
+ {
+ const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
+ H5A_info_t *ainfo = va_arg(arguments, H5A_info_t *);
+ H5A_t *attr = NULL;
+
+ if(H5VL_OBJECT_BY_SELF == loc_params->type) {
+ attr = (H5A_t *)obj;
+ if(H5A__get_info(attr, 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 = va_arg(arguments, char *);
+ H5G_loc_t loc;
+
+ /* check arguments */
+ if(H5G_loc_real(obj, 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)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+
+ /* Get the attribute information */
+ if(H5A__get_info(attr, 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) {
+ H5G_loc_t loc;
+
+ /* check arguments */
+ if(H5G_loc_real(obj, 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)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
+
+ /* Get the attribute information */
+ if(H5A__get_info(attr, 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
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr")
+
+ break;
+ }
+
+ case H5VL_ATTR_GET_STORAGE_SIZE:
+ {
+ hsize_t *ret = va_arg(arguments, hsize_t *);
+ H5A_t *attr = (H5A_t *)obj;
+
+ /* Set return value */
+ *ret = attr->shared->data_size;
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_specific
+ *
+ * Purpose: Specific operation on attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * August, 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5G_loc_t loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Get location for passed-in object */
+ 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) {
+ case H5VL_ATTR_DELETE:
+ {
+ char *attr_name = va_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)
+ 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)
+ 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 */
+ /* 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)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters")
+ break;
+ }
+
+ case H5VL_ATTR_EXISTS:
+ {
+ const char *attr_name = va_arg(arguments, const char *);
+ htri_t *ret = va_arg(arguments, htri_t *);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */
+ /* Check if the attribute exists */
+ if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 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 */
+ /* Check if the attribute exists */
+ if((*ret = H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, attr_name)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
+ break;
+ }
+
+ case H5VL_ATTR_ITER:
+ {
+ H5_index_t idx_type = va_arg(arguments, H5_index_t);
+ H5_iter_order_t order = va_arg(arguments, H5_iter_order_t);
+ hsize_t *idx = va_arg(arguments, hsize_t *);
+ H5A_operator2_t op = va_arg(arguments, H5A_operator2_t);
+ void *op_data = va_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 */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
+ break;
+ }
+
+ /* H5Arename/rename_by_name */
+ case H5VL_ATTR_RENAME:
+ {
+ const char *old_name = va_arg(arguments, const char *);
+ const char *new_name = va_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)
+ 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)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_optional
+ *
+ * Purpose: Perform a connector-specific operation on a native attribute
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5VL_attr_optional_t optional_type;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ optional_type = va_arg(arguments, H5VL_attr_optional_t);
+ switch(optional_type) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ case H5VL_ATTR_ITERATE_OLD:
+ {
+ hid_t loc_id = va_arg(arguments, hid_t);
+ unsigned *attr_num = va_arg(arguments, unsigned *);
+ H5A_operator1_t op = va_arg(arguments, H5A_operator1_t);
+ void *op_data = va_arg(arguments, void *);
+
+ /* Call the actual iteration routine */
+ if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
+ HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
+
+ break;
+ }
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_attr_close
+ *
+ * Purpose: Closes an attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1, attr not closed.
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(H5A__close((H5A_t*)attr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_attr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_create
+ *
+ * Purpose: Creates a dataset in a native HDF5 file
+ *
+ * Return: Success: Pointer to a dataset struct
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5G_loc_t loc; /* Object location to insert dataset into */
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t lcpl_id = H5I_INVALID_HID;
+ H5D_t *dset = NULL; /* New dataset's info */
+ const H5S_t *space; /* Dataspace for dataset */
+ void *ret_value;
+
+ FUNC_ENTER_STATIC
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* Get creation properties */
+ if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
+ if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
+ if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
+
+ /* Check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+ if(H5I_DATATYPE != H5I_get_type(type_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID")
+ if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataspace ID")
+
+ /* H5Dcreate_anon */
+ if(NULL == name) {
+ /* build and open the new dataset */
+ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
+ } /* end if */
+ /* H5Dcreate2 */
+ else {
+ /* Create the new dataset & get its ID */
+ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
+ } /* end else */
+
+ ret_value = (void *)dset;
+
+done:
+ if(NULL == name) {
+ /* Release the dataset's object header, if it was created */
+ if(dset) {
+ H5O_loc_t *oloc; /* Object location for dataset */
+
+ /* Get the new dataset's object location */
+ if(NULL == (oloc = H5D_oloc(dset)))
+ HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset")
+
+ /* Decrement refcount on dataset's object header in memory */
+ if(H5O_dec_rc_by_loc(oloc) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_open
+ *
+ * Purpose: Opens a dataset in a native HDF5 file.
+ *
+ * Return: Success: Pointer to a dataset struct
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5D_t *dset = NULL;
+ H5G_loc_t loc; /* Object location of group */
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* Open the dataset */
+ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
+
+ ret_value = (void *)dset;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_read
+ *
+ * Purpose: Reads raw data from a dataset into a buffer.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf,
+ void H5_ATTR_UNUSED **req)
+{
+ 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 */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ 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")
+
+ /* Read raw data */
+ if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_write
+ *
+ * Purpose: Writes raw data from a buffer into a dataset.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf,
+ void H5_ATTR_UNUSED **req)
+{
+ 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 */
+
+ FUNC_ENTER_STATIC
+
+ /* check arguments */
+ 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")
+
+ /* Write the data */
+ if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_get
+ *
+ * Purpose: Gets certain information about a dataset
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5D_t *dset = (H5D_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(get_type) {
+ /* H5Dget_space */
+ case H5VL_DATASET_GET_SPACE:
+ {
+ hid_t *ret_id = va_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")
+
+ break;
+ }
+
+ /* H5Dget_space_statuc */
+ case H5VL_DATASET_GET_SPACE_STATUS:
+ {
+ H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *);
+
+ /* Read data space address and return */
+ if(H5D__get_space_status(dset, allocation) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
+
+ break;
+ }
+
+ /* H5Dget_type */
+ case H5VL_DATASET_GET_TYPE:
+ {
+ hid_t *ret_id = va_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")
+
+ break;
+ }
+
+ /* H5Dget_create_plist */
+ case H5VL_DATASET_GET_DCPL:
+ {
+ hid_t *ret_id = va_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")
+
+ break;
+ }
+
+ /* H5Dget_access_plist */
+ case H5VL_DATASET_GET_DAPL:
+ {
+ hid_t *ret_id = va_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")
+
+ break;
+ }
+
+ /* H5Dget_storage_size */
+ case H5VL_DATASET_GET_STORAGE_SIZE:
+ {
+ hsize_t *ret = va_arg(arguments, hsize_t *);
+
+ /* Set return value */
+ if(H5D__get_storage_size(dset, ret) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
+ break;
+ }
+
+ /* H5Dget_offset */
+ case H5VL_DATASET_GET_OFFSET:
+ {
+ haddr_t *ret = va_arg(arguments, haddr_t *);
+
+ /* Set return value */
+ *ret = H5D__get_offset(dset);
+ if(!H5F_addr_defined(*ret))
+ *ret = HADDR_UNDEF;
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_specific
+ *
+ * Purpose: Specific operation on dataset
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5D_t *dset = (H5D_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(specific_type) {
+ /* H5Dspecific_space */
+ case H5VL_DATASET_SET_EXTENT:
+ {
+ const hsize_t *size = va_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")
+ break;
+ }
+
+ case H5VL_DATASET_FLUSH:
+ {
+ hid_t dset_id = va_arg(arguments, hid_t);
+
+ /* Flush the dataset */
+ if(H5D__flush(dset, dset_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
+
+ break;
+ }
+
+ case H5VL_DATASET_REFRESH:
+ {
+ hid_t dset_id = va_arg(arguments, hid_t);
+
+ /* Refresh the dataset */
+ if((H5D__refresh(dset_id, dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_optional
+ *
+ * Purpose: Perform a connector-specific operation on a native dataset
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5D_t *dset = NULL; /* Dataset */
+ H5VL_dataset_optional_t optional_type = va_arg(arguments, H5VL_dataset_optional_t);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(optional_type) {
+ case H5VL_DATASET_FORMAT_CONVERT:
+ {
+ dset = (H5D_t *)obj;
+
+ 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset")
+ break;
+
+ case H5D_CONTIGUOUS:
+ 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset")
+ break;
+
+ case H5D_VIRTUAL:
+ /* Nothing to do even though layout is version 4 */
+ break;
+
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
+
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
+ } /* end switch */
+
+ break;
+ }
+
+ case H5VL_DATASET_GET_CHUNK_INDEX_TYPE:
+ {
+ H5D_chunk_index_t *idx_type = va_arg(arguments, H5D_chunk_index_t *);
+
+ dset = (H5D_t *)obj;
+
+ /* 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;
+
+ break;
+ }
+
+ case H5VL_DATASET_GET_CHUNK_STORAGE_SIZE:
+ {
+ hsize_t *offset = va_arg(arguments, hsize_t *);
+ hsize_t *chunk_nbytes = va_arg(arguments, hsize_t *);
+
+ dset = (H5D_t *)obj;
+
+ /* 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)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
+
+ break;
+ }
+
+ case H5VL_DATASET_CHUNK_READ:
+ {
+ const hsize_t *offset = va_arg(arguments, hsize_t *);
+ uint32_t *filters = va_arg(arguments, uint32_t *);
+ void *buf = va_arg(arguments, void *);
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+
+ dset = (H5D_t *)obj;
+
+ /* Check arguments */
+ if(NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* 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")
+
+ /* Read the raw chunk */
+ if(H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
+
+ break;
+ }
+
+ case H5VL_DATASET_CHUNK_WRITE:
+ {
+ uint32_t filters = va_arg(arguments, uint32_t);
+ const hsize_t *offset = va_arg(arguments, const hsize_t *);
+ uint32_t data_size_32 = va_arg(arguments, uint32_t);
+ const void *buf = va_arg(arguments, const void *);
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+
+ dset = (H5D_t *)obj;
+
+ /* Check arguments */
+ if(NULL == dset->oloc.file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* 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")
+
+ /* Write chunk */
+ if(H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_close
+ *
+ * Purpose: Closes a dataset.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL (dataset will not be closed)
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(H5D_close((H5D_t*)dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_create
+ *
+ * Purpose: Creates a file as a native HDF5 file.
+ *
+ * Return: Success: A pointer to an H5F_t file struct
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5F_t *new_file = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ /* Adjust bit flags by turning on the creation bit and making sure that
+ * the EXCL or TRUNC bit is set. All newly-created files are opened for
+ * reading and writing.
+ */
+ if(0 == (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)))
+ flags |= H5F_ACC_EXCL; /*default*/
+ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
+
+ /* Create the file */
+ if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file")
+ new_file->id_exists = TRUE;
+
+ ret_value = (void *)new_file;
+
+done:
+ if(NULL == ret_value && new_file)
+ if(H5F__close(new_file) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_open
+ *
+ * Purpose: Opens a file as a native HDF5 file.
+ *
+ * Return: Success: A pointer to an H5F_t file struct
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5F_t *new_file = NULL;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ /* Open the file */
+ if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
+ new_file->id_exists = TRUE;
+
+ ret_value = (void *)new_file;
+
+done:
+ if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_get
+ *
+ * Purpose: Get info about a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5F_t *f = NULL; /* File struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(get_type) {
+ /* H5Fget_access_plist */
+ case H5VL_FILE_GET_FAPL:
+ {
+ H5P_genplist_t *new_plist; /* New property list */
+ hid_t *plist_id = va_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)
+ HGOTO_ERROR(H5E_PLIST, 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 = va_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)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties")
+
+ break;
+ }
+
+ /* H5Fget_obj_count */
+ case H5VL_FILE_GET_OBJ_COUNT:
+ {
+ unsigned types = va_arg(arguments, unsigned);
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ 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 = va_arg(arguments, unsigned);
+ size_t max_objs = va_arg(arguments, size_t);
+ hid_t *oid_list = va_arg(arguments, hid_t *);
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ 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")
+
+ /* Set the return value */
+ *ret = (ssize_t)obj_count;
+ break;
+ }
+
+ /* H5Fget_intent */
+ case H5VL_FILE_GET_INTENT:
+ {
+ unsigned *intent_flags = va_arg(arguments, unsigned *);
+
+ f = (H5F_t *)obj;
+
+ /* HDF5 uses some flags internally that users don't know about.
+ * Simplify things for them so that they only get either H5F_ACC_RDWR
+ * or H5F_ACC_RDONLY and any SWMR flags.
+ */
+ if(H5F_INTENT(f) & H5F_ACC_RDWR) {
+ *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;
+ } /* end if */
+ else {
+ *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;
+ } /* end else */
+
+ break;
+ }
+
+ /* H5Fget_name */
+ case H5VL_FILE_GET_NAME:
+ {
+ H5I_type_t type = va_arg(arguments, H5I_type_t);
+ size_t size = va_arg(arguments, size_t);
+ char *name = va_arg(arguments, char *);
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+ size_t len;
+
+ if(NULL == (f = H5F__get_file(obj, type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ 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';
+ } /* end if */
+
+ /* Set the return value for the API call */
+ *ret = (ssize_t)len;
+ break;
+ }
+
+ case H5VL_FILE_GET_MIN_DSET_OHDR_FLAG:
+ {
+ hbool_t *minimize = va_arg(arguments, hbool_t*);
+ f = (H5F_t*)obj;
+ if (NULL == f)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ *minimize = H5F_MIN_DSET_OHDR(f);
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_specific
+ *
+ * Purpose: Specific operation on file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(specific_type) {
+ /* H5Fflush */
+ case H5VL_FILE_FLUSH:
+ {
+ H5I_type_t type = va_arg(arguments, H5I_type_t);
+ H5F_scope_t scope = va_arg(arguments, H5F_scope_t);
+ H5F_t *f = NULL; /* File to flush */
+
+ /* Get the file for the object */
+ if(NULL == (f = H5F__get_file(obj, type)))
+ 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
+ * made at the shared open(2) flags level, implying that opening a
+ * file twice, once for read-only and once for read-write, and then
+ * calling H5Fflush() with the read-only handle, still causes data
+ * to be flushed.
+ */
+ if(H5F_ACC_RDWR & H5F_INTENT(f)) {
+ /* Flush other files, depending on scope */
+ if(H5F_SCOPE_GLOBAL == scope) {
+ /* Call the flush routine for mounted file hierarchies */
+ if(H5F_flush_mounts(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy")
+ } /* end if */
+ else {
+ /* Call the flush routine, for this file */
+ if(H5F__flush(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
+ } /* end else */
+ } /* end if */
+ break;
+ }
+
+ /* H5Freopen */
+ case H5VL_FILE_REOPEN:
+ {
+ void **ret = va_arg(arguments, void **);
+ H5F_t *new_file = NULL;
+
+ /* 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 = va_arg(arguments, H5I_type_t);
+ const char *name = va_arg(arguments, const char *);
+ H5F_t *child = va_arg(arguments, H5F_t *);
+ hid_t plist_id = va_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, plist_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
+
+ break;
+ }
+
+ /* H5Funmount */
+ case H5VL_FILE_UNMOUNT:
+ {
+ H5I_type_t type = va_arg(arguments, H5I_type_t);
+ const char *name = va_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")
+
+ break;
+ }
+
+ /* H5Fis_accessible */
+ case H5VL_FILE_IS_ACCESSIBLE:
+ {
+ hid_t fapl_id = va_arg(arguments, hid_t);
+ const char *name = va_arg(arguments, const char *);
+ htri_t *ret = va_arg(arguments, htri_t *);
+
+ /* Call private routine */
+ if((*ret = H5F__is_hdf5(name, fapl_id)) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check")
+ break;
+ }
+
+ /* H5Fcreate / H5Fopen */
+ case H5VL_FILE_CACHE_VOL_CONN:
+ {
+ hid_t vol_id = va_arg(arguments, hid_t);
+ void *vol_info = va_arg(arguments, void *);
+
+ /* Call private routine */
+ if(H5F__set_vol_conn((H5F_t *)obj, vol_id, vol_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cache VOL connector ID & info failed")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_optional
+ *
+ * Purpose: Perform a connector-specific operation on a native file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5F_t *f = NULL; /* File */
+ H5VL_file_optional_t optional_type = va_arg(arguments, H5VL_file_optional_t);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ f = (H5F_t *)obj;
+ switch(optional_type) {
+ /* H5Fget_filesize */
+ case H5VL_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 = va_arg(arguments, hsize_t *);
+
+ /* Go get the actual file size */
+ 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 */
+
+ break;
+ }
+
+ /* H5Fget_file_image */
+ case H5VL_FILE_GET_FILE_IMAGE:
+ {
+ void *buf_ptr = va_arg(arguments, void *);
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+ size_t buf_len = va_arg(arguments, size_t );
+
+ /* Do the actual work */
+ if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed")
+ break;
+ }
+
+ /* H5Fget_freespace */
+ case H5VL_FILE_GET_FREE_SPACE:
+ {
+ hsize_t tot_space; /* Amount of free space in the file */
+ hssize_t *ret = va_arg(arguments, hssize_t *);
+
+ /* Go get the actual amount of free space in the file */
+ if(H5MF_get_freespace(f, &tot_space, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ *ret = (hssize_t)tot_space;
+ break;
+ }
+
+ case H5VL_FILE_GET_FREE_SECTIONS:
+ {
+ H5F_sect_info_t *sect_info = va_arg(arguments, H5F_sect_info_t *);
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+ H5F_mem_t type = va_arg(arguments, H5F_mem_t);
+ size_t nsects = va_arg(arguments, size_t);
+
+ /* Go get the free-space section information in the file */
+ if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ break;
+ }
+
+ /* H5Fget_info2 */
+ case H5VL_FILE_GET_INFO:
+ {
+ H5I_type_t type = va_arg(arguments, H5I_type_t);
+ H5F_info2_t *finfo = va_arg(arguments, H5F_info2_t *);
+
+ /* Get the file struct. This call is careful to not return the file pointer
+ * for the top file in a mount hierarchy.
+ */
+ if(NULL == (f = H5F__get_file(obj, type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct")
+
+ /* Get the file info */
+ if(H5F__get_info(f, finfo) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
+
+ break;
+ }
+
+ /* H5Fget_mdc_config */
+ case H5VL_FILE_GET_MDC_CONF:
+ {
+ H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *);
+
+ /* 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_FILE_GET_MDC_HR:
+ {
+ double *hit_rate_ptr = va_arg(arguments, double *);
+
+ /* 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_FILE_GET_MDC_SIZE:
+ {
+ size_t *max_size_ptr = va_arg(arguments, size_t *);
+ size_t *min_clean_size_ptr = va_arg(arguments, size_t *);
+ size_t *cur_size_ptr = va_arg(arguments, size_t *);
+ int *cur_num_entries_ptr = va_arg(arguments, int *);
+ uint32_t cur_num_entries;
+
+ /* 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.")
+
+ if(cur_num_entries_ptr != NULL)
+ *cur_num_entries_ptr = (int)cur_num_entries;
+ break;
+ }
+
+ /* H5Fget_vfd_handle */
+ case H5VL_FILE_GET_VFD_HANDLE:
+ {
+ void **file_handle = va_arg(arguments, void **);
+ hid_t fapl_id = va_arg(arguments, hid_t);
+
+ /* Retrieve the VFD handle for the file */
+ if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle")
+ break;
+ }
+
+ /* H5Iget_file_id */
+ case H5VL_FILE_GET_FILE_ID:
+ {
+ H5I_type_t type = va_arg(arguments, H5I_type_t);
+ hid_t *file_id = va_arg(arguments, hid_t *);
+
+ if(NULL == (f = H5F__get_file(obj, type)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object")
+ if((*file_id = H5F__get_file_id(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID")
+ break;
+ }
+
+ /* H5Fclear_elink_file_cache */
+ case H5VL_FILE_CLEAR_ELINK_CACHE:
+ {
+ /* Release the EFC */
+ 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;
+ }
+
+ /* H5Freset_mdc_hit_rate_stats */
+ case H5VL_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")
+ break;
+ }
+
+ case H5VL_FILE_SET_MDC_CONFIG:
+ {
+ H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *);
+
+ /* 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;
+ }
+
+ case H5VL_FILE_GET_METADATA_READ_RETRY_INFO:
+ {
+ H5F_retry_info_t *info = va_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")
+
+ break;
+ }
+
+ case H5VL_FILE_START_SWMR_WRITE:
+ {
+ if(H5F__start_swmr_write(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write")
+
+ break;
+ }
+
+ case H5VL_FILE_START_MDC_LOGGING:
+ {
+ /* Call mdc logging function */
+ if(H5C_start_logging(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
+
+ break;
+ }
+
+ case H5VL_FILE_STOP_MDC_LOGGING:
+ {
+ /* Call mdc logging function */
+ if(H5C_stop_logging(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
+
+ break;
+ }
+
+ case H5VL_FILE_GET_MDC_LOGGING_STATUS:
+ {
+ hbool_t *is_enabled = va_arg(arguments, hbool_t *);
+ hbool_t *is_currently_logging = va_arg(arguments, hbool_t *);
+
+ /* Call mdc logging function */
+ if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status")
+
+ break;
+ }
+
+ case H5VL_FILE_FORMAT_CONVERT:
+ {
+ /* Convert the format */
+ if(H5F__format_convert(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
+
+ break;
+ }
+
+ case H5VL_FILE_RESET_PAGE_BUFFERING_STATS:
+ {
+ /* Sanity check */
+ if(NULL == f->shared->page_buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
+
+ /* Reset the statistics */
+ if (H5PB_reset_stats(f->shared->page_buf) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering")
+
+ break;
+ }
+
+ case H5VL_FILE_GET_PAGE_BUFFERING_STATS:
+ {
+ unsigned *accesses = va_arg(arguments, unsigned *);
+ unsigned *hits = va_arg(arguments, unsigned *);
+ unsigned *misses = va_arg(arguments, unsigned *);
+ unsigned *evictions = va_arg(arguments, unsigned *);
+ unsigned *bypasses = va_arg(arguments, unsigned *);
+
+ /* 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)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
+
+ break;
+ }
+
+ case H5VL_FILE_GET_MDC_IMAGE_INFO:
+ {
+ haddr_t *image_addr = va_arg(arguments, haddr_t *);
+ hsize_t *image_len = va_arg(arguments, hsize_t *);
+
+ /* Go get the address and size of the cache image */
+ if(H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
+
+ break;
+ }
+
+ case H5VL_FILE_GET_EOA:
+ {
+ haddr_t *eoa = va_arg(arguments, haddr_t *);
+ haddr_t rel_eoa; /* Relative address of EOA */
+
+ /* Sanity check */
+ HDassert(eoa);
+
+ /* This routine will work only for drivers with this feature enabled.*/
+ /* We might introduce a new feature flag in the future */
+ if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
+
+ /* The real work */
+ if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed")
+
+ /* Set return value */
+ /* (Note compensating for base address subtraction in internal routine) */
+ *eoa = rel_eoa + H5F_get_base_addr(f);
+
+ break;
+ }
+
+ case H5VL_FILE_INCR_FILESIZE:
+ {
+ hsize_t increment = va_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.*/
+ /* We might introduce a new feature flag in the future */
+ if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine")
+
+ /* Get the maximum of EOA and EOF */
+ 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 ")
+
+ /* Set EOA to the maximum value + increment */
+ if(H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
+
+ break;
+ }
+
+ case H5VL_FILE_SET_LIBVER_BOUNDS:
+ {
+ H5F_libver_t low = va_arg(arguments, H5F_libver_t);
+ H5F_libver_t high = va_arg(arguments, H5F_libver_t);
+
+ /* Call internal set_libver_bounds function */
+ if(H5F__set_libver_bounds(f, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
+
+ break;
+ }
+
+ case H5VL_FILE_SET_MIN_DSET_OHDR_FLAG:
+ {
+ int minimize = va_arg(arguments, int); /* int to satisfy va_arg */
+ if (0 > H5F_set_min_dset_ohdr(f, (hbool_t)minimize))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL,
+ "cannot set file's dataset object header minimization flag")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_file_close
+ *
+ * Purpose: Closes a file.
+ *
+ * Return: SUCCEED/FAIL (the file will not be closed on failure)
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ int nref;
+ H5F_t *f = (H5F_t *)file;
+ hid_t file_id = H5I_INVALID_HID;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* This routine should only be called when a file ID's ref count drops to zero */
+ HDassert(H5F_ID_EXISTS(f));
+
+ /* Flush file if this is the last reference to this id and we have write
+ * intent, unless it will be flushed by the "shared" file being closed.
+ * This is only necessary to replicate previous behaviour, and could be
+ * disabled by an option/property to improve performance.
+ */
+ if((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) {
+ /* Get the file ID corresponding to the H5F_t struct */
+ if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom")
+
+ /* Get the number of references outstanding for this file ID */
+ if((nref = H5I_get_ref(file_id, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count")
+ if(nref == 1)
+ if(H5F__flush(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
+ } /* end if */
+
+ /* Close the file */
+ if(H5F__close(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_create
+ *
+ * Purpose: Creates a group inside a native h5 file.
+ *
+ * Return: Success: Pointer to a group struct
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5G_loc_t loc; /* Location to create group */
+ H5G_t *grp = NULL; /* New group created */
+ hid_t lcpl_id;
+ void *ret_value;
+
+ FUNC_ENTER_STATIC
+
+ /* Get the property list structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* Get creation properties */
+ if(H5P_get(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
+
+ /* Set up the location */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* if name is NULL then this is from H5Gcreate_anon */
+ if(name == NULL) {
+ H5G_obj_create_t gcrt_info; /* Information for group creation */
+
+ /* Set up group creation info */
+ gcrt_info.gcpl_id = gcpl_id;
+ gcrt_info.cache_type = H5G_NOTHING_CACHED;
+ HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
+
+ /* Create the new group & get its ID */
+ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group")
+ } /* end if */
+ /* otherwise it's from H5Gcreate */
+ else {
+ /* Create the new group & get its ID */
+ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group")
+ } /* end else */
+
+ ret_value = (void *)grp;
+
+done:
+ if(name == NULL) {
+ /* Release the group's object header, if it was created */
+ if(grp) {
+ H5O_loc_t *oloc; /* Object location for group */
+
+ /* Get the new group's object location */
+ if(NULL == (oloc = H5G_oloc(grp)))
+ HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group")
+
+ /* Decrement refcount on group's object header in memory */
+ if(H5O_dec_rc_by_loc(oloc) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_open
+ *
+ * Purpose: Opens a group inside a native h5 file.
+ *
+ * Return: Success: Pointer to a group struct
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Location to open group */
+ H5G_t *grp = NULL; /* New group opend */
+ void *ret_value;
+
+ FUNC_ENTER_STATIC
+
+ /* Set up the location */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* Open the group */
+ if((grp = H5G__open_name(&loc, name)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group")
+
+ ret_value = (void *)grp;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_get
+ *
+ * Purpose: Get info about a group
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(get_type) {
+ /* H5Gget_create_plist */
+ case H5VL_GROUP_GET_GCPL:
+ {
+ hid_t *new_gcpl_id = va_arg(arguments, hid_t *);
+ H5G_t *grp = (H5G_t *)obj;
+
+ 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 = va_arg(arguments, const H5VL_loc_params_t *);
+ H5G_info_t *group_info = va_arg(arguments, H5G_info_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")
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* H5Gget_info */
+
+ /* Retrieve the group's information */
+ if(H5G__obj_info(loc.oloc, group_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ } /* end if */
+ else if(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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ } /* end else-if */
+ else if(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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_specific
+ *
+ * Purpose: Specific operations for groups
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5G_t *grp = (H5G_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(specific_type) {
+ case H5VL_GROUP_FLUSH:
+ {
+ hid_t group_id = va_arg(arguments, hid_t);
+
+ /* Flush object's metadata to file */
+ if(H5O_flush_common(&grp->oloc, group_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
+
+ break;
+ }
+
+ case H5VL_GROUP_REFRESH:
+ {
+ hid_t group_id = va_arg(arguments, hid_t);
+
+ /* Call private function to refresh group object */
+ if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_optional
+ *
+ * Purpose: Perform a connector-specific operation on a native group
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5VL_group_optional_t optional_type;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ optional_type = va_arg(arguments, H5VL_group_optional_t);
+ switch(optional_type) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ /* H5Giterate (deprecated) */
+ case H5VL_GROUP_ITERATE_OLD:
+ {
+ const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
+ hsize_t idx = va_arg(arguments, hsize_t);
+ hsize_t *last_obj = va_arg(arguments, hsize_t *);
+ const H5G_link_iterate_t *lnk_op = va_arg(arguments, const H5G_link_iterate_t *);
+ void *op_data = va_arg(arguments, void *);
+ H5G_loc_t grp_loc;
+
+ /* Get the location struct for the object */
+ if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* 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");
+
+ break;
+ }
+
+ /* H5Gget_objinfo (deprecated) */
+ case H5VL_GROUP_GET_OBJINFO:
+ {
+ const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *);
+ hbool_t follow_link = va_arg(arguments, unsigned);
+ H5G_stat_t *statbuf = va_arg(arguments, H5G_stat_t *);
+ H5G_loc_t grp_loc;
+
+ /* Get the location struct for the object */
+ if(H5G_loc_real(obj, 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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
+
+ break;
+ }
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_group_close
+ *
+ * Purpose: Closes a group.
+ *
+ * Return: SUCCEED/FAIL (the group will not be closed on failure)
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(H5G_close((H5G_t *)grp) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_create
+ *
+ * Purpose: Creates an hard/soft/UD/external links.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_link_create(H5VL_link_create_type_t create_type, 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)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ switch(create_type) {
+ case H5VL_LINK_CREATE_HARD:
+ {
+ H5G_loc_t cur_loc;
+ H5G_loc_t link_loc;
+ void *cur_obj;
+ H5VL_loc_params_t cur_params;
+
+ if(H5P_get(plist, H5VL_PROP_LINK_TARGET, &cur_obj) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current location id")
+ if(H5P_get(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &cur_params) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current name")
+
+ 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")
+ if(NULL != obj && H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* H5Lcreate_hard */
+ if(H5VL_OBJECT_BY_NAME == cur_params.type) {
+ H5G_loc_t *cur_loc_p, *link_loc_p;
+
+ /* Set up current & new location pointers */
+ cur_loc_p = &cur_loc;
+ link_loc_p = &link_loc;
+ if(NULL == cur_obj)
+ cur_loc_p = link_loc_p;
+ else if(NULL == obj)
+ link_loc_p = cur_loc_p;
+ else if(cur_loc_p->oloc->file != link_loc_p->oloc->file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
+
+ /* Create the link */
+ if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name,
+ 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")
+ } /* end else */
+ break;
+ }
+
+ case H5VL_LINK_CREATE_SOFT:
+ {
+ char *target_name;
+ 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(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name")
+
+ /* 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;
+ void *udata;
+ size_t udata_size;
+
+ 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(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for link type")
+ if(H5P_get(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata")
+ if(H5P_get(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size")
+
+ /* Create link */
+ if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size,
+ link_type, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_copy
+ *
+ * Purpose: Renames an object within an HDF5 file and copies it to a new
+ * group. The original name SRC is unlinked from the group graph
+ * and then inserted with the new name DST (which can specify a
+ * new path for the object) as an atomic operation. The names
+ * are interpreted relative to SRC_LOC_ID and
+ * DST_LOC_ID, which are either file IDs or group ID.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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 H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t src_loc, *src_loc_p;
+ H5G_loc_t dst_loc, *dst_loc_p;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Set up src & dst location pointers */
+ src_loc_p = &src_loc;
+ dst_loc_p = &dst_loc;
+ if(NULL == src_obj)
+ src_loc_p = dst_loc_p;
+ else if(NULL == dst_obj)
+ dst_loc_p = src_loc_p;
+
+ /* Copy the link */
+ if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name,
+ dst_loc_p, loc_params2->loc_data.loc_by_name.name,
+ TRUE, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_move
+ *
+ * Purpose: Renames an object within an HDF5 file and moves it to a new
+ * group. The original name SRC is unlinked from the group graph
+ * and then inserted with the new name DST (which can specify a
+ * new path for the object) as an atomic operation. The names
+ * are interpreted relative to SRC_LOC_ID and
+ * DST_LOC_ID, which are either file IDs or group ID.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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 H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t src_loc, *src_loc_p;
+ H5G_loc_t dst_loc, *dst_loc_p;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Set up src & dst location pointers */
+ src_loc_p = &src_loc;
+ dst_loc_p = &dst_loc;
+ if(NULL == src_obj)
+ src_loc_p = dst_loc_p;
+ else if(NULL == dst_obj)
+ dst_loc_p = src_loc_p;
+
+ /* Move the link */
+ if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name,
+ dst_loc_p, loc_params2->loc_data.loc_by_name.name,
+ FALSE, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_get
+ *
+ * Purpose: Get info about a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5G_loc_t loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ 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) {
+ /* H5Lget_info/H5Lget_info_by_idx */
+ case H5VL_LINK_GET_INFO:
+ {
+ H5L_info_t *linfo = va_arg(arguments, H5L_info_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, 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, linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+ break;
+ }
+
+ /* H5Lget_name_by_idx */
+ case H5VL_LINK_GET_NAME:
+ {
+ char *name = va_arg(arguments, char *);
+ size_t size = va_arg(arguments, size_t);
+ ssize_t *ret = va_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)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+
+ break;
+ }
+
+ /* H5Lget_val/H5Lget_val_by_idx */
+ case H5VL_LINK_GET_VAL:
+ {
+ void *buf = va_arg(arguments, void *);
+ size_t size = va_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)
+ 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)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
+ }
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_link_specific
+ *
+ * Purpose: Specific operation on a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(specific_type) {
+ case H5VL_LINK_EXISTS:
+ {
+ htri_t *ret = va_arg(arguments, htri_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((*ret = H5L_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info")
+ break;
+ }
+
+ case H5VL_LINK_ITER:
+ {
+ H5G_loc_t loc;
+ hbool_t recursive = va_arg(arguments, int);
+ H5_index_t idx_type = va_arg(arguments, H5_index_t);
+ H5_iter_order_t order = va_arg(arguments, H5_iter_order_t);
+ hsize_t *idx_p = va_arg(arguments, hsize_t *);
+ H5L_iterate_t op = va_arg(arguments, H5L_iterate_t);
+ void *op_data = va_arg(arguments, void *);
+
+ /* Get the location */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Visit or iterate over the links */
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if(recursive) {
+ /* H5Lvisit */
+ if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, 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)
+ 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) {
+ /* H5Lvisit_by_name */
+ if((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, 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)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
+ } /* end else */
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params")
+
+ break;
+ }
+
+ case H5VL_LINK_DELETE:
+ {
+ 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")
+
+ /* Unlink */
+ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */
+ if(H5L_delete(&loc, loc_params->loc_data.loc_by_name.name) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */
+ if(H5L_delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_open
+ *
+ * Purpose: Opens an object inside a native h5 file.
+ *
+ * Return: Success: object id.
+ * Failure: NULL
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ switch(loc_params->type) {
+ case H5VL_OBJECT_BY_NAME:
+ {
+ /* Open the object */
+ if(NULL == (ret_value = H5O_open_name(&loc, loc_params->loc_data.loc_by_name.name, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_IDX:
+ {
+ /* Open the object */
+ if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_ADDR:
+ {
+ /* Open the object */
+ if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params->loc_data.loc_by_addr.addr, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_REF:
+ {
+ hid_t temp_id = H5I_INVALID_HID;
+ H5F_t *file = NULL;
+
+ /* Get the file pointer from the entry */
+ file = loc.oloc->file;
+
+ /* Create reference */
+ if((temp_id = H5R__dereference(file, loc_params->loc_data.loc_by_ref.lapl_id,
+ loc_params->loc_data.loc_by_ref.ref_type,
+ loc_params->loc_data.loc_by_ref._ref)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, NULL, "unable to dereference object")
+
+ *opened_type = H5I_get_type(temp_id);
+ if(NULL == (ret_value = H5I_remove(temp_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object")
+ break;
+ }
+
+ case H5VL_OBJECT_BY_SELF:
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_copy
+ *
+ * Purpose: Copies an object inside a native h5 file.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_object_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 H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t src_loc; /* Source object group location */
+ H5G_loc_t dst_loc; /* Destination group location */
+ herr_t ret_value = FAIL;
+
+ FUNC_ENTER_STATIC
+
+ /* get location for objects */
+ if(H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if(H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Copy the object */
+ if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_get
+ *
+ * Purpose: Gets certain data about an object
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t loc; /* Location of group */
+
+ FUNC_ENTER_STATIC
+
+ 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) {
+ /* H5Rget_region */
+ case H5VL_REF_GET_REGION:
+ {
+ hid_t *ret = va_arg(arguments, hid_t *);
+ H5R_type_t H5_ATTR_UNUSED ref_type = va_arg(arguments, H5R_type_t);
+ void *ref = va_arg(arguments, void *);
+ H5S_t *space = NULL; /* Dataspace object */
+
+ /* Get the dataspace with the correct region selected */
+ if((space = H5R__get_region(loc.oloc->file, ref)) == NULL)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve region")
+
+ /* Atomize */
+ if((*ret = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+
+ break;
+ }
+
+ /* H5Rget_obj_type2 */
+ case H5VL_REF_GET_TYPE:
+ {
+ H5O_type_t *obj_type = va_arg(arguments, H5O_type_t *);
+ H5R_type_t ref_type = va_arg(arguments, H5R_type_t);
+ void *ref = va_arg(arguments, void *);
+
+ /* Get the object information */
+ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type")
+ break;
+ }
+
+ /* H5Rget_name */
+ case H5VL_REF_GET_NAME:
+ {
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+ char *name = va_arg(arguments, char *);
+ size_t size = va_arg(arguments, size_t);
+ H5R_type_t ref_type = va_arg(arguments, H5R_type_t);
+ void *ref = va_arg(arguments, void *);
+
+ /* Get name */
+ if((*ret = H5R__get_name(loc.oloc->file, ref_type, ref, name, size)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path")
+ break;
+ }
+
+ /* H5Iget_name */
+ case H5VL_ID_GET_NAME:
+ {
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+ char *name = va_arg(arguments, char *);
+ size_t size = va_arg(arguments, size_t);
+
+ /* Retrieve object's name */
+ if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_specific
+ *
+ * Purpose: Specific operation on an object
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5G_loc_t loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ 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) {
+ /* H5Oincr_refcount / H5Odecr_refcount */
+ case H5VL_OBJECT_CHANGE_REF_COUNT:
+ {
+ int update_ref = va_arg(arguments, int);
+ H5O_loc_t *oloc = loc.oloc;
+
+ if(H5O_link(oloc, update_ref) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
+
+ break;
+ }
+
+ /* H5Oexists_by_name */
+ case H5VL_OBJECT_EXISTS:
+ {
+ htri_t *ret = va_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)
+ 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;
+ }
+
+ case H5VL_OBJECT_VISIT:
+ {
+ H5_index_t idx_type = va_arg(arguments, H5_index_t);
+ H5_iter_order_t order = va_arg(arguments, H5_iter_order_t);
+ H5O_iterate_t op = va_arg(arguments, H5O_iterate_t);
+ void *op_data = va_arg(arguments, void *);
+ unsigned fields = va_arg(arguments, unsigned);
+
+ /* 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)
+ 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)
+ 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 = va_arg(arguments, hid_t);
+
+ /* Flush the object's metadata */
+ if(H5O_flush(loc.oloc, oid) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
+
+ break;
+ }
+
+ case H5VL_OBJECT_REFRESH:
+ {
+ hid_t oid = va_arg(arguments, hid_t);
+ H5O_loc_t *oloc = loc.oloc;
+
+ /* Refresh the metadata */
+ if(H5O_refresh_metadata(oid, *oloc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
+
+ break;
+ }
+
+ case H5VL_REF_CREATE:
+ {
+ void *ref = va_arg(arguments, void *);
+ const char *name = va_arg(arguments, char *);
+ H5R_type_t ref_type = va_arg(arguments, H5R_type_t);
+ hid_t space_id = va_arg(arguments, hid_t);
+ H5S_t *space = NULL; /* Pointer to dataspace containing region */
+
+ if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Create reference */
+ if(H5R__create(ref, &loc, name, ref_type, space) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_object_optional
+ *
+ * Purpose: Perform a connector-specific operation for an objectibute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list arguments)
+{
+ H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t);
+ H5VL_loc_params_t *loc_params = va_arg(arguments, H5VL_loc_params_t *);
+ H5G_loc_t loc; /* Location of group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ 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) {
+ /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */
+ case H5VL_OBJECT_GET_INFO:
+ {
+ H5O_info_t *obj_info = va_arg(arguments, H5O_info_t *);
+ unsigned fields = va_arg(arguments, unsigned);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, ".", obj_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, obj_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 */
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location, according to the order in the index */
+ if(H5G_loc_find_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, &obj_loc/*out*/) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
+
+ /* Retrieve the object's information */
+ if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) {
+ H5G_loc_free(&obj_loc);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
+ } /* end if */
+
+ /* Release the object location */
+ if(H5G_loc_free(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+ break;
+ }
+
+ /* H5Oget_comment / H5Oget_comment_by_name */
+ case H5VL_OBJECT_GET_COMMENT:
+ {
+ char *comment = va_arg(arguments, char *);
+ size_t bufsize = va_arg(arguments, size_t);
+ ssize_t *ret = va_arg(arguments, ssize_t *);
+
+ /* 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")
+ } /* 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")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
+ break;
+ }
+
+ /* H5Oset_comment */
+ case H5VL_OBJECT_SET_COMMENT:
+ {
+ const char *comment = va_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)
+ 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)
+ 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;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object");
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_commit
+ *
+ * Purpose: Commits a datatype inside a native h5 file.
+ *
+ * Return: Success: datatype id.
+ * Failure: NULL
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5G_loc_t loc; /* Location to commit datatype */
+ H5T_t *dt; /* Datatype for ID */
+ H5T_t *type = NULL; /* copy of the original type which will be committed */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* check arguments */
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
+
+ /* Check arguments. We cannot commit an immutable type because H5Tclose()
+ * normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing
+ * a named type should always succeed.
+ */
+ if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed")
+ if(H5T_STATE_IMMUTABLE == dt->shared->state)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable")
+
+ /* Check for a "sensible" datatype to store on disk */
+ if(H5T_is_sensible(dt) <= 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible")
+
+ /* Copy the datatype - the copied one will be the type that is
+ * committed, and attached to original datatype above the VOL
+ * layer
+ */
+ if(NULL == (type = H5T_copy(dt, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy");
+
+ /* Commit the datatype */
+ if(NULL != name) {
+ /* H5Tcommit */
+ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
+ } /* end if */
+ else {
+ /* H5Tcommit_anon */
+ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype")
+ } /* end else */
+
+ ret_value = (void *)type;
+
+done:
+ if(NULL == ret_value && type)
+ H5T_close(type);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_open
+ *
+ * Purpose: Opens a named datatype inside a native h5 file.
+ *
+ * Return: Success: datatype pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ H5T_t *type = NULL; /* Datatype opened in file */
+ H5G_loc_t loc; /* Group location of object to open */
+ void *ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+
+ /* Open the datatype */
+ if(NULL == (type = H5T__open_name(&loc, name)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype")
+
+ type->vol_obj = NULL;
+
+ ret_value = (void *)type;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_get
+ *
+ * Purpose: Get information about a datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5T_t *dt = (H5T_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch (get_type) {
+ case H5VL_DATATYPE_GET_BINARY:
+ {
+ ssize_t *nalloc = va_arg(arguments, ssize_t *);
+ void *buf = va_arg(arguments, void *);
+ size_t size = va_arg(arguments, size_t);
+
+ if(H5T_encode(dt, (unsigned char *)buf, &size) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype")
+
+ *nalloc = (ssize_t) size;
+ break;
+ }
+
+ /* H5Tget_create_plist */
+ case H5VL_DATATYPE_GET_TCPL:
+ {
+ hid_t *ret_id = va_arg(arguments, hid_t *);
+
+ if(H5I_INVALID_HID == (*ret_id = H5T__get_create_plist(dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info");
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_specific
+ *
+ * Purpose: Specific operations for datatype
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static 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)
+{
+ H5T_t *dt = (H5T_t *)obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ switch(specific_type) {
+ case H5VL_DATATYPE_FLUSH:
+ {
+ hid_t type_id = va_arg(arguments, hid_t);
+
+ /* To flush metadata and invoke flush callback if there is */
+ if (H5O_flush_common(&dt->oloc, type_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
+
+ break;
+ }
+
+ case H5VL_DATATYPE_REFRESH:
+ {
+ hid_t type_id = va_arg(arguments, hid_t);
+
+ /* Call private function to refresh datatype object */
+ if ((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_datatype_close
+ *
+ * Purpose: Closes a datatype.
+ *
+ * Return: Success: 0
+ * Failure: -1, datatype not closed.
+ *
+ * Programmer: Mohamad Chaarawi
+ * March, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ if(H5T_close((H5T_t*)dt) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_datatype_close() */
+
diff --git a/src/H5HGpublic.h b/src/H5VLnative.h
index fcec593..8ae3a66 100644
--- a/src/H5HGpublic.h
+++ b/src/H5VLnative.h
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 *
@@ -12,20 +11,31 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Friday, March 27, 1998
+ * Purpose: The public header file for the native VOL connector.
*/
-#ifndef _H5HGpublic_H
-#define _H5HGpublic_H
-/* Public headers needed by this file */
-#include "H5public.h"
+#ifndef _H5VLnative_H
+#define _H5VLnative_H
+
+/* Identifier for the native VOL connector */
+#define H5VL_NATIVE (H5VL_native_register())
+
+/* Characteristics of the native VOL connector */
+#define H5VL_NATIVE_NAME "native"
+#define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */
+#define H5VL_NATIVE_VERSION 0
+
#ifdef __cplusplus
extern "C" {
#endif
+H5_DLL hid_t H5VL_native_register(void);
+
+
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* _H5VLnative_H */
+
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
new file mode 100644
index 0000000..a93ac9a
--- /dev/null
+++ b/src/H5VLpassthru.c
@@ -0,0 +1,2693 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: This is a "pass through" VOL connector, which forwards each
+ * VOL callback to an underlying connector.
+ *
+ * It is designed as an example VOL connector for developers to
+ * use when creating new connectors, especially connectors that
+ * are outside of the HDF5 library. As such, it should _NOT_
+ * include _any_ private HDF5 header files. This connector should
+ * therefore only make public HDF5 API calls and use standard C /
+ * POSIX calls.
+ */
+
+
+/* Header files needed */
+/* (Public HDF5 and standard C / POSIX only) */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "hdf5.h"
+#include "H5VLpassthru.h"
+
+
+/**********/
+/* Macros */
+/**********/
+
+/* Whether to display log messge when callback is invoked */
+/* (Uncomment to enable) */
+/* #define ENABLE_LOGGING */
+
+
+/************/
+/* Typedefs */
+/************/
+
+/* The pass through VOL info object */
+typedef struct H5VL_pass_through_t {
+ hid_t under_vol_id; /* ID for underlying VOL connector */
+ void *under_object; /* Info object for underlying VOL connector */
+} H5VL_pass_through_t;
+
+/* The pass through VOL wrapper context */
+typedef struct H5VL_pass_through_wrap_ctx_t {
+ hid_t under_vol_id; /* VOL ID for under VOL */
+ void *under_wrap_ctx; /* Object wrapping context for under VOL */
+} H5VL_pass_through_wrap_ctx_t;
+
+
+/********************* */
+/* Function prototypes */
+/********************* */
+
+/* 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 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);
+
+/* "Management" callbacks */
+static herr_t H5VL_pass_through_init(hid_t vipl_id);
+static herr_t H5VL_pass_through_term(void);
+static void *H5VL_pass_through_info_copy(const void *info);
+static herr_t H5VL_pass_through_info_cmp(int *cmp_value, const void *info1, const void *info2);
+static herr_t H5VL_pass_through_info_free(void *info);
+static herr_t H5VL_pass_through_info_to_str(const void *info, char **str);
+static herr_t H5VL_pass_through_str_to_info(const char *str, void **info);
+static void *H5VL_pass_through_get_object(const void *obj);
+static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx);
+static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
+static void *H5VL_pass_through_wrap_object(void *obj, void *wrap_ctx);
+
+/* Attribute callbacks */
+static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, 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_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, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req);
+
+/* Dataset callbacks */
+static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req);
+static herr_t H5VL_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, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req);
+
+/* Datatype callbacks */
+static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_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, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req);
+
+/* File callbacks */
+static void *H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, 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, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
+
+/* Group callbacks */
+static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, 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, hid_t dxpl_id, void **req, va_list arguments);
+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, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, 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);
+static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_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);
+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, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Object callbacks */
+static void *H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_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);
+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, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Async request callbacks */
+static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5ES_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);
+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, va_list arguments);
+static herr_t H5VL_pass_through_request_free(void *req);
+
+/*******************/
+/* Local variables */
+/*******************/
+
+/* Pass through VOL connector class struct */
+static const H5VL_class_t H5VL_pass_through_g = {
+ H5VL_PASSTHRU_VERSION, /* version */
+ (H5VL_class_value_t)H5VL_PASSTHRU_VALUE, /* value */
+ H5VL_PASSTHRU_NAME, /* name */
+ 0, /* capability flags */
+ H5VL_pass_through_init, /* initialize */
+ H5VL_pass_through_term, /* terminate */
+ sizeof(H5VL_pass_through_t), /* info size */
+ H5VL_pass_through_info_copy, /* info copy */
+ H5VL_pass_through_info_cmp, /* info compare */
+ H5VL_pass_through_info_free, /* info free */
+ H5VL_pass_through_info_to_str, /* info to str */
+ H5VL_pass_through_str_to_info, /* str to info */
+ H5VL_pass_through_get_object, /* get_object */
+ H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */
+ H5VL_pass_through_wrap_object, /* wrap_object */
+ H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
+ { /* attribute_cls */
+ H5VL_pass_through_attr_create, /* create */
+ H5VL_pass_through_attr_open, /* open */
+ H5VL_pass_through_attr_read, /* read */
+ H5VL_pass_through_attr_write, /* write */
+ H5VL_pass_through_attr_get, /* get */
+ H5VL_pass_through_attr_specific, /* specific */
+ H5VL_pass_through_attr_optional, /* optional */
+ H5VL_pass_through_attr_close /* close */
+ },
+ { /* dataset_cls */
+ H5VL_pass_through_dataset_create, /* create */
+ H5VL_pass_through_dataset_open, /* open */
+ H5VL_pass_through_dataset_read, /* read */
+ H5VL_pass_through_dataset_write, /* write */
+ H5VL_pass_through_dataset_get, /* get */
+ H5VL_pass_through_dataset_specific, /* specific */
+ H5VL_pass_through_dataset_optional, /* optional */
+ H5VL_pass_through_dataset_close /* close */
+ },
+ { /* datatype_cls */
+ H5VL_pass_through_datatype_commit, /* commit */
+ H5VL_pass_through_datatype_open, /* open */
+ H5VL_pass_through_datatype_get, /* get_size */
+ H5VL_pass_through_datatype_specific, /* specific */
+ H5VL_pass_through_datatype_optional, /* optional */
+ H5VL_pass_through_datatype_close /* close */
+ },
+ { /* file_cls */
+ H5VL_pass_through_file_create, /* create */
+ H5VL_pass_through_file_open, /* open */
+ H5VL_pass_through_file_get, /* get */
+ H5VL_pass_through_file_specific, /* specific */
+ H5VL_pass_through_file_optional, /* optional */
+ H5VL_pass_through_file_close /* close */
+ },
+ { /* group_cls */
+ H5VL_pass_through_group_create, /* create */
+ H5VL_pass_through_group_open, /* open */
+ H5VL_pass_through_group_get, /* get */
+ H5VL_pass_through_group_specific, /* specific */
+ H5VL_pass_through_group_optional, /* optional */
+ H5VL_pass_through_group_close /* close */
+ },
+ { /* link_cls */
+ H5VL_pass_through_link_create, /* create */
+ H5VL_pass_through_link_copy, /* copy */
+ H5VL_pass_through_link_move, /* move */
+ H5VL_pass_through_link_get, /* get */
+ H5VL_pass_through_link_specific, /* specific */
+ H5VL_pass_through_link_optional, /* optional */
+ },
+ { /* object_cls */
+ H5VL_pass_through_object_open, /* open */
+ H5VL_pass_through_object_copy, /* copy */
+ H5VL_pass_through_object_get, /* get */
+ H5VL_pass_through_object_specific, /* specific */
+ H5VL_pass_through_object_optional, /* optional */
+ },
+ { /* request_cls */
+ H5VL_pass_through_request_wait, /* wait */
+ H5VL_pass_through_request_notify, /* notify */
+ H5VL_pass_through_request_cancel, /* cancel */
+ H5VL_pass_through_request_specific, /* specific */
+ H5VL_pass_through_request_optional, /* optional */
+ H5VL_pass_through_request_free /* free */
+ },
+ NULL /* optional */
+};
+
+/* The connector identification number, initialized at runtime */
+static hid_t H5VL_PASSTHRU_g = H5I_INVALID_HID;
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__pass_through_new_obj
+ *
+ * Purpose: Create a new pass through object for an underlying object
+ *
+ * Return: Success: Pointer to the new pass through object
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 3, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5VL_pass_through_t *
+H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
+{
+ H5VL_pass_through_t *new_obj;
+
+ new_obj = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t));
+ new_obj->under_object = under_obj;
+ new_obj->under_vol_id = under_vol_id;
+ H5Iinc_ref(new_obj->under_vol_id);
+
+ return(new_obj);
+} /* end H5VL__pass_through_new_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__pass_through_free_obj
+ *
+ * Purpose: Release a pass through object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 3, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
+{
+ H5Idec_ref(obj->under_vol_id);
+ free(obj);
+
+ return(0);
+} /* end H5VL__pass_through_free_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_register
+ *
+ * Purpose: Register the pass-through VOL connector and retrieve an ID
+ * for it.
+ *
+ * Return: Success: The ID for the pass-through VOL connector
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, November 28, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_pass_through_register(void)
+{
+ /* Clear the error stack */
+ H5Eclear2(H5E_DEFAULT);
+
+ /* Singleton register the pass-through VOL connector ID */
+ if(H5I_VOL != H5Iget_type(H5VL_PASSTHRU_g))
+ H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT);
+
+ return(H5VL_PASSTHRU_g);
+} /* end H5VL_pass_through_register() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_init
+ *
+ * Purpose: Initialize this VOL connector, performing any necessary
+ * operations for the connector that will apply to all containers
+ * accessed with the connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_init(hid_t vipl_id)
+{
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL INIT\n");
+#endif
+
+ /* Shut compiler up about unused parameter */
+ vipl_id = vipl_id;
+
+ return(0);
+} /* end H5VL_pass_through_init() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_term
+ *
+ * Purpose: Terminate this VOL connector, performing any necessary
+ * operations for the connector that release connector-wide
+ * resources (usually created / initialized with the 'init'
+ * callback).
+ *
+ * Return: Success: 0
+ * Failure: (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_term(void)
+{
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL TERM\n");
+#endif
+
+ /* Reset VOL ID */
+ H5VL_PASSTHRU_g = H5I_INVALID_HID;
+
+ return(0);
+} /* end H5VL_pass_through_term() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_copy
+ *
+ * Purpose: Duplicate the connector's info object.
+ *
+ * Returns: Success: New connector info object
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_info_copy(const void *_info)
+{
+ const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
+ H5VL_pass_through_info_t *new_info;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL INFO Copy\n");
+#endif
+
+ /* Allocate new VOL info struct for the pass through connector */
+ new_info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t));
+
+ /* Increment reference count on underlying VOL ID, and copy the VOL info */
+ new_info->under_vol_id = info->under_vol_id;
+ H5Iinc_ref(new_info->under_vol_id);
+ if(info->under_vol_info)
+ H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info);
+
+ return(new_info);
+} /* end H5VL_pass_through_info_copy() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_cmp
+ *
+ * Purpose: Compare two of the connector's info objects, setting *cmp_value,
+ * following the same rules as strcmp().
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info2)
+{
+ const H5VL_pass_through_info_t *info1 = (const H5VL_pass_through_info_t *)_info1;
+ const H5VL_pass_through_info_t *info2 = (const H5VL_pass_through_info_t *)_info2;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL INFO Compare\n");
+#endif
+
+ /* Sanity checks */
+ assert(info1);
+ assert(info2);
+
+ /* Initialize comparison value */
+ *cmp_value = 0;
+
+ /* Compare under VOL connector classes */
+ H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id);
+ if(*cmp_value != 0)
+ return(0);
+
+ /* Compare under VOL connector info objects */
+ H5VLcmp_connector_info(cmp_value, info1->under_vol_id, info1->under_vol_info, info2->under_vol_info);
+ if(*cmp_value != 0)
+ return(0);
+
+ return(0);
+} /* end H5VL_pass_through_info_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_free
+ *
+ * Purpose: Release an info object for the connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_info_free(void *_info)
+{
+ H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL INFO Free\n");
+#endif
+
+ /* Release underlying VOL ID and info */
+ if(info->under_vol_info)
+ H5VLfree_connector_info(info->under_vol_id, info->under_vol_info);
+ H5Idec_ref(info->under_vol_id);
+
+ /* Free pass through info object itself */
+ free(info);
+
+ return(0);
+} /* end H5VL_pass_through_info_free() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_info_to_str
+ *
+ * Purpose: Serialize an info object for this connector into a string
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_info_to_str(const void *_info, char **str)
+{
+ const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
+ H5VL_class_value_t under_value = (H5VL_class_value_t)-1;
+ char *under_vol_string = NULL;
+ size_t under_vol_str_len = 0;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL INFO To String\n");
+#endif
+
+ /* Get value and string for underlying VOL connector */
+ H5VLget_value(info->under_vol_id, &under_value);
+ H5VLconnector_info_to_str(info->under_vol_info, info->under_vol_id, &under_vol_string);
+
+ /* Determine length of underlying VOL info string */
+ if(under_vol_string)
+ under_vol_str_len = strlen(under_vol_string);
+
+ /* Allocate space for our info */
+ *str = (char *)H5allocate_memory(32 + under_vol_str_len, (hbool_t)0);
+ assert(*str);
+
+ /* Encode our info */
+ snprintf(*str, 32 + under_vol_str_len, "under_vol=%u;under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : ""));
+
+ return(0);
+} /* end H5VL_pass_through_info_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_str_to_info
+ *
+ * Purpose: Deserialize a string into an info object for this connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_str_to_info(const char *str, void **_info)
+{
+ H5VL_pass_through_info_t *info;
+ unsigned under_vol_value;
+ const char *under_vol_info_start, *under_vol_info_end;
+ hid_t under_vol_id;
+ void *under_vol_info = NULL;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL INFO String To Info\n");
+#endif
+
+ /* Retrieve the underlying VOL connector value and info */
+ sscanf(str, "under_vol=%u;", &under_vol_value);
+ under_vol_id = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT);
+ under_vol_info_start = strchr(str, '{');
+ under_vol_info_end = strrchr(str, '}');
+ assert(under_vol_info_end > under_vol_info_start);
+ if(under_vol_info_end != (under_vol_info_start + 1)) {
+ char *under_vol_info_str;
+
+ under_vol_info_str = (char *)malloc((size_t)(under_vol_info_end - under_vol_info_start));
+ memcpy(under_vol_info_str, under_vol_info_start + 1, (size_t)((under_vol_info_end - under_vol_info_start) - 1));
+ *(under_vol_info_str + (under_vol_info_end - under_vol_info_start)) = '\0';
+
+ H5VLconnector_str_to_info(under_vol_info_str, under_vol_id, &under_vol_info);
+
+ free(under_vol_info_str);
+ } /* end else */
+
+ /* Allocate new pass-through VOL connector info and set its fields */
+ info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t));
+ info->under_vol_id = under_vol_id;
+ info->under_vol_info = under_vol_info;
+
+ /* Set return value */
+ *_info = info;
+
+ return(0);
+} /* end H5VL_pass_through_str_to_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_get_object
+ *
+ * Purpose: Retrieve the 'data' for a VOL object.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_get_object(const void *obj)
+{
+ const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL Get object\n");
+#endif
+
+ return(H5VLget_object(o->under_object, o->under_vol_id));
+} /* end H5VL_pass_through_get_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_get_wrap_ctx
+ *
+ * Purpose: Retrieve a "wrapper context" for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
+{
+ const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj;
+ H5VL_pass_through_wrap_ctx_t *new_wrap_ctx;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL WRAP CTX Get\n");
+#endif
+
+ /* Allocate new VOL object wrapping context for the pass through connector */
+ new_wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)calloc(1, sizeof(H5VL_pass_through_wrap_ctx_t));
+
+ /* Increment reference count on underlying VOL ID, and copy the VOL info */
+ new_wrap_ctx->under_vol_id = o->under_vol_id;
+ H5Iinc_ref(new_wrap_ctx->under_vol_id);
+ H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx);
+
+ /* Set wrap context to return */
+ *wrap_ctx = new_wrap_ctx;
+
+ return(0);
+} /* end H5VL_pass_through_get_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_wrap_object
+ *
+ * Purpose: Use a "wrapper context" to wrap a data object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx)
+{
+ H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
+ H5VL_pass_through_t *new_obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL WRAP Object\n");
+#endif
+
+ /* Wrap the object with the underlying VOL */
+ under = H5VLwrap_object(obj, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx);
+ if(under)
+ new_obj = H5VL_pass_through_new_obj(under, wrap_ctx->under_vol_id);
+ else
+ new_obj = NULL;
+
+ return(new_obj);
+} /* end H5VL_pass_through_wrap_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_free_wrap_ctx
+ *
+ * Purpose: Release a "wrapper context" for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
+{
+ H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL WRAP CTX Free\n");
+#endif
+
+ /* Release underlying VOL ID and wrap context */
+ if(wrap_ctx->under_wrap_ctx)
+ H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id);
+ H5Idec_ref(wrap_ctx->under_vol_id);
+
+ /* Free pass through wrap context object itself */
+ free(wrap_ctx);
+
+ return(0);
+} /* end H5VL_pass_through_free_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_create
+ *
+ * Purpose: Creates an attribute on an object.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *attr;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Create\n");
+#endif
+
+ under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, acpl_id, aapl_id, dxpl_id, req);
+ if(under) {
+ attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ attr = NULL;
+
+ return((void*)attr);
+} /* end H5VL_pass_through_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_open
+ *
+ * Purpose: Opens an attribute on an object.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *attr;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Open\n");
+#endif
+
+ under = H5VLattr_open(o->under_object, loc_params, o->under_vol_id, name, aapl_id, dxpl_id, req);
+ if(under) {
+ attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ attr = NULL;
+
+ return((void *)attr);
+} /* end H5VL_pass_through_attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_read
+ *
+ * Purpose: Reads data from attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Read\n");
+#endif
+
+ ret_value = H5VLattr_read(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_write
+ *
+ * Purpose: Writes data to attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Write\n");
+#endif
+
+ ret_value = H5VLattr_write(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_get
+ *
+ * Purpose: Gets information about an attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_specific
+ *
+ * Purpose: Specific operation on attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_optional
+ *
+ * Purpose: Perform a connector-specific operation on an attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n");
+#endif
+
+ ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_attr_close
+ *
+ * Purpose: Closes an attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1, attr not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL ATTRIBUTE Close\n");
+#endif
+
+ ret_value = H5VLattr_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying attribute was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_attr_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_create
+ *
+ * Purpose: Creates a dataset in a container
+ *
+ * Return: Success: Pointer to a dataset object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *dset;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Create\n");
+#endif
+
+ under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, dcpl_id, dapl_id, dxpl_id, req);
+ if(under) {
+ dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dset = NULL;
+
+ return((void *)dset);
+} /* end H5VL_pass_through_dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_open
+ *
+ * Purpose: Opens a dataset in a container
+ *
+ * Return: Success: Pointer to a dataset object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *dset;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Open\n");
+#endif
+
+ under = H5VLdataset_open(o->under_object, loc_params, o->under_vol_id, name, dapl_id, dxpl_id, req);
+ if(under) {
+ dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dset = NULL;
+
+ return((void *)dset);
+} /* end H5VL_pass_through_dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_read
+ *
+ * Purpose: Reads data elements from a dataset into a buffer.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Read\n");
+#endif
+
+ ret_value = H5VLdataset_read(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_write
+ *
+ * Purpose: Writes data elements from a buffer into a dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Write\n");
+#endif
+
+ ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_get
+ *
+ * Purpose: Gets information about a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_specific
+ *
+ * Purpose: Specific operation on a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL H5Dspecific\n");
+#endif
+
+ ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_optional
+ *
+ * Purpose: Perform a connector-specific operation on a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Optional\n");
+#endif
+
+ ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_dataset_close
+ *
+ * Purpose: Closes a dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1, dataset not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATASET Close\n");
+#endif
+
+ ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying dataset was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_commit
+ *
+ * Purpose: Commits a datatype inside a container.
+ *
+ * Return: Success: Pointer to datatype object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *dt;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Commit\n");
+#endif
+
+ under = H5VLdatatype_commit(o->under_object, loc_params, o->under_vol_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req);
+ if(under) {
+ dt = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dt = NULL;
+
+ return((void *)dt);
+} /* end H5VL_pass_through_datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_open
+ *
+ * Purpose: Opens a named datatype inside a container.
+ *
+ * Return: Success: Pointer to datatype object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_pass_through_t *dt;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Open\n");
+#endif
+
+ under = H5VLdatatype_open(o->under_object, loc_params, o->under_vol_id, name, tapl_id, dxpl_id, req);
+ if(under) {
+ dt = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dt = NULL;
+
+ return((void *)dt);
+} /* end H5VL_pass_through_datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_get
+ *
+ * Purpose: Get information about a datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)dt;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_specific
+ *
+ * Purpose: Specific operations for datatypes
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Specific\n");
+#endif
+
+ ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_optional
+ *
+ * Purpose: Perform a connector-specific operation on a datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Optional\n");
+#endif
+
+ ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_datatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_datatype_close
+ *
+ * Purpose: Closes a datatype.
+ *
+ * Return: Success: 0
+ * Failure: -1, datatype not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL DATATYPE Close\n");
+#endif
+
+ assert(o->under_object);
+
+ ret_value = H5VLdatatype_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying datatype was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_datatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_create
+ *
+ * Purpose: Creates a container using this connector
+ *
+ * Return: Success: Pointer to a file object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id,
+ hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_info_t *info;
+ H5VL_pass_through_t *file;
+ hid_t under_fapl_id;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL FILE Create\n");
+#endif
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Open the file with the underlying VOL connector */
+ under = H5VLfile_create(name, flags, fcpl_id, under_fapl_id, dxpl_id, req);
+ if(under) {
+ file = H5VL_pass_through_new_obj(under, info->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, info->under_vol_id);
+ } /* end if */
+ else
+ file = NULL;
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+
+ return((void *)file);
+} /* end H5VL_pass_through_file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_open
+ *
+ * Purpose: Opens a container created with this connector
+ *
+ * Return: Success: Pointer to a file object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_info_t *info;
+ H5VL_pass_through_t *file;
+ hid_t under_fapl_id;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL FILE Open\n");
+#endif
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Open the file with the underlying VOL connector */
+ under = H5VLfile_open(name, flags, under_fapl_id, dxpl_id, req);
+ if(under) {
+ file = H5VL_pass_through_new_obj(under, info->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, info->under_vol_id);
+ } /* end if */
+ else
+ file = NULL;
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+
+ return((void *)file);
+} /* end H5VL_pass_through_file_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_get
+ *
+ * Purpose: Get info about a file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)file;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* 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
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)file;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_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 = va_arg(arguments, H5I_type_t);
+ 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, loc_type, name, child_file->under_object, plist_id);
+ } /* end if */
+ else if(specific_type == H5VL_FILE_IS_ACCESSIBLE) {
+ 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 *);
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ under_vol_id = info->under_vol_id;
+
+ /* Re-issue 'file specific' call */
+ ret_value = H5VL_pass_through_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id, req, under_fapl_id, name, ret);
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+ } /* end else-if */
+ else {
+ va_list my_arguments;
+
+ /* Make a copy of the argument list for later, if reopening */
+ if(specific_type == H5VL_FILE_REOPEN)
+ va_copy(my_arguments, arguments);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ under_vol_id = o->under_vol_id;
+
+ ret_value = H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Wrap file struct pointer, if we reopened one */
+ if(specific_type == H5VL_FILE_REOPEN) {
+ if(ret_value >= 0) {
+ void **ret = va_arg(my_arguments, void **);
+
+ if(ret && *ret)
+ *ret = H5VL_pass_through_new_obj(*ret, o->under_vol_id);
+ } /* end if */
+
+ /* Finish use of copied vararg list */
+ va_end(my_arguments);
+ } /* end if */
+ } /* end else */
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_optional
+ *
+ * Purpose: Perform a connector-specific operation on a file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL File Optional\n");
+#endif
+
+ ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_file_close
+ *
+ * Purpose: Closes a file.
+ *
+ * Return: Success: 0
+ * Failure: -1, file not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL FILE Close\n");
+#endif
+
+ ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying file was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_create
+ *
+ * Purpose: Creates a group inside a container
+ *
+ * Return: Success: Pointer to a group object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *group;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Create\n");
+#endif
+
+ under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, gcpl_id, gapl_id, dxpl_id, req);
+ if(under) {
+ group = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ group = NULL;
+
+ return((void *)group);
+} /* end H5VL_pass_through_group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_open
+ *
+ * Purpose: Opens a group inside a container
+ *
+ * Return: Success: Pointer to a group object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_pass_through_t *group;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Open\n");
+#endif
+
+ under = H5VLgroup_open(o->under_object, loc_params, o->under_vol_id, name, gapl_id, dxpl_id, req);
+ if(under) {
+ group = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ group = NULL;
+
+ return((void *)group);
+} /* end H5VL_pass_through_group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_get
+ *
+ * Purpose: Get info about a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_specific
+ *
+ * Purpose: Specific operation on a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Specific\n");
+#endif
+
+ ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_optional
+ *
+ * Purpose: Perform a connector-specific operation on a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL GROUP Optional\n");
+#endif
+
+ ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_group_close
+ *
+ * Purpose: Closes a group.
+ *
+ * Return: Success: 0
+ * Failure: -1, group not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)grp;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL H5Gclose\n");
+#endif
+
+ ret_value = H5VLgroup_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying file was closed */
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_create
+ *
+ * Purpose: Creates a hard / soft / UD / external link.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL LINK Create\n");
+#endif
+
+ /* Try to retrieve the "under" VOL id */
+ if(o)
+ under_vol_id = o->under_vol_id;
+
+ /* Fix up the link target object for hard link creation */
+ if(H5VL_LINK_CREATE_HARD == create_type) {
+ void *cur_obj;
+
+ /* Retrieve the object for the link target */
+ H5Pget(lcpl_id, H5VL_PROP_LINK_TARGET, &cur_obj);
+
+ /* If it's a non-NULL pointer, find the 'under object' and re-set the property */
+ if(cur_obj) {
+ /* Check if we still need the "under" VOL ID */
+ if(under_vol_id < 0)
+ under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id;
+
+ /* Set the object for the link target */
+ H5Pset(lcpl_id, H5VL_PROP_LINK_TARGET, &(((H5VL_pass_through_t *)cur_obj)->under_object));
+ } /* end if */
+ } /* end if */
+
+ ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_copy
+ *
+ * Purpose: Renames an object within an HDF5 container and copies it to a new
+ * group. The original name SRC is unlinked from the group graph
+ * and then inserted with the new name DST (which can specify a
+ * new path for the object) as an atomic operation. The names
+ * are interpreted relative to SRC_LOC_ID and
+ * DST_LOC_ID, which are either file IDs or group ID.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_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)
+{
+ H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj;
+ H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL LINK Copy\n");
+#endif
+
+ /* Retrieve the "under" VOL id */
+ if(o_src)
+ under_vol_id = o_src->under_vol_id;
+ else if(o_dst)
+ under_vol_id = o_dst->under_vol_id;
+ assert(under_vol_id > 0);
+
+ ret_value = H5VLlink_copy((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function:
+H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ *
+ * Purpose: Moves a link within an HDF5 file to a new group. The original
+ * name SRC is unlinked from the group graph
+ * and then inserted with the new name DST (which can specify a
+ * new path for the object) as an atomic operation. The names
+ * are interpreted relative to SRC_LOC_ID and
+ * DST_LOC_ID, which are either file IDs or group ID.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj;
+ H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL LINK Move\n");
+#endif
+
+ /* Retrieve the "under" VOL id */
+ if(o_src)
+ under_vol_id = o_src->under_vol_id;
+ else if(o_dst)
+ under_vol_id = o_dst->under_vol_id;
+ assert(under_vol_id > 0);
+
+ ret_value = H5VLlink_move((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_get
+ *
+ * Purpose: Get info about a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_specific
+ *
+ * Purpose: Specific operation on a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_link_optional
+ *
+ * Purpose: Perform a connector-specific operation on a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL LINK Optional\n");
+#endif
+
+ ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_link_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_open
+ *
+ * Purpose: Opens an object inside a container.
+ *
+ * Return: Success: Pointer to object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
+ H5I_type_t *opened_type, hid_t dxpl_id, void **req)
+{
+ H5VL_pass_through_t *new_obj;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ void *under;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Open\n");
+#endif
+
+ under = H5VLobject_open(o->under_object, loc_params, o->under_vol_id, opened_type, dxpl_id, req);
+ if(under) {
+ new_obj = H5VL_pass_through_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ new_obj = NULL;
+
+ return((void *)new_obj);
+} /* end H5VL_pass_through_object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_copy
+ *
+ * Purpose: Copies an object inside a container.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
+ void **req)
+{
+ H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj;
+ H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Copy\n");
+#endif
+
+ ret_value = H5VLobject_copy(o_src->under_object, src_loc_params, src_name, o_dst->under_object, dst_loc_params, dst_name, o_src->under_vol_id, ocpypl_id, lcpl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o_src->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_get
+ *
+ * Purpose: Get info about an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ 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);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_specific
+ *
+ * Purpose: Specific operation on an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+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_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Specific\n");
+#endif
+
+ ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_object_optional
+ *
+ * Purpose: Perform a connector-specific operation for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL OBJECT Optional\n");
+#endif
+
+ ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
+
+ return(ret_value);
+} /* end H5VL_pass_through_object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_wait
+ *
+ * Purpose: Wait (with a timeout) for an async operation to complete
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_wait(void *obj, uint64_t timeout,
+ H5ES_status_t *status)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Wait\n");
+#endif
+
+ ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status);
+
+ if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_request_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Wait\n");
+#endif
+
+ ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx);
+
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_request_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_cancel
+ *
+ * Purpose: Cancels an asynchronous operation
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_cancel(void *obj)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Cancel\n");
+#endif
+
+ ret_value = H5VLrequest_cancel(o->under_object, o->under_vol_id);
+
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* 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
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type,
+ va_list arguments)
+{
+ herr_t ret_value = -1;
+
+#ifdef ENABLE_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 *index; /* Pointer to the index of completed request */
+ H5ES_status_t *status; /* Pointer to the request's status */
+
+ /* Retrieve the remaining arguments */
+ index = va_arg(tmp_arguments, size_t *);
+ assert(*index <= req_count);
+ status = va_arg(tmp_arguments, H5ES_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, index, 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[*index];
+ 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 */
+ H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */
+
+ /* Retrieve the remaining arguments */
+ outcount = va_arg(tmp_arguments, size_t *);
+ assert(*outcount <= req_count);
+ array_of_indices = va_arg(tmp_arguments, unsigned *);
+ array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITSOME 'request specific' call */
+ ret_value = H5VL_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 */
+ H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */
+
+ /* Retrieve the remaining arguments */
+ array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITALL 'request specific' call */
+ ret_value = H5VL_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
+ assert(0 && "Unknown 'specific' operation");
+
+ return(ret_value);
+} /* end H5VL_pass_through_request_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_optional
+ *
+ * Purpose: Perform a connector-specific operation for a request
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_optional(void *obj, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Optional\n");
+#endif
+
+ ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, arguments);
+
+ return(ret_value);
+} /* end H5VL_pass_through_request_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_request_free
+ *
+ * Purpose: Releases a request, allowing the operation to complete without
+ * application tracking
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_request_free(void *obj)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Free\n");
+#endif
+
+ ret_value = H5VLrequest_free(o->under_object, o->under_vol_id);
+
+ if(ret_value >= 0)
+ H5VL_pass_through_free_obj(o);
+
+ return(ret_value);
+} /* end H5VL_pass_through_request_free() */
+
diff --git a/src/H5Bpublic.h b/src/H5VLpassthru.h
index 1764f61..e640636 100644
--- a/src/H5Bpublic.h
+++ b/src/H5VLpassthru.h
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 *
@@ -11,29 +10,37 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*-------------------------------------------------------------------------
- *
- * Created: H5Bproto.h
- * Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
- *
- * Purpose: Public declarations for the H5B package.
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
+/*
+ * Purpose: The public header file for the pass-through VOL connector.
*/
-#ifndef _H5Bpublic_H
-#define _H5Bpublic_H
-/* Public headers needed by this file */
-#include "H5public.h"
+#ifndef _H5VLpassthru_H
+#define _H5VLpassthru_H
+
+/* Identifier for the pass-through VOL connector */
+#define H5VL_PASSTHRU (H5VL_pass_through_register())
+
+/* Characteristics of the pass-through VOL connector */
+#define H5VL_PASSTHRU_NAME "pass_through"
+#define H5VL_PASSTHRU_VALUE 505 /* VOL connector ID */
+#define H5VL_PASSTHRU_VERSION 0
+
+/* Pass-through VOL connector info */
+typedef struct H5VL_pass_through_info_t {
+ hid_t under_vol_id; /* VOL ID for under VOL */
+ void *under_vol_info; /* VOL info for under VOL */
+} H5VL_pass_through_info_t;
+
#ifdef __cplusplus
extern "C" {
#endif
+H5_DLL hid_t H5VL_pass_through_register(void);
+
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* _H5VLpassthru_H */
+
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
new file mode 100644
index 0000000..bbdb0cc
--- /dev/null
+++ b/src/H5VLpkg.h
@@ -0,0 +1,48 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: This file contains declarations which are visible only within
+ * the H5VL package. Source files outside the H5VL package should
+ * include H5VLprivate.h instead.
+ */
+
+#if !(defined H5VL_FRIEND || defined H5VL_MODULE)
+#error "Do not include this file outside the H5VL package!"
+#endif
+
+#ifndef _H5VLpkg_H
+#define _H5VLpkg_H
+
+/* Get package's private header */
+#include "H5VLprivate.h" /* Generic Functions */
+
+/* Other private headers needed by this file */
+
+/**************************/
+/* Package Private Macros */
+/**************************/
+
+/****************************/
+/* Package Private Typedefs */
+/****************************/
+
+/*****************************/
+/* Package Private Variables */
+/*****************************/
+
+/******************************/
+/* Package Private Prototypes */
+/******************************/
+
+#endif /* _H5VLpkg_H */
+
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
new file mode 100644
index 0000000..ef5a81e
--- /dev/null
+++ b/src/H5VLprivate.h
@@ -0,0 +1,185 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _H5VLprivate_H
+#define _H5VLprivate_H
+
+/* Include package's public header */
+#include "H5VLpublic.h" /* Generic Functions */
+
+/* Private headers needed by this file */
+
+/**************************/
+/* Library Private Macros */
+/**************************/
+
+/****************************/
+/* Library Private Typedefs */
+/****************************/
+
+/* Internal struct to track VOL connector information for objects */
+typedef struct H5VL_t {
+ const H5VL_class_t *cls; /* Pointer to connector class struct */
+ int64_t nrefs; /* Number of references by objects using this struct */
+ hid_t id; /* Identifier for the VOL connector */
+} H5VL_t;
+
+/* Internal vol object structure returned to the API */
+typedef struct H5VL_object_t {
+ void *data; /* Pointer to connector-managed data for this object */
+ H5VL_t *connector; /* Pointer to VOL connector struct */
+} H5VL_object_t;
+
+/* Internal structure to hold the connector ID & info for FAPLs */
+typedef struct H5VL_connector_prop_t {
+ hid_t connector_id; /* VOL connector's ID */
+ const void *connector_info; /* VOL connector info, for open callbacks */
+} H5VL_connector_prop_t;
+
+/* Which kind of VOL connector field to use for searching */
+typedef enum H5VL_get_connector_kind_t {
+ H5VL_GET_CONNECTOR_BY_NAME, /* Name field is set */
+ H5VL_GET_CONNECTOR_BY_VALUE /* Value field is set */
+} H5VL_get_connector_kind_t;
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Library Private Prototypes */
+/******************************/
+
+/* Utility functions */
+H5_DLL herr_t H5VL_init(void);
+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 herr_t H5VL_conn_free(const H5VL_connector_prop_t *info);
+
+/* Functions that deal with VOL connectors */
+H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id);
+H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size);
+
+/* NOTE: The object and ID functions below deal in VOL objects (i.e.;
+ * H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use
+ * the H5VL calls with objects that go through the VOL, such as
+ * datasets and groups, and the H5I calls with objects
+ * that do not, such as property lists and dataspaces. Datatypes
+ * are can be either named, where they will use the VOL, or not,
+ * and thus require special treatment. See the datatype docs for
+ * how to handle this.
+ */
+
+/* Functions that manipulate VOL objects */
+H5_DLL void *H5VL_object(hid_t id);
+H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj);
+H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type);
+H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id);
+H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
+
+/* Functions that wrap / unwrap VOL objects */
+H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj,
+ void **wrap_ctx);
+H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx);
+H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector);
+H5_DLL herr_t H5VL_reset_vol_wrapper(void);
+H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx,
+ void *obj);
+
+/* ID registration functions */
+H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref);
+H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref);
+H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref);
+H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id);
+
+/**********************************
+ * VOL connector callback wrappers
+ *********************************/
+
+/* Connector "management" functions */
+H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info,
+ const void *src_info);
+H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
+ const void *info1, const void *info2);
+H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info);
+
+/* Attribute functions */
+H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, 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_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, 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 */
+H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_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 plist_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, 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);
+
+/* File functions */
+H5_DLL void *H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, 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, 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 */
+H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, 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, 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, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, 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);
+H5_DLL herr_t H5VL_link_move(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);
+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, ...);
+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, 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, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+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, ...);
+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, hid_t dxpl_id, void **req, ...);
+
+/* Datatype functions */
+H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+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, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
+
+/* Asynchronous functions */
+H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_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);
+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, ...);
+H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
+
+#endif /* _H5VLprivate_H */
+
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
new file mode 100644
index 0000000..5531395
--- /dev/null
+++ b/src/H5VLpublic.h
@@ -0,0 +1,534 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 H5VL (VOL) module.
+ */
+
+#ifndef _H5VLpublic_H
+#define _H5VLpublic_H
+
+/* Public headers needed by this file */
+#include "H5public.h" /* Generic Functions */
+#include "H5Apublic.h" /* Attributes */
+#include "H5ESpublic.h" /* Event Stack */
+#include "H5Fpublic.h" /* Files */
+#include "H5Lpublic.h" /* Links */
+#include "H5Opublic.h" /* Objects */
+#include "H5Rpublic.h" /* References */
+
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/* Dataset creation property names */
+#define H5VL_PROP_DSET_TYPE_ID "dataset_type_id"
+#define H5VL_PROP_DSET_SPACE_ID "dataset_space_id"
+#define H5VL_PROP_DSET_LCPL_ID "dataset_lcpl_id"
+
+/* Attribute creation property names */
+#define H5VL_PROP_ATTR_TYPE_ID "attr_type_id"
+#define H5VL_PROP_ATTR_SPACE_ID "attr_space_id"
+#define H5VL_PROP_ATTR_LOC_PARAMS "attr_location"
+
+/* Link creation property names */
+#define H5VL_PROP_LINK_TARGET "target_location_object"
+#define H5VL_PROP_LINK_TARGET_LOC_PARAMS "target_params"
+#define H5VL_PROP_LINK_TARGET_NAME "target_name"
+#define H5VL_PROP_LINK_TYPE "link type"
+#define H5VL_PROP_LINK_UDATA "udata"
+#define H5VL_PROP_LINK_UDATA_SIZE "udata size"
+
+/* Group creation property names */
+#define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id"
+
+/* Default VOL connector value */
+#define H5VL_VOL_DEFAULT 0
+
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/* types for attribute GET callback */
+typedef enum H5VL_attr_get_t {
+ H5VL_ATTR_GET_ACPL, /* creation property list */
+ H5VL_ATTR_GET_INFO, /* info */
+ H5VL_ATTR_GET_NAME, /* access property list */
+ H5VL_ATTR_GET_SPACE, /* dataspace */
+ H5VL_ATTR_GET_STORAGE_SIZE, /* storage size */
+ H5VL_ATTR_GET_TYPE /* datatype */
+} H5VL_attr_get_t;
+
+/* types for attribute SPECFIC callback */
+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_specific_t;
+
+/* types for dataset GET callback */
+typedef enum H5VL_dataset_get_t {
+ H5VL_DATASET_GET_DAPL, /* access property list */
+ H5VL_DATASET_GET_DCPL, /* creation property list */
+ H5VL_DATASET_GET_OFFSET, /* offset */
+ H5VL_DATASET_GET_SPACE, /* dataspace */
+ H5VL_DATASET_GET_SPACE_STATUS, /* space status */
+ H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */
+ H5VL_DATASET_GET_TYPE /* datatype */
+} H5VL_dataset_get_t;
+
+/* types for dataset SPECFIC callback */
+typedef enum H5VL_dataset_specific_t {
+ H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */
+ H5VL_DATASET_FLUSH, /* H5Dflush */
+ H5VL_DATASET_REFRESH /* H5Drefresh */
+} H5VL_dataset_specific_t;
+
+/* types for datatype GET callback */
+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_t;
+
+/* types for datatype SPECFIC callback */
+typedef enum H5VL_datatype_specific_t {
+ H5VL_DATATYPE_FLUSH,
+ H5VL_DATATYPE_REFRESH
+} H5VL_datatype_specific_t;
+
+/* types for file GET callback */
+typedef enum H5VL_file_get_t {
+ H5VL_FILE_GET_FAPL, /* file access property list */
+ H5VL_FILE_GET_FCPL, /* file creation property list */
+ H5VL_FILE_GET_INTENT, /* file intent */
+ H5VL_FILE_GET_NAME, /* file name */
+ H5VL_FILE_GET_OBJ_COUNT, /* object count in file */
+ H5VL_FILE_GET_OBJ_IDS, /* object ids in file */
+ H5VL_FILE_GET_MIN_DSET_OHDR_FLAG /* minimize dataset object headers? */
+} H5VL_file_get_t;
+
+/* types for file SPECIFIC callback */
+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_CACHE_VOL_CONN /* Cache VOL connector ID & info */
+} H5VL_file_specific_t;
+
+/* types for group GET callback */
+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;
+
+/* link create types for VOL */
+typedef enum H5VL_link_create_type_t {
+ H5VL_LINK_CREATE_HARD,
+ H5VL_LINK_CREATE_SOFT,
+ H5VL_LINK_CREATE_UD
+} H5VL_link_create_type_t;
+
+/* types for link GET callback */
+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 */
+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;
+
+/* types for object GET callback */
+typedef enum H5VL_object_get_t {
+ H5VL_REF_GET_NAME, /* object name, for reference */
+ H5VL_REF_GET_REGION, /* dataspace of region */
+ H5VL_REF_GET_TYPE, /* type of object */
+ H5VL_ID_GET_NAME /* object name, for hid_t */
+} H5VL_object_get_t;
+
+/* types for object SPECIFIC callback */
+typedef enum H5VL_object_specific_t {
+ H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
+ H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
+ H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
+ H5VL_REF_CREATE, /* H5Rcreate */
+ H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */
+ H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
+} H5VL_object_specific_t;
+
+/* types for async request SPECIFIC callback */
+typedef enum H5VL_request_specific_t {
+ H5VL_REQUEST_WAITANY, /* Wait until any request completes */
+ H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
+ H5VL_REQUEST_WAITALL /* Wait until all requests complete */
+} H5VL_request_specific_t;
+
+/* 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_ADDR,
+ H5VL_OBJECT_BY_REF
+} H5VL_loc_type_t;
+
+struct H5VL_loc_by_name {
+ const char *name;
+ hid_t lapl_id;
+};
+
+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;
+};
+
+struct H5VL_loc_by_addr {
+ haddr_t addr;
+};
+
+struct H5VL_loc_by_ref {
+ H5R_type_t ref_type;
+ const void *_ref;
+ hid_t lapl_id;
+};
+
+/* Structure to hold parameters for object locations.
+ * either: BY_ADDR, BY_ID, BY_NAME, BY_IDX, BY_REF
+ *
+ * Note: Leave loc_by_addr as the first union member so we
+ * can perform the simplest initialization of the struct
+ * without raising warnings.
+ */
+typedef struct H5VL_loc_params_t {
+ H5I_type_t obj_type;
+ H5VL_loc_type_t type;
+ union{
+ struct H5VL_loc_by_addr loc_by_addr;
+ struct H5VL_loc_by_name loc_by_name;
+ struct H5VL_loc_by_idx loc_by_idx;
+ struct H5VL_loc_by_ref loc_by_ref;
+ } loc_data;
+} H5VL_loc_params_t;
+
+/* H5A routines */
+typedef struct H5VL_attr_class_t {
+ void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
+ hid_t aapl_id, 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, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *attr, hid_t dxpl_id, void **req);
+} H5VL_attr_class_t;
+
+/* H5D routines */
+typedef struct H5VL_dataset_class_t {
+ void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ hid_t dapl_id, hid_t dxpl_id, void **req);
+ herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
+ hid_t xfer_plist_id, 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 xfer_plist_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, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *dset, hid_t dxpl_id, void **req);
+} H5VL_dataset_class_t;
+
+/* H5T routines*/
+typedef struct H5VL_datatype_class_t {
+ void *(*commit)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id,
+ hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+ 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, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *dt, hid_t dxpl_id, void **req);
+} H5VL_datatype_class_t;
+
+/* H5F routines */
+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, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*close) (void *file, hid_t dxpl_id, void **req);
+} H5VL_file_class_t;
+
+/* H5G routines */
+typedef struct H5VL_group_class_t {
+ void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
+ 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, hid_t dxpl_id, void **req, va_list arguments);
+ 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);
+ 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, hid_t lapl, 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, hid_t lapl, 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, hid_t dxpl_id, void **req, va_list arguments);
+} H5VL_link_class_t;
+
+/* H5O routines */
+typedef struct H5VL_object_class_t {
+ void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
+ hid_t dxpl_id, void **req);
+ 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, hid_t dxpl_id, void **req, va_list arguments);
+} H5VL_object_class_t;
+
+/* Asynchronous request 'notify' callback */
+typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5ES_status_t status);
+
+/* Async request operation routines */
+typedef struct H5VL_request_class_t {
+ herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status);
+ herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx);
+ herr_t (*cancel)(void *req);
+ herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments);
+ herr_t (*optional)(void *req, va_list arguments);
+ herr_t (*free)(void *req);
+} H5VL_request_class_t;
+
+/*
+ * VOL connector identifiers. Values 0 through 255 are for connectors defined
+ * by the HDF5 library. Values 256 through 511 are available for testing new
+ * filters. Subsequent values should be obtained from the HDF5 development
+ * team at help@hdfgroup.org.
+ */
+typedef int H5VL_class_value_t;
+
+/* VOL connector identifier values */
+#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */
+#define H5_VOL_NATIVE 0 /* Native HDF5 file formnat VOL connector */
+#define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */
+#define H5_VOL_MAX 65535 /* Maximum VOL connector ID */
+
+/* Capability flags for connector */
+#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
+#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+
+/* Class information for each VOL connector */
+typedef struct H5VL_class_t {
+ unsigned int version; /* VOL connector class struct version # */
+ H5VL_class_value_t value; /* Value to identify connector */
+ const char *name; /* Connector name (MUST be unique!) */
+ unsigned cap_flags; /* Capability flags for connector */
+ herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */
+ herr_t (*terminate)(void); /* Connector termination callback */
+ size_t info_size; /* Size of the VOL info */
+ void * (*info_copy)(const void *info); /* Callback to create a copy of the VOL info */
+ herr_t (*info_cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */
+ herr_t (*info_free)(void *info); /* Callback to release the VOL info copy */
+ herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */
+ herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */
+ void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */
+ herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
+ void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap a library object */
+ herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
+
+ /* Data Model */
+ H5VL_attr_class_t attr_cls; /* attribute class callbacks */
+ H5VL_dataset_class_t dataset_cls; /* dataset class callbacks */
+ H5VL_datatype_class_t datatype_cls; /* datatype class callbacks */
+ H5VL_file_class_t file_cls; /* file class callbacks */
+ H5VL_group_class_t group_cls; /* group class callbacks */
+ H5VL_link_class_t link_cls; /* link class callbacks */
+ H5VL_object_class_t object_cls; /* object class callbacks */
+
+ /* Services */
+ H5VL_request_class_t request_cls; /* asynchronous request class callbacks */
+
+ /* Catch-all */
+ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */
+} H5VL_class_t;
+
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* VOL Connector Functionality */
+H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
+H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
+H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id);
+H5_DLL htri_t H5VLis_connector_registered(const char *name);
+H5_DLL hid_t H5VLget_connector_id(const char *name);
+H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size);
+H5_DLL herr_t H5VLclose(hid_t connector_id);
+H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
+
+
+/*****************************************************************************
+ * VOL callback wrappers and helper routines, for _VOL_connector_ authors only! *
+ * (Not part of the public API for _application_ developers) *
+ *****************************************************************************/
+
+/* Helper routines for VOL connector authors */
+H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
+
+
+/* Public wrappers for generic callbacks */
+H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id);
+H5_DLL herr_t H5VLterminate(hid_t connector_id);
+H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags);
+H5_DLL herr_t H5VLget_value(hid_t connector_id, H5VL_class_value_t *conn_value);
+H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info);
+H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1,
+ const void *info2);
+H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info);
+H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str);
+H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info);
+H5_DLL void *H5VLget_object(void *obj, hid_t connector_id);
+H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx);
+H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx);
+H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
+
+/* Public wrappers for attribute callbacks */
+H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, 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_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, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for dataset callbacks */
+H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL void *H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdataset_read(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, 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, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_close(void *dset, 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, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for group callbacks */
+H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, 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, hid_t dxpl_id, void **req, va_list arguments);
+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);
+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);
+H5_DLL herr_t H5VLlink_move(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);
+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);
+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, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Public wrappers for object callbacks */
+H5_DLL void *H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLobject_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 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);
+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, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Public wrappers for named datatype callbacks */
+H5_DLL void *H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, 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);
+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, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req);
+
+/* Public wrappers for asynchronous request callbacks */
+H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_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);
+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, va_list arguments);
+H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5VLpublic_H */
+
diff --git a/src/H5Z.c b/src/H5Z.c
index f68fbce..f41588f 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -43,10 +43,10 @@ typedef struct H5Z_stats_t {
#endif /* H5Z_DEBUG */
typedef struct H5Z_object_t {
- H5Z_filter_t filter_id; /* ID of the filter we're looking for */
- htri_t found; /* Whether we find an object using the filter */
+ H5Z_filter_t filter_id; /* ID of the filter we're looking for */
+ htri_t found; /* Whether we find an object using the filter */
#ifdef H5_HAVE_PARALLEL
- hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */
+ hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */
#endif /* H5_HAVE_PARALLEL */
} H5Z_object_t;
@@ -339,12 +339,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Zunregister
+ * Function: H5Zunregister
*
- * Purpose: This function unregisters a filter.
+ * Purpose: This function unregisters a filter.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success
- * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -371,13 +371,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Z__unregister
+ * Function: H5Z__unregister
*
- * Purpose: Same as the public version except this one allows filters
- * to be unset for predefined method numbers <H5Z_FILTER_RESERVED
+ * Purpose: Same as the public version except this one allows filters
+ * to be unset for predefined method numbers <H5Z_FILTER_RESERVED
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success
- * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -387,9 +387,9 @@ H5Z__unregister(H5Z_filter_t filter_id)
H5Z_object_t object; /* Object to pass to callbacks */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
- HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX);
+ HDassert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX);
/* Is the filter already registered? */
for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++)
@@ -401,10 +401,10 @@ H5Z__unregister(H5Z_filter_t filter_id)
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered")
/* Initialize the structure object for iteration */
- object.filter_id = filter_id;
- object.found = FALSE;
+ object.filter_id = filter_id;
+ object.found = FALSE;
#ifdef H5_HAVE_PARALLEL
- object.sanity_checked = FALSE;
+ object.sanity_checked = FALSE;
#endif /* H5_HAVE_PARALLEL */
/* Iterate through all opened datasets, returns a failure if any of them uses the filter */
@@ -434,17 +434,19 @@ H5Z__unregister(H5Z_filter_t filter_id)
H5Z_table_used_g--;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__unregister() */
/*-------------------------------------------------------------------------
- * Function: H5Z__check_unregister
+ * Function: H5Z__check_unregister
*
- * Purpose: Check if an object uses the filter to be unregistered.
+ * Purpose: Check if an object uses the filter to be unregistered.
+ *
+ * Return: TRUE if the object uses the filter
+ * FALSE if not
+ * NEGATIVE on error
*
- * Return: TRUE if the object uses the filter.
- * FALSE if not, NEGATIVE on error.
*-------------------------------------------------------------------------
*/
static htri_t
@@ -469,15 +471,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Z__check_unregister_group_cb
+ * Function: H5Z__check_unregister_group_cb
+ *
+ * Purpose: The callback function for H5Z__unregister. It iterates
+ * through all opened objects. If the object is a dataset
+ * or a group and it uses the filter to be unregistered, the
+ * function returns TRUE.
*
- * Purpose: The callback function for H5Z__unregister. It iterates
- * through all opened objects. If the object is a dataset
- * or a group and it uses the filter to be unregistered, the
- * function returns TRUE.
+ * Return: TRUE if the object uses the filter
+ * FALSE if not
+ * NEGATIVE on error
*
- * Return: TRUE if the object uses the filter.
- * FALSE otherwise.
*-------------------------------------------------------------------------
*/
static int
@@ -506,7 +510,7 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void
if (filter_in_pline) {
object->found = TRUE;
ret_value = TRUE;
- } /* end if */
+ }
done:
if (ocpl_id > 0)
@@ -518,15 +522,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Z__check_unregister_dset_cb
+ * Function: H5Z__check_unregister_dset_cb
+ *
+ * Purpose: The callback function for H5Z__unregister. It iterates
+ * through all opened objects. If the object is a dataset
+ * or a group and it uses the filter to be unregistered, the
+ * function returns TRUE.
*
- * Purpose: The callback function for H5Z__unregister. It iterates
- * through all opened objects. If the object is a dataset
- * or a group and it uses the filter to be unregistered, the
- * function returns TRUE.
+ * Return: TRUE if the object uses the filter
+ * FALSE if not
+ * NEGATIVE on error
*
- * Return: TRUE if the object uses the filter.
- * FALSE otherwise.
*-------------------------------------------------------------------------
*/
static int
@@ -555,7 +561,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *
if (filter_in_pline) {
object->found = TRUE;
ret_value = TRUE;
- } /* end if */
+ }
done:
if (ocpl_id > 0)
@@ -567,27 +573,29 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Z__flush_file_cb
+ * Function: H5Z__flush_file_cb
*
- * Purpose: The callback function for H5Z__unregister. It iterates
- * through all opened files and flush them.
+ * Purpose: The callback function for H5Z__unregister. It iterates
+ * through all opened files and flush them.
*
- * Return: FALSE if finishes flushing and moves on
- * FAIL if there is an error
+ * Return: NON-NEGATIVE if finishes flushing and moves on
+ * NEGATIVE if there is an error
*-------------------------------------------------------------------------
*/
static int
H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
{
- H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
- H5Z_object_t *object = (H5Z_object_t *)key;
- int ret_value = FALSE; /* Return value */
+ H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
+#ifdef H5_HAVE_PARALLEL
+ H5Z_object_t *object = (H5Z_object_t *)key;
+#endif /* H5_HAVE_PARALLEL */
+ int ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
- HDassert(f);
- HDassert(object);
+ HDassert(obj_ptr);
+ HDassert(key);
/* Do a global flush if the file is opened for write */
if(H5F_ACC_RDWR & H5F_INTENT(f)) {
@@ -689,11 +697,11 @@ H5Z_filter_avail(H5Z_filter_t id)
HGOTO_DONE(TRUE)
key.id = (int)id;
- if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
- if (H5Z_register(filter_info) < 0)
+ if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
+ if(H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter")
HGOTO_DONE(TRUE)
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -817,11 +825,11 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
/* Get dataset creation property list object */
if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Peek at the layout information */
if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
/* Check if the dataset is chunked */
if (H5D_CHUNKED == dcpl_layout->type) {
@@ -829,7 +837,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
/* Get I/O pipeline information */
if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
/* Check if the chunks have filters */
if (dcpl_pline.nused > 0) {
@@ -846,12 +854,12 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
/* Get ID for dataspace to pass to filter routines */
if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) {
(void)H5S_close(space);
- HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
}
/* Make the callbacks */
if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0)
- HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
}
}
}
@@ -1281,7 +1289,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
/* Try loading the filter */
key.id = (int)(pline->filter[idx].id);
- if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
+ if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
/* Register the filter we loaded */
if(H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
@@ -1519,13 +1527,13 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter)
/* if the pipeline has no filters, just return */
if (pline->nused == 0)
- HGOTO_DONE (SUCCEED)
+ HGOTO_DONE(SUCCEED)
/* Delete all filters */
if (H5Z_FILTER_ALL == filter) {
if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info")
- } /* end if */
+ }
/* Delete filter */
else {
size_t idx; /* Index of filter in pipeline */
@@ -1568,7 +1576,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter)
pline->nused--;
/* Reset information for previous last filter in pipeline */
- HDmemset (&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t));
+ HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t));
} /* end else */
done:
@@ -1596,7 +1604,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
/* Get the filter info */
if (H5Z_get_filter_info(filter, filter_config_flags) < 0)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 0df05f0..a2a44fa 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -25,7 +25,7 @@
* Filter identifiers. Values 0 through 255 are for filters defined by the
* HDF5 library. Values 256 through 511 are available for testing new
* filters. Subsequent values should be obtained from the HDF5 development
- * team at hdf5dev@ncsa.uiuc.edu. These values will never change because they
+ * team at help@hdfgroup.org. These values will never change because they
* appear in the HDF5 files.
*/
typedef int H5Z_filter_t;
diff --git a/src/H5detect.c b/src/H5detect.c
index 2d33a3d..4424009 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -26,11 +26,6 @@ static const char *FileHeader = "\n\
* help@hdfgroup.org. *\n\
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *";
/*
- *
- * Created: H5detect.c
- * 10 Aug 1997
- * Robb Matzke
- *
* Purpose: This code was borrowed heavily from the `detect.c'
* program in the AIO distribution from Lawrence
* Livermore National Laboratory.
@@ -44,9 +39,6 @@ static const char *FileHeader = "\n\
* features which aren't available. We're not
* running on a Vax or other machine with mixed
* endianness.
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
#undef NDEBUG
@@ -117,6 +109,8 @@ typedef struct malign_t {
unsigned int comp_align; /* alignment for structure */
} malign_t;
+FILE *rawoutstream = NULL;
+
/* global variables types detection code */
H5_GCC_DIAG_OFF(larger-than=)
static detected_t d_g[MAXDETECT];
@@ -143,9 +137,9 @@ static void detect_C99_integers32(void);
static void detect_C99_integers64(void);
static void detect_alignments(void);
static unsigned int align_g[] = {1, 2, 4, 8, 16};
-static int align_status_g = 0; /* ALIGNMENT Signal Status */
+static int align_status_g = 0; /* ALIGNMENT Signal Status */
static int sigbus_handler_called_g = 0; /* how many times called */
-static int sigsegv_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)
@@ -156,18 +150,13 @@ static H5JMP_BUF jbuf_g;
#endif
+
/*-------------------------------------------------------------------------
* Function: precision
*
- * Purpose: Determine the precision and offset.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Thursday, June 18, 1998
- *
- * Modifications:
+ * Purpose: Determine the precision and offset.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -175,21 +164,22 @@ precision (detected_t *d)
{
unsigned int n;
- if (0 == d->msize) {
+ if(0 == d->msize) {
/*
* An integer. The permutation can have negative values at the
* beginning or end which represent padding of bytes. We must adjust
* the precision and offset accordingly.
*/
- if (d->perm[0] < 0) {
+ if(d->perm[0] < 0) {
/*
* Lower addresses are padded.
*/
- for (n = 0; n < d->size && d->perm[n] < 0; n++)
+ for(n = 0; n < d->size && d->perm[n] < 0; n++)
/*void*/;
d->precision = 8 * (d->size - n);
d->offset = 0;
- } else if (d->perm[d->size - 1] < 0) {
+ }
+ else if(d->perm[d->size - 1] < 0) {
/*
* Higher addresses are padded.
*/
@@ -197,36 +187,34 @@ precision (detected_t *d)
/*void*/;
d->precision = 8 * (d->size - n);
d->offset = 8 * n;
- } else {
+ }
+ else {
/*
* No padding.
*/
d->precision = 8 * d->size;
d->offset = 0;
}
- } else {
+ }
+ else {
/* A floating point */
d->offset = MIN3(d->mpos, d->epos, d->sign);
d->precision = d->msize + d->esize + 1;
}
}
-
+
/*-------------------------------------------------------------------------
* Function: DETECT_I/DETECT_BYTE
*
- * Purpose: These macro takes a type like `int' and a base name like
- * `nati' and detects the byte order. The VAR is used to
- * construct the names of the C variables defined.
+ * Purpose: These macro takes a type like `int' and a base name like
+ * `nati' and detects the byte order. The VAR is used to
+ * construct the names of the C variables defined.
*
* DETECT_I is used for types that are larger than one byte,
* DETECT_BYTE is used for types that are exactly one byte.
*
- * Return: void
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 12 1996
+ * Return: void
*
* Modifications:
*
@@ -244,7 +232,7 @@ precision (detected_t *d)
*
* Neil Fortner, 6 Sep 2013
* Split macro into DETECT_I and DETECT_BYTE macros, extracted
- * common cod einto DETECT_I_BYTE_CORE. This was done to remove
+ * common code into DETECT_I_BYTE_CORE. This was done to remove
* "will never be executed" warnings.
*
*-------------------------------------------------------------------------
@@ -289,22 +277,15 @@ precision (detected_t *d)
DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \
}
-
+
/*-------------------------------------------------------------------------
* Function: DETECT_F
*
- * Purpose: This macro takes a floating point type like `double' and
- * a base name like `natd' and detects byte order, mantissa
- * location, exponent location, sign bit location, presence or
- * absence of implicit mantissa bit, and exponent bias and
- * initializes a detected_t structure with those properties.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 12 1996
- *
+ * Purpose: This macro takes a floating point type like `double' and
+ * a base name like `natd' and detects byte order, mantissa
+ * location, exponent location, sign bit location, presence or
+ * absence of implicit mantissa bit, and exponent bias and
+ * initializes a detected_t structure with those properties.
*-------------------------------------------------------------------------
*/
#define DETECT_F(TYPE,VAR,INFO) { \
@@ -393,22 +374,15 @@ precision (detected_t *d)
} \
}
-
+
/*-------------------------------------------------------------------------
* Function: DETECT_M
*
- * Purpose: This macro takes only miscellaneous structures or pointer
+ * Purpose: This macro takes only miscellaneous structures or pointer
* (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It
- * constructs the names and decides the alignment in structure.
- *
- * Return: void
- *
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
- * Dec 9, 2002
- *
- * Modifications:
+ * constructs the names and decides the alignment in structure.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
#define DETECT_M(TYPE,VAR,INFO) { \
@@ -438,29 +412,29 @@ precision (detected_t *d)
_buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \
if(H5SETJMP(jbuf_g)) _ano++; \
if(_ano < NELMTS(align_g)) { \
- *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \
- _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\
- /* Cray Check: This section helps detect alignment on Cray's */ \
+ *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \
+ _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\
+ /* Cray Check: This section helps detect alignment on Cray's */ \
/* vector machines (like the SV1) which mask off */ \
- /* pointer values when pointing to non-word aligned */ \
- /* locations with pointers that are supposed to be */ \
- /* word aligned. -QAK */ \
- HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \
- /*How to handle VAX types?*/ \
- if(INFO.perm[0]) /* Big-Endian */ \
- HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \
- else /* Little-Endian */ \
- 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) \
- if(_val!=_val2) \
- H5LONGJMP(jbuf_g, 1); \
- H5_GCC_DIAG_ON(float-equal) \
- /* End Cray Check */ \
- (INFO.align)=align_g[_ano]; \
+ /* pointer values when pointing to non-word aligned */ \
+ /* locations with pointers that are supposed to be */ \
+ /* word aligned. -QAK */ \
+ HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \
+ /*How to handle VAX types?*/ \
+ if(INFO.perm[0]) /* Big-Endian */ \
+ HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \
+ else /* Little-Endian */ \
+ 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) \
+ if(_val!=_val2) \
+ H5LONGJMP(jbuf_g, 1); \
+ H5_GCC_DIAG_ON(float-equal) \
+ /* End Cray Check */ \
+ (INFO.align)=align_g[_ano]; \
} else { \
(INFO.align)=0; \
- fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \
+ fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \
} \
HDfree(_buf); \
HDsignal(SIGBUS, _handler); /*restore original handler*/ \
@@ -476,21 +450,16 @@ precision (detected_t *d)
#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL)
+
/*-------------------------------------------------------------------------
* Function: sigsegv_handler
*
- * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction()
- * because it's more portable to non-Posix systems. Although
- * it's not nearly as nice to work with, it does the job for
- * this simple stuff.
- *
- * Return: Returns via H5LONGJMP to jbuf_g.
- *
- * Programmer: Robb Matzke
- * Thursday, March 18, 1999
- *
- * Modifications:
+ * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction()
+ * because it's more portable to non-Posix systems. Although
+ * it's not nearly as nice to work with, it does the job for
+ * this simple stuff.
*
+ * Return: Returns via H5LONGJMP to jbuf_g.
*-------------------------------------------------------------------------
*/
static void
@@ -514,21 +483,16 @@ sigsegv_handler(int H5_ATTR_UNUSED signo)
#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL)
+
/*-------------------------------------------------------------------------
* Function: sigbus_handler
*
- * Purpose: Handler for SIGBUS. We use signal() instead of sigaction()
- * because it's more portable to non-Posix systems. Although
- * it's not nearly as nice to work with, it does the job for
- * this simple stuff.
- *
- * Return: Returns via H5LONGJMP to jbuf_g.
- *
- * Programmer: Robb Matzke
- * Thursday, March 18, 1999
- *
- * Modifications:
+ * Purpose: Handler for SIGBUS. We use signal() instead of sigaction()
+ * because it's more portable to non-Posix systems. Although
+ * it's not nearly as nice to work with, it does the job for
+ * this simple stuff.
*
+ * Return: Returns via H5LONGJMP to jbuf_g.
*-------------------------------------------------------------------------
*/
static void
@@ -552,19 +516,16 @@ sigbus_handler(int H5_ATTR_UNUSED signo)
#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL)
+
/*-------------------------------------------------------------------------
* Function: sigill_handler
*
- * Purpose: Handler for SIGILL. We use signal() instead of sigaction()
- * because it's more portable to non-Posix systems. Although
- * it's not nearly as nice to work with, it does the job for
- * this simple stuff.
- *
- * Return: Returns via H5LONGJMP to jbuf_g.
- *
- * Programmer: Raymond Lu
- * 28 October 2013
+ * Purpose: Handler for SIGILL. We use signal() instead of sigaction()
+ * because it's more portable to non-Posix systems. Although
+ * it's not nearly as nice to work with, it does the job for
+ * this simple stuff.
*
+ * Return: Returns via H5LONGJMP to jbuf_g.
*-------------------------------------------------------------------------
*/
static void
@@ -586,20 +547,13 @@ sigill_handler(int H5_ATTR_UNUSED signo)
}
#endif
-
+
/*-------------------------------------------------------------------------
* Function: print_results
*
- * Purpose: Prints information about the detected data types.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 14, 1996
- *
- * Modifications:
+ * Purpose: Prints information about the detected data types.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -609,7 +563,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align)
int i, j;
/* Include files */
- printf("\
+ fprintf(rawoutstream, "\
/****************/\n\
/* Module Setup */\n\
/****************/\n\
@@ -662,7 +616,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align)
/*********************/\n\
\n\
\n");
- printf("\n\
+ fprintf(rawoutstream, "\n\
/*******************/\n\
/* Local Variables */\n\
/*******************/\n\
@@ -670,7 +624,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align)
/* The interface initialization function */
- printf("\n\
+ fprintf(rawoutstream, "\n\
\n\
/*-------------------------------------------------------------------------\n\
* Function: H5T__init_native\n\
@@ -713,12 +667,12 @@ H5T__init_native(void)\n\
}
/* Print a comment to describe this section of definitions. */
- printf("\n /*\n");
+ fprintf(rawoutstream, "\n /*\n");
iprint(d+i);
- printf(" */\n");
+ fprintf(rawoutstream, " */\n");
/* The part common to fixed and floating types */
- printf("\
+ fprintf(rawoutstream, "\
if(NULL == (dt = H5T__alloc()))\n\
HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, \"datatype allocation failed\")\n\
dt->shared->state = H5T_STATE_IMMUTABLE;\n\
@@ -728,16 +682,16 @@ H5T__init_native(void)\n\
d[i].size); /*size */
if(byte_order==-1)
- printf("\
+ fprintf(rawoutstream, "\
dt->shared->u.atomic.order = H5T_ORDER_VAX;\n");
else if(byte_order==0)
- printf("\
+ fprintf(rawoutstream, "\
dt->shared->u.atomic.order = H5T_ORDER_LE;\n");
else
- printf("\
+ fprintf(rawoutstream, "\
dt->shared->u.atomic.order = H5T_ORDER_BE;\n");
- printf("\
+ fprintf(rawoutstream, "\
dt->shared->u.atomic.offset = %d;\n\
dt->shared->u.atomic.prec = %d;\n\
dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\
@@ -746,14 +700,15 @@ H5T__init_native(void)\n\
d[i].precision); /*precision */
/*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */
- if (0 == d[i].msize) {
+ if(0 == d[i].msize) {
/* The part unique to fixed point types */
- printf("\
+ fprintf(rawoutstream, "\
dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n",
d[i].sign ? "2" : "NONE");
- } else {
+ }
+ else {
/* The part unique to floating point types */
- printf("\
+ fprintf(rawoutstream, "\
dt->shared->u.atomic.u.f.sign = %d;\n\
dt->shared->u.atomic.u.f.epos = %d;\n\
dt->shared->u.atomic.u.f.esize = %d;\n\
@@ -772,11 +727,11 @@ H5T__init_native(void)\n\
}
/* Atomize the type */
- printf("\
+ fprintf(rawoutstream, "\
if((H5T_NATIVE_%s_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)\n\
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \"can't register ID for built-in datatype\")\n",
d[i].varname);
- printf(" H5T_NATIVE_%s_ALIGN_g = %lu;\n",
+ fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n",
d[i].varname, (unsigned long)(d[i].align));
/* Variables for alignment of compound datatype */
@@ -784,28 +739,29 @@ H5T__init_native(void)\n\
!HDstrcmp(d[i].varname, "INT") || !HDstrcmp(d[i].varname, "LONG") ||
!HDstrcmp(d[i].varname, "LLONG") || !HDstrcmp(d[i].varname, "FLOAT") ||
!HDstrcmp(d[i].varname, "DOUBLE") || !HDstrcmp(d[i].varname, "LDOUBLE")) {
- printf(" H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n",
+ fprintf(rawoutstream, " H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n",
d[i].varname, (unsigned long)(d[i].comp_align));
}
}
/* Consider VAX a little-endian machine */
if(byte_order==0 || byte_order==-1) {
- printf("\n\
+ fprintf(rawoutstream, "\n\
/* Set the native order for this machine */\n\
H5T_native_order_g = H5T_ORDER_%s;\n", "LE");
- } else {
- printf("\n\
+ }
+ else {
+ fprintf(rawoutstream, "\n\
/* Set the native order for this machine */\n\
H5T_native_order_g = H5T_ORDER_%s;\n", "BE");
}
/* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */
- printf("\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n");
+ fprintf(rawoutstream, "\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n");
for(j=0; j<na; j++)
- printf(" H5T_%s_COMP_ALIGN_g = %lu;\n", misc_align[j].name, (unsigned long)(misc_align[j].comp_align));
+ fprintf(rawoutstream, " H5T_%s_COMP_ALIGN_g = %lu;\n", misc_align[j].name, (unsigned long)(misc_align[j].comp_align));
- printf("\
+ fprintf(rawoutstream, "\
\n\
done:\n\
if(ret_value < 0) {\n\
@@ -818,73 +774,66 @@ done:\n\
FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5T__init_native() */\n");
/* Print the ALIGNMENT and signal-handling status as comments */
- printf("\n"
+ fprintf(rawoutstream, "\n"
"/****************************************/\n"
"/* ALIGNMENT and signal-handling status */\n"
"/****************************************/\n");
if (align_status_g & STA_NoALIGNMENT)
- printf("/* ALIGNAMENT test is not available */\n");
+ fprintf(rawoutstream, "/* ALIGNAMENT test is not available */\n");
if (align_status_g & STA_NoHandlerVerify)
- printf("/* Signal handlers verify test is not available */\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
- printf("/* Signal() support: yes */\n");
+ fprintf(rawoutstream, "/* Signal() support: yes */\n");
#else
- printf("/* Signal() support: no */\n");
+ fprintf(rawoutstream, "/* Signal() support: no */\n");
#endif
#ifdef H5_HAVE_SETJMP
- printf("/* setjmp() support: yes */\n");
+ fprintf(rawoutstream, "/* setjmp() support: yes */\n");
#else
- printf("/* setjmp() support: no */\n");
+ fprintf(rawoutstream, "/* setjmp() support: no */\n");
#endif
#ifdef H5_HAVE_LONGJMP
- printf("/* longjmp() support: yes */\n");
+ fprintf(rawoutstream, "/* longjmp() support: yes */\n");
#else
- printf("/* longjmp() support: no */\n");
+ fprintf(rawoutstream, "/* longjmp() support: no */\n");
#endif
#ifdef H5_HAVE_SIGSETJMP
- printf("/* sigsetjmp() support: yes */\n");
+ fprintf(rawoutstream, "/* sigsetjmp() support: yes */\n");
#else
- printf("/* sigsetjmp() support: no */\n");
+ fprintf(rawoutstream, "/* sigsetjmp() support: no */\n");
#endif
#ifdef H5_HAVE_SIGLONGJMP
- printf("/* siglongjmp() support: yes */\n");
+ fprintf(rawoutstream, "/* siglongjmp() support: yes */\n");
#else
- printf("/* siglongjmp() support: no */\n");
+ fprintf(rawoutstream, "/* siglongjmp() support: no */\n");
#endif
#ifdef H5_HAVE_SIGPROCMASK
- printf("/* sigprocmask() support: yes */\n");
+ fprintf(rawoutstream, "/* sigprocmask() support: yes */\n");
#else
- printf("/* sigprocmask() support: no */\n");
+ fprintf(rawoutstream, "/* sigprocmask() support: no */\n");
#endif
/* Print the statics of signal handlers called for debugging */
- printf("\n"
+ fprintf(rawoutstream, "\n"
"/******************************/\n"
"/* signal handlers statistics */\n"
"/******************************/\n");
- printf("/* signal_handlers tested: %d times */\n", signal_handler_tested_g);
- printf("/* sigbus_handler called: %d times */\n", sigbus_handler_called_g);
- printf("/* sigsegv_handler called: %d times */\n", sigsegv_handler_called_g);
- printf("/* sigill_handler called: %d times */\n", sigill_handler_called_g);
+ fprintf(rawoutstream, "/* signal_handlers tested: %d times */\n", signal_handler_tested_g);
+ fprintf(rawoutstream, "/* sigbus_handler called: %d times */\n", sigbus_handler_called_g);
+ fprintf(rawoutstream, "/* sigsegv_handler called: %d times */\n", sigsegv_handler_called_g);
+ fprintf(rawoutstream, "/* sigill_handler called: %d times */\n", sigill_handler_called_g);
} /* end print_results() */
-
+
/*-------------------------------------------------------------------------
* Function: iprint
*
- * Purpose: Prints information about the fields of a floating point
- * format.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 13, 1996
- *
- * Modifications:
+ * Purpose: Prints information about the fields of a floating point format.
*
+ * Return: void
+
*-------------------------------------------------------------------------
*/
static void
@@ -892,88 +841,92 @@ iprint(detected_t *d)
{
unsigned int pass;
- for (pass = (d->size - 1) / 4; ; --pass) {
+ for(pass = (d->size - 1) / 4; ; --pass) {
unsigned int i, k;
/*
* Print the byte ordering above the bit fields.
*/
- printf(" * ");
- for (i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) {
- printf("%4d", d->perm[i]);
- if (i > pass * 4) HDfputs(" ", stdout);
- if (!i) break;
+ fprintf(rawoutstream, " * ");
+ for(i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) {
+ fprintf(rawoutstream, "%4d", d->perm[i]);
+ if(i > pass * 4)
+ HDfputs(" ", stdout);
+ if(!i)
+ break;
}
/*
* Print the bit fields
*/
- printf("\n * ");
- for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31,
+ fprintf(rawoutstream, "\n * ");
+ for(i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31,
8 * d->size - 1); i >= pass * 4; --i) {
unsigned int j;
- for (j = 8; j > 0; --j) {
- if (k == d->sign && d->msize) {
- HDputchar('S');
- } else if (k >= d->epos && k < d->epos + d->esize) {
- HDputchar('E');
- } else if (k >= d->mpos && k < d->mpos + d->msize) {
- HDputchar('M');
- } else if (d->msize) {
- HDputchar('?'); /*unknown floating point bit */
- } else if (d->sign) {
- HDputchar('I');
- } else {
- HDputchar('U');
+ for(j = 8; j > 0; --j) {
+ if(k == d->sign && d->msize) {
+ HDfputc('S', rawoutstream);
+ }
+ else if(k >= d->epos && k < d->epos + d->esize) {
+ HDfputc('E', rawoutstream);
+ }
+ else if(k >= d->mpos && k < d->mpos + d->msize) {
+ HDfputc('M', rawoutstream);
+ }
+ else if(d->msize) {
+ HDfputc('?', rawoutstream); /*unknown floating point bit */
+ }
+ else if(d->sign) {
+ HDfputc('I', rawoutstream);
+ }
+ else {
+ HDfputc('U', rawoutstream);
}
--k;
}
- if (i > pass * 4) HDputchar(' ');
- if (!i) break;
+ if(i > pass * 4)
+ HDfputc(' ', rawoutstream);
+ if(!i)
+ break;
}
- HDputchar('\n');
- if (!pass) break;
+ HDfputc('\n', rawoutstream);
+ if(!pass)
+ break;
}
/*
* Is there an implicit bit in the mantissa.
*/
- if (d->msize) {
- printf(" * Implicit bit? %s\n", d->imp ? "yes" : "no");
+ if(d->msize) {
+ fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no");
}
/*
* Alignment
*/
- if (0 == d->align) {
- printf(" * Alignment: NOT CALCULATED\n");
- } else if (1 == d->align) {
- printf(" * Alignment: none\n");
- } else {
- printf(" * Alignment: %lu\n", (unsigned long) (d->align));
+ if(0 == d->align) {
+ fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n");
+ }
+ else if(1 == d->align) {
+ fprintf(rawoutstream, " * Alignment: none\n");
+ }
+ else {
+ fprintf(rawoutstream, " * Alignment: %lu\n", (unsigned long) (d->align));
}
}
-
+
/*-------------------------------------------------------------------------
* Function: byte_cmp
*
- * Purpose: Compares two chunks of memory A and B and returns the
- * byte index into those arrays of the first byte that
- * differs between A and B. Ignores differences where the
+ * Purpose: Compares two chunks of memory A and B and returns the
+ * byte index into those arrays of the first byte that
+ * differs between A and B. Ignores differences where the
* corresponding bit in pad_mask is set to 0.
*
- * Return: Success: Index of differing byte.
- *
- * Failure: -1 if all bytes are the same.
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 12, 1996
- *
- * Modifications:
- *
+ * Return: Success: Index of differing byte.
+ * Failure: -1 if all bytes are the same.
*-------------------------------------------------------------------------
*/
static int
@@ -990,17 +943,17 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask)
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: bit_cmp
*
- * Purpose: Compares two bit vectors and returns the index for the
- * first bit that differs between the two vectors. The
- * size of the vector is NBYTES. PERM is a mapping from
- * actual order to little endian. Ignores differences where
+ * Purpose: Compares two bit vectors and returns the index for the
+ * first bit that differs between the two vectors. The
+ * size of the vector is NBYTES. PERM is a mapping from
+ * actual order to little endian. Ignores differences where
* the corresponding bit in pad_mask is set to 0.
*
- * Return: Index of first differing bit.
+ * Return: Index of first differing bit.
*
*-------------------------------------------------------------------------
*/
@@ -1013,14 +966,14 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b,
unsigned char *b = (unsigned char *) _b;
unsigned char aa, bb;
- for (i = 0; i < nbytes; i++) {
+ for(i = 0; i < nbytes; i++) {
HDassert(perm[i] < (int) nbytes);
- if ((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]]))
+ if((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]]))
!= (bb = (unsigned char) (b[perm[i]] & pad_mask[perm[i]]))) {
unsigned int j;
- for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) {
- if ((aa & 1) != (bb & 1)) return i * 8 + j;
+ for(j = 0; j < 8; j++, aa >>= 1, bb >>= 1) {
+ if((aa & 1) != (bb & 1)) return i * 8 + j;
}
fprintf(stderr, "INTERNAL ERROR");
HDabort();
@@ -1031,26 +984,19 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b,
return 0;
}
-
+
/*-------------------------------------------------------------------------
* Function: fix_order
*
- * Purpose: Given an array PERM with elements FIRST through LAST
- * initialized with zero origin byte numbers, this function
- * creates a permutation vector that maps the actual order
- * of a floating point number to little-endian.
- *
- * This function assumes that the mantissa byte ordering
- * implies the total ordering.
- *
- * Return: void
+ * Purpose: Given an array PERM with elements FIRST through LAST
+ * initialized with zero origin byte numbers, this function
+ * creates a permutation vector that maps the actual order
+ * of a floating point number to little-endian.
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 13, 1996
- *
- * Modifications:
+ * This function assumes that the mantissa byte ordering
+ * implies the total ordering.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -1058,79 +1004,79 @@ fix_order(int n, int last, int *perm, const char **mesg)
{
int i;
- if (last > 1) {
- /*
- * We have at least three points to consider.
- */
- if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) {
+ if(last > 1) {
/*
- * Little endian.
- */
- if (mesg) *mesg = "Little-endian";
- for (i = 0; i < n; i++) perm[i] = i;
+ * We have at least three points to consider.
+ */
+ if(perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) {
+ /*
+ * Little endian.
+ */
+ if(mesg)
+ *mesg = "Little-endian";
+ for(i = 0; i < n; i++)
+ perm[i] = i;
- } else if (perm[last] > perm[last-1] && perm[last-1] > perm[last-2]) {
- /*
- * Big endian.
- */
- if (mesg) *mesg = "Big-endian";
- for (i = 0; i < n; i++) perm[i] = (n - 1) - i;
+ }
+ else if(perm[last] > perm[last - 1]
+ && perm[last - 1] > perm[last - 2]) {
+ /*
+ * Big endian.
+ */
+ if(mesg)
+ *mesg = "Big-endian";
+ for(i = 0; i < n; i++)
+ perm[i] = (n - 1) - i;
- } else {
- /*
- * Bi-endian machines like VAX.
+ }
+ else {
+ /*
+ * Bi-endian machines like VAX.
* (NOTE: This is not an actual determination of the VAX-endianness.
* It could have some other endianness and fall into this
* case - JKM & QAK)
- */
- HDassert(0 == n % 2);
- if (mesg) *mesg = "VAX";
- for (i = 0; i < n; i += 2) {
- perm[i] = (n - 2) - i;
- perm[i + 1] = (n - 1) - i;
+ */
+ HDassert(0 == n % 2);
+ if(mesg)
+ *mesg = "VAX";
+ for(i = 0; i < n; i += 2) {
+ perm[i] = (n - 2) - i;
+ perm[i + 1] = (n - 1) - i;
+ }
}
}
- } else {
- fprintf(stderr,
- "Failed to detect byte order of %d-byte floating point.\n", n);
- HDexit(1);
+ else {
+ fprintf(stderr,
+ "Failed to detect byte order of %d-byte floating point.\n", n);
+ HDexit(1);
}
}
-
+
/*-------------------------------------------------------------------------
* Function: imp_bit
*
- * Purpose: Looks for an implicit bit in the mantissa. The value
- * of _A should be 1.0 and the value of _B should be 0.5.
- * Some floating-point formats discard the most significant
- * bit of the mantissa after normalizing since it will always
- * be a one (except for 0.0). If this is true for the native
- * floating point values stored in _A and _B then the function
- * returns non-zero.
+ * Purpose: Looks for an implicit bit in the mantissa. The value
+ * of _A should be 1.0 and the value of _B should be 0.5.
+ * Some floating-point formats discard the most significant
+ * bit of the mantissa after normalizing since it will always
+ * be a one (except for 0.0). If this is true for the native
+ * floating point values stored in _A and _B then the function
+ * returns non-zero.
*
- * This function assumes that the exponent occupies higher
- * order bits than the mantissa and that the most significant
- * bit of the mantissa is next to the least significant bit
- * of the exponent.
+ * This function assumes that the exponent occupies higher
+ * order bits than the mantissa and that the most significant
+ * bit of the mantissa is next to the least significant bit
+ * of the exponent.
*
*
- * Return: Success: Non-zero if the most significant bit
- * of the mantissa is discarded (ie, the
- * mantissa has an implicit `one' as the
- * most significant bit). Otherwise,
- * returns zero.
+ * Return: Success: Non-zero if the most significant bit
+ * of the mantissa is discarded (ie, the
+ * mantissa has an implicit `one' as the
+ * most significant bit). Otherwise,
+ * returns zero.
*
- * Failure: exit(1)
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 13, 1996
- *
- * Modifications:
- *
- * Robb Matzke, 6 Nov 1996
- * Fixed a bug that occurs with non-implicit architectures.
+ * Failure: 1
*
*-------------------------------------------------------------------------
*/
@@ -1160,26 +1106,14 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_
return (a[perm[major]] >> minor) & 0x01 ? 0 : 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: find_bias
- *
- * Purpose: Determines the bias of the exponent. This function should
- * be called with _A having a value of `1'.
+ * Function: find_bias
*
- * Return: Success: The exponent bias.
+ * Purpose: Determines the bias of the exponent. This function should
+ * be called with _A having a value of `1'.
*
- * Failure:
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 13, 1996
- *
- * Modifications:
- *
- * Robb Matzke, 6 Nov 1996
- * Fixed a bug with non-implicit architectures returning the
- * wrong exponent bias.
+ * Return: The exponent bias.
*
*-------------------------------------------------------------------------
*/
@@ -1190,7 +1124,7 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a)
unsigned char mask;
unsigned int b, shift = 0, nbits, bias = 0;
- while (esize > 0) {
+ while(esize > 0) {
nbits = MIN(esize, (8 - epos % 8));
mask = (unsigned char) ((1 << nbits) - 1);
b = (unsigned int) (a[perm[epos / 8]] >> (epos % 8)) & mask;
@@ -1203,34 +1137,27 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a)
return bias;
}
-
+
/*-------------------------------------------------------------------------
* Function: print_header
*
- * Purpose: Prints the C file header for the generated file.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Mar 12 1997
- *
- * Modifications:
+ * Purpose: Prints the C file header for the generated file.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
print_header(void)
{
- time_t now = HDtime(NULL);
- struct tm *tm = HDlocaltime(&now);
- char real_name[30];
- char host_name[256];
+ time_t now = HDtime(NULL);
+ struct tm *tm = HDlocaltime(&now);
+ char real_name[30];
+ char host_name[256];
int i;
- const char *s;
+ const char *s;
#ifdef H5_HAVE_GETPWUID
- struct passwd *pwd = NULL;
+ struct passwd *pwd = NULL;
#else
int pwd = 1;
#endif
@@ -1281,20 +1208,21 @@ bit.\n";
*/
#ifdef H5_HAVE_GETPWUID
{
- size_t n;
- char *comma;
- if ((pwd = HDgetpwuid(HDgetuid()))) {
- if ((comma = HDstrchr(pwd->pw_gecos, ','))) {
- n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos));
- HDstrncpy(real_name, pwd->pw_gecos, n);
- real_name[n] = '\0';
- } else {
- HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name));
- real_name[sizeof(real_name) - 1] = '\0';
+ size_t n;
+ char *comma;
+ if((pwd = HDgetpwuid(HDgetuid()))) {
+ if((comma = HDstrchr(pwd->pw_gecos, ','))) {
+ n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos));
+ HDstrncpy(real_name, pwd->pw_gecos, n);
+ real_name[n] = '\0';
+ }
+ else {
+ HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name));
+ real_name[sizeof(real_name) - 1] = '\0';
+ }
}
- } else {
- real_name[0] = '\0';
- }
+ else
+ real_name[0] = '\0';
}
#else
real_name[0] = '\0';
@@ -1304,8 +1232,8 @@ bit.\n";
* The FQDM of this host or the empty string.
*/
#ifdef H5_HAVE_GETHOSTNAME
- if (HDgethostname(host_name, sizeof(host_name)) < 0) {
- host_name[0] = '\0';
+ if(HDgethostname(host_name, sizeof(host_name)) < 0) {
+ host_name[0] = '\0';
}
#else
host_name[0] = '\0';
@@ -1314,78 +1242,71 @@ bit.\n";
/*
* The file header: warning, copyright notice, build information.
*/
- printf("/* Generated automatically by H5detect -- do not edit */\n\n\n");
- HDputs(FileHeader); /*the copyright notice--see top of this file */
+ fprintf(rawoutstream, "/* Generated automatically by H5detect -- do not edit */\n\n\n");
+ HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */
- printf(" *\n * Created:\t\t%s %2d, %4d\n",
+ fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n",
month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year);
- if (pwd || real_name[0] || host_name[0]) {
- printf(" *\t\t\t");
- if (real_name[0]) printf("%s <", real_name);
+ if(pwd || real_name[0] || host_name[0]) {
+ fprintf(rawoutstream, " *\t\t\t");
+ if(real_name[0])
+ fprintf(rawoutstream, "%s <", real_name);
#ifdef H5_HAVE_GETPWUID
- if (pwd) HDfputs(pwd->pw_name, stdout);
+ if(pwd) HDfputs(pwd->pw_name, rawoutstream);
#endif
- if (host_name[0]) printf("@%s", host_name);
- if (real_name[0]) printf(">");
- HDputchar('\n');
+ if(host_name[0])
+ fprintf(rawoutstream, "@%s", host_name);
+ if(real_name[0])
+ fprintf(rawoutstream, ">");
+ HDfputc('\n', rawoutstream);
}
- printf(" *\n * Purpose:\t\t");
- for (s = purpose; *s; s++) {
- HDputchar(*s);
- if ('\n' == *s && s[1]) printf(" *\t\t\t");
+ fprintf(rawoutstream, " *\n * Purpose:\t\t");
+ for(s = purpose; *s; s++) {
+ HDfputc(*s, rawoutstream);
+ if('\n' == *s && s[1])
+ fprintf(rawoutstream, " *\t\t\t");
}
- printf(" *\n * Modifications:\n *\n");
- printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n");
- printf(" *\tIt was generated by code in `H5detect.c'.\n");
+ fprintf(rawoutstream, " *\n * Modifications:\n *\n");
+ fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n");
+ fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n");
- printf(" *\n *");
- for (i = 0; i < 73; i++) HDputchar('-');
- printf("\n */\n\n");
+ fprintf(rawoutstream, " *\n *");
+ for(i = 0; i < 73; i++)
+ HDfputc('-', rawoutstream);
+ fprintf(rawoutstream, "\n */\n\n");
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C89_integers
*
- * Purpose: Detect C89 integer types
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect C89 integer types
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
detect_C89_integers(void)
{
- DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++;
- DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++;
- DETECT_I(short, SHORT, d_g[nd_g]); nd_g++;
- DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++;
- DETECT_I(int, INT, d_g[nd_g]); nd_g++;
- DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++;
- DETECT_I(long, LONG, d_g[nd_g]); nd_g++;
- DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++;
+ DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++;
+ DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++;
+ DETECT_I(short, SHORT, d_g[nd_g]); nd_g++;
+ DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++;
+ DETECT_I(int, INT, d_g[nd_g]); nd_g++;
+ DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++;
+ DETECT_I(long, LONG, d_g[nd_g]); nd_g++;
+ DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++;
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C89_floats
*
- * Purpose: Detect C89 floating point types
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect C89 floating point types
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
@@ -1395,19 +1316,13 @@ detect_C89_floats(void)
DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++;
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C99_integers8
*
- * Purpose: Detect C99 8 bit integer types
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect C99 8 bit integer types
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
@@ -1415,61 +1330,55 @@ 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++;
+ DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++;
#else
- DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++;
+ 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++;
+ DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++;
#else
- DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++;
#endif
#endif
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C99_integers16
*
- * Purpose: Detect C99 16 bit integer types
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect C99 16 bit integer types
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
@@ -1479,35 +1388,29 @@ detect_C99_integers16(void)
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++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++;
#endif
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C99_integers32
*
- * Purpose: Detect C99 32 bit integer types
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect C99 32 bit integer types
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
@@ -1517,34 +1420,29 @@ detect_C99_integers32(void)
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++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++;
#endif
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C99_integers64
*
- * Purpose: Detect C99 64 bit integer types
+ * Purpose: Detect C99 64 bit integer types
*
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Return: void
*
*-------------------------------------------------------------------------
*/
@@ -1555,24 +1453,24 @@ detect_C99_integers64(void)
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++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ 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++;
+ DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++;
#else
/*
* This architecture doesn't support an integer type larger than `long'
@@ -1580,23 +1478,17 @@ detect_C99_integers64(void)
* `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++;
+ DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++;
#endif
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C99_integers
*
- * Purpose: Detect C99 integer types
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect C99 integer types
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
@@ -1610,19 +1502,13 @@ detect_C99_integers(void)
detect_C99_integers64();
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_C99_floats
*
- * Purpose: Detect C99 floating point types
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect C99 floating point types
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
@@ -1641,19 +1527,13 @@ detect_C99_floats(void)
#endif
}
-
+
/*-------------------------------------------------------------------------
* Function: detect_alignments
*
- * Purpose: Detect structure alignments
- *
- * Return: void
- *
- * Programmer: Albert Cheng
- * 2004/05/20
- *
- * Modifications:
+ * Purpose: Detect structure alignments
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void HDF_NO_UBSAN
@@ -1685,60 +1565,54 @@ static int verify_signal_handlers(int signum, void (*handler)(int))
#endif
void (*save_handler)(int) = HDsignal(signum, handler);
volatile int i, val;
- int ntries=5;
- volatile int nfailures=0;
- volatile int nsuccesses=0;
-
- for (i=0;i<ntries; i++){
- val=H5SETJMP(jbuf_g);
- if (val==0)
- {
- /* send self the signal to trigger the handler */
- signal_handler_tested_g++;
- HDraise(signum);
- /* Should not reach here. Record error. */
- nfailures++;
- }else{
- if (val==signum){
- /* return from signum handler. Record a sucess. */
- nsuccesses++;
- }else{
- fprintf(stderr, "Unknown return value (%d) from H5SETJMP",
- val);
- nfailures++;
+ int ntries = 5;
+ volatile int nfailures = 0;
+ volatile int nsuccesses = 0;
+
+ for(i=0;i<ntries; i++) {
+ val=H5SETJMP(jbuf_g);
+ if(val==0) {
+ /* send self the signal to trigger the handler */
+ signal_handler_tested_g++;
+ HDraise(signum);
+ /* Should not reach here. Record error. */
+ nfailures++;
+ }
+ else {
+ if(val==signum) {
+ /* return from signum handler. Record a sucess. */
+ nsuccesses++;
+ }
+ else {
+ fprintf(stderr, "Unknown return value (%d) from H5SETJMP", val);
+ nfailures++;
+ }
}
- }
}
/* restore save handler, check results and report failures */
HDsignal(signum, save_handler);
- if (nfailures>0 || nsuccesses != ntries){
- fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. "
- "Found %d failures and %d successes\n",
- signum, ntries, nfailures, nsuccesses);
- return(-1);
- }else{
- /* all succeeded */
- return(0);
+ if(nfailures>0 || nsuccesses != ntries) {
+ fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. "
+ "Found %d failures and %d successes\n",
+ signum, ntries, nfailures, nsuccesses);
+ return -1;
+ }
+ else {
+ /* all succeeded */
+ return 0;
}
}
#endif
-
+
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose: Main entry point.
- *
- * Return: Success: exit(0)
+ * Purpose: Main entry point.
*
- * Failure: exit(1)
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 12, 1996
+ * Return: Success: EXIT_SUCCESS
*
* Modifications:
- * Albert Cheng, 2004/05/20
* Some compilers, e.g., Intel C v7.0, took a long time to compile
* with optimization when a module routine contains many code lines.
* Divide up all those types detections macros into subroutines, both
@@ -1747,8 +1621,23 @@ static int verify_signal_handlers(int signum, void (*handler)(int))
*-------------------------------------------------------------------------
*/
int HDF_NO_UBSAN
-main(void)
+main(int argc, char *argv[])
{
+ char *fname = NULL;
+ FILE *f; /* temporary holding place for the stream pointer
+ * so that rawoutstream is changed only when succeeded */
+
+ if(argc > 1)
+ fname = argv[1];
+
+ /* First check if filename is string "NULL" */
+ if(fname != NULL) {
+ /* binary output */
+ if((f = HDfopen(fname, "w")) != NULL)
+ rawoutstream = f;
+ }
+ if(!rawoutstream)
+ rawoutstream = stdout;
#if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS)
#if defined(UAC_NOPRINT) && defined(UAC_SIGBUS)
@@ -1759,8 +1648,8 @@ main(void)
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",
+ if(setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) {
+ fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n",
HDstrerror(errno));
}
#endif
@@ -1768,15 +1657,15 @@ main(void)
#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL)
/* verify the SIGBUS and SIGSEGV handlers work properly */
- if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) {
+ if(verify_signal_handlers(SIGBUS, sigbus_handler) != 0) {
fprintf(stderr, "Signal handler %s for signal %d failed\n",
"sigbus_handler", SIGBUS);
}
- if (verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) {
+ if(verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) {
fprintf(stderr, "Signal handler %s for signal %d failed\n",
"sigsegv_handler", SIGSEGV);
}
- if (verify_signal_handlers(SIGILL, sigill_handler) != 0) {
+ if(verify_signal_handlers(SIGILL, sigill_handler) != 0) {
fprintf(stderr, "Signal handler %s for signal %d failed\n",
"sigill_handler", SIGILL);
}
@@ -1803,5 +1692,13 @@ main(void)
print_results (nd_g, d_g, na_g, m_g);
- return 0;
+ if(rawoutstream && rawoutstream != stdout) {
+ if(HDfclose(rawoutstream))
+ fprintf(stderr, "closing rawoutstream");
+ else
+ rawoutstream = NULL;
+ }
+
+ return EXIT_SUCCESS;
}
+
diff --git a/src/H5err.txt b/src/H5err.txt
index 19374cd..3965242 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -46,7 +46,7 @@
MAJOR, H5E_ARGS, Invalid arguments to routine
MAJOR, H5E_RESOURCE, Resource unavailable
MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail)
-MAJOR, H5E_FILE, File accessibilty
+MAJOR, H5E_FILE, File accessibility
MAJOR, H5E_IO, Low-level I/O
MAJOR, H5E_FUNC, Function entry/exit
MAJOR, H5E_ATOM, Object atom
@@ -66,6 +66,7 @@ MAJOR, H5E_PLINE, Data filters
MAJOR, H5E_EFL, External file list
MAJOR, H5E_REFERENCE, References
MAJOR, H5E_VFL, Virtual File Layer
+MAJOR, H5E_VOL, Virtual Object Layer
MAJOR, H5E_TST, Ternary Search Trees
MAJOR, H5E_RS, Reference Counted Strings
MAJOR, H5E_ERROR, Error API
@@ -82,7 +83,7 @@ MAJOR, H5E_NONE_MAJOR, No error
# Sections (for grouping minor errors)
SECTION, ARGS, Argument errors
SECTION, RESOURCE, Resource errors
-SECTION, FILEACC, File accessibilty errors
+SECTION, FILEACC, File accessibility errors
SECTION, FILE, Generic low-level file I/O errors
SECTION, FUNC, Function entry/exit interface errors
SECTION, ATOM, Object atom related errors
@@ -123,7 +124,7 @@ MINOR, RESOURCE, H5E_CANTGC, Unable to garbage collect
MINOR, RESOURCE, H5E_CANTGETSIZE, Unable to compute size
MINOR, RESOURCE, H5E_OBJOPEN, Object is already open
-# File accessibilty errors
+# File accessibility errors
MINOR, FILEACC, H5E_FILEEXISTS, File already exists
MINOR, FILEACC, H5E_FILEOPEN, File already open
MINOR, FILEACC, H5E_CANTCREATE, Unable to create file
diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c
index 1892806..da7c8d9 100644
--- a/src/H5make_libsettings.c
+++ b/src/H5make_libsettings.c
@@ -26,13 +26,8 @@ static const char *FileHeader = "\n\
* help@hdfgroup.org. *\n\
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *";
/*
- *
- * Created: H5make_libsettings.c
- * 17 Mar 2010
- * Quincey Koziol
- *
- * Purpose: Generate the H5libsettings.c file from the
- * libhdf5.settings file.
+ * Purpose: Generate the H5libsettings.c file from the
+ * libhdf5.settings file.
*
*-------------------------------------------------------------------------
*/
@@ -43,33 +38,31 @@ static const char *FileHeader = "\n\
#define LIBSETTINGSFNAME "libhdf5.settings"
+FILE *rawoutstream = NULL;
+
/*-------------------------------------------------------------------------
- * Function: insert_libhdf5_settings
- *
- * Purpose: insert the contents of libhdf5.settings into a file
- * represented by flibinfo.
- * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not
- * defined, i.e., not enabled.
+ * Function: insert_libhdf5_settings
*
- * Return: void
- *
- * Programmer: Albert Cheng
- * Apr 20, 2009
+ * Purpose: insert the contents of libhdf5.settings into a file
+ * represented by flibinfo.
+ * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not
+ * defined, i.e., not enabled.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
insert_libhdf5_settings(FILE *flibinfo)
{
#ifdef H5_HAVE_EMBEDDED_LIBINFO
- FILE *fsettings; /* for files libhdf5.settings */
+ FILE *fsettings; /* for files libhdf5.settings */
int inchar;
- int bol = 0; /* indicates the beginning of a new line */
+ int bol = 0; /* indicates the beginning of a new line */
if(NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) {
HDperror(LIBSETTINGSFNAME);
- HDexit(1);
+ HDexit(EXIT_FAILURE);
} /* end if */
/* print variable definition and the string */
@@ -77,33 +70,33 @@ insert_libhdf5_settings(FILE *flibinfo)
fprintf(flibinfo, "char H5libhdf5_settings[]=\n");
bol++;
while(EOF != (inchar = HDgetc(fsettings))) {
- if(bol) {
- /* Start a new line */
- fprintf(flibinfo, "\t\"");
- bol = 0;
- } /* end if */
- if(inchar == '\n') {
- /* end of a line */
- fprintf(flibinfo, "\\n\"\n");
- bol++;
+ if(bol) {
+ /* Start a new line */
+ fprintf(flibinfo, "\t\"");
+ bol = 0;
+ } /* end if */
+ if(inchar == '\n') {
+ /* end of a line */
+ fprintf(flibinfo, "\\n\"\n");
+ bol++;
} /* end if */
- else
- HDputc(inchar, flibinfo);
+ else
+ HDputc(inchar, flibinfo);
} /* end while */
if(HDfeof(fsettings)) {
- /* wrap up */
- if(!bol)
- /* EOF found without a new line */
- fprintf(flibinfo, "\\n\"\n");
- fprintf(flibinfo, ";\n\n");
+ /* wrap up */
+ if(!bol)
+ /* EOF found without a new line */
+ fprintf(flibinfo, "\\n\"\n");
+ fprintf(flibinfo, ";\n\n");
} /* end if */
else {
- fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME);
- HDexit(1);
+ fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME);
+ HDexit(EXIT_FAILURE);
} /* end else */
if(0 != HDfclose(fsettings)) {
- HDperror(LIBSETTINGSFNAME);
- HDexit(1);
+ HDperror(LIBSETTINGSFNAME);
+ HDexit(EXIT_FAILURE);
} /* end if */
#else
/* print variable definition and an empty string */
@@ -114,59 +107,50 @@ insert_libhdf5_settings(FILE *flibinfo)
/*-------------------------------------------------------------------------
- * Function: make_libinfo
- *
- * Purpose: Create the embedded library information definition.
- * This sets up for a potential extension that the declaration
- * is printed to a file different from stdout.
- *
- * Return: void
+ * Function: make_libinfo
*
- * Programmer: Albert Cheng
- * Sep 15, 2009
+ * Purpose: Create the embedded library information definition.
+ * This sets up for a potential extension that the declaration
+ * is printed to a file different from stdout.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
make_libinfo(void)
{
/* print variable definition and then the string as a macro. */
- insert_libhdf5_settings(stdout);
+ insert_libhdf5_settings(rawoutstream);
}
/*-------------------------------------------------------------------------
- * Function: print_header
+ * Function: print_header
*
- * Purpose: Prints the header for the generated file.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Mar 12 1997
+ * Purpose: Prints the header for the generated file.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
print_header(void)
{
- time_t now = HDtime(NULL);
- struct tm *tm = HDlocaltime(&now);
- char real_name[30];
- char host_name[256];
- int i;
- const char *s;
+ time_t now = HDtime(NULL);
+ struct tm *tm = HDlocaltime(&now);
+ char real_name[30];
+ char host_name[256];
+ int i;
+ const char *s;
#ifdef H5_HAVE_GETPWUID
- struct passwd *pwd = NULL;
+ struct passwd *pwd = NULL;
#else
- int pwd = 1;
+ int pwd = 1;
#endif
- static const char *month_name[] =
+ static const char *month_name[] =
{
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
- static const char *purpose = "\
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+ static const char *purpose = "\
This machine-generated source code contains\n\
information about the library build configuration\n";
@@ -175,22 +159,22 @@ information about the library build configuration\n";
*/
#ifdef H5_HAVE_GETPWUID
{
- size_t n;
- char *comma;
+ size_t n;
+ char *comma;
- if((pwd = HDgetpwuid(HDgetuid()))) {
- if((comma = HDstrchr(pwd->pw_gecos, ','))) {
- n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos));
- HDstrncpy(real_name, pwd->pw_gecos, n);
- real_name[n] = '\0';
- } /* end if */
+ if((pwd = HDgetpwuid(HDgetuid()))) {
+ if((comma = HDstrchr(pwd->pw_gecos, ','))) {
+ n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos));
+ HDstrncpy(real_name, pwd->pw_gecos, n);
+ real_name[n] = '\0';
+ } /* end if */
else {
- HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name));
- real_name[sizeof(real_name) - 1] = '\0';
- } /* end else */
- } /* end if */
+ HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name));
+ real_name[sizeof(real_name) - 1] = '\0';
+ } /* end else */
+ } /* end if */
else
- real_name[0] = '\0';
+ real_name[0] = '\0';
}
#else
real_name[0] = '\0';
@@ -201,7 +185,7 @@ information about the library build configuration\n";
*/
#ifdef H5_HAVE_GETHOSTNAME
if(HDgethostname(host_name, sizeof(host_name)) < 0)
- host_name[0] = '\0';
+ host_name[0] = '\0';
#else
host_name[0] = '\0';
#endif
@@ -209,54 +193,49 @@ information about the library build configuration\n";
/*
* The file header: warning, copyright notice, build information.
*/
- printf("/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n");
- HDputs(FileHeader); /*the copyright notice--see top of this file */
+ fprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n");
+ HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */
- printf(" *\n * Created:\t\t%s %2d, %4d\n",
- month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year);
+ fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n",
+ month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year);
if(pwd || real_name[0] || host_name[0]) {
- printf(" *\t\t\t");
- if(real_name[0])
- printf("%s <", real_name);
+ fprintf(rawoutstream, " *\t\t\t");
+ if(real_name[0])
+ fprintf(rawoutstream, "%s <", real_name);
#ifdef H5_HAVE_GETPWUID
- if(pwd)
- HDfputs(pwd->pw_name, stdout);
+ if(pwd)
+ HDfputs(pwd->pw_name, rawoutstream);
#endif
- if(host_name[0])
- printf("@%s", host_name);
- if(real_name[0])
- printf(">");
- HDputchar('\n');
+ if(host_name[0])
+ fprintf(rawoutstream, "@%s", host_name);
+ if(real_name[0])
+ fprintf(rawoutstream, ">");
+ HDfputc('\n', rawoutstream);
} /* end if */
- printf(" *\n * Purpose:\t\t");
+ fprintf(rawoutstream, " *\n * Purpose:\t\t");
for(s = purpose; *s; s++) {
- HDputchar(*s);
- if('\n' == *s && s[1])
- printf(" *\t\t\t");
+ HDfputc(*s, rawoutstream);
+ if('\n' == *s && s[1])
+ fprintf(rawoutstream, " *\t\t\t");
} /* end for */
- printf(" *\n * Modifications:\n *\n");
- printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n");
- printf(" *\tIt was generated by code in `H5make_libsettings.c'.\n");
+ fprintf(rawoutstream, " *\n * Modifications:\n *\n");
+ fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n");
+ fprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n");
- printf(" *\n *");
+ fprintf(rawoutstream, " *\n *");
for(i = 0; i < 73; i++)
- HDputchar('-');
- printf("\n */\n\n");
+ HDfputc('-', rawoutstream);
+ fprintf(rawoutstream, "\n */\n\n");
}
/*-------------------------------------------------------------------------
- * Function: print_footer
+ * Function: print_footer
*
- * Purpose: Prints the file footer for the generated file.
- *
- * Return: void
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Mar 31 2010
+ * Purpose: Prints the file footer for the generated file.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -267,22 +246,33 @@ print_footer(void)
/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Main entry point.
- *
- * Return: Success: exit(0)
+ * Function: main
*
- * Failure: exit(1)
- *
- * Programmer: Albert Cheng
- * 2010/4/1
+ * Purpose: Main entry point.
*
+ * Return: Success: EXIT_SUCCESS
*-------------------------------------------------------------------------
*/
int
-main(void)
+main(int argc, char *argv[])
{
+ char *fname = NULL;
+ FILE *f; /* temporary holding place for the stream pointer
+ * so that rawoutstream is changed only when succeeded
+ */
+
+ if(argc > 1)
+ fname = argv[1];
+
+ /* First check if filename is string "NULL" */
+ if(fname != NULL) {
+ /* binary output */
+ if((f = HDfopen(fname, "w")) != NULL)
+ rawoutstream = f;
+ }
+ if(!rawoutstream)
+ rawoutstream = stdout;
+
print_header();
/* Generate embedded library information variable definition */
@@ -290,5 +280,13 @@ main(void)
print_footer();
- HDexit(0);
+ if(rawoutstream && rawoutstream != stdout) {
+ if(HDfclose(rawoutstream))
+ fprintf(stderr, "closing rawoutstream");
+ else
+ rawoutstream = NULL;
+ }
+
+ HDexit(EXIT_SUCCESS);
}
+
diff --git a/src/H5private.h b/src/H5private.h
index 8974e46..b654bae 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -169,6 +169,9 @@
*/
#define H5_DEFAULT_VFD H5FD_SEC2
+/* Define the default VOL driver */
+#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 */
@@ -510,6 +513,11 @@
# define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1))
#endif
+/* Represents an empty asynchronous request handle.
+ * Used in the VOL code.
+ */
+#define H5_REQUEST_NULL NULL
+
/*
* A macro to portably decrement enumerated types.
*/
@@ -1704,6 +1712,7 @@ typedef enum {
H5_PKG_S, /* Dataspaces */
H5_PKG_T, /* Datatypes */
H5_PKG_V, /* Vector functions */
+ H5_PKG_VL, /* VOL functions */
H5_PKG_Z, /* Raw data filters */
H5_NPKGS /* Must be last */
} H5_pkg_t;
@@ -1992,7 +2001,6 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
H5_DLL herr_t H5CX_push(void);
H5_DLL herr_t H5CX_pop(void);
-
#ifndef NDEBUG
#define FUNC_ENTER_CHECK_NAME(asrt) \
{ \
@@ -2031,7 +2039,7 @@ H5_DLL herr_t H5CX_pop(void);
/* Local variables for API routines */
#define FUNC_ENTER_API_VARS \
MPE_LOG_VARS \
- H5TRACE_DECL \
+ H5TRACE_DECL
#define FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_VARS \
@@ -2078,10 +2086,11 @@ H5_DLL herr_t H5CX_pop(void);
/*
* Use this macro for API functions that shouldn't perform _any_ initialization
* of the library or an interface, just perform tracing, etc. Examples
- * are: H5allocate_memory, H5is_library_threadsafe, etc.
+ * are: H5allocate_memory, H5is_library_threadsafe, public VOL callback
+ * wrappers (e.g. H5VLfile_create, H5VLdataset_read, etc.), etc.
*
*/
-#define FUNC_ENTER_API_NOINIT {{ \
+#define FUNC_ENTER_API_NOINIT {{{ \
FUNC_ENTER_API_COMMON \
H5_PUSH_FUNC \
BEGIN_MPE_LOG \
@@ -2094,7 +2103,7 @@ H5_DLL herr_t H5CX_pop(void);
* are: H5close, H5check_version, etc.
*
*/
-#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \
+#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{{{ \
FUNC_ENTER_API_VARS \
FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
FUNC_ENTER_API_THREADSAFE; \
@@ -2199,12 +2208,6 @@ H5_DLL herr_t H5CX_pop(void);
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use this macro for all package-level functions that are VOL entry-points */
-#define FUNC_ENTER_PACKAGE_VOL { \
- 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)); \
@@ -2221,29 +2224,12 @@ H5_DLL herr_t H5CX_pop(void);
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use the following macro as replacement for the FUNC_ENTER_PACKAGE
- * macro when the function needs to set up a metadata tag and is also a
- * VOL entry-point. */
-#define FUNC_ENTER_PACKAGE_VOL_TAG(tag) { \
- haddr_t prev_tag = HADDR_UNDEF; \
- \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
- H5AC_tag(tag, &prev_tag); \
- H5_PUSH_FUNC \
- if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-
/* Use this macro for all "normal" staticly-scoped functions */
#define FUNC_ENTER_STATIC { \
FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use this macro for all "normal" staticly-scoped functions that are VOL entry-points */
-#define FUNC_ENTER_STATIC_VOL { \
- 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)); \
@@ -2266,17 +2252,6 @@ H5_DLL herr_t H5CX_pop(void);
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use the following macro as replacement for the FUNC_ENTER_STATIC
- * macro when the function needs to set up a metadata tag and is a VOL
- * entry-point. */
-#define FUNC_ENTER_STATIC_VOL_TAG(tag) { \
- haddr_t prev_tag = HADDR_UNDEF; \
- \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
- H5AC_tag(tag, &prev_tag); \
- H5_PUSH_FUNC \
- if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-
/*-------------------------------------------------------------------------
* Purpose: Register function exit for code profiling. This should be
@@ -2315,14 +2290,14 @@ H5_DLL herr_t H5CX_pop(void);
(void)H5E_dump_api_stack(TRUE); \
FUNC_LEAVE_API_THREADSAFE \
return(ret_value); \
-}} /*end scope from beginning of FUNC_ENTER*/
+}}} /*end scope from beginning of FUNC_ENTER*/
/* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */
#define FUNC_LEAVE_API_NOFS(ret_value) \
FUNC_LEAVE_API_COMMON(ret_value); \
FUNC_LEAVE_API_THREADSAFE \
return(ret_value); \
-}} /*end scope from beginning of FUNC_ENTER*/
+}}}} /*end scope from beginning of FUNC_ENTER*/
#define FUNC_LEAVE_NOAPI(ret_value) \
; \
@@ -2331,13 +2306,6 @@ H5_DLL herr_t H5CX_pop(void);
return(ret_value); \
} /*end scope from beginning of FUNC_ENTER*/
-#define FUNC_LEAVE_NOAPI_VOL(ret_value) \
- ; \
- } /*end scope from end of FUNC_ENTER*/ \
- H5_POP_FUNC \
- return(ret_value); \
-} /*end scope from beginning of FUNC_ENTER*/
-
#define FUNC_LEAVE_NOAPI_VOID \
; \
} /*end scope from end of FUNC_ENTER*/ \
@@ -2365,15 +2333,6 @@ H5_DLL herr_t H5CX_pop(void);
return(ret_value); \
} /*end scope from beginning of FUNC_ENTER*/
-/* Use this macro when exiting a VOL entry-point function that set up a metadata tag */
-#define FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) \
- ; \
- } /*end scope from end of FUNC_ENTER*/ \
- H5AC_tag(prev_tag, NULL); \
- H5_POP_FUNC \
- return(ret_value); \
-} /*end scope from beginning of FUNC_ENTER*/
-
/****************************************/
/* Revisions to FUNC_ENTER/LEAVE Macros */
@@ -2671,6 +2630,7 @@ H5_DLL int H5S_top_term_package(void);
H5_DLL int H5SL_term_package(void);
H5_DLL int H5T_term_package(void);
H5_DLL int H5T_top_term_package(void);
+H5_DLL int H5VL_term_package(void);
H5_DLL int H5Z_term_package(void);
/* Checksum functions */
diff --git a/src/H5public.h b/src/H5public.h
index a4c80cd..353ff16 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -93,10 +93,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 11 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 2 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 4 /* 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.11.2" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.11.4" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5system.c b/src/H5system.c
index 186d8fa..2d29650 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -294,13 +294,13 @@ HDfprintf(FILE *stream, const char *fmt, ...)
unsigned short x = (unsigned short)va_arg(ap, unsigned int);
n = fprintf(stream, format_templ, x);
} else if(!*modifier) {
- unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occurring */
+ unsigned int x = va_arg(ap, unsigned int);
n = fprintf(stream, format_templ, x);
} else if(!HDstrcmp(modifier, "l")) {
- unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occurring */
+ unsigned long x = va_arg(ap, unsigned long);
n = fprintf(stream, format_templ, x);
} else {
- uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occurring */
+ uint64_t x = va_arg(ap, uint64_t);
n = fprintf(stream, format_templ, x);
}
break;
@@ -333,7 +333,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'a':
{
- haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occurring */
+ haddr_t x = va_arg(ap, haddr_t);
if(H5F_addr_defined(x)) {
len = 0;
@@ -387,7 +387,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 's':
case 'p':
{
- char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occurring */
+ char *x = va_arg(ap, char*);
n = fprintf(stream, format_templ, x);
}
break;
diff --git a/src/H5trace.c b/src/H5trace.c
index eef268c..a628da3 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -36,6 +36,7 @@
#include "H5FDprivate.h" /* File drivers */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
+#include "H5VLprivate.h" /* Virtual Object Layer */
#ifdef H5_HAVE_PARALLEL
/* datatypes of predefined drivers needed by H5_trace() */
@@ -813,6 +814,37 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end else */
break;
+ case 's':
+ if(ptr) {
+ if(vp)
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5ES_status_t status = (H5ES_status_t)va_arg(ap, int);
+
+ switch(status) {
+ case H5ES_STATUS_IN_PROGRESS:
+ HDfprintf(out, "H5ES_STATUS_IN_PROGRESS");
+ break;
+ case H5ES_STATUS_SUCCEED:
+ HDfprintf(out, "H5ES_STATUS_SUCCEED");
+ break;
+ case H5ES_STATUS_FAIL:
+ HDfprintf(out, "H5ES_STATUS_FAIL");
+ break;
+ case H5ES_STATUS_CANCELED:
+ HDfprintf(out, "H5ES_STATUS_CANCELED");
+ break;
+
+ default:
+ HDfprintf(out, "%ld", (long)status);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
case 't':
if(ptr) {
if(vp)
@@ -1331,6 +1363,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "%ld (file driver)", (long)obj);
break;
+ case H5I_VOL:
+ HDfprintf(out, "%ld (VOL plugin)", (long)obj);
+ break;
+
case H5I_GENPROP_CLS:
HDfprintf(out, "%ld (genprop class)", (long)obj);
break;
@@ -1512,6 +1548,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "H5I_VFL");
break;
+ case H5I_VOL:
+ HDfprintf(out, "H5I_VOL");
+ break;
+
case H5I_GENPROP_CLS:
HDfprintf(out, "H5I_GENPROP_CLS");
break;
@@ -2466,6 +2506,491 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
break;
+ case 'V':
+ switch(type[1]) {
+ case 'a':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_attr_get_t get = (H5VL_attr_get_t)va_arg(ap, int);
+
+ switch(get) {
+ case H5VL_ATTR_GET_SPACE:
+ HDfprintf(out, "H5VL_ATTR_GET_SPACE");
+ break;
+ case H5VL_ATTR_GET_TYPE:
+ HDfprintf(out, "H5VL_ATTR_GET_TYPE");
+ break;
+ case H5VL_ATTR_GET_ACPL:
+ HDfprintf(out, "H5VL_ATTR_GET_ACPL");
+ break;
+ case H5VL_ATTR_GET_NAME:
+ HDfprintf(out, "H5VL_ATTR_GET_NAME");
+ break;
+ case H5VL_ATTR_GET_STORAGE_SIZE:
+ HDfprintf(out, "H5VL_ATTR_GET_STORAGE_SIZE");
+ break;
+ case H5VL_ATTR_GET_INFO:
+ HDfprintf(out, "H5VL_ATTR_GET_INFO");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'b':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_attr_specific_t specific = (H5VL_attr_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_ATTR_DELETE:
+ HDfprintf(out, "H5VL_ATTR_DELETE");
+ break;
+ case H5VL_ATTR_EXISTS:
+ HDfprintf(out, "H5VL_ATTR_EXISTS");
+ break;
+ case H5VL_ATTR_ITER:
+ HDfprintf(out, "H5VL_ATTR_ITER");
+ break;
+ case H5VL_ATTR_RENAME:
+ HDfprintf(out, "H5VL_ATTR_RENAME");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'C':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_class_value_t class_val = (H5VL_class_value_t)va_arg(ap, H5VL_class_value_t);
+
+ if(H5_VOL_NATIVE == class_val)
+ HDfprintf(out, "H5_VOL_NATIVE");
+ else
+ HDfprintf(out, "%ld", (long)class_val);
+ } /* end else */
+ break;
+ case 'c':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_dataset_get_t get = (H5VL_dataset_get_t)va_arg(ap, int);
+
+ switch(get) {
+ case H5VL_DATASET_GET_SPACE:
+ HDfprintf(out, "H5VL_DATASET_GET_SPACE");
+ break;
+ case H5VL_DATASET_GET_SPACE_STATUS:
+ HDfprintf(out, "H5VL_DATASET_GET_SPACE_STATUS");
+ break;
+ case H5VL_DATASET_GET_TYPE:
+ HDfprintf(out, "H5VL_DATASET_GET_TYPE");
+ break;
+ case H5VL_DATASET_GET_DCPL:
+ HDfprintf(out, "H5VL_DATASET_GET_DCPL");
+ break;
+ case H5VL_DATASET_GET_DAPL:
+ HDfprintf(out, "H5VL_DATASET_GET_DAPL");
+ break;
+ case H5VL_DATASET_GET_STORAGE_SIZE:
+ HDfprintf(out, "H5VL_DATASET_GET_STORAGE_SIZE");
+ break;
+ case H5VL_DATASET_GET_OFFSET:
+ HDfprintf(out, "H5VL_DATASET_GET_OFFSET");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'd':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_DATASET_SET_EXTENT:
+ HDfprintf(out, "H5VL_DATASET_SET_EXTENT");
+ break;
+ case H5VL_DATASET_FLUSH:
+ HDfprintf(out, "H5VL_DATASET_FLUSH");
+ break;
+ case H5VL_DATASET_REFRESH:
+ HDfprintf(out, "H5VL_DATASET_REFRESH");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'e':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_datatype_get_t get = (H5VL_datatype_get_t)va_arg(ap, int);
+
+ switch(get) {
+ case H5VL_DATATYPE_GET_BINARY:
+ HDfprintf(out, "H5VL_DATATYPE_GET_BINARY");
+ break;
+ case H5VL_DATATYPE_GET_TCPL:
+ HDfprintf(out, "H5VL_DATATYPE_GET_TCPL");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'f':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_DATATYPE_FLUSH:
+ HDfprintf(out, "H5VL_DATATYPE_FLUSH");
+ break;
+ case H5VL_DATATYPE_REFRESH:
+ HDfprintf(out, "H5VL_DATATYPE_REFRESH");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'g':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_file_get_t get = (H5VL_file_get_t)va_arg(ap, int);
+
+ switch(get) {
+ case H5VL_FILE_GET_FAPL:
+ HDfprintf(out, "H5VL_FILE_GET_FAPL");
+ break;
+ case H5VL_FILE_GET_FCPL:
+ HDfprintf(out, "H5VL_FILE_GET_FCPL");
+ break;
+ case H5VL_FILE_GET_INTENT:
+ HDfprintf(out, "H5VL_FILE_GET_INTENT");
+ break;
+ case H5VL_FILE_GET_NAME:
+ HDfprintf(out, "H5VL_FILE_GET_NAME");
+ break;
+ case H5VL_FILE_GET_OBJ_COUNT:
+ HDfprintf(out, "H5VL_FILE_GET_OBJ_COUNT");
+ break;
+ case H5VL_FILE_GET_OBJ_IDS:
+ HDfprintf(out, "H5VL_FILE_GET_OBJ_IDS");
+ break;
+ case H5VL_FILE_GET_MIN_DSET_OHDR_FLAG:
+ HDfprintf(out, "H5VL_FILE_GET_MIN_DSET_OHDR_FLAG");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'h':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_file_specific_t specific = (H5VL_file_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_FILE_FLUSH:
+ HDfprintf(out, "H5VL_FILE_FLUSH");
+ break;
+ case H5VL_FILE_REOPEN:
+ HDfprintf(out, "H5VL_FILE_REOPEN");
+ break;
+ case H5VL_FILE_MOUNT:
+ HDfprintf(out, "H5VL_FILE_MOUNT");
+ break;
+ case H5VL_FILE_UNMOUNT:
+ HDfprintf(out, "H5VL_FILE_UNMOUNT");
+ break;
+ case H5VL_FILE_IS_ACCESSIBLE:
+ HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE");
+ break;
+ case H5VL_FILE_CACHE_VOL_CONN:
+ HDfprintf(out, "H5VL_FILE_CACHE_VOL_CONN");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'i':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_group_get_t get = (H5VL_group_get_t)va_arg(ap, int);
+
+ switch(get) {
+ case H5VL_GROUP_GET_GCPL:
+ HDfprintf(out, "H5VL_GROUP_GET_GCPL");
+ break;
+ case H5VL_GROUP_GET_INFO:
+ HDfprintf(out, "H5VL_GROUP_GET_INFO");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'j':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_group_specific_t specific = (H5VL_group_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_GROUP_FLUSH:
+ HDfprintf(out, "H5VL_GROUP_FLUSH");
+ break;
+ case H5VL_GROUP_REFRESH:
+ HDfprintf(out, "H5VL_GROUP_REFRESH");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'k':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_link_create_type_t create = (H5VL_link_create_type_t)va_arg(ap, int);
+
+ switch(create) {
+ case H5VL_LINK_CREATE_HARD:
+ HDfprintf(out, "H5VL_LINK_CREATE_HARD");
+ break;
+ case H5VL_LINK_CREATE_SOFT:
+ HDfprintf(out, "H5VL_LINK_CREATE_SOFT");
+ break;
+ case H5VL_LINK_CREATE_UD:
+ HDfprintf(out, "H5VL_LINK_CREATE_UD");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)create);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'l':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_link_get_t get = (H5VL_link_get_t)va_arg(ap, int);
+
+ switch(get) {
+ case H5VL_LINK_GET_INFO:
+ HDfprintf(out, "H5VL_LINK_GET_INFO");
+ break;
+ case H5VL_LINK_GET_NAME:
+ HDfprintf(out, "H5VL_LINK_GET_NAME");
+ break;
+ case H5VL_LINK_GET_VAL:
+ HDfprintf(out, "H5VL_LINK_GET_VAL");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'm':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_link_specific_t specific = (H5VL_link_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_LINK_DELETE:
+ HDfprintf(out, "H5VL_LINK_DELETE");
+ break;
+ case H5VL_LINK_EXISTS:
+ HDfprintf(out, "H5VL_LINK_EXISTS");
+ break;
+ case H5VL_LINK_ITER:
+ HDfprintf(out, "H5VL_LINK_ITER");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'n':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_object_get_t get = (H5VL_object_get_t)va_arg(ap, int);
+
+ switch(get) {
+ case H5VL_REF_GET_REGION:
+ HDfprintf(out, "H5VL_REF_GET_REGION");
+ break;
+ case H5VL_REF_GET_TYPE:
+ HDfprintf(out, "H5VL_REF_GET_TYPE");
+ break;
+ case H5VL_REF_GET_NAME:
+ HDfprintf(out, "H5VL_REF_GET_NAME");
+ break;
+ case H5VL_ID_GET_NAME:
+ HDfprintf(out, "H5VL_ID_GET_NAME");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'o':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_object_specific_t specific = (H5VL_object_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_OBJECT_CHANGE_REF_COUNT:
+ HDfprintf(out, "H5VL_OBJECT_CHANGE_REF_COUNT");
+ break;
+ case H5VL_OBJECT_EXISTS:
+ HDfprintf(out, "H5VL_OBJECT_EXISTS");
+ break;
+ case H5VL_OBJECT_VISIT:
+ HDfprintf(out, "H5VL_OBJECT_VISIT");
+ break;
+ case H5VL_REF_CREATE:
+ HDfprintf(out, "H5VL_REF_CREATE");
+ break;
+ case H5VL_OBJECT_FLUSH:
+ HDfprintf(out, "H5VL_OBJECT_FLUSH");
+ break;
+ case H5VL_OBJECT_REFRESH:
+ HDfprintf(out, "H5VL_OBJECT_REFRESH");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ case 'r':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_request_specific_t specific = (H5VL_request_specific_t)va_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_REQUEST_WAITANY:
+ HDfprintf(out, "H5VL_REQUEST_WAITANY");
+ break;
+ case H5VL_REQUEST_WAITSOME:
+ HDfprintf(out, "H5VL_REQUEST_WAITSOME");
+ break;
+ case H5VL_REQUEST_WAITALL:
+ HDfprintf(out, "H5VL_REQUEST_WAITALL");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+ default:
+ HDfprintf(out, "BADTYPE(Z%c)", type[1]);
+ goto error;
+ } /* end switch */
+ break;
+
case 'x':
if(ptr) {
if(vp) {
diff --git a/src/Makefile.am b/src/Makefile.am
index a0defad..69b51b2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,7 +113,9 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \
H5Topaque.c \
H5Torder.c \
- H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \
+ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \
+ H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c H5VLpassthru.c \
+ H5VM.c H5WB.c H5Z.c \
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \
H5Zscaleoffset.c H5Zszip.c H5Ztrans.c
@@ -131,15 +133,15 @@ endif
include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \
H5Apublic.h H5ACpublic.h \
H5Cpublic.h H5Dpublic.h \
- H5Epubgen.h H5Epublic.h H5Fpublic.h \
+ H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \
H5FDpublic.h H5FDcore.h H5FDdirect.h \
H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
- H5FDmulti.h H5FDsec2.h H5FDstdio.h \
+ H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
- H5Rpublic.h H5Spublic.h \
- H5Tpublic.h H5Zpublic.h
+ H5Rpublic.h H5Spublic.h H5Tpublic.h \
+ H5VLnative.h H5VLpassthru.h H5VLpublic.h H5Zpublic.h
# install libhdf5.settings in lib directory
settingsdir=$(libdir)
@@ -153,7 +155,7 @@ settings_DATA=libhdf5.settings
H5Tinit.c: H5detect$(EXEEXT)
LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \
sed -e 's/-L/:/g' -e 's/ //g'`" \
- $(RUNSERIAL) ./H5detect$(EXEEXT) > $@ || \
+ $(RUNSERIAL) ./H5detect$(EXEEXT) $@ || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
($(RM) $@ ; exit 1)
@@ -165,7 +167,7 @@ H5Tinit.c: H5detect$(EXEEXT)
H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings
LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \
sed -e 's/-L/:/g' -e 's/ //g'`" \
- $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@ || \
+ $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) $@ || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
($(RM) $@ ; exit 1)
diff --git a/src/hdf5.h b/src/hdf5.h
index 1709375..c12037f 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -36,6 +36,7 @@
#include "H5Rpublic.h" /* References */
#include "H5Spublic.h" /* Dataspaces */
#include "H5Tpublic.h" /* Datatypes */
+#include "H5VLpublic.h" /* Virtual Object Layer */
#include "H5Zpublic.h" /* Data filters */
/* Predefined file drivers */
@@ -51,4 +52,8 @@
#include "H5FDwindows.h" /* Win32 I/O */
#endif
+/* Virtual object layer (VOL) connectors */
+#include "H5VLnative.h" /* Native VOL connector */
+#include "H5VLpassthru.h" /* Pass-through VOL connector */
+
#endif