summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/H5A.c79
-rw-r--r--src/H5ACmpio.c2
-rw-r--r--src/H5Adeprec.c31
-rw-r--r--src/H5Aint.c33
-rw-r--r--src/H5Aprivate.h1
-rw-r--r--src/H5B.c4
-rw-r--r--src/H5B2cache.c13
-rw-r--r--src/H5B2dbg.c6
-rw-r--r--src/H5B2int.c14
-rw-r--r--src/H5B2internal.c4
-rw-r--r--src/H5B2leaf.c5
-rw-r--r--src/H5C.c10
-rw-r--r--src/H5CS.c6
-rw-r--r--src/H5CX.c226
-rw-r--r--src/H5CXprivate.h8
-rw-r--r--src/H5Cdbg.c5
-rw-r--r--src/H5Clog_json.c2
-rw-r--r--src/H5Cmpio.c37
-rw-r--r--src/H5Cpkg.h4
-rw-r--r--src/H5Ctest.c19
-rw-r--r--src/H5D.c190
-rw-r--r--src/H5Dbtree.c4
-rw-r--r--src/H5Dchunk.c1429
-rw-r--r--src/H5Dcompact.c18
-rw-r--r--src/H5Dcontig.c11
-rw-r--r--src/H5Ddeprec.c71
-rw-r--r--src/H5Dfill.c5
-rw-r--r--src/H5Dint.c456
-rw-r--r--src/H5Dio.c84
-rw-r--r--src/H5Dmpio.c36
-rw-r--r--src/H5Dnone.c2
-rw-r--r--src/H5Dpkg.h15
-rw-r--r--src/H5Dprivate.h3
-rw-r--r--src/H5Dpublic.h2
-rw-r--r--src/H5Dsingle.c2
-rw-r--r--src/H5Dvirtual.c10
-rw-r--r--src/H5EAcache.c16
-rw-r--r--src/H5EAtest.c2
-rw-r--r--src/H5Eint.c17
-rw-r--r--src/H5Epkg.h2
-rw-r--r--src/H5Epublic.h8
-rw-r--r--src/H5F.c150
-rw-r--r--src/H5FAcache.c12
-rw-r--r--src/H5FD.c34
-rw-r--r--src/H5FDcore.c12
-rw-r--r--src/H5FDdirect.c16
-rw-r--r--src/H5FDfamily.c10
-rw-r--r--src/H5FDhdfs.c22
-rw-r--r--src/H5FDlog.c10
-rw-r--r--src/H5FDmpio.c37
-rw-r--r--src/H5FDmulti.c5
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDs3comms.c4
-rw-r--r--src/H5FDsec2.c14
-rw-r--r--src/H5FS.c3
-rw-r--r--src/H5FScache.c61
-rw-r--r--src/H5FSprivate.h2
-rw-r--r--src/H5Fdeprec.c10
-rw-r--r--src/H5Fefc.c12
-rw-r--r--src/H5Fint.c210
-rw-r--r--src/H5Fmount.c2
-rw-r--r--src/H5Fmpi.c12
-rw-r--r--src/H5Fpkg.h9
-rw-r--r--src/H5Fprivate.h46
-rw-r--r--src/H5Fquery.c83
-rw-r--r--src/H5Fsuper.c2
-rw-r--r--src/H5Fsuper_cache.c24
-rw-r--r--src/H5G.c40
-rw-r--r--src/H5Gdeprec.c156
-rw-r--r--src/H5Gint.c16
-rw-r--r--src/H5Glink.c9
-rw-r--r--src/H5Gloc.c187
-rw-r--r--src/H5Gname.c70
-rw-r--r--src/H5Gnode.c12
-rw-r--r--src/H5Gobj.c2
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Gprivate.h11
-rw-r--r--src/H5Gtraverse.c6
-rw-r--r--src/H5HFcache.c18
-rw-r--r--src/H5HFsection.c12
-rw-r--r--src/H5HFspace.c2
-rw-r--r--src/H5HFtest.c2
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5HGcache.c4
-rw-r--r--src/H5HGprivate.h6
-rw-r--r--src/H5HLcache.c12
-rw-r--r--src/H5I.c23
-rw-r--r--src/H5Itest.c4
-rw-r--r--src/H5L.c212
-rw-r--r--src/H5Ldeprec.c628
-rw-r--r--src/H5Lexternal.c15
-rw-r--r--src/H5Lprivate.h11
-rw-r--r--src/H5Lpublic.h124
-rw-r--r--src/H5M.c73
-rw-r--r--src/H5MF.c50
-rw-r--r--src/H5MFdbg.c6
-rw-r--r--src/H5MM.c25
-rw-r--r--src/H5MMprivate.h1
-rw-r--r--src/H5Mprivate.h1
-rw-r--r--src/H5Mpublic.h3
-rw-r--r--src/H5O.c504
-rw-r--r--src/H5Oainfo.c8
-rw-r--r--src/H5Oalloc.c2
-rw-r--r--src/H5Oattr.c4
-rw-r--r--src/H5Oattribute.c26
-rw-r--r--src/H5Ocache.c6
-rw-r--r--src/H5Ocopy.c209
-rw-r--r--src/H5Ocopy_ref.c499
-rw-r--r--src/H5Odbg.c4
-rw-r--r--src/H5Odeprec.c729
-rw-r--r--src/H5Odtype.c70
-rw-r--r--src/H5Ofill.c6
-rw-r--r--src/H5Oflush.c4
-rw-r--r--src/H5Ofsinfo.c14
-rw-r--r--src/H5Oginfo.c4
-rw-r--r--src/H5Oint.c278
-rw-r--r--src/H5Olayout.c2
-rw-r--r--src/H5Olinfo.c2
-rw-r--r--src/H5Olink.c2
-rw-r--r--src/H5Omessage.c9
-rw-r--r--src/H5Opkg.h4
-rw-r--r--src/H5Oprivate.h10
-rw-r--r--src/H5Opublic.h139
-rw-r--r--src/H5Osdspace.c2
-rw-r--r--src/H5Oshared.c4
-rw-r--r--src/H5Oshared.h2
-rw-r--r--src/H5PL.c32
-rw-r--r--src/H5PLint.c5
-rw-r--r--src/H5PLpath.c64
-rw-r--r--src/H5PLplugin_cache.c5
-rw-r--r--src/H5Pdcpl.c70
-rw-r--r--src/H5Pdxpl.c4
-rw-r--r--src/H5Pfapl.c35
-rw-r--r--src/H5Pint.c53
-rw-r--r--src/H5Plapl.c66
-rw-r--r--src/H5Pmapl.c3
-rw-r--r--src/H5Pprivate.h1
-rw-r--r--src/H5Ppublic.h4
-rw-r--r--src/H5R.c1005
-rw-r--r--src/H5Rdeprec.c516
-rw-r--r--src/H5Rint.c1984
-rw-r--r--src/H5Rpkg.h80
-rw-r--r--src/H5Rprivate.h2
-rw-r--r--src/H5Rpublic.h115
-rw-r--r--src/H5S.c5
-rw-r--r--src/H5SL.c2
-rw-r--r--src/H5SMcache.c14
-rw-r--r--src/H5SMmessage.c2
-rw-r--r--src/H5Sall.c33
-rw-r--r--src/H5Shyper.c387
-rw-r--r--src/H5Smpio.c243
-rw-r--r--src/H5Snone.c33
-rw-r--r--src/H5Spkg.h41
-rw-r--r--src/H5Spoint.c122
-rw-r--r--src/H5Sprivate.h9
-rw-r--r--src/H5Spublic.h5
-rw-r--r--src/H5Sselect.c336
-rw-r--r--src/H5T.c686
-rw-r--r--src/H5TS.c112
-rw-r--r--src/H5TSprivate.h10
-rw-r--r--src/H5Tbit.c4
-rw-r--r--src/H5Tcommit.c28
-rw-r--r--src/H5Tcompound.c87
-rw-r--r--src/H5Tconv.c363
-rw-r--r--src/H5Tdeprec.c9
-rw-r--r--src/H5Tnative.c42
-rw-r--r--src/H5Tpkg.h136
-rw-r--r--src/H5Tprivate.h19
-rw-r--r--src/H5Tpublic.h5
-rw-r--r--src/H5Tref.c1218
-rw-r--r--src/H5Tvlen.c892
-rw-r--r--src/H5VL.c281
-rw-r--r--src/H5VLcallback.c2364
-rw-r--r--src/H5VLconnector.h212
-rw-r--r--src/H5VLconnector_passthru.h51
-rw-r--r--src/H5VLint.c472
-rw-r--r--src/H5VLnative.c393
-rw-r--r--src/H5VLnative.h132
-rw-r--r--src/H5VLnative_attr.c9
-rw-r--r--src/H5VLnative_blob.c242
-rw-r--r--src/H5VLnative_dataset.c25
-rw-r--r--src/H5VLnative_file.c149
-rw-r--r--src/H5VLnative_group.c7
-rw-r--r--src/H5VLnative_introspect.c52
-rw-r--r--src/H5VLnative_link.c24
-rw-r--r--src/H5VLnative_object.c333
-rw-r--r--src/H5VLnative_private.h69
-rw-r--r--src/H5VLnative_token.c157
-rw-r--r--src/H5VLpassthru.c618
-rw-r--r--src/H5VLpassthru.h3
-rw-r--r--src/H5VLpkg.h9
-rw-r--r--src/H5VLprivate.h64
-rw-r--r--src/H5VLpublic.h34
-rw-r--r--src/H5Z.c7
-rw-r--r--src/H5Znbit.c4
-rw-r--r--src/H5detect.c19
-rw-r--r--src/H5mpi.c167
-rw-r--r--src/H5overflow.txt2
-rw-r--r--src/H5private.h161
-rw-r--r--src/H5public.h52
-rw-r--r--src/H5system.c37
-rw-r--r--src/H5trace.c565
-rw-r--r--src/H5vers.txt29
-rw-r--r--src/H5win32defs.h10
-rw-r--r--src/Makefile.am84
-rw-r--r--src/hdf5-lin.lnt3
-rw-r--r--src/hdf5.lnt7
208 files changed, 17611 insertions, 6115 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6df8af3..070cf62 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -254,7 +254,7 @@ set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDmulti.h
${HDF5_SRC_DIR}/H5FDpublic.h
${HDF5_SRC_DIR}/H5FDros3.h
- ${HDF5_SRC_DIR}/H5FDs3comms.c
+ ${HDF5_SRC_DIR}/H5FDs3comms.h
${HDF5_SRC_DIR}/H5FDsec2.h
${HDF5_SRC_DIR}/H5FDstdio.h
${HDF5_SRC_DIR}/H5FDwindows.h
@@ -386,6 +386,7 @@ IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" )
set (H5L_SOURCES
${HDF5_SRC_DIR}/H5L.c
+ ${HDF5_SRC_DIR}/H5Ldeprec.c
${HDF5_SRC_DIR}/H5Lexternal.c
)
set (H5L_HDRS
@@ -446,6 +447,7 @@ set (H5O_SOURCES
${HDF5_SRC_DIR}/H5Ochunk.c
${HDF5_SRC_DIR}/H5Ocont.c
${HDF5_SRC_DIR}/H5Ocopy.c
+ ${HDF5_SRC_DIR}/H5Ocopy_ref.c
${HDF5_SRC_DIR}/H5Odbg.c
${HDF5_SRC_DIR}/H5Odeprec.c
${HDF5_SRC_DIR}/H5Odrvinfo.c
@@ -616,6 +618,7 @@ set (H5T_SOURCES
${HDF5_SRC_DIR}/H5Torder.c
${HDF5_SRC_DIR}/H5Tpad.c
${HDF5_SRC_DIR}/H5Tprecis.c
+ ${HDF5_SRC_DIR}/H5Tref.c
${HDF5_SRC_DIR}/H5Tstrpad.c
${HDF5_SRC_DIR}/H5Tvisit.c
${HDF5_SRC_DIR}/H5Tvlen.c
@@ -649,12 +652,15 @@ set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VLint.c
${HDF5_SRC_DIR}/H5VLnative.c
${HDF5_SRC_DIR}/H5VLnative_attr.c
+ ${HDF5_SRC_DIR}/H5VLnative_blob.c
${HDF5_SRC_DIR}/H5VLnative_dataset.c
${HDF5_SRC_DIR}/H5VLnative_datatype.c
${HDF5_SRC_DIR}/H5VLnative_file.c
${HDF5_SRC_DIR}/H5VLnative_group.c
${HDF5_SRC_DIR}/H5VLnative_link.c
+ ${HDF5_SRC_DIR}/H5VLnative_introspect.c
${HDF5_SRC_DIR}/H5VLnative_object.c
+ ${HDF5_SRC_DIR}/H5VLnative_token.c
${HDF5_SRC_DIR}/H5VLpassthru.c
)
set (H5VL_HDRS
diff --git a/src/H5A.c b/src/H5A.c
index abf8694..f99fb7d 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -100,6 +100,29 @@ static hbool_t H5A_top_package_initialize_s = FALSE;
+/*-------------------------------------------------------------------------
+ * Function: H5A_init
+ *
+ * Purpose: Initialize the interface from some other layer.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5A_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 H5A_init() */
+
+
/*--------------------------------------------------------------------------
NAME
H5A__init_package -- Initialize interface-specific information
@@ -253,7 +276,7 @@ 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)
{
void *attr = NULL; /* Attribute created */
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -337,8 +360,8 @@ 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)
{
- void *attr = NULL; /* attr token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -360,13 +383,9 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* 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")
-
- if(H5P_DEFAULT != lapl_id) {
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID")
- H5CX_set_lapl(lapl_id);
- }
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info")
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info")
/* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
@@ -418,8 +437,8 @@ done:
hid_t
H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
{
- void *attr = NULL; /* attr token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID;
@@ -489,8 +508,8 @@ 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)
{
- void *attr = NULL; /* attr token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID;
@@ -507,16 +526,9 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_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, 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, H5I_INVALID_HID, "not link access property list ID")
- H5CX_set_lapl(lapl_id);
- }
- else
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info")
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info")
/* Fill in location struct fields */
loc_params.type = H5VL_OBJECT_BY_NAME;
@@ -575,7 +587,7 @@ 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)
{
void *attr = NULL; /* Attribute opened */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -595,16 +607,9 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* 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, 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, H5I_INVALID_HID, "not link access property list ID")
- H5CX_set_lapl(lapl_id);
- }
- else
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info")
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info")
/* Fill in location struct parameters */
loc_params.type = H5VL_OBJECT_BY_IDX;
@@ -1323,7 +1328,7 @@ 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_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
@@ -1402,7 +1407,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index e4b81fa..fadde28 100644
--- a/src/H5ACmpio.c
+++ b/src/H5ACmpio.c
@@ -498,7 +498,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr,
+H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUSED *aux_ptr,
int sync_point_op)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 8d0e33c..e0a0f55 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -116,8 +116,8 @@ hid_t
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t acpl_id)
{
- void *attr = NULL; /* attr token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ void *attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -147,7 +147,8 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_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, type_id, space_id, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id,
+ H5P_ATTRIBUTE_ACCESS_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 */
@@ -189,8 +190,8 @@ done:
hid_t
H5Aopen_name(hid_t loc_id, const char *name)
{
- void *attr = NULL; /* attr token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ void *attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -212,7 +213,8 @@ H5Aopen_name(hid_t loc_id, const char *name)
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)))
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_ATTRIBUTE_ACCESS_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 */
@@ -254,8 +256,8 @@ done:
hid_t
H5Aopen_idx(hid_t loc_id, unsigned idx)
{
- void *attr = NULL; /* attr token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ void *attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -280,7 +282,8 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
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)))
+ if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_ATTRIBUTE_ACCESS_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 */
@@ -318,9 +321,9 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
int ret_value = -1;
FUNC_ENTER_API((-1))
@@ -334,7 +337,7 @@ H5Aget_num_attrs(hid_t 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_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
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);
@@ -384,7 +387,7 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(H5_ITER_ERROR)
@@ -399,7 +402,7 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
/* Call attribute iteration routine */
- if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0)
+ if((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0)
HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
done:
diff --git a/src/H5Aint.c b/src/H5Aint.c
index c1c0078..1a74abe 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -181,8 +181,9 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "can't allocate shared attr structure")
- /* If the creation property list is H5P_DEFAULT, use the default character encoding */
- if(acpl_id == H5P_DEFAULT)
+ /* If the creation property list is H5P_ATTRIBUTE_CREATE_DEFAULT, use the default character encoding */
+ HDassert(acpl_id != H5P_DEFAULT);
+ if(acpl_id == H5P_ATTRIBUTE_CREATE_DEFAULT)
attr->shared->encoding = H5F_DEFAULT_CSET;
else {
H5P_genplist_t *ac_plist; /* ACPL Property list */
@@ -208,7 +209,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info")
/* Mark datatype as being on disk now */
- if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(attr->shared->dt, H5F_VOL_OBJ(loc->oloc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
/* Set the version for datatype */
@@ -223,7 +224,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace")
/* Copy the object header information */
- if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to copy entry")
/* Deep copy of the group hierarchy path */
@@ -389,7 +390,7 @@ H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path")
/* Deep copy of the symbol table entry */
- if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry")
/* Deep copy of the group hier. path */
@@ -908,7 +909,7 @@ H5A__get_type(H5A_t *attr)
* reopen the type before returning it to the user. Make the type
* read-only.
*/
- if (NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN)))
+ if (NULL == (dt = H5T_copy_reopen(attr->shared->dt)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy datatype")
/* Mark any datatypes as being in memory now */
@@ -2026,7 +2027,7 @@ H5A__set_version(const H5F_t *f, H5A_t *attr)
version = H5O_ATTR_VERSION_1; /* Write out basic version */
/* Upgrade to the version indicated by the file's low bound if higher */
- version = MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]);
+ version = (uint8_t)MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]);
/* Version bounds check */
if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)])
@@ -2062,7 +2063,7 @@ done:
*/
H5A_t *
H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size,
- H5O_copy_t *cpy_info)
+ H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info)
{
H5A_t *attr_dst = NULL; /* Destination attribute */
hid_t tid_src = -1; /* Datatype ID for source datatype */
@@ -2115,7 +2116,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "cannot copy datatype")
/* Set the location of the destination datatype */
- if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(attr_dst->shared->dt, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk")
if(!H5T_is_named(attr_src->shared->dt)) {
@@ -2270,7 +2271,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
H5MM_memcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
- if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data")
} /* end if */
else {
@@ -2401,17 +2402,9 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
/* Check for expanding references */
if(cpy_info->expand_ref) {
- size_t ref_count;
- size_t dst_dt_size; /* Destination datatype size */
-
- /* Determine size of the destination datatype */
- if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- /* Determine # of reference elements to copy */
- ref_count = attr_dst->shared->data_size / dst_dt_size;
-
/* Copy objects referenced in source buffer to destination file and set destination elements */
- if(H5O_copy_expand_ref(file_src, attr_dst->shared->data, file_dst, attr_dst->shared->data, ref_count, H5T_get_ref_type(attr_dst->shared->dt), cpy_info) < 0)
+ if(H5O_copy_expand_ref(file_src, H5I_INVALID_HID, attr_src->shared->dt,
+ attr_src->shared->data, attr_src->shared->data_size, file_dst, attr_dst->shared->data, cpy_info) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
} /* end if */
else
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h
index 342ffc8..b288228 100644
--- a/src/H5Aprivate.h
+++ b/src/H5Aprivate.h
@@ -73,6 +73,7 @@ typedef struct H5A_attr_iter_op_t {
/***************************************/
/* General attribute routines */
+H5_DLL herr_t H5A_init(void);
H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr);
H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr);
H5_DLL H5T_t *H5A_type(const H5A_t *attr);
diff --git a/src/H5B.c b/src/H5B.c
index 2a34fae..f909d90 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -2020,7 +2020,6 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr)
{
H5B_t *bt = NULL; /* The B-tree */
H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
htri_t ret_value = SUCCEED; /* Return value */
@@ -2038,8 +2037,7 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr)
/* Get shared info for B-tree */
if(NULL == (rc_shared = (type->get_shared)(f, NULL)))
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);
+ HDassert(H5UC_GET_OBJ(rc_shared) != NULL);
/*
* Load the tree node.
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 2a77bd5..80cb6c5 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -398,7 +398,8 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
*image++ = H5B2_HDR_VERSION;
/* B-tree type */
- *image++ = hdr->cls->id;
+ HDassert(hdr->cls->id <= 255);
+ *image++ = (uint8_t)hdr->cls->id;
/* Node size (in bytes) */
UINT32ENCODE(image, hdr->node_size);
@@ -653,6 +654,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
uint32_t stored_chksum; /* Stored metadata checksum value */
unsigned u; /* Local index variable */
H5B2_internal_t *ret_value = NULL; /* Return value */
+ int node_nrec = 0;
FUNC_ENTER_STATIC
@@ -715,7 +717,8 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
for(u = 0; u < (unsigned)(internal->nrec + 1); u++) {
/* Decode node pointer */
H5F_addr_decode(udata->f, (const uint8_t **)&image, &(int_node_ptr->addr));
- UINT64DECODE_VAR(image, int_node_ptr->node_nrec, udata->hdr->max_nrec_size);
+ UINT64DECODE_VAR(image, node_nrec, udata->hdr->max_nrec_size);
+ H5_CHECKED_ASSIGN(int_node_ptr->node_nrec, uint16_t, node_nrec, int);
if(udata->depth > 1)
UINT64DECODE_VAR(image, int_node_ptr->all_nrec, udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size)
else
@@ -818,7 +821,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
*image++ = H5B2_INT_VERSION;
/* B-tree type */
- *image++ = internal->hdr->cls->id;
+ HDassert(internal->hdr->cls->id <= 255);
+ *image++ = (uint8_t)internal->hdr->cls->id;
HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM));
/* Serialize records for internal node */
@@ -1219,7 +1223,8 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H
*image++ = H5B2_LEAF_VERSION;
/* B-tree type */
- *image++ = leaf->hdr->cls->id;
+ HDassert(leaf->hdr->cls->id <= 255);
+ *image++ = (uint8_t)leaf->hdr->cls->id;
HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM));
/* Serialize records for leaf node */
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index 0e3ebd5..b5b1c03 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -87,7 +87,7 @@
*/
herr_t
H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5B2_class_t *type, haddr_t obj_addr)
+ const H5B2_class_t H5_ATTR_NDEBUG_UNUSED *type, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
{
H5B2_hdr_t *hdr = NULL; /* B-tree header info */
unsigned u; /* Local index variable */
@@ -182,7 +182,7 @@ done:
*/
herr_t
H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t obj_addr)
+ const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
{
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_internal_t *internal = NULL; /* B-tree internal node */
@@ -294,7 +294,7 @@ done:
*/
herr_t
H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t obj_addr)
+ const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
{
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 2d77276..ea03ed6 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -239,7 +239,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
old_node_nrec = internal->node_ptrs[idx].node_nrec;
/* Determine "middle" record to promote to internal node */
- mid_record = old_node_nrec / 2;
+ mid_record = (uint16_t)(old_node_nrec / 2);
/* Copy "upper half" of records to new child */
H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0),
@@ -507,8 +507,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
if(*left_nrec < *right_nrec) {
/* Moving record from right node to left */
- uint16_t new_right_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for right child */
- uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */
+ uint16_t new_right_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for right child */
+ uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */
/* Copy record from parent node down into left child */
H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
@@ -558,8 +558,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
else {
/* Moving record from left node to right */
- uint16_t new_left_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for left child */
- uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */
+ uint16_t new_left_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for left child */
+ uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */
/* Sanity check */
HDassert(*left_nrec > *right_nrec);
@@ -762,8 +762,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
{
/* Compute new # of records in each node */
unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2);
- uint16_t new_middle_nrec = (uint16_t)(total_nrec - 2) / 3;
- uint16_t new_left_nrec = (uint16_t)((total_nrec - 2) - new_middle_nrec) / 2;
+ uint16_t new_middle_nrec = (uint16_t)((total_nrec - 2) / 3);
+ uint16_t new_left_nrec = (uint16_t)(((total_nrec - 2) - new_middle_nrec) / 2);
uint16_t new_right_nrec = (uint16_t)((total_nrec - 2) - (unsigned)(new_left_nrec + new_middle_nrec));
uint16_t curr_middle_nrec = *middle_nrec;
diff --git a/src/H5B2internal.c b/src/H5B2internal.c
index 7f6b80a..92c802e 100644
--- a/src/H5B2internal.c
+++ b/src/H5B2internal.c
@@ -1355,7 +1355,7 @@ done:
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal)
+H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
uint16_t u, v; /* Local index variables */
@@ -1396,7 +1396,7 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2)
+H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
uint16_t u, v; /* Local index variables */
diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c
index beca40c..c1221ba 100644
--- a/src/H5B2leaf.c
+++ b/src/H5B2leaf.c
@@ -1027,7 +1027,8 @@ done:
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf)
+H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr,
+ const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
@@ -1050,7 +1051,7 @@ H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf)
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
+H5B2__assert_leaf2(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf, const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
diff --git a/src/H5C.c b/src/H5C.c
index 3e0cf95..2a90bd1 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1056,7 +1056,6 @@ H5C_flush_cache(H5F_t *f, unsigned flags)
H5C_ring_t ring;
H5C_t * cache_ptr;
hbool_t destroy;
- hbool_t ignore_protected;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -1101,9 +1100,8 @@ H5C_flush_cache(H5F_t *f, unsigned flags)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 );
destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 );
- HDassert( ! ( destroy && ignore_protected ) );
+ HDassert( ! ( destroy && ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 )) );
HDassert( ! ( cache_ptr->flush_in_progress ) );
cache_ptr->flush_in_progress = TRUE;
@@ -3856,7 +3854,11 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr,
{
herr_t ret_value = SUCCEED; /* Return value */
+#if H5C_DO_SANITY_CHECKS
FUNC_ENTER_STATIC
+#else
+ FUNC_ENTER_STATIC_NOERR
+#endif
/* Sanity checking */
HDassert(cache_ptr);
@@ -3873,7 +3875,9 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr,
/* Update the stats for an unpin operation */
H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr)
+#if H5C_DO_SANITY_CHECKS
done:
+#endif
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__unpin_entry_real() */
diff --git a/src/H5CS.c b/src/H5CS.c
index 0a3dcce..3fccce4 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -145,11 +145,7 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream)
HDfprintf(stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g);
/* try show the process or thread id in multiple processes cases*/
-#ifdef H5_HAVE_THREADSAFE
- HDfprintf(stream, "thread %lu.", HDpthread_self_ulong());
-#else /* H5_HAVE_THREADSAFE */
- HDfprintf(stream, "thread 0.");
-#endif /* H5_HAVE_THREADSAFE */
+ HDfprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id());
if(fstack && fstack->nused>0)
HDfprintf(stream, " Back trace follows.");
HDfputc('\n', stream);
diff --git a/src/H5CX.c b/src/H5CX.c
index 96c1d72..160aa84 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -105,7 +105,7 @@
} /* end if */
#endif /* H5_HAVE_PARALLEL */
-#ifdef H5_HAVE_PARALLEL
+#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY)
/* Macro for the duplicated code to test and set properties for a property list */
#define H5CX_TEST_SET_PROP(PROP_NAME, PROP_FIELD) \
{ \
@@ -127,7 +127,9 @@
(*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \
} /* end if */ \
}
+#endif /* defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) */
+#ifdef 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) \
if((*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \
@@ -181,6 +183,10 @@ typedef struct H5CX_t {
hid_t dxpl_id; /* DXPL ID for API operation */
H5P_genplist_t *dxpl; /* Dataset Transfer Property List */
+ /* LCPL */
+ hid_t lcpl_id; /* LCPL ID for API operation */
+ H5P_genplist_t *lcpl; /* Link Creation Property List */
+
/* LAPL */
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
@@ -278,6 +284,12 @@ typedef struct H5CX_t {
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
+ /* Cached LCPL properties */
+ H5T_cset_t encoding; /* Link name character encoding */
+ hbool_t encoding_valid; /* Whether link name character encoding is valid */
+ unsigned intermediate_group; /* Whether to create intermediate groups */
+ hbool_t intermediate_group_valid; /* Whether create intermediate group flag is valid */
+
/* 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 */
@@ -285,6 +297,8 @@ typedef struct H5CX_t {
/* Cached DCPL properties */
hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
+ uint8_t ohdr_flags; /* Object header flags */
+ hbool_t ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
const char *extfile_prefix; /* Prefix for external file */
@@ -346,6 +360,13 @@ typedef struct H5CX_dxpl_cache_t {
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
} H5CX_dxpl_cache_t;
+/* Typedef for cached default link creation property list information */
+/* (Same as the cached DXPL struct, above, except for the default LCPL) */
+typedef struct H5CX_lcpl_cache_t {
+ H5T_cset_t encoding; /* Link name character encoding */
+ unsigned intermediate_group; /* Whether to create intermediate groups */
+} H5CX_lcpl_cache_t;
+
/* Typedef for cached default link access property list information */
/* (Same as the cached DXPL struct, above, except for the default LAPL) */
typedef struct H5CX_lapl_cache_t {
@@ -356,6 +377,7 @@ typedef struct H5CX_lapl_cache_t {
/* (Same as the cached DXPL struct, above, except for the default DCPL) */
typedef struct H5CX_dcpl_cache_t {
hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ uint8_t ohdr_flags; /* Object header flags */
} H5CX_dcpl_cache_t;
/* Typedef for cached default dataset access property list information */
@@ -401,6 +423,9 @@ static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context st
/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
static H5CX_dxpl_cache_t H5CX_def_dxpl_cache;
+/* Define a "default" link creation property list cache structure to use for default LCPLs */
+static H5CX_lcpl_cache_t H5CX_def_lcpl_cache;
+
/* Define a "default" link access property list cache structure to use for default LAPLs */
static H5CX_lapl_cache_t H5CX_def_lapl_cache;
@@ -435,6 +460,7 @@ herr_t
H5CX__init_package(void)
{
H5P_genplist_t *dx_plist; /* Data transfer property list */
+ H5P_genplist_t *lc_plist; /* Link creation property list */
H5P_genplist_t *la_plist; /* Link access property list */
H5P_genplist_t *dc_plist; /* Dataset creation property list */
H5P_genplist_t *da_plist; /* Dataset access property list */
@@ -525,6 +551,23 @@ H5CX__init_package(void)
if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback")
+ /* Reset the "default LCPL cache" information */
+ HDmemset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t));
+
+ /* Get the default LCPL cache information */
+
+ /* Get the default link creation property list */
+ if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list")
+
+ /* Get link name character encoding */
+ if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding")
+
+ /* Get flag whether to create intermediate groups */
+ if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag")
+
/* Reset the "default LAPL cache" information */
HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t));
@@ -552,6 +595,10 @@ H5CX__init_package(void)
if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
+ /* Get object header flags */
+ if(H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags")
+
/* Reset the "default DAPL cache" information */
HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t));
@@ -710,6 +757,7 @@ H5CX__push_common(H5CX_node_t *cnode)
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
cnode->ctx.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT;
+ cnode->ctx.lcpl_id = H5P_LINK_CREATE_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
cnode->ctx.tag = H5AC__INVALID_TAG;
@@ -820,6 +868,18 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
if(NULL == (*api_state = H5FL_CALLOC(H5CX_state_t)))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state")
+ /* Check for non-default DCPL */
+ if(H5P_DATASET_CREATE_DEFAULT != (*head)->ctx.dcpl_id) {
+ /* Retrieve the DCPL property list */
+ H5CX_RETRIEVE_PLIST(dcpl, FAIL)
+
+ /* Copy the DCPL ID */
+ if(((*api_state)->dcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dcpl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+
/* Check for non-default DXPL */
if(H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
/* Retrieve the DXPL property list */
@@ -844,6 +904,18 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
else
(*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ /* Check for non-default LCPL */
+ if(H5P_LINK_CREATE_DEFAULT != (*head)->ctx.lcpl_id) {
+ /* Retrieve the LCPL property list */
+ H5CX_RETRIEVE_PLIST(lcpl, FAIL)
+
+ /* Copy the LCPL ID */
+ if(((*api_state)->lcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lcpl, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
+ } /* end if */
+ else
+ (*api_state)->lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
/* Keep a reference to the current VOL wrapping context */
(*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
if(NULL != (*api_state)->vol_wrap_ctx)
@@ -916,6 +988,10 @@ H5CX_restore_state(const H5CX_state_t *api_state)
HDassert(head && *head);
HDassert(api_state);
+ /* Restore the DCPL info */
+ (*head)->ctx.dcpl_id = api_state->dcpl_id;
+ (*head)->ctx.dcpl = NULL;
+
/* Restore the DXPL info */
(*head)->ctx.dxpl_id = api_state->dxpl_id;
(*head)->ctx.dxpl = NULL;
@@ -924,6 +1000,10 @@ H5CX_restore_state(const H5CX_state_t *api_state)
(*head)->ctx.lapl_id = api_state->lapl_id;
(*head)->ctx.lapl = NULL;
+ /* Restore the LCPL info */
+ (*head)->ctx.lcpl_id = api_state->lcpl_id;
+ (*head)->ctx.lcpl = NULL;
+
/* Restore the VOL wrapper context */
(*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
@@ -964,6 +1044,11 @@ H5CX_free_state(H5CX_state_t *api_state)
/* Sanity check */
HDassert(api_state);
+ /* Release the DCPL */
+ if(api_state->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
+ if(H5I_dec_ref(api_state->dcpl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL")
+
/* Release the DXPL */
if(api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
if(H5I_dec_ref(api_state->dxpl_id) < 0)
@@ -974,6 +1059,11 @@ H5CX_free_state(H5CX_state_t *api_state)
if(H5I_dec_ref(api_state->lapl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
+ /* Release the LCPL */
+ if(api_state->lcpl_id != H5P_LINK_CREATE_DEFAULT)
+ if(H5I_dec_ref(api_state->lcpl_id) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL")
+
/* Release the VOL wrapper context */
if(api_state->vol_wrap_ctx)
if(H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
@@ -1119,6 +1209,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_lcpl
+ *
+ * Purpose: Sets the LCPL for the current API call context.
+ *
+ * Return: <none>
+ *
+ * Programmer: Chris Hogan
+ * October 28, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5CX_set_lcpl(hid_t lcpl_id)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(*head);
+
+ /* Set the API context's LCPL to a new value */
+ (*head)->ctx.lcpl_id = lcpl_id;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5CX_set_lcpl() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
*
* Purpose: Sets the LAPL for the current API call context.
@@ -2371,6 +2490,76 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_encoding
+ *
+ * Purpose: Retrieves the character encoding for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Gerd Heber
+ * October 21, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_encoding(H5T_cset_t* encoding)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(encoding);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5P_STRCRT_CHAR_ENCODING_NAME, encoding)
+
+ /* Get the value */
+ *encoding = (*head)->ctx.encoding;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_encoding() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_intermediate_group
+ *
+ * Purpose: Retrieves the create intermediate group flag for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Gerd Heber
+ * October 21, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_intermediate_group(unsigned* crt_intermed_group)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(crt_intermed_group);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5L_CRT_INTERMEDIATE_GROUP_NAME, intermediate_group)
+
+ /* Get the value */
+ *crt_intermed_group = (*head)->ctx.intermediate_group;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_create_intermediate_group() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_nlinks
*
* Purpose: Retrieves the # of soft / UD links to traverse for the current API call context.
@@ -3284,6 +3473,41 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_ohdr_flags
+ *
+ * Purpose: Retrieves the object header flags for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Chris Hogan
+ * November 15, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_ohdr_flags(uint8_t *ohdr_flags)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(ohdr_flags);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5O_CRT_OHDR_FLAGS_NAME, ohdr_flags)
+
+ /* Get the value */
+ *ohdr_flags = (*head)->ctx.ohdr_flags;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* End H5CX_get_ohdr_flags() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX__pop_common
*
* Purpose: Common code for popping the context for an API call.
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 2f86adf..2ae71f3 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -41,8 +41,10 @@
/* API context state */
typedef struct H5CX_state_t {
+ hid_t dcpl_id; /* DCPL for operation */
hid_t dxpl_id; /* DXPL for operation */
hid_t lapl_id; /* LAPL for operation */
+ hid_t lcpl_id; /* LCPL for operation */
void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
@@ -77,6 +79,7 @@ H5_DLL herr_t H5CX_free_state(H5CX_state_t *api_state);
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
+H5_DLL void H5CX_set_lcpl(hid_t lcpl_id);
H5_DLL void H5CX_set_lapl(hid_t lapl_id);
H5_DLL void H5CX_set_dcpl(hid_t dcpl_id);
H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f);
@@ -122,11 +125,16 @@ H5_DLL herr_t H5CX_get_data_transform(H5Z_data_xform_t **data_transform);
H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
+/* "Getter" routines for LCPL properties cached in API context */
+H5_DLL herr_t H5CX_get_encoding(H5T_cset_t* encoding);
+H5_DLL herr_t H5CX_get_intermediate_group(unsigned* crt_intermed_group);
+
/* "Getter" routines for LAPL properties cached in API context */
H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks);
/* "Getter" routines for DCPL properties cached in API context */
H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag);
+H5_DLL herr_t H5CX_get_ohdr_flags(uint8_t *ohdr_flags);
/* "Getter" routines for DAPL properties cached in API context */
H5_DLL herr_t H5CX_get_ext_file_prefix(const char **prefix_extfile);
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index 1f55e86..cb1d0e2 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -319,9 +319,8 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
(int)(entry_ptr->is_dirty),
entry_ptr->type->name);
- HDfprintf(stdout, " node_ptr = 0x%llx, item = %p\n",
- (unsigned long long)node_ptr,
- H5SL_item(node_ptr));
+ HDfprintf(stdout, " node_ptr = %p, item = %p\n",
+ node_ptr, H5SL_item(node_ptr));
/* increment node_ptr before we delete its target */
node_ptr = H5SL_next(node_ptr);
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
index dd9e9b2..5ac354d 100644
--- a/src/H5Clog_json.c
+++ b/src/H5Clog_json.c
@@ -1281,7 +1281,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t H5_ATTR_NDEBUG_UNUSED *config,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index e784487..2c176e4 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -174,13 +174,13 @@ H5C_apply_candidate_list(H5F_t * f,
int mpi_size)
{
int i;
- int m;
- int n;
- unsigned first_entry_to_flush;
- unsigned last_entry_to_flush;
- unsigned total_entries_to_clear = 0;
- unsigned total_entries_to_flush = 0;
- int * candidate_assignment_table = NULL;
+ int m;
+ unsigned n;
+ unsigned first_entry_to_flush;
+ unsigned last_entry_to_flush;
+ unsigned total_entries_to_clear = 0;
+ unsigned total_entries_to_flush = 0;
+ unsigned * candidate_assignment_table = NULL;
unsigned entries_to_flush[H5C_RING_NTYPES];
unsigned entries_to_clear[H5C_RING_NTYPES];
haddr_t addr;
@@ -231,17 +231,18 @@ H5C_apply_candidate_list(H5F_t * f,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries")
} /* end if */
- n = num_candidates / mpi_size;
- m = num_candidates % mpi_size;
- HDassert(n >= 0);
- if(NULL == (candidate_assignment_table = (int *)H5MM_malloc(sizeof(int) * (size_t)(mpi_size + 1))))
+ n = num_candidates / (unsigned)mpi_size;
+ if(num_candidates % (unsigned)mpi_size > INT_MAX)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "m overflow")
+ m = (int)(num_candidates % (unsigned)mpi_size);
+
+ if(NULL == (candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for candidate assignment table")
candidate_assignment_table[0] = 0;
candidate_assignment_table[mpi_size] = num_candidates;
if(m == 0) { /* mpi_size is an even divisor of num_candidates */
- HDassert(n > 0);
for(i = 1; i < mpi_size; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
} /* end if */
@@ -249,7 +250,7 @@ H5C_apply_candidate_list(H5F_t * f,
for(i = 1; i <= m; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1;
- if(num_candidates < mpi_size) {
+ if(num_candidates < (unsigned)mpi_size) {
for(i = m + 1; i < mpi_size; i++)
candidate_assignment_table[i] = num_candidates;
} /* end if */
@@ -263,7 +264,7 @@ H5C_apply_candidate_list(H5F_t * f,
#if H5C_DO_SANITY_CHECKS
/* Verify that the candidate assignment table has the expected form */
for(i = 1; i < mpi_size - 1; i++) {
- int a, b;
+ unsigned a, b;
a = candidate_assignment_table[i] - candidate_assignment_table[i - 1];
b = candidate_assignment_table[i + 1] - candidate_assignment_table[i];
@@ -282,7 +283,7 @@ H5C_apply_candidate_list(H5F_t * f,
tbl_buf[i] = '\0';
HDsprintf(&(tbl_buf[0]), "candidate assignment table = ");
for(i = 0; i <= mpi_size; i++)
- HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[i]);
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
@@ -359,11 +360,11 @@ H5C_apply_candidate_list(H5F_t * f,
n = 0;
for(i = 0; i < H5C_RING_NTYPES; i++) {
m += (int)entries_to_flush[i];
- n += (int)entries_to_clear[i];
+ n += entries_to_clear[i];
} /* end if */
HDassert((unsigned)m == total_entries_to_flush);
- HDassert((unsigned)n == total_entries_to_clear);
+ HDassert(n == total_entries_to_clear);
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
@@ -397,7 +398,7 @@ H5C_apply_candidate_list(H5F_t * f,
done:
if(candidate_assignment_table != NULL)
- candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table);
+ candidate_assignment_table = (unsigned *)H5MM_xfree((void *)candidate_assignment_table);
if(cache_ptr->coll_write_list) {
if(H5SL_close(cache_ptr->coll_write_list) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list")
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 9156c0d..6608bc2 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -4694,7 +4694,7 @@ struct H5C_t {
uint32_t num_last_entries;
#if H5C_DO_SANITY_CHECKS
int32_t slist_len_increase;
- ssize_t slist_size_increase;
+ int64_t slist_size_increase;
#endif /* H5C_DO_SANITY_CHECKS */
/* Fields for maintaining list of tagged entries */
@@ -4923,7 +4923,7 @@ H5_DLL herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry);
/* Testing functions */
#ifdef H5C_TESTING
-H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status);
+H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status);
#endif /* H5C_TESTING */
#endif /* _H5Cpkg_H */
diff --git a/src/H5Ctest.c b/src/H5Ctest.c
index 340071a..7f24302 100644
--- a/src/H5Ctest.c
+++ b/src/H5Ctest.c
@@ -35,12 +35,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5Iprivate.h" /* IDs */
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
@@ -132,11 +133,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status)
+H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status)
{
H5F_t * f; /* File Pointer */
H5C_t * cache; /* Cache Pointer */
H5C_tag_iter_vct_ctx_t ctx; /* Context for iterator callback */
+ haddr_t tag; /* Tagged address */
herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
@@ -146,6 +148,11 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status)
if(NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ /* Convert token to address */
+ tag = HADDR_UNDEF;
+ if(H5VL_native_token_to_addr(f, H5I_FILE, tag_token, &tag) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get address for token")
+
/* Get cache pointer */
cache = f->shared->cache;
diff --git a/src/H5D.c b/src/H5D.c
index 96dce3f..178bb30 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -54,12 +54,6 @@
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
-/* Declare extern the free list to manage blocks of VL data */
-H5FL_BLK_EXTERN(vlen_vl_buf);
-
-/* Declare extern the free list to manage other blocks of VL data */
-H5FL_BLK_EXTERN(vlen_fl_buf);
-
/*****************************/
/* Library Private Variables */
@@ -106,7 +100,7 @@ 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)
{
void *dset = NULL; /* New dataset's info */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -137,6 +131,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Set the DCPL for the API context */
H5CX_set_dcpl(dcpl_id);
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_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")
@@ -202,8 +199,8 @@ hid_t
H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
hid_t dapl_id)
{
- void *dset = NULL; /* dset token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -268,8 +265,8 @@ done:
hid_t
H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
{
- void *dset = NULL; /* dset token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -706,56 +703,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dvlen_reclaim
- *
- * Purpose: Frees the buffers allocated for storing variable-length data
- * in memory. Only frees the VL data in the selection defined in the
- * dataspace. The dataset transfer property list is required to find the
- * correct allocation/free methods for the VL data in the buffer.
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, June 10, 1999
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf)
-{
- H5S_t *space; /* Dataspace for iteration */
- herr_t ret_value; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "iii*x", type_id, space_id, dxpl_id, buf);
-
- /* Check args */
- if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
- 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)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
-
- /* 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 xfer parms")
-
- /* Set DXPL for operation */
- H5CX_set_dxpl(dxpl_id);
-
- /* Call internal routine */
- ret_value = H5D_vlen_reclaim(type_id, space, buf);
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Dvlen_reclaim() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Dvlen_get_buf_size
*
* Purpose: This routine checks the number of bytes required to store the VL
@@ -764,14 +711,6 @@ done:
* VL data, in memory. The *size value is modified according to how many
* bytes are required to store the VL data in memory.
*
- * Implementation: This routine actually performs the read with a custom
- * memory manager which basically just counts the bytes requested and
- * uses a temporary memory buffer (through the H5FL API) to make certain
- * enough space is available to perform the read. Then the temporary
- * buffer is released and the number of bytes allocated is returned.
- * Kinda kludgy, but easier than the other method of trying to figure out
- * the sizes without actually reading the data in... - QAK
- *
* Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
@@ -781,88 +720,43 @@ done:
*/
herr_t
H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
- hsize_t *size)
+ hsize_t *size)
{
- H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0};
- 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 */
- H5T_t *type; /* Datatype */
- H5S_sel_iter_op_t dset_op; /* Operator for iteration */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iii*h", dataset_id, type_id, space_id, size);
/* Check args */
- 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 == (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)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
- if(!(H5S_has_extent(space)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
-
- /* Save the dataset */
- 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(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")
- 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)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
- if(NULL == (vlen_bufsize.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
-
- /* Set the memory manager to the special allocation routine */
- if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine")
-
- /* Set the initial number of bytes required */
- 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;
-
- ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
-
- /* Get the size if we succeeded */
- if(ret_value >= 0)
- *size = vlen_bufsize.size;
+ if(H5I_DATATYPE != H5I_get_type(type_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype identifier")
+ if(H5I_DATASPACE != H5I_get_type(space_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace identifier")
+ if(size == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'size' pointer")
+
+ /* Check if the 'get_vlen_buf_size' callback is supported */
+ supported = FALSE;
+ if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, &supported) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'get vlen buf size' operation")
+ if(supported) {
+ /* Make the 'get_vlen_buf_size' callback */
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id, space_id, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size")
+ } /* end if */
+ else {
+ /* Perform a generic operation that will work with all VOL connectors */
+ if(H5D__vlen_get_buf_size_gen(vol_obj, type_id, space_id, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size")
+ } /* end else */
done:
- 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)
- vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf);
-
FUNC_LEAVE_API(ret_value)
-} /* end H5Dvlen_get_buf_size() */
+} /* end H5Dvlen_get_buf_size() */
/*-------------------------------------------------------------------------
@@ -1011,7 +905,7 @@ H5Dformat_convert(hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Convert the dataset */
- if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_FORMAT_CONVERT) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format")
done:
@@ -1047,7 +941,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
/* Get the chunk indexing type */
- if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type")
done:
@@ -1088,7 +982,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n
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_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, chunk_nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
done:
@@ -1133,13 +1027,13 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
/* Get the number of written chunks */
- if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, nchunks) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, nchunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
done:
FUNC_LEAVE_API(ret_value);
} /* H5Dget_num_chunks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Dget_chunk_info
@@ -1181,7 +1075,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
/* Get the number of written chunks to check range */
- if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, &nchunks) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, &nchunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
/* Check range for chunk index */
@@ -1189,7 +1083,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range")
/* Call private function to get the chunk info given the chunk's index */
- if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, fspace_id, chk_index, offset, filter_mask, addr, size) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index")
done:
@@ -1236,7 +1130,7 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
/* Call private function to get the chunk info given the chunk's index */
- if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, offset, filter_mask, addr, size) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates")
done:
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index c13c36a..098e01b 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -253,7 +253,7 @@ H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__btree_new_node(H5F_t *f, H5B_ins_t op, void *_lt_key, void *_udata,
+H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, void *_udata,
void *_rt_key, haddr_t *addr_p/*out*/)
{
H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key;
@@ -536,7 +536,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5D__btree_insert(H5F_t *f, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed,
+H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED addr, void *_lt_key, hbool_t *lt_key_changed,
void *_md_key, void *_udata, void *_rt_key, hbool_t H5_ATTR_UNUSED *rt_key_changed,
haddr_t *new_node_p/*out*/)
{
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 66dd414..58dfbc5 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -11,31 +11,31 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Thursday, April 24, 2008
- *
- * Purpose: Abstract indexed (chunked) I/O functions. The logical
- * multi-dimensional dataspace is regularly partitioned into
- * same-sized "chunks", the first of which is aligned with the
- * logical origin. The chunks are indexed by different methods,
- * that map a chunk index to disk address. Each chunk can be
+/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Thursday, April 24, 2008
+ *
+ * Purpose: Abstract indexed (chunked) I/O functions. The logical
+ * multi-dimensional dataspace is regularly partitioned into
+ * same-sized "chunks", the first of which is aligned with the
+ * logical origin. The chunks are indexed by different methods,
+ * that map a chunk index to disk address. Each chunk can be
* compressed independently and the chunks may move around in the
* file as their storage requirements change.
*
- * Cache: Disk I/O is performed in units of chunks and H5MF_alloc()
- * contains code to optionally align chunks on disk block
- * boundaries for performance.
- *
- * The chunk cache is an extendible hash indexed by a function
- * of storage B-tree address and chunk N-dimensional offset
- * within the dataset. Collisions are not resolved -- one of
- * the two chunks competing for the hash slot must be preempted
- * from the cache. All entries in the hash also participate in
- * a doubly-linked list and entries are penalized by moving them
- * toward the front of the list. When a new chunk is about to
- * be added to the cache the heap is pruned by preempting
- * entries near the front of the list to make room for the new
- * entry which is added to the end of the list.
+ * Cache: Disk I/O is performed in units of chunks and H5MF_alloc()
+ * contains code to optionally align chunks on disk block
+ * boundaries for performance.
+ *
+ * The chunk cache is an extendible hash indexed by a function
+ * of storage B-tree address and chunk N-dimensional offset
+ * within the dataset. Collisions are not resolved -- one of
+ * the two chunks competing for the hash slot must be preempted
+ * from the cache. All entries in the hash also participate in
+ * a doubly-linked list and entries are penalized by moving them
+ * toward the front of the list. When a new chunk is about to
+ * be added to the cache the heap is pruned by preempting
+ * entries near the front of the list to make room for the new
+ * entry which is added to the end of the list.
*/
/****************/
@@ -48,19 +48,19 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_PARALLEL
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#endif /* H5_HAVE_PARALLEL */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File functions */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File functions */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vector and array functions */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
@@ -74,35 +74,35 @@
/* Sanity check on chunk index types: commonly used by a lot of routines in this file */
#define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \
- HDassert((H5D_CHUNK_IDX_EARRAY == storage->idx_type && H5D_COPS_EARRAY == storage->ops) || \
- (H5D_CHUNK_IDX_FARRAY == storage->idx_type && H5D_COPS_FARRAY == storage->ops) || \
- (H5D_CHUNK_IDX_BT2 == storage->idx_type && H5D_COPS_BT2 == storage->ops) || \
- (H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops) || \
- (H5D_CHUNK_IDX_SINGLE == storage->idx_type && H5D_COPS_SINGLE == storage->ops) || \
- (H5D_CHUNK_IDX_NONE == storage->idx_type && H5D_COPS_NONE == storage->ops));
+ HDassert((H5D_CHUNK_IDX_EARRAY == (storage)->idx_type && H5D_COPS_EARRAY == (storage)->ops) || \
+ (H5D_CHUNK_IDX_FARRAY == (storage)->idx_type && H5D_COPS_FARRAY == (storage)->ops) || \
+ (H5D_CHUNK_IDX_BT2 == (storage)->idx_type && H5D_COPS_BT2 == (storage)->ops) || \
+ (H5D_CHUNK_IDX_BTREE == (storage)->idx_type && H5D_COPS_BTREE == (storage)->ops) || \
+ (H5D_CHUNK_IDX_SINGLE == (storage)->idx_type && H5D_COPS_SINGLE == (storage)->ops) || \
+ (H5D_CHUNK_IDX_NONE == (storage)->idx_type && H5D_COPS_NONE == (storage)->ops));
/*
* Feature: If this constant is defined then every cache preemption and load
- * causes a character to be printed on the standard error stream:
+ * causes a character to be printed on the standard error stream:
*
* `.': Entry was preempted because it has been completely read or
- * completely written but not partially read and not partially
- * written. This is often a good reason for preemption because such
- * a chunk will be unlikely to be referenced in the near future.
+ * completely written but not partially read and not partially
+ * written. This is often a good reason for preemption because such
+ * a chunk will be unlikely to be referenced in the near future.
*
* `:': Entry was preempted because it hasn't been used recently.
*
* `#': Entry was preempted because another chunk collided with it. This
- * is usually a relatively bad thing. If there are too many of
- * these then the number of entries in the cache can be increased.
+ * is usually a relatively bad thing. If there are too many of
+ * these then the number of entries in the cache can be increased.
*
* c: Entry was preempted because the file is closing.
*
- * w: A chunk read operation was eliminated because the library is
- * about to write new values to the entire chunk. This is a good
- * thing, especially on files where the chunk size is the same as
- * the disk block size, chunks are aligned on disk block boundaries,
- * and the operating system can also eliminate a read operation.
+ * w: A chunk read operation was eliminated because the library is
+ * about to write new values to the entire chunk. This is a good
+ * thing, especially on files where the chunk size is the same as
+ * the disk block size, chunks are aligned on disk block boundaries,
+ * and the operating system can also eliminate a read operation.
*/
/*#define H5D_CHUNK_DEBUG */
@@ -119,19 +119,19 @@
/* Raw data chunks are cached. Each entry in the cache is: */
typedef struct H5D_rdcc_ent_t {
- hbool_t locked; /*entry is locked in cache */
- hbool_t dirty; /*needs to be written to disk? */
- hbool_t deleted; /*chunk about to be deleted */
+ hbool_t locked; /*entry is locked in cache */
+ hbool_t dirty; /*needs to be written to disk? */
+ hbool_t deleted; /*chunk about to be deleted */
unsigned edge_chunk_state; /*states related to edge chunks (see above) */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */
- uint32_t rd_count; /*bytes remaining to be read */
- uint32_t wr_count; /*bytes remaining to be written */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */
+ uint32_t rd_count; /*bytes remaining to be read */
+ uint32_t wr_count; /*bytes remaining to be written */
H5F_block_t chunk_block; /*offset/length of chunk in file */
- hsize_t chunk_idx; /*index of chunk in dataset */
- uint8_t *chunk; /*the unfiltered chunk data */
- unsigned idx; /*index in hash table */
- struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */
- struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */
+ hsize_t chunk_idx; /*index of chunk in dataset */
+ uint8_t *chunk; /*the unfiltered chunk data */
+ unsigned idx; /*index in hash table */
+ struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */
+ struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */
struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */
struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */
} H5D_rdcc_ent_t;
@@ -142,7 +142,7 @@ typedef struct H5D_chunk_it_ud1_t {
H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
const H5D_chk_idx_info_t *idx_info; /* Chunked index info */
const H5D_io_info_t *io_info; /* I/O info for dataset operation */
- const hsize_t *space_dim; /* New dataset dimensions */
+ const hsize_t *space_dim; /* New dataset dimensions */
const hbool_t *shrunk_dim; /* Dimensions which have been shrunk */
H5S_t *chunk_space; /* Dataspace for a chunk */
uint32_t elmts_per_chunk;/* Elements in chunk */
@@ -192,12 +192,12 @@ typedef struct H5D_chunk_it_ud3_t {
/* needed for getting raw data from chunk cache */
hbool_t chunk_in_cache;
- uint8_t *chunk; /* the unfiltered chunk data */
+ uint8_t *chunk; /* the unfiltered chunk data */
} H5D_chunk_it_ud3_t;
/* Callback info for iteration to dump index */
typedef struct H5D_chunk_it_ud4_t {
- FILE *stream; /* Output stream */
+ FILE *stream; /* Output stream */
hbool_t header_displayed; /* Node's header is displayed? */
unsigned ndims; /* Number of dimensions for chunk/dataset */
uint32_t *chunk_dim; /* Chunk dimensions */
@@ -207,7 +207,7 @@ typedef struct H5D_chunk_it_ud4_t {
typedef struct H5D_chunk_it_ud5_t {
H5D_chk_idx_info_t *new_idx_info; /* Dest. chunk index info object */
unsigned dset_ndims; /* Number of dimensions in dataset */
- hsize_t *dset_dims; /* Dataset dimensions */
+ hsize_t *dset_dims; /* Dataset dimensions */
} H5D_chunk_it_ud5_t;
/* Callback info for nonexistent readvv operation */
@@ -254,7 +254,7 @@ static herr_t H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
static herr_t H5D__chunk_io_init(const H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
const H5S_t *mem_space, H5D_chunk_map_t *fm);
-static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info,
+static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
@@ -321,7 +321,7 @@ static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info,
static herr_t H5D__chunk_cache_prune(const H5D_t *dset, size_t size);
static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk);
#ifdef H5_HAVE_PARALLEL
-static herr_t H5D__chunk_collective_fill(const H5D_t *dset,
+static herr_t H5D__chunk_collective_fill(const H5D_t *dset,
H5D_chunk_coll_info_t *chunk_info, size_t chunk_size, const void *fill_buf);
static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2);
#endif /* H5_HAVE_PARALLEL */
@@ -393,15 +393,15 @@ H5FL_BLK_DEFINE_STATIC(chunk);
/* Declare extern free list to manage the H5S_sel_iter_t struct */
H5FL_EXTERN(H5S_sel_iter_t);
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_direct_write
+ * Function: H5D__chunk_direct_write
*
- * Purpose: Internal routine to write a chunk directly into the file.
+ * Purpose: Internal routine to write a chunk directly into the file.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 July 2012
*
*-------------------------------------------------------------------------
@@ -444,7 +444,7 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
- HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
+ HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
(!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
/* Set the file block information for the old chunk */
@@ -486,7 +486,7 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
/* Evict the (old) entry from the cache if present, but do not flush
* it to disk */
if(UINT_MAX != udata.idx_hint) {
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
+ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
if(H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk")
@@ -509,7 +509,7 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_direct_write() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_direct_read
*
@@ -606,7 +606,7 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_direct_read() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_storage_size
*
@@ -704,15 +704,15 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5D__get_chunk_storage_size */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_set_info_real
+ * Function: H5D__chunk_set_info_real
*
- * Purpose: Internal routine to set the information about chunks for a dataset
+ * Purpose: Internal routine to set the information about chunks for a dataset
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 30, 2009
*
*-------------------------------------------------------------------------
@@ -742,7 +742,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
/* Sanity check */
if(layout->dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimension size must be > 0, dim = %u ", u)
-
+
layout->max_chunks[u] = ((max_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
}
@@ -761,15 +761,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_set_info_real() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_set_info
+ * Function: H5D__chunk_set_info
*
- * Purpose: Sets the information about chunks for a dataset
+ * Purpose: Sets the information about chunks for a dataset
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 30, 2009
*
*-------------------------------------------------------------------------
@@ -786,7 +786,7 @@ H5D__chunk_set_info(const H5D_t *dset)
/* Set the base layout information */
if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims, dset->shared->max_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
/* Call the index's "resize" callback */
if(dset->shared->layout.storage.u.chunk.ops->resize && (dset->shared->layout.storage.u.chunk.ops->resize)(&dset->shared->layout.u.chunk) < 0)
@@ -796,15 +796,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_set_info() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_set_sizes
+ * Function: H5D__chunk_set_sizes
*
* Purpose: Sets chunk and type sizes.
*
* Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
+ * Programmer: Dana Robinson
* December 2015
*
*-------------------------------------------------------------------------
@@ -859,15 +859,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_set_sizes */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_construct
+ * Function: H5D__chunk_construct
*
- * Purpose: Constructs new chunked layout information for dataset
+ * Purpose: Constructs new chunked layout information for dataset
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, May 22, 2008
*
*-------------------------------------------------------------------------
@@ -922,25 +922,25 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_construct() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_init
+ * Function: H5D__chunk_init
*
- * Purpose: Initialize the raw data chunk cache for a dataset. This is
- * called when the dataset is initialized.
+ * Purpose: Initialize the raw data chunk cache for a dataset. This is
+ * called when the dataset is initialized.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, May 18, 1998
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
+H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id)
{
H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */
H5P_genplist_t *dapl; /* Data access property list object pointer */
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@@ -1013,11 +1013,11 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
idx_info.f = f;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Allocate any indexing structures */
- if(dset->shared->layout.storage.u.chunk.ops->init && (dset->shared->layout.storage.u.chunk.ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
+ if(sc->ops->init && (sc->ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
/* Set the number of chunks in dataset, etc. */
if(H5D__chunk_set_info(dset) < 0)
@@ -1027,15 +1027,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_init() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_is_space_alloc
+ * Function: H5D__chunk_is_space_alloc
*
- * Purpose: Query if space is allocated for layout
+ * Purpose: Query if space is allocated for layout
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, January 15, 2009
*
*-------------------------------------------------------------------------
@@ -1053,12 +1053,12 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage)
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Query index layer */
- ret_value = (storage->u.chunk.ops->is_space_alloc)(&storage->u.chunk);
+ ret_value = (sc->ops->is_space_alloc)(sc);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_is_space_alloc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_is_data_cached
*
@@ -1082,15 +1082,15 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
FUNC_LEAVE_NOAPI(shared_dset->cache.chunk.nused > 0)
} /* end H5D__chunk_is_data_cached() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_io_init
+ * Function: H5D__chunk_io_init
*
- * Purpose: Performs initialization before any sort of I/O on the raw data
+ * Purpose: Performs initialization before any sort of I/O on the raw data
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, March 20, 2008
*
*-------------------------------------------------------------------------
@@ -1101,16 +1101,12 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
H5D_chunk_map_t *fm)
{
const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
- H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */
hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
htri_t file_space_normalized = FALSE; /* File dataspace was normalized */
- H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */
- hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
- char bogus; /* "bogus" buffer to pass to selection iterator */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1176,15 +1172,15 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_io_init_selections
+ * Function: H5D__chunk_io_init_selections
*
- * Purpose: Initialize the chunk mappings
+ * Purpose: Initialize the chunk mappings
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, March 20, 2008
*
*-------------------------------------------------------------------------
@@ -1198,7 +1194,7 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
char bogus; /* "bogus" buffer to pass to selection iterator */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1269,22 +1265,22 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
else
sel_hyper_flag = TRUE;
- /* Check if file selection is a not a hyperslab selection */
- if(sel_hyper_flag) {
- /* Build the file selection for each chunk */
- if(H5S_SEL_ALL == fm->fsel_type) {
- if(H5D__create_chunk_file_map_all(fm, io_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
- } /* end if */
- else {
- /* Sanity check */
- HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS);
-
- if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
- } /* end else */
+ /* Check if file selection is a not a hyperslab selection */
+ if(sel_hyper_flag) {
+ /* Build the file selection for each chunk */
+ if(H5S_SEL_ALL == fm->fsel_type) {
+ if(H5D__create_chunk_file_map_all(fm, io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
} /* end if */
else {
+ /* Sanity check */
+ HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS);
+
+ if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
+ } /* end else */
+ } /* end if */
+ else {
H5S_sel_iter_op_t iter_op; /* Operator for iteration */
H5D_chunk_file_iter_ud_t udata; /* User data for iteration */
@@ -1321,14 +1317,12 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
if(H5D__create_chunk_mem_map_hyper(fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
} /* end if */
- else if(sel_hyper_flag &&
- fm->f_ndims == 1 && fm->m_ndims == 1 &&
+ else if(sel_hyper_flag && fm->f_ndims == 1 && fm->m_ndims == 1 &&
H5S_SELECT_IS_REGULAR(fm->mem_space) && H5S_SELECT_IS_SINGLE(fm->mem_space)) {
-
if(H5D__create_chunk_mem_map_1d(fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
-
- } else {
+ } /* end else-if */
+ else {
H5S_sel_iter_op_t iter_op; /* Operator for iteration */
size_t elmt_size; /* Memory datatype size */
@@ -1344,8 +1338,8 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
fm->mchunk_tmpl = tmp_mspace;
/* Create temporary datatypes for selection iteration */
- if(!file_type)
- if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
+ if(!file_type)
+ if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
/* Create selection iterator for memory selection */
@@ -1353,7 +1347,7 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
if(H5S_select_iter_init(&(fm->mem_iter), fm->mem_space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- iter_init = TRUE; /* Selection iteration info has been initialized */
+ iter_init = TRUE; /* Selection iteration info has been initialized */
iter_op.op_type = H5S_SEL_ITER_OP_LIB;
iter_op.u.lib_op = H5D__chunk_mem_cb;
@@ -1367,11 +1361,9 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
done:
/* Release the [potentially partially built] chunk mapping information if an error occurs */
if(ret_value < 0) {
- if(tmp_mspace && !fm->mchunk_tmpl) {
+ if(tmp_mspace && !fm->mchunk_tmpl)
if(H5S_close(tmp_mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
- } /* end if */
-
if(H5D__chunk_io_term(fm) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping")
} /* end if */
@@ -1384,17 +1376,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init_selections() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_mem_alloc
+ * Function: H5D__chunk_mem_alloc
*
- * Purpose: Allocate space for a chunk in memory. This routine allocates
+ * Purpose: Allocate space for a chunk in memory. This routine allocates
* memory space for non-filtered chunks from a block free list
* and uses malloc()/free() for filtered chunks.
*
- * Return: Pointer to memory for chunk on success/NULL on failure
+ * Return: Pointer to memory for chunk on success/NULL on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* April 22, 2004
*
*-------------------------------------------------------------------------
@@ -1402,7 +1394,7 @@ done:
static void *
H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
{
- void *ret_value = NULL; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -1416,17 +1408,17 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_mem_alloc() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_mem_xfree
+ * Function: H5D__chunk_mem_xfree
*
- * Purpose: Free space for a chunk in memory. This routine releases
+ * Purpose: Free space for a chunk in memory. This routine releases
* memory space for non-filtered chunks from a block free list
* and uses malloc()/free() for filtered chunks.
*
- * Return: NULL (never fails)
+ * Return: NULL (never fails)
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* April 22, 2004
*
*-------------------------------------------------------------------------
@@ -1448,7 +1440,7 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
FUNC_LEAVE_NOAPI(NULL)
} /* H5D__chunk_mem_xfree() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_realloc
*
@@ -1481,7 +1473,7 @@ H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_mem_realloc() */
-
+
/*--------------------------------------------------------------------------
NAME
H5D__free_chunk_info
@@ -1524,16 +1516,16 @@ H5D__free_chunk_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *
FUNC_LEAVE_NOAPI(0)
} /* H5D__free_chunk_info() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_map_single
+ * Function: H5D__create_chunk_map_single
*
- * Purpose: Create chunk selections when appending a single record
+ * Purpose: Create chunk selections when appending a single record
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Tuesday, November 20, 2007
+ * Programmer: Quincey Koziol
+ * Tuesday, November 20, 2007
*
*-------------------------------------------------------------------------
*/
@@ -1549,7 +1541,7 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1609,16 +1601,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_map_single() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_file_map_all
+ * Function: H5D__create_chunk_file_map_all
*
- * Purpose: Create all chunk selections in file, for an "all" selection.
+ * Purpose: Create all chunk selections in file, for an "all" selection.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Monday, January 21, 2019
+ * Programmer: Quincey Koziol
+ * Monday, January 21, 2019
*
*-------------------------------------------------------------------------
*/
@@ -1635,14 +1627,14 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
hsize_t zeros[H5S_MAX_RANK]; /* All zero vector (for start parameter to setting hyperslab on partial chunks) */
hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
hsize_t end[H5S_MAX_RANK]; /* Final coordinates of chunk */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
hsize_t chunk_index; /* "Index" of chunk */
- hsize_t curr_partial_clip[H5S_MAX_RANK]; /* Current partial dimension sizes to clip against */
- hsize_t partial_dim_size[H5S_MAX_RANK]; /* Size of a partial dimension */
+ hsize_t curr_partial_clip[H5S_MAX_RANK]; /* Current partial dimension sizes to clip against */
+ hsize_t partial_dim_size[H5S_MAX_RANK]; /* Size of a partial dimension */
hbool_t is_partial_dim[H5S_MAX_RANK]; /* Whether a dimension is currently a partial chunk */
unsigned num_partial_dims; /* Current number of partial dimensions */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1692,7 +1684,7 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Iterate through each chunk in the dataset */
while(sel_points) {
H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
- hssize_t schunk_points; /* Number of elements in chunk selection */
+ hsize_t chunk_points; /* Number of elements in chunk selection */
/* Add temporary chunk to the list of chunks */
@@ -1736,12 +1728,11 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Get number of elements selected in chunk */
- if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
- H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t);
+ chunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace);
+ H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, chunk_points, hsize_t);
/* Decrement # of points left in file selection */
- sel_points -= (hsize_t)schunk_points;
+ sel_points -= chunk_points;
/* Advance to next chunk if we are not done */
if(sel_points > 0) {
@@ -1767,7 +1758,7 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
end[curr_dim] = fm->chunk_dim[curr_dim] - 1;
/* Check for previous partial chunk in this dimension */
- if(is_partial_dim[curr_dim] && end[curr_dim] < file_dims[curr_dim]) {
+ if(is_partial_dim[curr_dim] && end[curr_dim] < file_dims[curr_dim]) {
/* Sanity check */
HDassert(num_partial_dims > 0);
@@ -1814,16 +1805,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_file_map_all() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_file_map_hyper
+ * Function: H5D__create_chunk_file_map_hyper
*
- * Purpose: Create all chunk selections in file, for a hyperslab selection.
+ * Purpose: Create all chunk selections in file, for a hyperslab selection.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, May 29, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, May 29, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1843,10 +1834,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */
hsize_t chunk_index; /* Index of chunk */
hsize_t start_scaled[H5S_MAX_RANK]; /* Starting scaled coordinates of selection */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
int curr_dim; /* Current dimension to increment */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1879,7 +1870,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* (Casting away const OK - QAK) */
if(TRUE == H5S_SELECT_INTERSECT_BLOCK(fm->file_space, coords, end)) {
H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
- hssize_t schunk_points; /* Number of elements in chunk selection */
+ hsize_t chunk_points; /* Number of elements in chunk selection */
/* Create dataspace for chunk, 'AND'ing the overall selection with
* the current chunk.
@@ -1922,7 +1913,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
new_chunk_info->mspace_shared = FALSE;
/* Copy the chunk's scaled coordinates */
- H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+ H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
new_chunk_info->scaled[fm->f_ndims] = 0;
/* Insert the new chunk into the skip list */
@@ -1932,12 +1923,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Get number of elements selected in chunk */
- if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
- H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t);
+ chunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace);
+ H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, chunk_points, hsize_t);
/* Decrement # of points left in file selection */
- sel_points -= (hsize_t)schunk_points;
+ sel_points -= chunk_points;
/* Leave if we are done */
if(sel_points == 0)
@@ -1989,18 +1979,18 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_file_map_hyper() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_mem_map_hyper
+ * Function: H5D__create_chunk_mem_map_hyper
*
- * Purpose: Create all chunk selections in memory by copying the file
+ * Purpose: Create all chunk selections in memory by copying the file
* chunk selections and adjusting their offsets to be correct
* for the memory.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, May 29, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, May 29, 2003
*
* Assumptions: That the file and memory selections are the same shape.
*
@@ -2017,7 +2007,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2108,7 +2098,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)
+ if(H5S_SELECT_ADJUST_S(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
} /* end else */
@@ -2122,17 +2112,16 @@ done:
} /* end H5D__create_chunk_mem_map_hyper() */
-
/*-------------------------------------------------------------------------
- * Function: H5D__create_mem_map_1d
+ * Function: H5D__create_mem_map_1d
*
- * Purpose: Create all chunk selections for 1-dimensional regular memory space
+ * Purpose: Create all chunk selections for 1-dimensional regular memory space
* that has only one single block in the selection
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
- * Sept 18, 2019
+ * Programmer: Vailin Choi
+ * Sept 18, 2019
*
*-------------------------------------------------------------------------
*/
@@ -2141,13 +2130,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
{
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
H5SL_node_t *curr_node; /* Current node in skip list */
- hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
- hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
- hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
- hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
- hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2171,17 +2154,18 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
chunk_info->mspace_shared = TRUE;
} /* end if */
else {
- HDassert(fm->m_ndims == 1);
hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ HDassert(fm->m_ndims == 1);
+
if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Iterate over each chunk in the chunk list */
curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
- hssize_t schunk_points; /* Number of elements in chunk selection */
+ hsize_t chunk_points; /* Number of elements in chunk selection */
hsize_t tmp_count = 1;
/* Get pointer to chunk's information */
@@ -2192,12 +2176,12 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
- schunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace);
+ chunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace);
- if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &schunk_points) < 0)
+ if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &chunk_points) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection")
- mem_sel_start[0] += schunk_points;
+ mem_sel_start[0] += chunk_points;
/* Get the next chunk node in the skip list */
curr_node = H5SL_next(curr_node);
@@ -2208,17 +2192,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_mem_map_1d() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_file_cb
+ * Function: H5D__chunk_file_cb
*
- * Purpose: Callback routine for file selection iterator. Used when
+ * Purpose: Callback routine for file selection iterator. Used when
* creating selections in file for each point selected.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Wednesday, July 23, 2003
+ * Programmer: Quincey Koziol
+ * Wednesday, July 23, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2230,9 +2214,9 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type,
H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */
hsize_t chunk_index; /* Chunk index */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2325,17 +2309,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_file_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_mem_cb
+ * Function: H5D__chunk_mem_cb
*
- * Purpose: Callback routine for file selection iterator. Used when
+ * Purpose: Callback routine for file selection iterator. Used when
* creating selections in memory for each chunk.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Thursday, April 10, 2003
+ * Programmer: Raymond Lu
+ * Thursday, April 10, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2346,7 +2330,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */
hsize_t chunk_index; /* Chunk index */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2401,17 +2385,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_mem_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cacheable
+ * Function: H5D__chunk_cacheable
*
- * Purpose: A small internal function to if it's possible to load the
+ * Purpose: A small internal function to if it's possible to load the
* chunk into cache.
*
- * Return: TRUE or FALSE
+ * Return: TRUE or FALSE
*
- * Programmer: Raymond Lu
- * 17 July 2007
+ * Programmer: Raymond Lu
+ * 17 July 2007
*
*-------------------------------------------------------------------------
*/
@@ -2493,16 +2477,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_cacheable() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_read
+ * Function: H5D__chunk_read
*
- * Purpose: Read from a chunked dataset.
+ * Purpose: Read from a chunked dataset.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Thursday, April 10, 2003
+ * Programmer: Raymond Lu
+ * Thursday, April 10, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2520,7 +2504,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
uint32_t src_accessed_bytes = 0; /* Total accessed size in a chunk */
hbool_t skip_missing_chunks = FALSE; /* Whether to skip missing chunks */
- herr_t ret_value = SUCCEED; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_STATIC
@@ -2572,7 +2556,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm);
while(chunk_node) {
H5D_chunk_info_t *chunk_info; /* Chunk information */
- H5D_chunk_ud_t udata; /* Chunk index pass-through */
+ H5D_chunk_ud_t udata; /* Chunk index pass-through */
/* Get the actual chunk information from the skip list node */
chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node);
@@ -2582,7 +2566,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
- HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
+ HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
(!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
/* Check for non-existant chunk & skip it if appropriate */
@@ -2645,16 +2629,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_read() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_write
+ * Function: H5D__chunk_write
*
- * Purpose: Writes to a chunked dataset.
+ * Purpose: Writes to a chunked dataset.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Thursday, April 10, 2003
+ * Programmer: Raymond Lu
+ * Thursday, April 10, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2670,7 +2654,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2700,10 +2684,10 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm);
while(chunk_node) {
H5D_chunk_info_t *chunk_info; /* Chunk information */
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */
void *chunk; /* Pointer to locked chunk buffer */
- H5D_chunk_ud_t udata; /* Index pass-through */
+ H5D_chunk_ud_t udata; /* Index pass-through */
htri_t cacheable; /* Whether the chunk is cacheable */
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
@@ -2715,11 +2699,11 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
- HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
+ HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
(!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
- /* Set chunk's [scaled] coordinates */
- io_info->store->chunk.scaled = chunk_info->scaled;
+ /* Set chunk's [scaled] coordinates */
+ io_info->store->chunk.scaled = chunk_info->scaled;
/* Determine if we should use the chunk cache */
if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0)
@@ -2736,7 +2720,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Determine if we will access all the data in the chunk */
if(dst_accessed_bytes != ctg_store.contig.dset_size ||
(chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size ||
- fm->fsel_type == H5S_SEL_POINTS)
+ fm->fsel_type == H5S_SEL_POINTS)
entire_chunk = FALSE;
/* Lock the chunk into the cache */
@@ -2762,8 +2746,8 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size;
/* Allocate the chunk */
- if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
+ if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -2788,16 +2772,16 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
(hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed")
- /* Release the cache lock on the chunk, or insert chunk into index. */
- if(chunk) {
- if(H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
- } /* end if */
- else {
+ /* Release the cache lock on the chunk, or insert chunk into index. */
+ if(chunk) {
+ if(H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
+ } /* end if */
+ else {
if(need_insert && io_info->dset->shared->layout.storage.u.chunk.ops->insert)
if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
- } /* end else */
+ } /* end else */
/* Advance to next chunk in list */
chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node);
@@ -2807,16 +2791,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_write() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_flush
+ * Function: H5D__chunk_flush
*
- * Purpose: Writes all dirty chunks to disk and optionally preempts them
- * from the cache.
+ * Purpose: Writes all dirty chunks to disk and optionally preempts them
+ * from the cache.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -2825,8 +2809,8 @@ static herr_t
H5D__chunk_flush(H5D_t *dset)
{
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- H5D_rdcc_ent_t *ent, *next;
- unsigned nerrors = 0; /* Count of any errors encountered when flushing chunks */
+ H5D_rdcc_ent_t *ent, *next;
+ unsigned nerrors = 0; /* Count of any errors encountered when flushing chunks */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2836,34 +2820,34 @@ H5D__chunk_flush(H5D_t *dset)
/* Loop over all entries in the chunk cache */
for(ent = rdcc->head; ent; ent = next) {
- next = ent->next;
+ next = ent->next;
if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
nerrors++;
} /* end for */
if(nerrors)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_flush() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_io_term
+ * Function: H5D__chunk_io_term
*
- * Purpose: Destroy I/O operation information.
+ * Purpose: Destroy I/O operation information.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Saturday, May 17, 2003
+ * Programmer: Quincey Koziol
+ * Saturday, May 17, 2003
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__chunk_io_term(const H5D_chunk_map_t *fm)
{
- herr_t ret_value = SUCCEED; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_STATIC
@@ -2898,16 +2882,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_term() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_dest
+ * Function: H5D__chunk_dest
*
- * Purpose: Destroy the entire chunk cache by flushing dirty entries,
- * preempting all entries, and freeing the cache itself.
+ * Purpose: Destroy the entire chunk cache by flushing dirty entries,
+ * preempting all entries, and freeing the cache itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -2916,9 +2900,9 @@ static herr_t
H5D__chunk_dest(H5D_t *dset)
{
H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */
- H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */
- int nerrors = 0; /* Accumulated count of errors */
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */
+ H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */
+ int nerrors = 0; /* Accumulated count of errors */
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@@ -2934,7 +2918,7 @@ H5D__chunk_dest(H5D_t *dset)
if(H5D__chunk_cache_evict(dset, ent, TRUE) < 0)
nerrors++;
} /* end for */
-
+
/* Continue even if there are failures. */
if(nerrors)
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
@@ -2948,26 +2932,25 @@ H5D__chunk_dest(H5D_t *dset)
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Free any index structures */
- if(dset->shared->layout.storage.u.chunk.ops->dest &&
- (dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
+ if(sc->ops->dest && (sc->ops->dest)(&idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_dest() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D_chunk_idx_reset
+ * Function: H5D_chunk_idx_reset
*
- * Purpose: Reset index information
+ * Purpose: Reset index information
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, January 15, 2009
*
*-------------------------------------------------------------------------
@@ -2986,21 +2969,21 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
/* Reset index structures */
if((storage->ops->reset)(storage, reset_addr) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_chunk_idx_reset() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cinfo_cache_reset
+ * Function: H5D__chunk_cinfo_cache_reset
*
- * Purpose: Reset the cached chunk info
+ * Purpose: Reset the cached chunk info
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 27, 2007
*
*-------------------------------------------------------------------------
@@ -3019,15 +3002,15 @@ H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__chunk_cinfo_cache_reset() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cinfo_cache_update
+ * Function: H5D__chunk_cinfo_cache_update
*
- * Purpose: Update the cached chunk info
+ * Purpose: Update the cached chunk info
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 27, 2007
*
*-------------------------------------------------------------------------
@@ -3056,15 +3039,15 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__chunk_cinfo_cache_update() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cinfo_cache_found
+ * Function: H5D__chunk_cinfo_cache_found
*
- * Purpose: Look for chunk info in cache
+ * Purpose: Look for chunk info in cache
*
- * Return: TRUE/FALSE/FAIL
+ * Return: TRUE/FALSE/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 27, 2007
*
*-------------------------------------------------------------------------
@@ -3105,19 +3088,19 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_cinfo_cache_found() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_create
+ * Function: H5D__chunk_create
*
- * Purpose: Creates a new chunked storage index and initializes the
- * layout information with information about the storage. The
- * layout info should be immediately written to the object header.
+ * Purpose: Creates a new chunked storage index and initializes the
+ * layout information with information about the storage. The
+ * layout info should be immediately written to the object header.
*
- * Return: Non-negative on success (with the layout information initialized
- * and ready to write to an object header). Negative on failure.
+ * Return: Non-negative on success (with the layout information initialized
+ * and ready to write to an object header). Negative on failure.
*
- * Programmer: Quincey Koziol
- * Thursday, May 22, 2008
+ * Programmer: Quincey Koziol
+ * Thursday, May 22, 2008
*
*-------------------------------------------------------------------------
*/
@@ -3141,7 +3124,7 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/)
unsigned u; /* Local index variable */
for(u = 0; u < dset->shared->layout.u.chunk.ndims; u++)
- HDassert(dset->shared->layout.u.chunk.dim[u] > 0);
+ HDassert(dset->shared->layout.u.chunk.dim[u] > 0);
}
#endif
@@ -3149,26 +3132,26 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/)
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Create the index for the chunks */
- if((dset->shared->layout.storage.u.chunk.ops->create)(&idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index")
+ if((sc->ops->create)(&idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_create() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_hash_val
+ * Function: H5D__chunk_hash_val
*
- * Purpose: To calculate an index based on the dataset's scaled
- * coordinates and sizes of the faster dimensions.
+ * Purpose: To calculate an index based on the dataset's scaled
+ * coordinates and sizes of the faster dimensions.
*
- * Return: Hash value index
+ * Return: Hash value index
*
- * Programmer: Vailin Choi; Nov 2014
+ * Programmer: Vailin Choi; Nov 2014
*
*-------------------------------------------------------------------------
*/
@@ -3201,16 +3184,16 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
FUNC_LEAVE_NOAPI(ret)
} /* H5D__chunk_hash_val() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_lookup
+ * Function: H5D__chunk_lookup
*
- * Purpose: Loops up a chunk in cache and on disk, and retrieves
+ * Purpose: Loops up a chunk in cache and on disk, and retrieves
* information about that chunk.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Albert Cheng
+ * Programmer: Albert Cheng
* June 27, 1998
*
*-------------------------------------------------------------------------
@@ -3223,7 +3206,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
unsigned idx; /* Index of chunk in cache, if present */
hbool_t found = FALSE; /* In cache? */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3236,7 +3219,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
/* Initialize the query information about the chunk we are looking for */
udata->common.layout = &(dset->shared->layout.u.chunk);
- udata->common.storage = &(dset->shared->layout.storage.u.chunk);
+ udata->common.storage = sc;
udata->common.scaled = scaled;
/* Reset information about the chunk we are looking for */
@@ -3286,7 +3269,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
#ifdef H5_HAVE_PARALLEL
/* Disable collective metadata read for chunk indexes as it is
@@ -3298,7 +3281,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
#endif /* H5_HAVE_PARALLEL */
/* Go get the chunk information */
- if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0)
+ if((sc->ops->get_addr)(&idx_info, udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address")
/*
@@ -3343,18 +3326,18 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_lookup() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_flush_entry
+ * Function: H5D__chunk_flush_entry
*
- * Purpose: Writes a chunk to disk. If RESET is non-zero then the
- * entry is cleared -- it's slightly faster to flush a chunk if
- * the RESET flag is turned on because it results in one fewer
- * memory copy.
+ * Purpose: Writes a chunk to disk. If RESET is non-zero then the
+ * entry is cleared -- it's slightly faster to flush a chunk if
+ * the RESET flag is turned on because it results in one fewer
+ * memory copy.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -3362,10 +3345,10 @@ done:
static herr_t
H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
{
- void *buf = NULL; /* Temporary buffer */
- hbool_t point_of_no_return = FALSE;
+ void *buf = NULL; /* Temporary buffer */
+ hbool_t point_of_no_return = FALSE;
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dset->oloc.addr)
@@ -3378,13 +3361,13 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
buf = ent->chunk;
if(ent->dirty) {
H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_chunk_ud_t udata; /* pass through B-tree */
+ H5D_chunk_ud_t udata; /* pass through B-tree */
hbool_t must_alloc = FALSE; /* Whether the chunk must be allocated */
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
/* Set up user data for index callbacks */
udata.common.layout = &dset->shared->layout.u.chunk;
- udata.common.storage = &dset->shared->layout.storage.u.chunk;
+ udata.common.storage = sc;
udata.common.scaled = ent->scaled;
udata.chunk_block.offset = ent->chunk_block.offset;
udata.chunk_block.length = dset->shared->layout.u.chunk.size;
@@ -3396,7 +3379,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
&& !(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)) {
H5Z_EDC_t err_detect; /* Error detection info */
H5Z_cb_t filter_cb; /* I/O filter callback function */
- size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */
+ size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */
size_t nbytes; /* Chunk size (in bytes) */
/* Retrieve filter settings from API context */
@@ -3469,7 +3452,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Create the chunk it if it doesn't exist, or reallocate the chunk
* if its size changed.
@@ -3489,8 +3472,8 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
/* Insert the chunk record into the index */
- if(need_insert && dset->shared->layout.storage.u.chunk.ops->insert)
- if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, dset) < 0)
+ if(need_insert && sc->ops->insert)
+ if((sc->ops->insert)(&idx_info, &udata, dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
/* Cache the chunk's info, in case it's accessed again shortly */
@@ -3534,7 +3517,7 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_flush_entry() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_cache_evict
*
@@ -3613,17 +3596,17 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_cache_evict() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cache_prune
+ * Function: H5D__chunk_cache_prune
*
- * Purpose: Prune the cache by preempting some things until the cache has
- * room for something which is SIZE bytes. Only unlocked
- * entries are considered for preemption.
+ * Purpose: Prune the cache by preempting some things until the cache has
+ * room for something which is SIZE bytes. Only unlocked
+ * entries are considered for preemption.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -3631,13 +3614,13 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
static herr_t
H5D__chunk_cache_prune(const H5D_t *dset, size_t size)
{
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- size_t total = rdcc->nbytes_max;
- const int nmeth = 2; /*number of methods */
- int w[1]; /*weighting as an interval */
- H5D_rdcc_ent_t *p[2], *cur; /*list pointers */
- H5D_rdcc_ent_t *n[2]; /*list next pointers */
- int nerrors = 0; /* Accumulated error count during preemptions */
+ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
+ size_t total = rdcc->nbytes_max;
+ const int nmeth = 2; /*number of methods */
+ int w[1]; /*weighting as an interval */
+ H5D_rdcc_ent_t *p[2], *cur; /*list pointers */
+ H5D_rdcc_ent_t *n[2]; /*list next pointers */
+ int nerrors = 0; /* Accumulated error count during preemptions */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3659,91 +3642,91 @@ H5D__chunk_cache_prune(const H5D_t *dset, size_t size)
while((p[0] || p[1]) && (rdcc->nbytes_used + size) > total) {
int i; /* Local index variable */
- /* Introduce new pointers */
- for(i = 0; i < nmeth - 1; i++)
+ /* Introduce new pointers */
+ for(i = 0; i < nmeth - 1; i++)
if(0 == w[i])
p[i + 1] = rdcc->head;
- /* Compute next value for each pointer */
- for(i = 0; i < nmeth; i++)
+ /* Compute next value for each pointer */
+ for(i = 0; i < nmeth; i++)
n[i] = p[i] ? p[i]->next : NULL;
- /* Give each method a chance */
- for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) {
- if(0 == i && p[0] && !p[0]->locked &&
+ /* Give each method a chance */
+ for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) {
+ if(0 == i && p[0] && !p[0]->locked &&
((0 == p[0]->rd_count && 0 == p[0]->wr_count) ||
(0 == p[0]->rd_count && dset->shared->layout.u.chunk.size == p[0]->wr_count) ||
(dset->shared->layout.u.chunk.size == p[0]->rd_count && 0 == p[0]->wr_count))) {
- /*
- * Method 0: Preempt entries that have been completely written
- * and/or completely read but not entries that are partially
- * written or partially read.
- */
- cur = p[0];
- } else if(1 == i && p[1] && !p[1]->locked) {
- /*
- * Method 1: Preempt the entry without regard to
- * considerations other than being locked. This is the last
- * resort preemption.
- */
- cur = p[1];
- } else {
- /* Nothing to preempt at this point */
- cur = NULL;
- }
-
- if(cur) {
+ /*
+ * Method 0: Preempt entries that have been completely written
+ * and/or completely read but not entries that are partially
+ * written or partially read.
+ */
+ cur = p[0];
+ } else if(1 == i && p[1] && !p[1]->locked) {
+ /*
+ * Method 1: Preempt the entry without regard to
+ * considerations other than being locked. This is the last
+ * resort preemption.
+ */
+ cur = p[1];
+ } else {
+ /* Nothing to preempt at this point */
+ cur = NULL;
+ }
+
+ if(cur) {
int j; /* Local index variable */
- for(j = 0; j < nmeth; j++) {
- if(p[j] == cur)
+ for(j = 0; j < nmeth; j++) {
+ if(p[j] == cur)
p[j] = NULL;
- if(n[j] == cur)
+ if(n[j] == cur)
n[j] = cur->next;
- } /* end for */
- if(H5D__chunk_cache_evict(dset, cur, TRUE) < 0)
+ } /* end for */
+ if(H5D__chunk_cache_evict(dset, cur, TRUE) < 0)
nerrors++;
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
- /* Advance pointers */
- for(i = 0; i < nmeth; i++)
+ /* Advance pointers */
+ for(i = 0; i < nmeth; i++)
p[i] = n[i];
- for(i = 0; i < nmeth - 1; i++)
+ for(i = 0; i < nmeth - 1; i++)
w[i] -= 1;
} /* end while */
if(nerrors)
- HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_cache_prune() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_lock
+ * Function: H5D__chunk_lock
*
- * Purpose: Return a pointer to a dataset chunk. The pointer points
- * directly into the chunk cache and should not be freed
- * by the caller but will be valid until it is unlocked. The
- * input value IDX_HINT is used to speed up cache lookups and
- * it's output value should be given to H5D__chunk_unlock().
- * IDX_HINT is ignored if it is out of range, and if it points
- * to the wrong entry then we fall back to the normal search
- * method.
+ * Purpose: Return a pointer to a dataset chunk. The pointer points
+ * directly into the chunk cache and should not be freed
+ * by the caller but will be valid until it is unlocked. The
+ * input value IDX_HINT is used to speed up cache lookups and
+ * it's output value should be given to H5D__chunk_unlock().
+ * IDX_HINT is ignored if it is out of range, and if it points
+ * to the wrong entry then we fall back to the normal search
+ * method.
*
- * If RELAX is non-zero and the chunk isn't in the cache then
- * don't try to read it from the file, but just allocate an
- * uninitialized buffer to hold the result. This is intended
- * for output functions that are about to overwrite the entire
- * chunk.
+ * If RELAX is non-zero and the chunk isn't in the cache then
+ * don't try to read it from the file, but just allocate an
+ * uninitialized buffer to hold the result. This is intended
+ * for output functions that are about to overwrite the entire
+ * chunk.
*
- * Return: Success: Ptr to a file chunk.
+ * Return: Success: Ptr to a file chunk.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -3759,12 +3742,12 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/
- H5D_rdcc_ent_t *ent; /*cache entry */
- size_t chunk_size; /*size of a chunk */
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/
+ H5D_rdcc_ent_t *ent; /*cache entry */
+ size_t chunk_size; /*size of a chunk */
hbool_t disable_filters = FALSE; /* Whether to disable filters (when adding to cache) */
- void *chunk = NULL; /*the file chunk */
- void *ret_value = NULL; /* Return value */
+ void *chunk = NULL; /*the file chunk */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -3791,7 +3774,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
#ifndef NDEBUG
{
- unsigned u; /*counters */
+ unsigned u; /*counters */
/* Make sure this is the right chunk */
for(u = 0; u < layout->u.chunk.ndims - 1; u++)
@@ -3949,8 +3932,8 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* Check if the chunk exists on disk */
if(H5F_addr_defined(chunk_addr)) {
- size_t my_chunk_alloc = chunk_alloc; /* Allocated buffer size */
- size_t buf_alloc = chunk_alloc; /* [Re-]allocated buffer size */
+ size_t my_chunk_alloc = chunk_alloc; /* Allocated buffer size */
+ size_t buf_alloc = chunk_alloc; /* [Re-]allocated buffer size */
/* Chunk size on disk isn't [likely] the same size as the final chunk
* size in memory, so allocate memory big enough. */
@@ -3990,7 +3973,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
rdcc->stats.nmisses++;
} /* end if */
else {
- H5D_fill_value_t fill_status;
+ H5D_fill_value_t fill_status;
/* Sanity check */
HDassert(fill->alloc_time != H5D_ALLOC_TIME_EARLY);
@@ -4124,25 +4107,25 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_lock() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_unlock
+ * Function: H5D__chunk_unlock
*
- * Purpose: Unlocks a previously locked chunk. The LAYOUT, COMP, and
- * OFFSET arguments should be the same as for H5D__chunk_lock().
- * The DIRTY argument should be set to non-zero if the chunk has
- * been modified since it was locked. The IDX_HINT argument is
- * the returned index hint from the lock operation and BUF is
- * the return value from the lock.
+ * Purpose: Unlocks a previously locked chunk. The LAYOUT, COMP, and
+ * OFFSET arguments should be the same as for H5D__chunk_lock().
+ * The DIRTY argument should be set to non-zero if the chunk has
+ * been modified since it was locked. The IDX_HINT argument is
+ * the returned index hint from the lock operation and BUF is
+ * the return value from the lock.
*
- * The NACCESSED argument should be the number of bytes accessed
- * for reading or writing (depending on the value of DIRTY).
- * It's only purpose is to provide additional information to the
- * preemption policy.
+ * The NACCESSED argument should be the number of bytes accessed
+ * for reading or writing (depending on the value of DIRTY).
+ * It's only purpose is to provide additional information to the
+ * preemption policy.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -4152,7 +4135,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
hbool_t dirty, void *chunk, uint32_t naccessed)
{
const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */
- const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
+ const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -4190,9 +4173,9 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS;
if(udata->new_unfilt_chunk)
fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
- H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
+ H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
HDassert(layout->u.chunk.size > 0);
- fake_ent.chunk_idx = udata->chunk_idx;
+ fake_ent.chunk_idx = udata->chunk_idx;
fake_ent.chunk_block.offset = udata->chunk_block.offset;
fake_ent.chunk_block.length = udata->chunk_block.length;
fake_ent.chunk = (uint8_t *)chunk;
@@ -4203,16 +4186,16 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
else {
if(chunk)
chunk = H5D__chunk_mem_xfree(chunk, (is_unfiltered_edge_chunk ? NULL
- : &(io_info->dset->shared->dcpl_cache.pline)));
+ : &(io_info->dset->shared->dcpl_cache.pline)));
} /* end else */
} /* end if */
else {
- H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */
+ H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */
/* Sanity check */
- HDassert(udata->idx_hint < rdcc->nslots);
- HDassert(rdcc->slot[udata->idx_hint]);
- HDassert(rdcc->slot[udata->idx_hint]->chunk == chunk);
+ HDassert(udata->idx_hint < rdcc->nslots);
+ HDassert(rdcc->slot[udata->idx_hint]);
+ HDassert(rdcc->slot[udata->idx_hint]->chunk == chunk);
/*
* It's in the cache so unlock it.
@@ -4232,16 +4215,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_unlock() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_allocated_cb
+ * Function: H5D__chunk_allocated_cb
*
- * Purpose: Simply counts the number of chunks for a dataset.
+ * Purpose: Simply counts the number of chunks for a dataset.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 21, 1999
*
*-------------------------------------------------------------------------
@@ -4258,17 +4241,17 @@ H5D__chunk_allocated_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5D__chunk_allocated_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_allocated
+ * Function: H5D__chunk_allocated
*
- * Purpose: Return the number of bytes allocated in the file for storage
- * of raw data in the chunked dataset
+ * Purpose: Return the number of bytes allocated in the file for storage
+ * of raw data in the chunked dataset
*
- * Return: Success: Number of bytes stored in all chunks.
- * Failure: 0
+ * Return: Success: Number of bytes stored in all chunks.
+ * Failure: 0
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, May 20, 2008
*
*-------------------------------------------------------------------------
@@ -4277,7 +4260,7 @@ herr_t
H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes)
{
H5D_chk_idx_info_t idx_info; /* Chunked index info */
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Raw data chunk cache */
+ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Raw data chunk cache */
H5D_rdcc_ent_t *ent; /* Cache entry */
hsize_t chunk_bytes = 0; /* Number of bytes allocated for chunks */
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
@@ -4299,10 +4282,10 @@ H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes)
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Iterate over the chunks */
- if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_allocated_cb, &chunk_bytes) < 0)
+ if((sc->ops->iterate)(&idx_info, H5D__chunk_allocated_cb, &chunk_bytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index")
/* Set number of bytes for caller */
@@ -4312,18 +4295,18 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_allocated() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_allocate
+ * Function: H5D__chunk_allocate
*
- * Purpose: Allocate file space for all chunks that are not allocated yet.
- * Return SUCCEED if all needed allocation succeed, otherwise
- * FAIL.
+ * Purpose: Allocate file space for all chunks that are not allocated yet.
+ * Return SUCCEED if all needed allocation succeed, otherwise
+ * FAIL.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Albert Cheng
- * June 26, 1998
+ * Programmer: Albert Cheng
+ * June 26, 1998
*
*-------------------------------------------------------------------------
*/
@@ -4335,8 +4318,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */
hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated (in scaled coordinates) */
hsize_t max_unalloc[H5O_LAYOUT_NDIMS]; /* Last chunk in each dimension that is unallocated (in scaled coordinates) */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Offset of current chunk (in scaled coordinates) */
- size_t orig_chunk_size; /* Original size of chunk in bytes */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Offset of current chunk (in scaled coordinates) */
+ size_t orig_chunk_size; /* Original size of chunk in bytes */
size_t chunk_size; /* Actual size of chunk in bytes, possibly filtered */
unsigned filter_mask = 0; /* Filter mask for chunks that have them */
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
@@ -4352,7 +4335,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
H5D_chunk_coll_info_t chunk_info; /* chunk address information for doing I/O */
#endif /* H5_HAVE_PARALLEL */
- hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
+ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
unsigned space_ndims; /* Dataset's space rank */
const hsize_t *space_dim; /* Dataset's dataspace dimensions */
const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */
@@ -4364,7 +4347,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each dimension */
unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */
const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -4501,7 +4484,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Loop over all chunks */
/* The algorithm is:
@@ -4572,7 +4555,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
- if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) {
+ if(H5D_CHUNK_IDX_NONE != sc->idx_type) {
HDassert(!H5F_addr_defined(udata.chunk_block.offset));
}
@@ -4647,15 +4630,15 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Initialize the chunk information */
udata.common.layout = &layout->u.chunk;
- udata.common.storage = &layout->storage.u.chunk;
+ udata.common.storage = sc;
udata.common.scaled = scaled;
udata.chunk_block.offset = HADDR_UNDEF;
H5_CHECKED_ASSIGN(udata.chunk_block.length, uint32_t, chunk_size, size_t);
udata.filter_mask = filter_mask;
/* Allocate the chunk (with all processes) */
- if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
+ if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
HDassert(H5F_addr_defined(udata.chunk_block.offset));
/* Check if fill values should be written to chunks */
@@ -4694,7 +4677,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
} /* end if */
/* Insert the chunk record into the index */
- if(need_insert && ops->insert)
+ if(need_insert && ops->insert)
if((ops->insert)(&idx_info, &udata, dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
@@ -4773,7 +4756,7 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_allocate() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_update_old_edge_chunks
*
@@ -4797,7 +4780,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
hsize_t max_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* largest offset of chunks that might need to be modified in each dimension */
hbool_t new_full_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of chunks in this dimension needs to be modified */
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
- const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
hsize_t chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */
const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */
unsigned space_ndims; /* Dataset's space rank */
@@ -4808,7 +4790,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
H5D_storage_t chk_store; /* Chunk storage information */
void *chunk; /* The file chunk */
hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
- const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -4816,8 +4797,8 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
- H5D_CHUNK_STORAGE_INDEX_CHK(sc);
- HDassert(pline->nused > 0);
+ H5D_CHUNK_STORAGE_INDEX_CHK(&layout->storage.u.chunk);
+ HDassert(dset->shared->dcpl_cache.pline.nused > 0);
HDassert(layout->u.chunk.flags
& H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
@@ -4856,12 +4837,12 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Calculate offset of first previously incomplete chunk in this
* dimension */
- old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]);
+ old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]);
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
- max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
- MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1);
+ max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
+ MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1);
/* Check for old_dim aligned with chunk boundary in this dimension, if
* so we do not need to modify chunks along the edge in this dimension
@@ -4871,7 +4852,7 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Check if the dataspace expanded enough to cause the old edge chunks
* in this dimension to become full */
- if((space_dim[op_dim]/chunk_dim[op_dim]) >= (old_edge_chunk_sc[op_dim] + 1))
+ if((space_dim[op_dim]/chunk_dim[op_dim]) >= (old_edge_chunk_sc[op_dim] + 1))
new_full_dim[op_dim] = TRUE;
} /* end for */
@@ -4919,7 +4900,7 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
carry = TRUE;
for(i = ((int)space_ndims - 1); i >= 0; --i) {
if((unsigned)i != op_dim) {
- ++chunk_sc[i];
+ ++chunk_sc[i];
if(chunk_sc[i] > (hsize_t) max_edge_chunk_sc[i])
chunk_sc[i] = 0;
else {
@@ -4947,18 +4928,18 @@ done:
} /* end H5D__chunk_update_old_edge_chunks() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_collective_fill
+ * Function: H5D__chunk_collective_fill
*
* Purpose: Use MPIO collective write to fill the chunks (if number of
- * chunks to fill is greater than the number of MPI procs;
+ * chunks to fill is greater than the number of MPI procs;
* otherwise use independent I/O).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
- * July 30, 2014
+ * Programmer: Mohamad Chaarawi
+ * July 30, 2014
*
*-------------------------------------------------------------------------
*/
@@ -4966,7 +4947,7 @@ static herr_t
H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
size_t chunk_size, const void *fill_buf)
{
- MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */
+ MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank = (-1); /* This process's rank */
int mpi_size = (-1); /* MPI Comm size */
int mpi_code; /* MPI return code */
@@ -4999,12 +4980,12 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* Distribute evenly the number of blocks between processes. */
if(mpi_size == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero")
- num_blocks = chunk_info->num_io / mpi_size; /* value should be the same on all procs */
+ num_blocks = (size_t)(chunk_info->num_io / (size_t)mpi_size); /* value should be the same on all procs */
/* after evenly distributing the blocks between processes, are
there any leftover blocks for each individual process
(round-robin) */
- leftover_blocks = chunk_info->num_io % mpi_size;
+ leftover_blocks = (size_t)(chunk_info->num_io % (size_t)mpi_size);
/* Cast values to types needed by MPI */
H5_CHECKED_ASSIGN(blocks, int, num_blocks, size_t);
@@ -5013,9 +4994,9 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* Allocate buffers */
/* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */
- if(NULL == (block_lens = (int *)H5MM_malloc((blocks + 1) * sizeof(int))))
+ if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer")
- if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((blocks + 1) * sizeof(MPI_Aint))))
+ if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer")
for(i = 0 ; i < blocks ; i++) {
@@ -5049,8 +5030,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
if(need_addr_sort)
HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
- /* MSC
- * should use this if MPI_type_create_hindexed block is working
+ /* MSC - should use this if MPI_type_create_hindexed block is working:
* mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type);
*/
mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type);
@@ -5136,17 +5116,17 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
} /* end H5D__chunk_cmp_addr() */
#endif /* H5_HAVE_PARALLEL */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_prune_fill
+ * Function: H5D__chunk_prune_fill
*
- * Purpose: Write the fill value to the parts of the chunk that are no
+ * Purpose: Write the fill value to the parts of the chunk that are no
* longer part of the dataspace
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * March 26, 2002
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * March 26, 2002
*
*-------------------------------------------------------------------------
*/
@@ -5160,10 +5140,10 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
const hsize_t *scaled = udata->common.scaled; /* Scaled chunk offset */
H5S_sel_iter_t *chunk_iter = NULL; /* Memory selection iteration info */
hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */
- hssize_t sel_nelmts; /* Number of elements in selection */
+ hsize_t sel_nelmts; /* Number of elements in selection */
hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */
size_t chunk_size; /*size of a chunk */
- void *chunk; /* The file chunk */
+ void *chunk; /* The file chunk */
H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
uint32_t bytes_accessed; /* Bytes accessed in chunk */
unsigned u; /* Local index variable */
@@ -5221,8 +5201,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
/* Get the number of elements in the selection */
sel_nelmts = H5S_GET_SELECT_NPOINTS(udata->chunk_space);
- HDassert(sel_nelmts >= 0);
- H5_CHECK_OVERFLOW(sel_nelmts, hssize_t, size_t);
+ H5_CHECK_OVERFLOW(sel_nelmts, hsize_t, size_t);
/* Check for VL datatype & non-default fill value */
if(udata->fb_info.has_vlen_fill_type)
@@ -5263,18 +5242,18 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_prune_fill */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_prune_by_extent
+ * Function: H5D__chunk_prune_by_extent
*
- * Purpose: This function searches for chunks that are no longer necessary
+ * Purpose: This function searches for chunks that are no longer necessary
* both in the raw data cache and in the chunk index.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * Algorithm: Robb Matzke
- * March 27, 2002
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Algorithm: Robb Matzke
+ * March 27, 2002
*
* The algorithm is:
*
@@ -5376,7 +5355,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
H5D_io_info_t chk_io_info; /* Chunked I/O info object */
H5D_storage_t chk_store; /* Chunk storage information */
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
+ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
unsigned space_ndims; /* Dataset's space rank */
const hsize_t *space_dim; /* Current dataspace dimensions */
unsigned op_dim; /* Current operating dimension */
@@ -5391,7 +5370,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
uint32_t elmts_per_chunk; /* Elements in chunk */
hbool_t disable_edge_filters = FALSE; /* Whether to disable filters on partial edge chunks */
hbool_t new_unfilt_chunk = FALSE; /* Whether the chunk is newly unfiltered */
- unsigned u; /* Local index variable */
+ unsigned u; /* Local index variable */
const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@@ -5425,13 +5404,13 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
elmts_per_chunk = 1;
for(u = 0; u < space_ndims; u++) {
elmts_per_chunk *= layout->u.chunk.dim[u];
- chunk_dim[u] = layout->u.chunk.dim[u];
- shrunk_dim[u] = (space_dim[u] < old_dim[u]);
+ chunk_dim[u] = layout->u.chunk.dim[u];
+ shrunk_dim[u] = (space_dim[u] < old_dim[u]);
} /* end for */
/* Create a dataspace for a chunk & set the extent */
if(NULL == (chunk_space = H5S_create_simple(space_ndims, chunk_dim, NULL)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Reset hyperslab start array */
/* (hyperslabs will always start from origin) */
@@ -5452,7 +5431,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
/* Initialize the user data for the iteration */
HDmemset(&udata, 0, sizeof udata);
udata.common.layout = &layout->u.chunk;
- udata.common.storage = &layout->storage.u.chunk;
+ udata.common.storage = sc;
udata.common.scaled = scaled;
udata.io_info = &chk_io_info;
udata.idx_info = &idx_info;
@@ -5465,7 +5444,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
/* Initialize user data for removal */
idx_udata.layout = &layout->u.chunk;
- idx_udata.storage = &layout->storage.u.chunk;
+ idx_udata.storage = sc;
/* Determine if partial edge chunk filters are disabled */
disable_edge_filters = (layout->u.chunk.flags
@@ -5554,11 +5533,11 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
} /* end if */
else
dims_outside_fill[u] = FALSE;
- } /* end if */
+ } /* end else */
carry = FALSE;
while(!carry) {
- int i; /* Local index variable */
+ int i; /* Local index variable */
udata.common.scaled = scaled;
@@ -5619,10 +5598,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
/* Remove the chunk from disk, if present */
if(H5F_addr_defined(chk_udata.chunk_block.offset)) {
/* Update the offset in idx_udata */
- idx_udata.scaled = udata.common.scaled;
+ idx_udata.scaled = udata.common.scaled;
/* Remove the chunk from disk */
- if((layout->storage.u.chunk.ops->remove)(&idx_info, &idx_udata) < 0)
+ if((sc->ops->remove)(&idx_info, &idx_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry from index")
} /* end if */
} /* end else */
@@ -5687,16 +5666,16 @@ done:
} /* end H5D__chunk_prune_by_extent() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_addrmap_cb
+ * Function: H5D__chunk_addrmap_cb
*
* Purpose: Callback when obtaining the chunk addresses for all existing chunks
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Kent Yang
+ * Programmer: Kent Yang
* Tuesday, November 15, 2005
*
*-------------------------------------------------------------------------
@@ -5704,12 +5683,11 @@ done:
static int
H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */
+ H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */
unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */
hsize_t chunk_index;
- int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Compute the index for this chunk */
chunk_index = H5VM_array_offset_pre(rank, udata->common.layout->down_chunks, chunk_rec->scaled);
@@ -5717,18 +5695,17 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Set it in the userdata to return */
udata->chunk_addr[chunk_index] = chunk_rec->chunk_addr;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5D__chunk_addrmap_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_addrmap
+ * Function: H5D__chunk_addrmap
*
* Purpose: Obtain the chunk addresses for all existing chunks
*
- * Return: Success: Non-negative on succeed.
- * Failure: negative value
+ * Return: Success: Non-negative on succeed.
+ * Failure: negative value
*
* Programmer: Kent Yang
* November 15, 2005
@@ -5740,7 +5717,7 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[])
{
H5D_chk_idx_info_t idx_info; /* Chunked index info */
const H5D_t *dset = io_info->dset; /* Local pointer to dataset info */
- H5D_chunk_it_ud2_t udata; /* User data for iteration callback */
+ H5D_chunk_it_ud2_t udata; /* User data for iteration callback */
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@@ -5754,17 +5731,17 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[])
/* Set up user data for B-tree callback */
HDmemset(&udata, 0, sizeof(udata));
udata.common.layout = &dset->shared->layout.u.chunk;
- udata.common.storage = &dset->shared->layout.storage.u.chunk;
+ udata.common.storage = sc;
udata.chunk_addr = chunk_addr;
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Iterate over chunks to build mapping of chunk addresses */
- if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_addrmap_cb, &udata) < 0)
+ if((sc->ops->iterate)(&idx_info, H5D__chunk_addrmap_cb, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to iterate over chunk index to build address map")
done:
@@ -5772,16 +5749,16 @@ done:
} /* end H5D__chunk_addrmap() */
#endif /* H5_HAVE_PARALLEL */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_delete
+ * Function: H5D__chunk_delete
*
- * Purpose: Delete raw data storage for entire dataset (i.e. all chunks)
+ * Purpose: Delete raw data storage for entire dataset (i.e. all chunks)
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, March 20, 2003
*
*-------------------------------------------------------------------------
@@ -5794,8 +5771,7 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage)
hbool_t layout_read = FALSE; /* Whether the layout message was read from the file */
H5O_pline_t pline; /* I/O pipeline message */
hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */
- htri_t exists; /* Flag if header message of interest exists */
- H5O_storage_chunk_t *sc = &(storage->u.chunk);
+ htri_t exists; /* Flag if header message of interest exists */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -5804,7 +5780,7 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage)
HDassert(f);
HDassert(oh);
HDassert(storage);
- H5D_CHUNK_STORAGE_INDEX_CHK(sc);
+ H5D_CHUNK_STORAGE_INDEX_CHK(&storage->u.chunk);
/* Check for I/O pipeline message */
if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
@@ -5850,17 +5826,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_delete() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_update_cache
+ * Function: H5D__chunk_update_cache
*
- * Purpose: Update any cached chunks index values after the dataspace
+ * Purpose: Update any cached chunks index values after the dataspace
* size has changed
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, May 29, 2004
*
*-------------------------------------------------------------------------
@@ -5868,8 +5844,8 @@ done:
herr_t
H5D__chunk_update_cache(H5D_t *dset)
{
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
- H5D_rdcc_ent_t *ent, *next; /*cache entry */
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
+ H5D_rdcc_ent_t *ent, *next; /*cache entry */
H5D_rdcc_ent_t tmp_head; /* Sentinel entry for temporary entry list */
H5D_rdcc_ent_t *tmp_tail; /* Tail pointer for temporary entry list */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5890,7 +5866,7 @@ H5D__chunk_update_cache(H5D_t *dset)
/* Recompute the index for each cached chunk that is in a dataset */
for(ent = rdcc->head; ent; ent = next) {
- unsigned old_idx; /* Previous index number */
+ unsigned old_idx; /* Previous index number */
/* Get the pointer to the next cache entry */
next = ent->next;
@@ -5900,7 +5876,7 @@ H5D__chunk_update_cache(H5D_t *dset)
ent->idx = H5D__chunk_hash_val(dset->shared, ent->scaled);
if(old_idx != ent->idx) {
- H5D_rdcc_ent_t *old_ent; /* Old cache entry */
+ H5D_rdcc_ent_t *old_ent; /* Old cache entry */
/* Check if there is already a chunk at this chunk's new location */
old_ent = rdcc->slot[ent->idx];
@@ -5963,7 +5939,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_update_cache() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_copy_cb
*
@@ -6011,11 +5987,10 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Check for an edge chunk that is not filtered */
if(pline && pline->nused) {
must_filter = TRUE;
- if( (udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
- (H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim,
- chunk_rec->scaled, udata->dset_dims)) )
+ if((udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
+ H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims))
must_filter = FALSE;
- }
+ } /* end if */
/* Check parameter for type conversion */
if(udata->do_convert) {
@@ -6053,7 +6028,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(!H5F_addr_defined(chunk_rec->chunk_addr));
H5MM_memcpy(buf, udata->chunk, nbytes);
udata->chunk = NULL;
- }
+ } /* end if */
else {
H5D_rdcc_ent_t *ent = NULL; /* Cache entry */
unsigned idx; /* Index of chunk in cache, if present */
@@ -6086,13 +6061,13 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t);
H5MM_memcpy(buf, ent->chunk, nbytes);
- }
+ } /* end if */
else {
/* read chunk data from the source file */
if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
- }
- }
+ } /* end else */
+ } /* end else */
/* Need to uncompress filtered variable-length & reference data elements that are not found in chunk cache */
if(must_filter && (is_vlen || fix_ref) && !udata->chunk_in_cache) {
@@ -6129,23 +6104,15 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed")
/* Reclaim space from variable length data */
- if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, H5_ITER_ERROR, "unable to reclaim variable-length data")
} /* end if */
else if(fix_ref) {
/* Check for expanding references */
/* (background buffer has already been zeroed out, if not expanding) */
if(udata->cpy_info->expand_ref) {
- size_t ref_count;
- size_t dt_size;
-
- /* Determine # of reference elements to copy */
- if((dt_size = H5T_get_size(udata->dt_src)) == 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "size must not be 0")
- ref_count = nbytes / dt_size;
-
/* Copy the reference elements */
- if(H5O_copy_expand_ref(udata->file_src, buf, udata->idx_info_dst->f, bkg, ref_count, H5T_get_ref_type(udata->dt_src), udata->cpy_info) < 0)
+ if(H5O_copy_expand_ref(udata->file_src, udata->tid_src, udata->dt_src, buf, nbytes, udata->idx_info_dst->f, bkg, udata->cpy_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy reference attribute")
} /* end if */
@@ -6177,8 +6144,8 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
udata->chunk_in_cache = FALSE;
- udata_dst.chunk_idx = H5VM_array_offset_pre(udata_dst.common.layout->ndims - 1,
- udata_dst.common.layout->max_down_chunks, udata_dst.common.scaled);
+ udata_dst.chunk_idx = H5VM_array_offset_pre(udata_dst.common.layout->ndims - 1,
+ udata_dst.common.layout->max_down_chunks, udata_dst.common.scaled);
/* Allocate chunk in the file */
if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert, udata_dst.common.scaled) < 0)
@@ -6204,17 +6171,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_copy_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_copy
+ * Function: H5D__chunk_copy
*
- * Purpose: Copy chunked storage from SRC file to DST file.
+ * Purpose: Copy chunked storage from SRC file to DST file.
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
* Programmer: Peter Cao
- * August 20, 2005
+ * August 20, 2005
*
*-------------------------------------------------------------------------
*/
@@ -6328,7 +6295,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
@@ -6488,7 +6455,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_bh_info
*
@@ -6540,26 +6507,25 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout,
idx_info.f = loc->file;
idx_info.pline = &pline;
idx_info.layout = &layout->u.chunk;
- idx_info.storage = &layout->storage.u.chunk;
+ idx_info.storage = sc;
/* Get the dataspace for the dataset */
if(NULL == (space = H5S_read(loc)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header")
/* Allocate any indexing structures */
- if(layout->storage.u.chunk.ops->init && (layout->storage.u.chunk.ops->init)(&idx_info, space, loc->addr) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
+ if(sc->ops->init && (sc->ops->init)(&idx_info, space, loc->addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
idx_info_init = TRUE;
/* Get size of index structure */
- if(layout->storage.u.chunk.ops->size && (layout->storage.u.chunk.ops->size)(&idx_info, index_size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info")
+ if(sc->ops->size && (sc->ops->size)(&idx_info, index_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info")
done:
/* Free resources, if they've been initialized */
- if(idx_info_init && layout->storage.u.chunk.ops->dest &&
- (layout->storage.u.chunk.ops->dest)(&idx_info) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
+ if(idx_info_init && sc->ops->dest && (sc->ops->dest)(&idx_info) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
if(pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message")
if(space && H5S_close(space) < 0)
@@ -6568,18 +6534,18 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_bh_info() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_dump_index_cb
+ * Function: H5D__chunk_dump_index_cb
*
- * Purpose: If the UDATA.STREAM member is non-null then debugging
+ * Purpose: If the UDATA.STREAM member is non-null then debugging
* information is written to that stream.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 21, 1999
*
*-------------------------------------------------------------------------
@@ -6587,7 +6553,7 @@ done:
static int
H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5D_chunk_it_ud4_t *udata = (H5D_chunk_it_ud4_t *)_udata; /* User data from caller */
+ H5D_chunk_it_ud4_t *udata = (H5D_chunk_it_ud4_t *)_udata; /* User data from caller */
FUNC_ENTER_STATIC_NOERR
@@ -6613,17 +6579,17 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5D__chunk_dump_index_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_dump_index
+ * Function: H5D__chunk_dump_index
*
- * Purpose: Prints information about the storage index to the specified
- * stream.
+ * Purpose: Prints information about the storage index to the specified
+ * stream.
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 28, 1999
*
*-------------------------------------------------------------------------
@@ -6646,14 +6612,14 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream)
H5D_chunk_it_ud4_t udata; /* User data for callback */
/* Display info for index */
- if((dset->shared->layout.storage.u.chunk.ops->dump)(&dset->shared->layout.storage.u.chunk, stream) < 0)
+ if((sc->ops->dump)(sc, stream) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info")
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
- idx_info.storage = &dset->shared->layout.storage.u.chunk;
+ idx_info.storage = sc;
/* Set up user data for callback */
udata.stream = stream;
@@ -6662,7 +6628,7 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream)
udata.chunk_dim = dset->shared->layout.u.chunk.dim;
/* Iterate over index and dump chunk info */
- if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0)
+ if((sc->ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to dump chunk info")
} /* end if */
@@ -6671,17 +6637,17 @@ done:
} /* end H5D__chunk_dump_index() */
#ifdef H5D_CHUNK_DEBUG
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_stats
+ * Function: H5D__chunk_stats
*
- * Purpose: Print raw data cache statistics to the debug stream. If
- * HEADERS is non-zero then print table column headers,
- * otherwise assume that the H5AC layer has already printed them.
+ * Purpose: Print raw data cache statistics to the debug stream. If
+ * HEADERS is non-zero then print table column headers,
+ * otherwise assume that the H5AC layer has already printed them.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -6689,9 +6655,9 @@ done:
herr_t
H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
{
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- double miss_rate;
- char ascii[32];
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
+ double miss_rate;
+ char ascii[32];
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -6735,22 +6701,22 @@ done:
} /* end H5D__chunk_stats() */
#endif /* H5D_CHUNK_DEBUG */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__nonexistent_readvv_cb
+ * Function: H5D__nonexistent_readvv_cb
*
- * Purpose: Callback operation for performing fill value I/O operation
+ * Purpose: Callback operation for performing fill value I/O operation
* on memory buffer.
*
- * Note: This algorithm is pretty inefficient about initializing and
+ * Note: This algorithm is pretty inefficient about initializing and
* terminating the fill buffer info structure and it would be
* faster to refactor this into a "real" initialization routine,
* and a "vectorized fill" routine. -QAK
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * 30 Sep 2010
+ * Programmer: Quincey Koziol
+ * 30 Sep 2010
*
*-------------------------------------------------------------------------
*/
@@ -6784,24 +6750,24 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__nonexistent_readvv_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5D__nonexistent_readvv
+ * Function: H5D__nonexistent_readvv
*
- * Purpose: When the chunk doesn't exist on disk and the chunk is bigger
+ * Purpose: When the chunk doesn't exist on disk and the chunk is bigger
* than the cache size, performs fill value I/O operation on
* memory buffer, advancing through two I/O vectors, until one
* runs out.
*
- * Note: This algorithm is pretty inefficient about initializing and
+ * Note: This algorithm is pretty inefficient about initializing and
* terminating the fill buffer info structure and it would be
* faster to refactor this into a "real" initialization routine,
* and a "vectorized fill" routine. -QAK
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * 6 Feb 2009
+ * Programmer: Raymond Lu
+ * 6 Feb 2009
*
*-------------------------------------------------------------------------
*/
@@ -6838,7 +6804,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__nonexistent_readvv() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_is_partial_edge_chunk
*
@@ -6877,14 +6843,14 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_is_partial_edge_chunk() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_file_alloc()
*
- * Purpose: Chunk allocation:
- * Create the chunk if it doesn't exist, or reallocate the
+ * Purpose: Chunk allocation:
+ * Create the chunk if it doesn't exist, or reallocate the
* chunk if its size changed.
- * The coding is moved and modified from each index structure.
+ * The coding is moved and modified from each index structure.
*
* Return: Non-negative on success/Negative on failure
*
@@ -6896,8 +6862,8 @@ herr_t
H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled)
{
- hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -6915,7 +6881,7 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
/* Check for filters on chunks */
if(idx_info->pline->nused > 0) {
/* Sanity/error checking block */
- HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE);
+ HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE);
{
unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */
unsigned new_chunk_size_len; /* Size of encoded chunk size */
@@ -6965,9 +6931,9 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
} /* end else */
} /* end if */
else {
- HDassert(!H5F_addr_defined(new_chunk->offset));
- HDassert(new_chunk->length == idx_info->layout->size);
- alloc_chunk = TRUE;
+ HDassert(!H5F_addr_defined(new_chunk->offset));
+ HDassert(new_chunk->length == idx_info->layout->size);
+ alloc_chunk = TRUE;
} /* end else */
/* Actually allocate space for the chunk in the file */
@@ -7007,11 +6973,11 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HDassert(H5F_addr_defined(new_chunk->offset));
-done:
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_file_alloc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_format_convert_cb
*
@@ -7029,13 +6995,13 @@ done:
static int
H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5D_chunk_it_ud5_t *udata = (H5D_chunk_it_ud5_t *)_udata; /* User data */
- H5D_chk_idx_info_t *new_idx_info; /* The new chunk index information */
- H5D_chunk_ud_t insert_udata; /* Chunk information to be inserted */
- haddr_t chunk_addr; /* Chunk address */
- size_t nbytes; /* Chunk size */
- void *buf = NULL; /* Pointer to buffer of chunk data */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5D_chunk_it_ud5_t *udata = (H5D_chunk_it_ud5_t *)_udata; /* User data */
+ H5D_chk_idx_info_t *new_idx_info; /* The new chunk index information */
+ H5D_chunk_ud_t insert_udata; /* Chunk information to be inserted */
+ haddr_t chunk_addr; /* Chunk address */
+ size_t nbytes; /* Chunk size */
+ void *buf = NULL; /* Pointer to buffer of chunk data */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -7053,7 +7019,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
unsigned filter_mask = chunk_rec->filter_mask;
H5Z_cb_t filter_cb; /* Filter failure callback struct */
- size_t read_size = nbytes; /* Bytes to read */
+ size_t read_size = nbytes; /* Bytes to read */
HDassert(read_size == new_idx_info->layout->size);
@@ -7108,12 +7074,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_format_convert_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_format_convert
*
* Purpose: Iterate over the chunks for the current chunk index and insert the
- * the chunk addresses into v1 B-tree chunk index via callback.
+ * the chunk addresses into v1 B-tree chunk index via callback.
*
* Return: Non-negative on success/Negative on failure
*
@@ -7125,7 +7091,7 @@ done:
herr_t
H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx_info_t *new_idx_info)
{
- H5D_chunk_it_ud5_t udata; /* User data */
+ H5D_chunk_it_ud5_t udata; /* User data */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -7138,15 +7104,15 @@ H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx
udata.dset_ndims = dset->shared->ndims;
udata.dset_dims = dset->shared->curr_dims;
- /* terate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */
+ /* Iterate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */
if((idx_info->storage->ops->iterate)(idx_info, H5D__chunk_format_convert_cb, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_format_convert() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__get_num_chunks_cb
*
@@ -7178,7 +7144,7 @@ H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_u
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_num_chunks_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__get_num_chunks
*
@@ -7202,7 +7168,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
hsize_t num_chunks = 0; /* Number of written chunks */
H5D_rdcc_ent_t *ent; /* Cache entry */
const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
- const H5O_layout_t *layout; /* Dataset layout */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -7212,7 +7177,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
HDassert(space);
HDassert(nchunks);
- layout = &(dset->shared->layout); /* Dataset layout */
rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */
HDassert(rdcc);
@@ -7229,21 +7193,20 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
idx_info.storage = &dset->shared->layout.storage.u.chunk;
/* If the dataset is not written, number of chunks will be 0 */
- if(!H5F_addr_defined(idx_info.storage->idx_addr)) {
+ if(!H5F_addr_defined(idx_info.storage->idx_addr))
*nchunks = 0;
- }
else {
/* Iterate over the allocated chunks */
if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index")
*nchunks = num_chunks;
- }
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_num_chunks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info_cb
*
@@ -7262,7 +7225,6 @@ static int
H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata;
- hsize_t ii = 0; /* Dimension index */
int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
@@ -7272,17 +7234,20 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(chunk_info);
/* If this is the queried chunk, retrieve its info and stop iterating */
- if (chunk_info->curr_idx == chunk_info->chunk_idx) {
+ if(chunk_info->curr_idx == chunk_info->chunk_idx) {
+ hsize_t ii = 0; /* Dimension index */
+
+ /* Copy info */
chunk_info->filter_mask = chunk_rec->filter_mask;
chunk_info->chunk_addr = chunk_rec->chunk_addr;
chunk_info->nbytes = chunk_rec->nbytes;
- for (ii = 0; ii < chunk_info->ndims; ii++)
+ for(ii = 0; ii < chunk_info->ndims; ii++)
chunk_info->scaled[ii] = chunk_rec->scaled[ii];
chunk_info->found = TRUE;
/* Stop iterating */
ret_value = H5_ITER_STOP;
- }
+ } /* end if */
/* Go to the next chunk */
else
chunk_info->curr_idx++;
@@ -7290,7 +7255,7 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_chunk_info_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info
*
@@ -7341,9 +7306,9 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
idx_info.storage = &dset->shared->layout.storage.u.chunk;
/* Set addr & size for when dset is not written or queried chunk is not found */
- if (addr)
+ if(addr)
*addr = HADDR_UNDEF;
- if (size)
+ if(size)
*size = 0;
/* If the chunk is written, get its info, otherwise, return without error */
@@ -7372,14 +7337,14 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
if(offset)
for(ii = 0; ii < udata.ndims; ii++)
offset[ii] = udata.scaled[ii] * dset->shared->layout.u.chunk.dim[ii];
- }
+ } /* end if */
} /* end if H5F_addr_defined */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_chunk_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info_by_coord_cb
*
@@ -7397,9 +7362,9 @@ done:
static int
H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- hsize_t ii;
H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata;
hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */
+ hsize_t ii; /* Local index value */
int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
@@ -7409,12 +7374,12 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(chunk_info);
/* Going through the scaled, stop when a mismatch is found */
- for (ii = 0; ii < chunk_info->ndims && !different; ii++)
- if (chunk_info->scaled[ii] != chunk_rec->scaled[ii])
+ for(ii = 0; ii < chunk_info->ndims && !different; ii++)
+ if(chunk_info->scaled[ii] != chunk_rec->scaled[ii])
different = TRUE;
/* Same scaled coords means the chunk is found, copy the chunk info */
- if (!different) {
+ if(!different) {
chunk_info->nbytes = chunk_rec->nbytes;
chunk_info->filter_mask = chunk_rec->filter_mask;
chunk_info->chunk_addr = chunk_rec->chunk_addr;
@@ -7422,12 +7387,12 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Stop iterating */
ret_value = H5_ITER_STOP;
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_chunk_info_by_coord_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info_by_coord
*
@@ -7473,9 +7438,9 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned*
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
/* Set addr & size for when dset is not written or queried chunk is not found */
- if (addr)
+ if(addr)
*addr = HADDR_UNDEF;
- if (size)
+ if(size)
*size = 0;
/* Compose chunked index info struct */
@@ -7502,14 +7467,14 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned*
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve information of the chunk by its scaled coordinates")
/* Obtain requested info if the chunk is found */
- if (udata.found) {
+ if(udata.found) {
if(filter_mask)
*filter_mask = udata.filter_mask;
if(addr)
*addr = udata.chunk_addr;
if(size)
*size = udata.nbytes;
- }
+ } /* end if */
} /* end if H5F_addr_defined */
done:
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 29401f8..809cdfc 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -476,7 +476,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
@@ -551,26 +551,16 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
H5MM_memcpy(storage_dst->buf, buf, storage_dst->size);
- if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
else if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
if(f_src != f_dst) {
/* Check for expanding references */
if(cpy_info->expand_ref) {
- size_t ref_count;
- size_t src_dt_size; /* Source datatype size */
-
- /* Determine largest datatype size */
- if(0 == (src_dt_size = H5T_get_size(dt_src)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
-
- /* Determine # of reference elements to copy */
- ref_count = storage_src->size / src_dt_size;
-
/* Copy objects referenced in source buffer to destination file and set destination elements */
- if(H5O_copy_expand_ref(f_src, storage_src->buf, f_dst,
- storage_dst->buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0)
+ if (H5O_copy_expand_ref(f_src, tid_src, dt_src, storage_src->buf,
+ storage_src->size, f_dst, storage_dst->buf, cpy_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
} /* end if */
else
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index c9f9fc2..e48c3b3 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -1398,7 +1398,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
@@ -1543,19 +1543,14 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Reclaim space from variable length data */
- if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
else if(fix_ref) {
/* Check for expanding references */
if(cpy_info->expand_ref) {
- size_t ref_count;
-
- /* Determine # of reference elements to copy */
- ref_count = src_nbytes / H5T_get_size(dt_src);
-
/* Copy the reference elements */
- if(H5O_copy_expand_ref(f_src, buf, f_dst, bkg, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0)
+ if(H5O_copy_expand_ref(f_src, tid_src, dt_src, buf, buf_size, f_dst, bkg, cpy_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
/* After fix ref, copy the new reference elements to the buffer to write out */
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 6380bee..f4f4223 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -113,11 +113,9 @@ hid_t
H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t dcpl_id)
{
- void *dset = NULL; /* dset token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- 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)
@@ -129,6 +127,10 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
+ /* Set up collective metadata if appropriate */
+ if(H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read")
+
if(H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
else
@@ -138,10 +140,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Set the DCPL for the API context */
H5CX_set_dcpl(dcpl_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")
-
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -151,7 +149,8 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_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, lcpl_id, type_id, space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id,
+ H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
@@ -187,8 +186,8 @@ done:
hid_t
H5Dopen1(hid_t loc_id, const char *name)
{
- void *dset = NULL; /* dset token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -303,5 +302,55 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dextend() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dvlen_reclaim
+ *
+ * Purpose: Frees the buffers allocated for storing variable-length data
+ * in memory. Only frees the VL data in the selection defined in the
+ * dataspace. The dataset transfer property list is required to find the
+ * correct allocation/free methods for the VL data in the buffer.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, June 10, 1999
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf)
+{
+ H5S_t *space; /* Dataspace for iteration */
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "iii*x", type_id, space_id, dxpl_id, buf);
+
+ /* Check args */
+ if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
+ 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)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
+
+ /* 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 xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Call internal routine */
+ ret_value = H5T_reclaim(type_id, space, buf);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Dvlen_reclaim() */
+
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 3ccee90..f5a5238 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -249,12 +249,11 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
* of the VL data.
*/
if(TRUE == H5T_detect_class(fill_type, H5T_VLEN, FALSE)) {
- hssize_t nelmts; /* Number of data elements */
+ hsize_t nelmts; /* Number of data elements */
/* Get the number of elements in the selection */
nelmts = H5S_GET_SELECT_NPOINTS(space);
- HDassert(nelmts >= 0);
- H5_CHECK_OVERFLOW(nelmts, hssize_t, size_t);
+ H5_CHECK_OVERFLOW(nelmts, hsize_t, size_t);
/* Allocate a temporary buffer */
if(NULL == (tmp_buf = H5FL_BLK_MALLOC(type_conv, (size_t)nelmts * buf_size)))
diff --git a/src/H5Dint.c b/src/H5Dint.c
index ada542e..1624f7b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -43,13 +43,42 @@
/* Local Typedefs */
/******************/
+/* Shared data structure for computing variable-length dataset's total size */
+/* (Used for both native and generic 'get vlen buf size' operation) */
+typedef struct {
+ 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 */
+ size_t vl_tbuf_size; /* Current size of the temp. buffer for VL data */
+ hsize_t size; /* Accumulated number of bytes for the selection */
+} H5D_vlen_bufsize_common_t;
+
+/* Internal data structure for computing variable-length dataset's total size */
+/* (Used for native 'get vlen buf size' operation) */
+typedef struct {
+ H5D_t *dset; /* Dataset for operation */
+ H5S_t *fspace; /* Dataset's dataspace for operation */
+ H5S_t *mspace; /* Memory dataspace for operation */
+ H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */
+} H5D_vlen_bufsize_native_t;
+
+/* Internal data structure for computing variable-length dataset's total size */
+/* (Used for generic 'get vlen buf size' operation) */
+typedef struct {
+ H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */
+ hid_t fspace_id; /* Dataset dataspace ID of the dataset we are working on */
+ H5S_t *fspace; /* Dataset's dataspace for operation */
+ hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */
+ hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */
+ H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */
+} H5D_vlen_bufsize_generic_t;
+
/********************/
/* Local Prototypes */
/********************/
/* General stuff */
-static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
+static H5D_shared_t *H5D__new(hid_t dcpl_id, hid_t dapl, hbool_t creating, hbool_t vl_type);
static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
@@ -60,9 +89,14 @@ static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overw
hsize_t old_dim[]);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
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__use_minimized_dset_headers(H5F_t *file, 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);
+static void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
+static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim,
+ const hsize_t *point, void *op_data);
+static herr_t H5D__vlen_get_buf_size_gen_cb(void *elem, hid_t type_id, unsigned ndim,
+ const hsize_t *point, void *op_data);
/*********************/
@@ -98,8 +132,11 @@ H5FL_EXTERN(H5D_chunk_info_t);
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
+/* Disable warning for intentional identical branches here -QAK */
+H5_GCC_DIAG_OFF(larger-than=)
/* Define a static "default" dataset structure to use to initialize new datasets */
static H5D_shared_t H5D_def_dset;
+H5_GCC_DIAG_ON(larger-than=)
/* Dataset ID class */
static const H5I_class_t H5I_DATASET_CLS[1] = {{
@@ -113,7 +150,7 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{
static hbool_t H5D_top_package_initialize_s = FALSE;
/* Prefixes of VDS and external file from the environment variables
- * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */
+ * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */
static const char *H5D_prefix_ext_env = NULL;
static const char *H5D_prefix_vds_env = NULL;
@@ -465,7 +502,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5D_shared_t *
-H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
+H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type)
{
H5D_shared_t *new_dset = NULL; /* New dataset object */
H5P_genplist_t *plist; /* Property list created */
@@ -496,6 +533,19 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
new_dset->dcpl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
+ if(!vl_type && creating && dapl_id == H5P_DATASET_ACCESS_DEFAULT) {
+ if(H5I_inc_ref(dapl_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DAPL ID")
+ new_dset->dapl_id = dapl_id;
+ } /* end if */
+ else {
+ /* Get the property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
+
+ new_dset->dapl_id = H5P_copy_plist(plist, FALSE);
+ } /* end else */
+
/* Set return value */
ret_value = new_dset;
@@ -504,6 +554,8 @@ done:
if(new_dset != NULL) {
if(new_dset->dcpl_id != 0 && H5I_dec_ref(new_dset->dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID")
+ if(new_dset->dapl_id != 0 && H5I_dec_ref(new_dset->dapl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID")
new_dset = H5FL_FREE(H5D_shared_t, new_dset);
} /* end if */
@@ -547,7 +599,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* To use at least v18 format versions or not */
use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
- /* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
+ /* Copy the datatype if it's a custom datatype or if it'll change when its location is changed */
if(!immutable || relocatable || use_at_least_v18) {
/* Copy datatype for dataset */
if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
@@ -560,7 +612,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
/* Mark any datatypes as being on disk now */
- if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dset->shared->type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
/* Set the version for datatype */
@@ -684,14 +736,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize)
+H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT;
HDassert(file);
- HDassert(dset);
HDassert(minimize);
/* Get the dataset object header minimize flag for this call */
@@ -962,7 +1013,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info")
} /* end if */
- if(H5D__use_minimized_dset_headers(file, dset, &minimize_header) == FAIL)
+ if(H5D__use_minimized_dset_headers(file, &minimize_header) == FAIL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings")
if(TRUE == minimize_header) {
@@ -1225,9 +1276,8 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
H5G_loc_reset(&dset_loc);
/* Initialize the shared dataset space */
- if(NULL == (new_dset->shared = H5D__new(dcpl_id, TRUE, has_vl_type)))
+ if(NULL == (new_dset->shared = H5D__new(dcpl_id, dapl_id, TRUE, has_vl_type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
/* Copy & initialize datatype for dataset */
if(H5D__init_type(file, new_dset, type_id, type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy datatype")
@@ -1320,14 +1370,14 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information")
/* Update the dataset's object header info. */
- if(H5D__update_oh_info(file, new_dset, dapl_id) < 0)
+ if(H5D__update_oh_info(file, new_dset, new_dset->shared->dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache")
/* Indicate that the layout information was initialized */
layout_init = TRUE;
/* Set up append flush parameters for the dataset */
- if(H5D__append_flush_setup(new_dset, dapl_id) < 0)
+ if(H5D__append_flush_setup(new_dset, new_dset->shared->dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property")
/* Set the external file prefix */
@@ -1382,6 +1432,8 @@ done:
} /* end if */
if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
+ if(new_dset->shared->dapl_id != 0 && H5I_dec_ref(new_dset->shared->dapl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix);
new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix);
new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared);
@@ -1482,7 +1534,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Shallow copy (take ownership) of the object location object */
- if(H5O_loc_copy(&(dataset->oloc), loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&(dataset->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
@@ -1686,7 +1738,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
HDassert(dataset);
/* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */
- if(NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, FALSE, FALSE)))
+ if(NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, dapl_id, FALSE, FALSE)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Open the dataset object */
@@ -1697,7 +1749,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
if(NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header")
- if(H5T_set_loc(dataset->shared->type, dataset->oloc.file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dataset->shared->type, H5F_VOL_OBJ(dataset->oloc.file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc))))
@@ -1968,12 +2020,13 @@ 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 and access property lists -- 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) ||
(H5S_close(dataset->shared->space) < 0) ||
- (H5I_dec_ref(dataset->shared->dcpl_id) < 0);
+ (H5I_dec_ref(dataset->shared->dcpl_id) < 0) ||
+ (H5I_dec_ref(dataset->shared->dapl_id) < 0);
/* Remove the dataset from the list of opened objects in the file */
if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
@@ -2542,81 +2595,180 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_vlen_reclaim
+ * Function: H5D__vlen_get_buf_size_alloc
*
- * Purpose: Frees the buffers allocated for storing variable-length data
- * in memory. Only frees the VL data in the selection defined in the
- * dataspace.
+ * Purpose: This routine makes certain there is enough space in the temporary
+ * buffer for the new data to read in. All the VL data read in is actually
+ * placed in this buffer, overwriting the previous data. Needless to say,
+ * this data is not actually usable.
*
* Return: Non-negative on success, negative on failure
+ *
*-------------------------------------------------------------------------
*/
-herr_t
-H5D_vlen_reclaim(hid_t type_id, H5S_t *space, void *buf)
+static void *
+H5D__vlen_get_buf_size_alloc(size_t size, void *info)
{
- H5T_t *type; /* Datatype */
- H5S_sel_iter_op_t dset_op; /* Operator for iteration */
- H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */
- herr_t ret_value = FAIL; /* Return value */
+ H5D_vlen_bufsize_common_t *vlen_bufsize_com = (H5D_vlen_bufsize_common_t *)info;
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
- /* Check args */
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
- HDassert(space);
- HDassert(buf);
+ /* Check for increasing the size of the temporary space for VL data */
+ if(size > vlen_bufsize_com->vl_tbuf_size) {
+ if(NULL == (vlen_bufsize_com->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize_com->vl_tbuf, size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't reallocate temporary VL data buffer")
+ vlen_bufsize_com->vl_tbuf_size = size;
+ } /* end if */
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
+ /* Increment size of VL data buffer needed */
+ vlen_bufsize_com->size += size;
- /* Get the allocation info */
- if(H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
+ /* Set return value */
+ ret_value = vlen_bufsize_com->vl_tbuf;
- /* Call H5S_select_iterate with args, etc. */
- dset_op.op_type = H5S_SEL_ITER_OP_APP;
- dset_op.u.app_op.op = H5T_vlen_reclaim;
- dset_op.u.app_op.type_id = type_id;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__vlen_get_buf_size_alloc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__vlen_get_buf_size_cb
+ *
+ * Purpose: Dataspace selection iteration callback for H5Dvlen_get_buf_size.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id,
+ unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data)
+{
+ H5D_vlen_bufsize_native_t *vlen_bufsize = (H5D_vlen_bufsize_native_t *)op_data;
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(point);
+ HDassert(op_data);
+
+ /* Select point to read in */
+ if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5_ITER_ERROR, "can't select point")
- ret_value = H5S_select_iterate(buf, type, space, &dset_op, &vl_alloc_info);
+ /* 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->common.fl_tbuf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, H5_ITER_ERROR, "can't read point")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_vlen_reclaim() */
+} /* end H5D__vlen_get_buf_size_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__vlen_get_buf_size_alloc
+ * Function: H5D__vlen_get_buf_size
*
- * Purpose: This routine makes certain there is enough space in the temporary
- * buffer for the new data to read in. All the VL data read in is actually
- * placed in this buffer, overwriting the previous data. Needless to say,
- * this data is not actually usable.
+ * Purpose: This routine checks the number of bytes required to store the VL
+ * data from the dataset, using the space_id for the selection in the
+ * dataset on disk and the type_id for the memory representation of the
+ * VL data, in memory. The *size value is modified according to how many
+ * bytes are required to store the VL data in memory.
+ *
+ * Implementation: This routine actually performs the read with a custom
+ * memory manager which basically just counts the bytes requested and
+ * uses a temporary memory buffer (through the H5FL API) to make certain
+ * enough space is available to perform the read. Then the temporary
+ * buffer is released and the number of bytes allocated is returned.
+ * Kinda kludgy, but easier than the other method of trying to figure out
+ * the sizes without actually reading the data in... - QAK
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 11, 1999
*
- * Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
-void *
-H5D__vlen_get_buf_size_alloc(size_t size, void *info)
+herr_t
+H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id,
+ hsize_t *size)
{
- H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)info;
- void *ret_value = NULL; /* Return value */
+ H5D_vlen_bufsize_native_t vlen_bufsize = {NULL, NULL, NULL, {NULL, NULL, 0, 0}};
+ H5S_t *fspace = NULL; /* Dataset's dataspace */
+ H5S_t *mspace = NULL; /* Memory dataspace */
+ char bogus; /* bogus value to pass to H5Diterate() */
+ H5S_t *space; /* Dataspace for iteration */
+ H5T_t *type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_PACKAGE
- FUNC_ENTER_PACKAGE_NOERR
+ /* Check args */
+ if(NULL == (type = (H5T_t *)H5I_object(type_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
+ if(NULL == (space = (H5S_t *)H5I_object(space_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
+ if(!(H5S_has_extent(space)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
+
+ /* Save the dataset */
+ vlen_bufsize.dset = dset;
+
+ /* 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;
+
+ /* 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;
+
+ /* Grab the temporary buffers required */
+ if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
+ if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
+ vlen_bufsize.common.vl_tbuf_size = 1;
+
+ /* Set the memory manager to the special allocation routine */
+ if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine")
+
+ /* Set the initial number of bytes required */
+ vlen_bufsize.common.size = 0;
- /* Get a temporary pointer to space for the VL data */
- if((vlen_bufsize->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize->vl_tbuf, size)) != NULL)
- vlen_bufsize->size += size;
+ /* 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_cb;
+ dset_op.u.app_op.type_id = type_id;
- /* Set return value */
- ret_value = vlen_bufsize->vl_tbuf;
+ ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
+
+ /* Get the size if we succeeded */
+ if(ret_value >= 0)
+ *size = vlen_bufsize.common.size;
+
+done:
+ if(fspace && H5S_close(fspace) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ if(mspace && H5S_close(mspace) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ if(vlen_bufsize.common.fl_tbuf != NULL)
+ vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf);
+ if(vlen_bufsize.common.vl_tbuf != NULL)
+ vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__vlen_get_buf_size_alloc() */
+} /* end H5D__vlen_get_buf_size() */
/*-------------------------------------------------------------------------
- * Function: H5D__vlen_get_buf_size
+ * Function: H5D__vlen_get_buf_size_gen_cb
*
* Purpose: This routine checks the number of bytes required to store a single
* element from a dataset in memory, creating a selection with just the
@@ -2636,42 +2788,152 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info)
* Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
-herr_t
-H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
+static herr_t
+H5D__vlen_get_buf_size_gen_cb(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;
+ H5D_vlen_bufsize_generic_t *vlen_bufsize = (H5D_vlen_bufsize_generic_t *)op_data;
H5T_t *dt; /* Datatype for operation */
- H5S_t *fspace; /* File dataspace for operation */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
+ /* Sanity check */
+ HDassert(point);
HDassert(op_data);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a datatype")
/* Make certain there is enough fixed-length buffer available */
- if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt))))
+ if(NULL == (vlen_bufsize->common.fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->common.fl_tbuf, H5T_get_size(dt))))
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Select point to read in */
- 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)
+ if(H5S_select_elements(vlen_bufsize->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(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)
+ if(H5VL_dataset_read(vlen_bufsize->dset_vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->common.fl_tbuf, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__vlen_get_buf_size() */
+} /* end H5D__vlen_get_buf_size_gen_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__vlen_get_buf_size_gen
+ *
+ * Purpose: Generic routine to checks the number of bytes required to store the
+ * VL data from the dataset.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 20, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id,
+ hsize_t *size)
+{
+ H5D_vlen_bufsize_generic_t vlen_bufsize = {NULL, H5I_INVALID_HID, NULL, H5I_INVALID_HID, H5I_INVALID_HID, {NULL, NULL, 0, 0}};
+ H5P_genplist_t *dxpl = NULL; /* DXPL for operation */
+ H5S_t *mspace = NULL; /* Memory dataspace */
+ char bogus; /* Bogus value to pass to H5Diterate() */
+ H5S_t *space; /* Dataspace for iteration */
+ H5T_t *type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check args */
+ if(NULL == (type = (H5T_t *)H5I_object(type_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not an valid datatype")
+ if(NULL == (space = (H5S_t *)H5I_object(space_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid dataspace")
+ if(!(H5S_has_extent(space)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
+
+ /* Save the dataset */
+ vlen_bufsize.dset_vol_obj = vol_obj;
+
+ /* Get a copy of the dataset's dataspace */
+ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace")
+ if(NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Create a scalar for the memory dataspace */
+ if(NULL == (mspace = H5S_create(H5S_SCALAR)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+
+ /* Grab the temporary buffers required */
+ if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available")
+ if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available")
+ vlen_bufsize.common.vl_tbuf_size = 1;
+
+ /* Set the VL allocation callbacks on a DXPL */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL")
+ if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy property list");
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL")
+ if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL")
+
+ /* Set the initial number of bytes required */
+ vlen_bufsize.common.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_gen_cb;
+ dset_op.u.app_op.type_id = type_id;
+
+ ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
+
+ /* Get the size if we succeeded */
+ if(ret_value >= 0)
+ *size = vlen_bufsize.common.size;
+
+done:
+ if(vlen_bufsize.fspace_id >= 0) {
+ if(H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id")
+ vlen_bufsize.fspace = NULL;
+ } /* end if */
+ if(vlen_bufsize.fspace && H5S_close(vlen_bufsize.fspace) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ if(vlen_bufsize.mspace_id >= 0) {
+ if(H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id")
+ mspace = NULL;
+ } /* end if */
+ if(mspace && H5S_close(mspace) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ if(vlen_bufsize.common.fl_tbuf != NULL)
+ vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf);
+ if(vlen_bufsize.common.vl_tbuf != NULL)
+ vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf);
+ if(vlen_bufsize.dxpl_id != H5I_INVALID_HID) {
+ if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list")
+ dxpl = NULL;
+ } /* end if */
+ if(dxpl && H5P_close(dxpl) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release DXPL")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__vlen_get_buf_size_gen() */
/*-------------------------------------------------------------------------
@@ -3472,22 +3734,26 @@ done:
hid_t
H5D_get_access_plist(const H5D_t *dset)
{
- H5P_genplist_t *old_plist; /* Default DAPL */
+ H5P_genplist_t *old_plist; /* Stored DAPL from dset */
H5P_genplist_t *new_plist; /* New DAPL */
+ H5P_genplist_t *def_fapl; /* Default FAPL */
+ H5D_append_flush_t def_append_flush_info = {0}; /* Default append flush property */
+ H5D_rdcc_t def_chunk_info; /* Default chunk cache property */
hid_t new_dapl_id = FAIL;
hid_t ret_value = FAIL;
FUNC_ENTER_NOAPI_NOINIT
- /* Make a copy of the default dataset access property list */
- 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")
+ /* Make a copy of the dataset's dataset access property list */
+ if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(dset->shared->dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list")
if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0)
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")
- /* If the dataset is chunked then copy the rdcc & append flush parameters */
+ /* If the dataset is chunked then copy the rdcc & append flush parameters.
+ * Otherwise, use the default values. */
if(dset->shared->layout.type == H5D_CHUNKED) {
if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(dset->shared->cache.chunk.nslots)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots")
@@ -3497,7 +3763,33 @@ H5D_get_access_plist(const H5D_t *dset)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks")
if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &dset->shared->append_flush) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush property")
- } /* end if */
+ } else {
+ /* Get the default FAPL */
+ if(NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Set the data cache number of slots to the value of the default FAPL */
+ if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data number of slots");
+ if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache number of slots")
+
+ /* Set the data cache byte size to the value of the default FAPL */
+ if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data cache byte size");
+ if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache byte size")
+
+ /* Set the preempt read chunks property to the value of the default FAPL */
+ if (H5P_get(def_fapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get preempt read chunks");
+ if(H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set preempt read chunks")
+
+ /* Set the append flush property to its default value */
+ if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &def_append_flush_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set append flush property")
+ }/* end if-else */
/* Set the VDS view & printf gap options */
if(H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0)
@@ -3589,7 +3881,7 @@ H5D__get_type(const H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to patch datatype's file pointer")
/* Copy the dataset's datatype */
- if(NULL == (dt = H5T_copy(dset->shared->type, H5T_COPY_REOPEN)))
+ if(NULL == (dt = H5T_copy_reopen(dset->shared->type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype")
/* Mark any datatypes as being in memory now */
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 1e6e70d..3d49df7 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -32,11 +32,6 @@
#include "H5VLnative_private.h" /* Native VOL connector */
-#ifdef H5_HAVE_PARALLEL
-/* Remove this if H5R_DATASET_REGION is no longer used in this file */
-#include "H5Rpublic.h"
-#endif /*H5_HAVE_PARALLEL*/
-
/****************/
/* Local Macros */
@@ -244,7 +239,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
H5CX_set_dxpl(dxpl_id);
/* Read the raw chunk */
- if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_READ, offset, filters, buf) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset, filters, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
done:
@@ -372,7 +367,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
H5CX_set_dxpl(dxpl_id);
/* Write chunk */
- if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters, offset, data_size_32, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:
@@ -414,9 +409,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Note that if this variable is used, the */
/* projected mem space must be discarded at the */
/* end of the function to avoid a memory leak. */
- H5D_storage_t store; /*union of EFL and chunk pointer in file space */
- hssize_t snelmts; /*total number of elmts (signed) */
- hsize_t nelmts; /*total number of elmts */
+ H5D_storage_t store; /* union of EFL and chunk pointer in file space */
+ hsize_t nelmts; /* total number of elmts */
hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */
@@ -430,9 +424,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
file_space = dataset->shared->space;
if(!mem_space)
mem_space = file_space;
- if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dst dataspace has invalid selection")
- H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
+ nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
/* Set up datatype info for operation */
if(H5D__typeinfo_init(dataset, mem_type_id, FALSE, &type_info) < 0)
@@ -455,7 +447,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
- if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
+ if(nelmts != H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected")
/* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
@@ -478,33 +470,33 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set")
/* H5S_select_shape_same() has been modified to accept topologically identical
- * selections with different rank as having the same shape (if the most
- * rapidly changing coordinates match up), but the I/O code still has
+ * selections with different rank as having the same shape (if the most
+ * rapidly changing coordinates match up), but the I/O code still has
* difficulties with the notion.
*
- * To solve this, we check to see if H5S_select_shape_same() returns true,
- * and if the ranks of the mem and file spaces are different. If the are,
- * construct a new mem space that is equivalent to the old mem space, and
+ * To solve this, we check to see if H5S_select_shape_same() returns true,
+ * and if the ranks of the mem and file spaces are different. If the are,
+ * construct a new mem space that is equivalent to the old mem space, and
* use that instead.
*
- * Note that in general, this requires us to touch up the memory buffer as
+ * Note that in general, this requires us to touch up the memory buffer as
* well.
*/
if(TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
- void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
+ const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
/* to the beginning of the projected mem space. */
/* Attempt to construct projected dataspace for memory dataspace */
if(H5S_select_construct_projection(mem_space, &projected_mem_space,
- (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, (const void **)&adj_buf, type_info.dst_type_size) < 0)
+ (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf, type_info.dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace")
HDassert(projected_mem_space);
HDassert(adj_buf);
/* Switch to using projected memory dataspace & adjusted buffer */
mem_space = projected_mem_space;
- buf = adj_buf;
+ buf = (void *)adj_buf; /* Casting away 'const' OK -QAK */
} /* end if */
@@ -628,9 +620,8 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Note that if this variable is used, the */
/* projected mem space must be discarded at the */
/* end of the function to avoid a memory leak. */
- H5D_storage_t store; /*union of EFL and chunk pointer in file space */
- hssize_t snelmts; /*total number of elmts (signed) */
- hsize_t nelmts; /*total number of elmts */
+ H5D_storage_t store; /* union of EFL and chunk pointer in file space */
+ hsize_t nelmts; /* total number of elmts */
hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */
@@ -685,12 +676,10 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
if(!mem_space)
mem_space = file_space;
- if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
- H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
+ nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
/* Make certain that the number of elements in each selection is the same */
- if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
+ if(nelmts != H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected")
/* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
@@ -712,27 +701,27 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
if(!(H5S_has_extent(mem_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set")
- /* H5S_select_shape_same() has been modified to accept topologically
- * identical selections with different rank as having the same shape
- * (if the most rapidly changing coordinates match up), but the I/O
+ /* H5S_select_shape_same() has been modified to accept topologically
+ * identical selections with different rank as having the same shape
+ * (if the most rapidly changing coordinates match up), but the I/O
* code still has difficulties with the notion.
*
- * To solve this, we check to see if H5S_select_shape_same() returns
- * true, and if the ranks of the mem and file spaces are different.
- * If the are, construct a new mem space that is equivalent to the
+ * To solve this, we check to see if H5S_select_shape_same() returns
+ * true, and if the ranks of the mem and file spaces are different.
+ * If the are, construct a new mem space that is equivalent to the
* old mem space, and use that instead.
*
- * Note that in general, this requires us to touch up the memory buffer
+ * Note that in general, this requires us to touch up the memory buffer
* as well.
*/
if(TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
- void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
+ const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
/* to the beginning of the projected mem space. */
/* Attempt to construct projected dataspace for memory dataspace */
if(H5S_select_construct_projection(mem_space, &projected_mem_space,
- (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, (const void **)&adj_buf, type_info.src_type_size) < 0)
+ (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf, type_info.src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace")
HDassert(projected_mem_space);
HDassert(adj_buf);
@@ -922,7 +911,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
HDassert(dset);
/* Patch the top level file pointer for dt->shared->u.vlen.f if needed */
- if(H5T_patch_vlen_file(dset->shared->type, dset->oloc.file) < 0 )
+ if(H5T_patch_vlen_file(dset->shared->type, H5F_VOL_OBJ(dset->oloc.file)) < 0 )
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer")
/* Initialize type info safely */
@@ -1142,7 +1131,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
uint32_t global_no_collective_cause;
hbool_t local_error_message_previously_written = FALSE;
hbool_t global_error_message_previously_written = FALSE;
- size_t index;
+ size_t idx;
size_t cause_strings_len;
char local_no_collective_cause_string[512] = "";
char global_no_collective_cause_string[512] = "";
@@ -1164,8 +1153,11 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
/* Append each of the "reason for breaking collective I/O" error messages to the
* local and global no collective cause strings */
- for (cause = 1, index = 0; (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (index < cause_strings_len); cause <<= 1, index++) {
- size_t cause_strlen = HDstrlen(cause_strings[index]);
+ for (cause = 1, idx = 0;
+ (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) &&
+ (idx < cause_strings_len);
+ cause <<= 1, idx++) {
+ size_t cause_strlen = HDstrlen(cause_strings[idx]);
if (cause & local_no_collective_cause) {
/* Check if there were any previous error messages included. If so, prepend a semicolon
@@ -1174,7 +1166,8 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
if(local_error_message_previously_written)
HDstrncat(local_no_collective_cause_string, "; ", 2);
- HDstrncat(local_no_collective_cause_string, cause_strings[index], cause_strlen);
+ HDstrncat(local_no_collective_cause_string,
+ cause_strings[idx], cause_strlen);
local_error_message_previously_written = TRUE;
} /* end if */
@@ -1186,7 +1179,8 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
if(global_error_message_previously_written)
HDstrncat(global_no_collective_cause_string, "; ", 2);
- HDstrncat(global_no_collective_cause_string, cause_strings[index], cause_strlen);
+ HDstrncat(global_no_collective_cause_string,
+ cause_strings[idx], cause_strlen);
global_error_message_previously_written = TRUE;
} /* end if */
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 0dbbe9f..91557c3 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -2524,7 +2524,9 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
} /* end if */
/* Broadcasting the MPI_IO option info. and chunk address info. */
- if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, ((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm)))
+ if((sizeof(haddr_t) + 1) * total_chunks > INT_MAX)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow")
+ if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, (int)((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
H5MM_memcpy(assign_io_mode, mergebuf, total_chunks);
@@ -2606,7 +2608,7 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ
H5D_chunk_info_t *chunk_info;
H5D_chunk_ud_t udata;
H5SL_node_t *chunk_node;
- hssize_t select_npoints;
+ hsize_t select_npoints;
hssize_t chunk_npoints;
if(NULL == (local_info_array = (H5D_filtered_collective_io_info_t *) H5MM_malloc(num_chunks_selected * sizeof(H5D_filtered_collective_io_info_t))))
@@ -2632,8 +2634,7 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ
H5MM_memcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled));
- if ((select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
local_info_array[i].io_size = (size_t) select_npoints * type_info->src_type_size;
/* Currently the full overwrite status of a chunk is only obtained on a per-process
@@ -2841,7 +2842,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
if (mpi_rank != chunk_entry->owners.new_owner) {
H5D_chunk_info_t *chunk_info = NULL;
unsigned char *mod_data_p = NULL;
- hssize_t iter_nelmts;
+ hsize_t iter_nelmts;
size_t mod_data_size;
/* Look up the chunk and get its file and memory dataspaces */
@@ -2854,9 +2855,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size")
- if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
+ H5_CHECK_OVERFLOW(iter_nelmts, hsize_t, size_t);
mod_data_size += (size_t) iter_nelmts * type_info->src_type_size;
if(NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size)))
@@ -3088,7 +3089,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
H5Z_EDC_t err_detect; /* Error detection info */
H5Z_cb_t filter_cb; /* I/O filter callback function */
unsigned filter_mask = 0;
- hssize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */
+ hsize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */
hssize_t extent_npoints;
hsize_t true_chunk_size;
hbool_t mem_iter_init = FALSE;
@@ -3193,17 +3194,15 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
file_iter_init = TRUE;
- if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace);
- if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
+ if(NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
if(!H5D__gather_mem(chunk_entry->buf, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer")
- if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer")
@@ -3211,10 +3210,9 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
break;
case H5D_IO_OP_WRITE:
- if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
- if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
+ if(NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
/* Gather modification data from the application write buffer into a temporary buffer */
@@ -3230,8 +3228,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
mem_iter_init = TRUE;
- if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace);
/* Scatter the owner's modification data into the chunk data buffer according to
* the file space.
@@ -3262,8 +3259,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
- if((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace);
/* Update the chunk data with the received modification data */
if(H5D__scatter_mem(mod_data_p, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
diff --git a/src/H5Dnone.c b/src/H5Dnone.c
index 9346220..2093512 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -378,7 +378,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src,
const H5D_chk_idx_info_t *idx_info_dst)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 723acf9..c46e38b6 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -443,6 +443,7 @@ struct H5D_shared_t {
H5T_t *type; /* Datatype for this dataset */
H5S_t *space; /* Dataspace of this dataset */
hid_t dcpl_id; /* Dataset creation property id */
+ hid_t dapl_id; /* Dataset access property id */
H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */
H5O_layout_t layout; /* Data layout */
hbool_t checked_filters;/* TRUE if dataset passes can_apply check */
@@ -515,16 +516,6 @@ typedef struct H5D_fill_buf_info_t {
hbool_t has_vlen_fill_type; /* Whether the datatype for the fill value has a variable-length component */
} H5D_fill_buf_info_t;
-/* Internal data structure for computing variable-length dataset's total size */
-typedef struct {
- 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;
-
/*****************************/
/* Package Private Variables */
@@ -573,8 +564,8 @@ H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t
H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size);
H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
H5_DLL 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(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size);
+H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, hsize_t *size);
H5_DLL herr_t H5D__check_filters(H5D_t *dataset);
H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size);
H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 511e380..9a5277f 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -170,9 +170,6 @@ H5_DLL herr_t H5D_flush_all(H5F_t *f);
H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);
H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset);
-/* Functions that operate on vlen data */
-H5_DLL herr_t H5D_vlen_reclaim(hid_t type_id, H5S_t *space, void *buf);
-
/* Functions that operate on chunked storage */
H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 7234d16..281da81 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -156,7 +156,6 @@ H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id,
const hsize_t *offset, uint32_t *filters, void *buf);
H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id,
H5D_operator_t op, void *operator_data);
-H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size);
H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf,
hid_t buf_type, hid_t space);
@@ -203,6 +202,7 @@ H5_DLL hid_t H5Dcreate1(hid_t file_id, const char *name, hid_t type_id,
hid_t space_id, hid_t dcpl_id);
H5_DLL hid_t H5Dopen1(hid_t file_id, const char *name);
H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]);
+H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
index 4510a03..8efa771 100644
--- a/src/H5Dsingle.c
+++ b/src/H5Dsingle.c
@@ -437,7 +437,7 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src,
const H5D_chk_idx_info_t *idx_info_dst)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 53640e7..877aadb 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -2406,7 +2406,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
/* Project intersection of virtual space and clipped
* virtual space onto source space (create
* clipped_source_select) */
- if(H5S_select_project_intersection(storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select) < 0)
+ if(H5S_select_project_intersection(storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Set extents of virtual_select and
@@ -2423,7 +2423,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
if(storage->list[i].sub_dset[j].clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space
* onto memory space */
- if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space) < 0)
+ if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Check number of elements selected */
@@ -2460,7 +2460,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
if(storage->list[i].source_dset.clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space onto
* memory space */
- if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space) < 0)
+ if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Check number of elements selected, add to tot_nelmts */
@@ -2590,7 +2590,7 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
- if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space) < 0)
+ if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform read on source dataset */
@@ -2781,7 +2781,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
* extent in the unlimited dimension. -NAF */
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
- if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space) < 0)
+ if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform write on source dataset */
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index da67e6b..1d182a4 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -487,7 +487,8 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
*image++ = H5EA_HDR_VERSION;
/* Extensible array type */
- *image++ = hdr->cparam.cls->id;
+ HDassert(hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)hdr->cparam.cls->id;
/* General array creation/configuration information */
*image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */
@@ -875,7 +876,8 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
*image++ = H5EA_IBLOCK_VERSION;
/* Extensible array type */
- *image++ = iblock->hdr->cparam.cls->id;
+ HDassert(iblock->hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)iblock->hdr->cparam.cls->id;
/* Address of array header for array which owns this block */
H5F_addr_encode(f, &image, iblock->hdr->addr);
@@ -1284,7 +1286,8 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
*image++ = H5EA_SBLOCK_VERSION;
/* Extensible array type */
- *image++ = sblock->hdr->cparam.cls->id;
+ HDassert(sblock->hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)sblock->hdr->cparam.cls->id;
/* Address of array header for array which owns this block */
H5F_addr_encode(f, &image, sblock->hdr->addr);
@@ -1540,7 +1543,7 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
*/
BEGIN_FUNC(STATIC, ERR,
void *, NULL, NULL,
-H5EA__cache_dblock_deserialize(const void *_image, size_t len,
+H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
/* Local variables */
@@ -1698,7 +1701,8 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
*image++ = H5EA_DBLOCK_VERSION;
/* Extensible array type */
- *image++ = dblock->hdr->cparam.cls->id;
+ HDassert(dblock->hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)dblock->hdr->cparam.cls->id;
/* Address of array header for array which owns this block */
H5F_addr_encode(f, &image, dblock->hdr->addr);
@@ -2076,7 +2080,7 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
*/
BEGIN_FUNC(STATIC, ERR,
herr_t, SUCCEED, FAIL,
-H5EA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
+H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
void *_thing))
/* Local variables */
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 814e64f..58e255a 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -279,7 +279,7 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx))
+H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx))
/* Local variables */
#ifndef NDEBUG
diff --git a/src/H5Eint.c b/src/H5Eint.c
index e76db82..2aedc17 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -37,6 +37,7 @@
#include "H5Epkg.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
+#include "H5TSprivate.h" /* Thread stuff */
/****************/
@@ -259,10 +260,8 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
else
HDfprintf(stream, "thread 0");
} /* end block */
-#elif defined(H5_HAVE_THREADSAFE)
- HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
- HDfprintf(stream, "thread 0");
+ HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id());
#endif
HDfprintf(stream, ":\n");
} /* end if */
@@ -391,10 +390,8 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
else
HDfprintf(stream, "thread 0");
} /* end block */
-#elif defined(H5_HAVE_THREADSAFE)
- HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
- HDfprintf(stream, "thread 0");
+ HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id());
#endif
HDfprintf(stream, ":\n");
} /* end if */
@@ -883,12 +880,12 @@ H5E__clear_entries(H5E_t *estack, size_t nentries)
/* Release strings */
if(error->func_name)
- error->func_name = (const char *) H5MM_xfree((void *)error->func_name); /* Casting away const OK - QAK */
+ error->func_name = (const char *) H5MM_xfree_const(error->func_name);
if(error->file_name)
- error->file_name = (const char *) H5MM_xfree((void *)error->file_name); /* Casting away const OK - QAK */
+ error->file_name = (const char *) H5MM_xfree_const(error->file_name);
if(error->desc)
- error->desc = (const char *) H5MM_xfree((void *)error->desc); /* Casting away const OK - QAK */
- } /* end for */
+ error->desc = (const char *) H5MM_xfree_const(error->desc);
+ }
/* Decrement number of errors on stack */
estack->nused -= u;
diff --git a/src/H5Epkg.h b/src/H5Epkg.h
index ac98496..86b5b73 100644
--- a/src/H5Epkg.h
+++ b/src/H5Epkg.h
@@ -77,7 +77,7 @@ typedef struct {
} H5E_auto_op_t;
#else /* H5_NO_DEPRECATED_SYMBOLS */
typedef struct {
- H5E_auto_t func2; /* Only the new style callback function is available. */
+ H5E_auto2_t func2; /* Only the new style callback function is available. */
} H5E_auto_op_t;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 3eae2da..ed14217 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -100,14 +100,14 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g;
}
#else /* H5_NO_DEPRECATED_SYMBOLS */
#define H5E_BEGIN_TRY { \
- H5E_auto_t saved_efunc; \
+ H5E_auto2_t saved_efunc; \
void *H5E_saved_edata; \
\
- (void)H5Eget_auto(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \
- (void)H5Eset_auto(H5E_DEFAULT, NULL, NULL);
+ (void)H5Eget_auto2(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \
+ (void)H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
#define H5E_END_TRY \
- (void)H5Eset_auto(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \
+ (void)H5Eset_auto2(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5F.c b/src/H5F.c
index d216cd2..1a9bab5 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -113,6 +113,30 @@ static const H5I_class_t H5I_FILE_CLS[1] = {{
(H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */
}};
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_init
+ *
+ * Purpose: Initialize the interface from some other layer.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_init(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+ /* FUNC_ENTER() does all the work */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_init() */
+
/*--------------------------------------------------------------------------
NAME
@@ -547,7 +571,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Retrieve the VFD handle for the file */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_VFD_HANDLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, file_handle, fapl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle")
done:
@@ -623,7 +647,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
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 */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_object_t *vol_obj = NULL; /* VOL object for file */
+ hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */
hid_t ret_value; /* return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -682,6 +708,18 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
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")
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the 'post open' callback */
+ supported = FALSE;
+ if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation")
+ if(supported)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fcreate() */
@@ -709,10 +747,12 @@ done:
hid_t
H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
{
- 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 */
+ 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 */
+ H5VL_object_t *vol_obj = NULL; /* VOL object for file */
+ hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "*sIui", filename, flags, fapl_id);
@@ -756,6 +796,18 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
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")
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the 'post open' callback */
+ supported = FALSE;
+ if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation")
+ if(supported)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fopen() */
@@ -862,13 +914,6 @@ H5Fdelete(const char *filename, hid_t fapl_id)
if(!filename || !*filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
- /* 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 a file access 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")
@@ -918,8 +963,9 @@ done:
hid_t
H5Freopen(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL;
- H5F_t *file = NULL; /* File struct for new file */
+ void *file = NULL; /* File struct for new file */
+ H5VL_object_t *vol_obj = NULL; /* VOL object for file */
+ hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -941,6 +987,18 @@ H5Freopen(hid_t file_id)
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")
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the 'post open' callback */
+ supported = FALSE;
+ if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation")
+ if(supported)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback")
+
done:
/* XXX (VOL MERGE): If registration fails, file will not be closed */
FUNC_LEAVE_API(ret_value)
@@ -994,15 +1052,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_fileno(hid_t file_id, unsigned long *fileno)
+H5Fget_fileno(hid_t file_id, unsigned long *fnumber)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Ul", file_id, fileno);
+ H5TRACE2("e", "i*Ul", file_id, fnumber);
- /* If no fileno pointer was passed in, exit quietly */
- if(fileno) {
+ /* If no fnumber pointer was passed in, exit quietly */
+ if(fnumber) {
H5VL_object_t *vol_obj; /* File info */
/* Get the internal file structure */
@@ -1010,7 +1068,7 @@ H5Fget_fileno(hid_t file_id, unsigned long *fileno)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Get the flags */
- if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_FILENO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fileno)) < 0)
+ if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_FILENO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fnumber)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'")
} /* end if */
@@ -1044,7 +1102,7 @@ H5Fget_freespace(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the amount of free space in the file */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SPACE, &ret_value) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space")
done:
@@ -1079,7 +1137,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the file size */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_SIZE, size) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
done:
@@ -1140,7 +1198,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID")
/* Get the file image */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FILE_IMAGE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf_ptr, &ret_value, buf_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
done:
@@ -1180,7 +1238,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
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_NATIVE_FILE_GET_MDC_CONF, config_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_CONF, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, config_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
@@ -1213,7 +1271,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Set the metadata cache configuration */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MDC_CONFIG, config_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MDC_CONFIG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, config_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration")
done:
@@ -1249,7 +1307,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the current hit rate */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_HR, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, hit_rate_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1286,7 +1344,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the size data */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
done:
@@ -1324,7 +1382,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the hit rate statistic */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
done:
@@ -1418,7 +1476,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
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_NATIVE_FILE_GET_INFO, (int)type, finfo) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)type, finfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
done:
@@ -1454,7 +1512,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the retry info */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info")
done:
@@ -1493,7 +1551,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0")
/* Get the free-space section information in the file */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, (int)type, nsects) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, sect_info, &ret_value, (int)type, nsects) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections")
done:
@@ -1526,7 +1584,7 @@ H5Fclear_elink_file_cache(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Release the EFC */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
@@ -1586,7 +1644,7 @@ H5Fstart_swmr_write(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Start SWMR writing */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_SWMR_WRITE) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_SWMR_WRITE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing")
done:
@@ -1618,7 +1676,7 @@ H5Fstart_mdc_logging(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_MDC_LOGGING) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging")
done:
@@ -1651,7 +1709,7 @@ H5Fstop_mdc_logging(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_STOP_MDC_LOGGING) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_STOP_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging")
done:
@@ -1685,7 +1743,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Call mdc logging function */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, is_enabled, is_currently_logging) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status")
done:
@@ -1697,7 +1755,7 @@ done:
* Function: H5Fset_libver_bounds
*
* Purpose: Set to a different low and high bounds while a file is open.
- * This public routine is introduced in place of
+ * This public routine is introduced in place of
* H5Fset_latest_format() starting release 1.10.2.
* See explanation for H5Fset_latest_format() in H5Fdeprec.c.
*
@@ -1723,7 +1781,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Set the library's version bounds */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, low, high) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, low, high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
@@ -1760,7 +1818,7 @@ H5Fformat_convert(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Convert the format */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_FORMAT_CONVERT) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
@@ -1791,7 +1849,7 @@ H5Freset_page_buffering_stats(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* Reset the statistics */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
@@ -1826,7 +1884,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
/* Get the statistics */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, accesses, hits, misses, evictions, bypasses) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
done:
@@ -1861,7 +1919,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
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(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, image_addr, image_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
@@ -1895,7 +1953,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa)
/* 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_NATIVE_FILE_GET_EOA, eoa) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_EOA, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, eoa) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA")
} /* end if */
@@ -1926,7 +1984,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
/* Increment the file size */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_INCR_FILESIZE, increment) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_INCR_FILESIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, increment) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size")
done:
@@ -1971,7 +2029,7 @@ H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize)
if(NULL == vol_obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, minimize) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, minimize) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
done:
@@ -2012,7 +2070,7 @@ H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize)
if(NULL == vol_obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, minimize) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, minimize) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
done:
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index f440efe..922153c 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -253,7 +253,7 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
*/
BEGIN_FUNC(STATIC, ERR,
void *, NULL, NULL,
-H5FA__cache_hdr_deserialize(const void *_image, size_t len,
+H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
/* Local variables */
@@ -417,7 +417,8 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
*image++ = H5FA_HDR_VERSION;
/* Fixed array type */
- *image++ = hdr->cparam.cls->id;
+ HDassert(hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)hdr->cparam.cls->id;
/* General array creation/configuration information */
*image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */
@@ -650,7 +651,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
*/
BEGIN_FUNC(STATIC, ERR,
void *, NULL, NULL,
-H5FA__cache_dblock_deserialize(const void *_image, size_t len,
+H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
/* Local variables */
@@ -805,7 +806,8 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
*image++ = H5FA_DBLOCK_VERSION;
/* Fixed array type */
- *image++ = dblock->hdr->cparam.cls->id;
+ HDassert(dblock->hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)dblock->hdr->cparam.cls->id;
/* Address of array header for array which owns this block */
H5F_addr_encode(f, &image, dblock->hdr->addr);
@@ -1176,7 +1178,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
*/
BEGIN_FUNC(STATIC, ERR,
herr_t, SUCCEED, FAIL,
-H5FA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
+H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
void *_thing))
/* Local variables */
diff --git a/src/H5FD.c b/src/H5FD.c
index 61969b6..63112bd 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -202,7 +202,7 @@ H5FD__free_cls(H5FD_class_t *cls)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_free_cls() */
+} /* end H5FD__free_cls() */
/*-------------------------------------------------------------------------
@@ -241,7 +241,7 @@ H5FDregister(const H5FD_class_t *cls)
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, 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))
+ for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++)
if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping")
@@ -286,7 +286,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref)
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; type++) {
HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES);
}
@@ -566,22 +566,22 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_fapl_close
+ * Function: H5FD_free_driver_info
*
- * Purpose: Closes a driver for a dataset transfer property list
+ * Purpose: Frees a driver's info
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_fapl_close(hid_t driver_id, const void *driver_info)
+H5FD_free_driver_info(hid_t driver_id, const void *driver_info)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(driver_id > 0) {
+ if(driver_id > 0 && driver_info) {
H5FD_class_t *driver;
/* Retrieve the driver for the ID */
@@ -589,19 +589,19 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Allow driver to free info or do it ourselves */
- if(driver_info) {
- if(driver->fapl_free) {
- if((driver->fapl_free)((void *)driver_info) < 0) /* Casting away const OK -QAK */
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed")
- } /* end if */
- else
- driver_info = H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */
- } /* end if */
- } /* end if */
+ if(driver->fapl_free) {
+ /* Free the const pointer */
+ /* Cast through uintptr_t to de-const memory */
+ if((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed")
+ }
+ else
+ driver_info = H5MM_xfree_const(driver_info);
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_fapl_close() */
+} /* end H5FD_free_driver_info() */
/*-------------------------------------------------------------------------
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 6db8af6..552b7ca 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -342,6 +342,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
unsigned char *ptr = file->mem + addr; /* mutable pointer into the
* buffer (can't change mem)
*/
+ HDoff_t offset = (HDoff_t)addr; /* Offset to write at */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -358,7 +359,6 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -371,7 +371,8 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
do {
#ifdef H5_HAVE_PREADWRITE
bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset);
- offset += bytes_wrote;
+ if(bytes_wrote > 0)
+ offset += bytes_wrote;
#else
bytes_wrote = HDwrite(file->fd, ptr, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -856,12 +857,12 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
* partial results, and the end of the file.
*/
- uint8_t *mem = file->mem; /* memory pointer for writes */
+ uint8_t *mem = file->mem; /* memory pointer for writes */
+ HDoff_t offset = (HDoff_t)0; /* offset for reading */
while(size > 0) {
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
- HDoff_t offset = (HDoff_t)0;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -874,7 +875,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
do {
#ifdef H5_HAVE_PREADWRITE
bytes_read = HDpread(file->fd, mem, bytes_in, offset);
- offset += bytes_read;
+ if(bytes_read > 0)
+ offset += bytes_read;
#else
bytes_read = HDread(file->fd, mem, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 33a0ef4..ce5e081 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -459,8 +459,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
#endif
h5_stat_t sb;
H5P_genplist_t *plist; /* Property list */
- int *buf1, *buf2;
- H5FD_t *ret_value;
+ void *buf1, *buf2;
+ H5FD_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
@@ -525,13 +525,13 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
/* NOTE: Use HDmalloc and HDfree here to ensure compatibility with
* HDposix_memalign.
*/
- buf1 = (int *)HDmalloc(sizeof(int));
+ buf1 = HDmalloc(sizeof(int));
if(HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed")
if(o_flags & O_CREAT) {
- if(HDwrite(file->fd, (void*)buf1, sizeof(int))<0) {
- if(HDwrite(file->fd, (void*)buf2, file->fa.fbsize)<0)
+ if(HDwrite(file->fd, buf1, sizeof(int))<0) {
+ if(HDwrite(file->fd, buf2, file->fa.fbsize)<0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, "file system may not support Direct I/O")
else
file->fa.must_align = TRUE;
@@ -540,8 +540,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
HDftruncate(file->fd, (HDoff_t)0);
}
} else {
- if(HDread(file->fd, (void*)buf1, sizeof(int))<0) {
- if(HDread(file->fd, (void*)buf2, file->fa.fbsize)<0)
+ if(HDread(file->fd, buf1, sizeof(int))<0) {
+ if(HDread(file->fd, buf2, file->fa.fbsize)<0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "file system may not support Direct I/O")
else
file->fa.must_align = TRUE;
@@ -549,7 +549,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
if(o_flags & O_RDWR) {
if(HDlseek(file->fd, (HDoff_t)0, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to seek to proper position")
- if(HDwrite(file->fd, (void *)buf1, sizeof(int))<0)
+ if(HDwrite(file->fd, buf1, sizeof(int))<0)
file->fa.must_align = TRUE;
else
file->fa.must_align = FALSE;
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index bc00403..d110ef7 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -619,8 +619,7 @@ done:
* memb_name & temp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static H5FD_t *
H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
@@ -771,7 +770,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_family_open() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -957,8 +956,7 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
* memb_name in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static herr_t
H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
{
@@ -1025,7 +1023,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index 819d200..3d086ea 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -569,11 +569,7 @@ done:
* Return: Success: The driver ID for the hdfs driver.
* Failure: Negative
*
- * Programmer: Robb Matzke
- * Thursday, July 29, 1999
- *
- * Changes: Rename as appropriate for hdfs vfd.
- * Jacob Smith 2018
+ * Programmer: Jacob Smith, 2018
*
*-------------------------------------------------------------------------
*/
@@ -581,7 +577,9 @@ hid_t
H5FD_hdfs_init(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
+#if HDFS_STATS
unsigned int bin_i;
+#endif
FUNC_ENTER_NOAPI(FAIL)
@@ -589,28 +587,24 @@ H5FD_hdfs_init(void)
HDfprintf(stdout, "H5FD_hdfs_init() called.\n");
#endif
- if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) {
- H5FD_HDFS_g = H5FD_register(
- &H5FD_hdfs_g,
- sizeof(H5FD_class_t),
- FALSE);
- }
+ if(H5I_VFL != H5I_get_type(H5FD_HDFS_g))
+ H5FD_HDFS_g = H5FD_register( &H5FD_hdfs_g, sizeof(H5FD_class_t), FALSE);
#if HDFS_STATS
/* pre-compute statsbin boundaries
*/
- for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) {
+ for(bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) {
unsigned long long value = 0;
+
HDFS_STATS_POW(bin_i, &value)
hdfs_stats_boundaries[bin_i] = value;
- }
+ } /* end for */
#endif
ret_value = H5FD_HDFS_g;
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5FD_hdfs_init() */
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index ac5667f..60255e5 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -1171,6 +1171,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
#ifdef H5_HAVE_GETTIMEOFDAY
struct timeval timeval_start, timeval_stop;
#endif /* H5_HAVE_GETTIMEOFDAY */
+ HDoff_t offset = (HDoff_t)addr;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1255,7 +1256,6 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1268,7 +1268,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
do {
#ifdef H5_HAVE_PREADWRITE
bytes_read = HDpread(file->fd, buf, bytes_in, offset);
- offset += bytes_read;
+ if(bytes_read > 0)
+ offset += bytes_read;
#else
bytes_read = HDread(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -1382,6 +1383,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
#ifdef H5_HAVE_GETTIMEOFDAY
struct timeval timeval_start, timeval_stop;
#endif /* H5_HAVE_GETTIMEOFDAY */
+ HDoff_t offset = (HDoff_t)addr;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1471,7 +1473,6 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1484,7 +1485,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
do {
#ifdef H5_HAVE_PREADWRITE
bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
- offset += bytes_wrote;
+ if(bytes_wrote > 0)
+ offset += bytes_wrote;
#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 71e9fe1..11f0411 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -22,15 +22,15 @@
#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FDmpi.h" /* MPI-based file drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5Dprivate.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
#ifdef H5_HAVE_PARALLEL
@@ -1324,6 +1324,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__mpio_read() */
+
/*-------------------------------------------------------------------------
* Function: H5FD__mpio_write
@@ -1366,6 +1367,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
#endif
int size_i;
hbool_t use_view_this_time = FALSE;
+ hbool_t derived_type = FALSE;
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
herr_t ret_value = SUCCEED;
@@ -1391,8 +1393,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
if(H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off")
size_i = (int)size;
- if((hsize_t)size_i != size)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i")
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'w'])
@@ -1430,6 +1430,20 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
*/
mpi_off = 0;
} /* end if */
+ else if(size != (hsize_t)size_i) {
+ /* If HERE, then we need to work around the integer size limit
+ * of 2GB. The input size_t size variable cannot fit into an integer,
+ * but we can get around that limitation by creating a different datatype
+ * and then setting the integer size (or element count) to 1 when using
+ * the derived_type.
+ */
+
+ if (H5_mpio_create_large_type(size, 0, MPI_BYTE, &buf_type) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype")
+
+ derived_type = TRUE;
+ size_i = 1;
+ }
/* Write the data. */
if(use_view_this_time) {
@@ -1506,6 +1520,9 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
file->local_eof = addr + (haddr_t)bytes_written;
done:
+ if(derived_type) {
+ MPI_Type_free(&buf_type);
+ }
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value );
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 800869d..d7fc88d 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -1961,8 +1961,7 @@ compute_next(H5FD_multi_t *file)
* tmp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static int
open_members(H5FD_multi_t *file)
{
@@ -1996,7 +1995,7 @@ open_members(H5FD_multi_t *file)
return 0;
}
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
#ifdef _H5private_H
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index ac08f7f..2e3d3ce 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -115,7 +115,7 @@ H5_DLL hsize_t H5FD_sb_size(H5FD_t *file);
H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf);
H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf);
H5_DLL void *H5FD_fapl_get(H5FD_t *file);
-H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl);
+H5_DLL herr_t H5FD_free_driver_info(hid_t driver_id, const void *driver_info);
H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref);
H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index f08e9d5..d9d4c88 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -1202,7 +1202,7 @@ H5FD_s3comms_s3r_open(const char *url,
if ((region != NULL && *region != '\0') ||
(id != NULL && *id != '\0') ||
- (signing_key != NULL && *signing_key != '\0'))
+ (signing_key != NULL))
{
/* if one exists, all three must exist
*/
@@ -1214,7 +1214,7 @@ H5FD_s3comms_s3r_open(const char *url,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL,
"secret id cannot be null.\n");
}
- if (signing_key == NULL || signing_key[0] == '\0') {
+ if (signing_key == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL,
"signing key cannot be null.\n");
}
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 0054a86..a393490 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -669,6 +669,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
haddr_t addr, size_t size, void *buf /*out*/)
{
H5FD_sec2_t *file = (H5FD_sec2_t *)_file;
+ HDoff_t offset = (HDoff_t)addr;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -687,7 +688,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
if(addr != file->pos || OP_READ != file->op) {
if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
- } /* end if */
+ }
#endif /* H5_HAVE_PREADWRITE */
/* Read data, being careful of interrupted system calls, partial results,
@@ -697,7 +698,6 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -710,7 +710,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
do {
#ifdef H5_HAVE_PREADWRITE
bytes_read = HDpread(file->fd, buf, bytes_in, offset);
- offset += bytes_read;
+ if(bytes_read > 0)
+ offset += bytes_read;
#else
bytes_read = HDread(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -773,6 +774,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
haddr_t addr, size_t size, const void *buf)
{
H5FD_sec2_t *file = (H5FD_sec2_t *)_file;
+ HDoff_t offset = (HDoff_t)addr;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -791,7 +793,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if(addr != file->pos || OP_WRITE != file->op) {
if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
- } /* end if */
+ }
#endif /* H5_HAVE_PREADWRITE */
/* Write the data, being careful of interrupted system calls and partial
@@ -801,7 +803,6 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -814,7 +815,8 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
do {
#ifdef H5_HAVE_PREADWRITE
bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
- offset += bytes_wrote;
+ if(bytes_wrote > 0)
+ offset += bytes_wrote;
#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
diff --git a/src/H5FS.c b/src/H5FS.c
index dbcb6b5..1bd56b8 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -665,14 +665,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size)
+H5FS_size(const H5FS_t *fspace, hsize_t *meta_size)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
/*
* Check arguments.
*/
- HDassert(f);
HDassert(fspace);
HDassert(meta_size);
diff --git a/src/H5FScache.c b/src/H5FScache.c
index b520458..d5f2817 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -241,7 +241,7 @@ H5FS__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static void *
-H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
+H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
hbool_t H5_ATTR_UNUSED *dirty)
{
H5FS_t *fspace = NULL; /* Free space header info */
@@ -404,8 +404,8 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len)
*/
static herr_t
H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing,
- haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t *new_addr, size_t *new_len,
- unsigned *flags)
+ haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t H5_ATTR_NDEBUG_UNUSED *new_addr,
+ size_t H5_ATTR_NDEBUG_UNUSED *new_len, unsigned *flags)
{
H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
@@ -694,7 +694,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
+H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_thing)
{
H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */
@@ -735,7 +735,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
*image++ = H5FS_HDR_VERSION;
/* Client ID */
- *image++ = fspace->client;
+ H5_CHECKED_ASSIGN(*image++, uint8_t, fspace->client, int);
/* Total space tracked */
H5F_ENCODE_LENGTH(f, image, fspace->tot_space);
@@ -979,8 +979,8 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU
*-------------------------------------------------------------------------
*/
static void *
-H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t *dirty)
+H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_NDEBUG_UNUSED *dirty)
{
H5FS_sinfo_cache_ud_t *udata = (H5FS_sinfo_cache_ud_t *)_udata; /* User data for callback */
H5FS_t *fspace; /* free space manager */
@@ -1025,11 +1025,11 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata,
/* Check for any serialized sections */
if(fspace->serial_sect_count > 0) {
- hsize_t old_tot_sect_count; /* Total section count from header */
- hsize_t old_serial_sect_count; /* Total serializable section count from header */
- hsize_t old_ghost_sect_count; /* Total ghost section count from header */
- hsize_t old_tot_space; /* Total space managed from header */
- unsigned sect_cnt_size; /* The size of the section size counts */
+ hsize_t old_tot_sect_count; /* Total section count from header */
+ hsize_t H5_ATTR_NDEBUG_UNUSED old_serial_sect_count; /* Total serializable section count from header */
+ hsize_t H5_ATTR_NDEBUG_UNUSED old_ghost_sect_count; /* Total ghost section count from header */
+ hsize_t H5_ATTR_NDEBUG_UNUSED old_tot_space; /* Total space managed from header */
+ unsigned sect_cnt_size; /* The size of the section size counts */
/* Compute the size of the section counts */
sect_cnt_size = H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count);
@@ -1046,8 +1046,8 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata,
/* Walk through the image, deserializing sections */
do {
- hsize_t sect_size; /* Current section size */
- size_t node_count; /* # of sections of this size */
+ hsize_t sect_size = 0; /* Current section size */
+ size_t node_count = 0; /* # of sections of this size */
size_t u; /* Local index variable */
/* The number of sections of this node's size */
@@ -1061,7 +1061,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata,
/* Loop over nodes of this size */
for(u = 0; u < node_count; u++) {
H5FS_section_info_t *new_sect; /* Section that was deserialized */
- haddr_t sect_addr; /* Address of free space section in the address space */
+ haddr_t sect_addr = 0; /* Address of free space section in the address space */
unsigned sect_type; /* Type of free space section */
unsigned des_flags; /* Flags from deserialize callback */
@@ -1141,7 +1141,6 @@ static herr_t
H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len)
{
const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)_thing; /* Pointer to the object */
- const H5FS_t *fspace; /* Free space header */
FUNC_ENTER_STATIC_NOERR
@@ -1149,10 +1148,9 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len)
HDassert(sinfo);
HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO);
- fspace = sinfo->fspace;
- HDassert(fspace);
- HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR);
+ HDassert(sinfo->fspace);
+ HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR);
HDassert(image_len);
/* Set the image length size */
@@ -1180,7 +1178,8 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len)
*/
static herr_t
H5FS__cache_sinfo_pre_serialize(H5F_t *f, void *_thing, haddr_t addr,
- size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags)
+ size_t H5_ATTR_NDEBUG_UNUSED len, haddr_t *new_addr, size_t H5_ATTR_NDEBUG_UNUSED *new_len,
+ unsigned *flags)
{
H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */
H5FS_t *fspace; /* Free space header */
@@ -1267,7 +1266,6 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len,
void *_thing)
{
H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */
- H5FS_t *fspace; /* Free space header */
H5FS_iter_ud_t udata; /* User data for callbacks */
uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint8_t *chksum_image = NULL; /* Points to chksum location */
@@ -1283,12 +1281,11 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len,
HDassert(sinfo);
HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO);
- fspace = sinfo->fspace;
- HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR);
- HDassert(fspace->cache_info.is_pinned);
- HDassert(fspace->sect_size == len);
- HDassert(fspace->sect_cls);
+ HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR);
+ HDassert(sinfo->fspace->cache_info.is_pinned);
+ HDassert(sinfo->fspace->sect_size == len);
+ HDassert(sinfo->fspace->sect_cls);
/* Magic number */
H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -1418,7 +1415,6 @@ static herr_t
H5FS__cache_sinfo_free_icr(void *_thing)
{
H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */
- H5FS_t *fspace; /* Free space header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1427,10 +1423,9 @@ H5FS__cache_sinfo_free_icr(void *_thing)
HDassert(sinfo);
HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC);
HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO);
- fspace = sinfo->fspace;
- HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR);
- HDassert(fspace->cache_info.is_pinned);
+ HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR);
+ HDassert(sinfo->fspace->cache_info.is_pinned);
/* Destroy free space info */
if(H5FS__sinfo_dest(sinfo) < 0)
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index 31fc63c..d2e1f90 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -182,7 +182,7 @@ H5_DLL H5FS_t *H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_c
H5_DLL H5FS_t *H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses,
const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment,
hsize_t threshold);
-H5_DLL herr_t H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size);
+H5_DLL herr_t H5FS_size(const H5FS_t *fspace, hsize_t *meta_size);
H5_DLL herr_t H5FS_delete(H5F_t *f, haddr_t fs_addr);
H5_DLL herr_t H5FS_close(H5F_t *f, H5FS_t *fspace);
H5_DLL herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr);
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 18e915f..a047161 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -120,7 +120,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
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_NATIVE_FILE_GET_INFO, type, &finfo2) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &finfo2) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
/* Copy the compatible fields into the older struct */
@@ -177,10 +177,10 @@ done:
* bounds.
*
* Before release 1.10.2, the library supports only two
- * combinations of low/high bounds:
+ * combinations of low/high bounds:
* (earliest, latest)
* (latest, latest)
- * Thus, this public routine does the job in switching
+ * Thus, this public routine does the job in switching
* between the two combinations listed above.
*
* Starting release 1.10.2, we add v18 to the enumerated
@@ -198,7 +198,7 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; December 2017
- *
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -227,7 +227,7 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
low = H5F_LIBVER_EARLIEST;
/* Set the library's version bounds */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, (int)low, (int)high) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)low, (int)high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 66d68b2..264a623 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -179,6 +179,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file")
+ /* Make file post open call */
+ if(H5F__post_open(ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file")
+
/* Increment the number of open objects to prevent the file from being
* closed out from under us - "simulate" having an open file id. Note
* that this behaviour replaces the calls to H5F_incr_nopen_objs() and
@@ -251,6 +255,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file")
+ /* Make file post open call */
+ if(H5F__post_open(ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file")
+
/* Increment the number of open objects to prevent the file from
* being closed out from under us - "simulate" having an open
* file id */
@@ -273,6 +281,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file")
open_file = TRUE;
+ /* Make file post open call */
+ if(H5F__post_open(ent->file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file")
+
/* Increment the number of open objects to prevent the file from being
* closed out from under us - "simulate" having an open file id */
ent->file->nopen_objs++;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 5e2cf26..0000512 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -139,18 +139,14 @@ H5F__set_vol_conn(H5F_t *file)
/* Sanity check */
HDassert(0 != connector_prop.connector_id);
- /* 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 == (file->shared->vol_cls = (H5VL_class_t *)H5I_object(connector_prop.connector_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
- /* Retrieve the connector for the ID */
- if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_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, connector_prop.connector_info) < 0)
+ /* Allocate and copy connector info, if it exists */
+ if(connector_prop.connector_info)
+ if(H5VL_copy_connector_info(file->shared->vol_cls, &new_connector_info, connector_prop.connector_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 = connector_prop.connector_id;
@@ -277,7 +273,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
done:
/* Release the copy of the driver info, if it was set up */
- if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0)
+ if(driver_prop_copied && H5FD_free_driver_info(driver_prop.driver_id, driver_prop.driver_info) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1142,9 +1138,15 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list")
f->shared = H5FL_FREE(H5F_shared_t, f->shared);
- }
+ } /* end if */
+
+ /* Free VOL object */
+ if(f->vol_obj)
+ if(H5VL_free_object(f->vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "unable to free VOL object")
+
f = H5FL_FREE(H5F_t, f);
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__new() */
@@ -1377,6 +1379,7 @@ H5F__dest(H5F_t *f, hbool_t flush)
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")
+ f->shared->vol_cls = NULL;
/* Close the file */
if(H5FD_close(f->shared->lf) < 0)
@@ -1410,6 +1413,9 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Free the non-shared part of the file */
f->open_name = (char *)H5MM_xfree(f->open_name);
f->actual_name = (char *)H5MM_xfree(f->actual_name);
+ if(f->vol_obj && H5VL_free_object(f->vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ f->vol_obj = NULL;
if(H5FO_top_dest(f) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file")
f->shared = NULL;
@@ -1503,8 +1509,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
H5P_genplist_t *a_plist; /*file access property list */
H5F_close_degree_t fc_degree; /*file close degree */
size_t page_buf_size;
- unsigned page_buf_min_meta_perc;
- unsigned page_buf_min_raw_perc;
+ unsigned page_buf_min_meta_perc = 0;
+ unsigned page_buf_min_raw_perc = 0;
hbool_t set_flag = FALSE; /*set the status_flags in the superblock */
hbool_t clear = FALSE; /*clear the status_flags */
hbool_t evict_on_close; /* evict on close value from plist */
@@ -1823,6 +1829,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5F__post_open
+ *
+ * Purpose: Finishes file open after wrapper context for file has been
+ * set.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F__post_open(H5F_t *f)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check arguments */
+ HDassert(f);
+
+ /* Store a vol object in the file struct */
+ if(NULL == (f->vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, f, f->shared->vol_id)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create VOL object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__flush() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_flush_phase1
*
* Purpose: First phase of flushing cached data.
@@ -3546,82 +3581,10 @@ done:
} /* 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_MAP:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "maps not supported in native VOL connector")
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_DATASPACE:
- case H5I_VFL:
- case H5I_VOL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_SPACE_SEL_ITER:
- case H5I_NTYPES:
- default:
- 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
+ * Function: H5F_get_file_id
*
- * Purpose: The package version of H5Iget_file_id(), obtains the file
+ * 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
@@ -3630,22 +3593,37 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5F__get_file_id(H5F_t *file, hbool_t app_ref)
+H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
{
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *vol_obj_file = NULL; /* File object pointer */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for object */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = obj_type;
+
+ /* Retrieve VOL file from object */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vol_obj_file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object")
/* Check if the file's ID already exists */
- if(H5I_find_id(file, H5I_FILE, &file_id) < 0)
+ if(H5I_find_id(vol_obj_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, app_ref)) < 0)
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ if((file_id = H5VL_wrap_register(H5I_FILE, vol_obj_file, app_ref)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
- file->id_exists = TRUE;
} /* end if */
else {
/* Increment ref count on existing ID */
@@ -3657,44 +3635,10 @@ H5F__get_file_id(H5F_t *file, hbool_t app_ref)
ret_value = file_id;
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__get_file_id() */
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset VOL wrapper info")
-
-/*-------------------------------------------------------------------------
- * 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, hbool_t app_ref)
-{
- 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_NATIVE_FILE_GET_FILE_ID, (int)type, (int)app_ref, &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() */
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 13d95aa..5e6b899 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -766,7 +766,7 @@ H5F_traverse_mount(H5O_loc_t *oloc/*in,out*/)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to free object location")
/* Copy the entry for the root group */
- if(H5O_loc_copy(oloc, mnt_oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(oloc, mnt_oloc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
/* In case the shared root group info points to a different file handle
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 1630d6b..0c46f59 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -291,11 +291,11 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
H5TRACE2("e", "ib", file_id, flag);
/* Get the file object */
- if (NULL == (vol_obj = (H5VL_object_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, "invalid file identifier");
/* Set atomicity value */
- if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, va_flag) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, va_flag) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity");
done:
@@ -359,11 +359,11 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag)
H5TRACE2("e", "i*b", file_id, flag);
/* Get the file object */
- if (NULL == (vol_obj = (H5VL_object_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, "invalid file identifier");
/* Get atomicity value */
- if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, flag) < 0)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, flag) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity");
done:
@@ -374,8 +374,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5F_mpi_retrieve_comm
*
- * Purpose: Retrieves an MPI communicator from the file the location ID
- * is in. If the loc_id is invalid, the fapl_id is used to
+ * Purpose: Retrieves an MPI communicator from the file the location ID
+ * is in. If the loc_id is invalid, the fapl_id is used to
* retrieve the communicator.
*
* Return: Success: Non-negative
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 6cd2d3c..b85305e 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -29,9 +29,6 @@
/* Get package's private header */
#include "H5Fprivate.h"
-/* Other public headers needed by this file */
-#include "H5VLpublic.h" /* Virtual Object Layer */
-
/* Other private headers needed by this file */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
@@ -313,6 +310,7 @@ struct H5F_shared_t {
/* Cached VOL connector ID & info */
hid_t vol_id; /* ID of VOL connector for the container */
+ const H5VL_class_t *vol_cls; /* Pointer to VOL connector class for the container */
void *vol_info; /* Copy of VOL connector info for container */
/* File space allocation information */
@@ -377,6 +375,7 @@ struct H5F_t {
char *open_name; /* Name used to open file */
char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */
H5F_shared_t *shared; /* The shared file info */
+ H5VL_object_t *vol_obj; /* VOL object */
unsigned nopen_objs; /* Number of open object headers */
H5FO_t *obj_count; /* # of time each object is opened through top file structure */
hbool_t id_exists; /* Whether an ID for this struct exists */
@@ -401,6 +400,7 @@ H5FL_EXTERN(H5F_shared_t);
/******************************/
/* General routines */
+H5_DLL herr_t H5F__post_open(H5F_t *f);
H5_DLL H5F_t *H5F__reopen(H5F_t *f);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f);
@@ -411,8 +411,7 @@ H5_DLL herr_t H5F__format_convert(H5F_t *f);
H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
-H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type);
-H5_DLL hid_t H5F__get_file_id(H5F_t *file, hbool_t app_ref);
+H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *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);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 7e87f79..fbb164d 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -25,14 +25,15 @@ typedef struct H5F_t H5F_t;
#include "H5Fpublic.h"
/* Public headers needed by this file */
-#include "H5FDpublic.h" /* File drivers */
+#include "H5FDpublic.h" /* File drivers */
/* Private headers needed by this file */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
-#include "H5Pprivate.h" /* Property lists */
+#include "H5Pprivate.h" /* Property lists */
#endif /* H5_HAVE_PARALLEL */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/**************************/
@@ -92,7 +93,7 @@ typedef struct H5F_t H5F_t;
for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \
*_p++ = (uint8_t)(_n & 0xff); \
for (/*void*/; _i < 8; _i++) \
- *_p++ = (n) < 0 ? 0xff : 0; \
+ *_p++ = (uint8_t)((n) < 0 ? 0xff : 0); \
(p) = (uint8_t*)(p)+8; \
}
@@ -246,29 +247,29 @@ typedef struct H5F_t H5F_t;
}
/* Address-related macros */
-#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \
- HADDR_UNDEF==(X)+(haddr_t)(Z) || \
+#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \
+ HADDR_UNDEF==(X)+(haddr_t)(Z) || \
(X)+(haddr_t)(Z)<(X))
#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF)
/* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making
* certain that X is not HADDR_UNDEF and then checking that X equals Y
*/
-#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \
+#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \
(X)==(Y))
#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y)))
-#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \
- (Y)!=HADDR_UNDEF && \
+#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
(X)<(Y))
-#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \
- (Y)!=HADDR_UNDEF && \
+#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
(X)<=(Y))
-#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \
- (Y)!=HADDR_UNDEF && \
+#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
(X)>(Y))
-#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \
- (Y)!=HADDR_UNDEF && \
+#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
(X)>=(Y))
-#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \
+#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \
(H5F_addr_lt((X), (Y)) ? -1 : 1))
#define H5F_addr_pow2(N) ((haddr_t)1<<(N))
#define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \
@@ -335,6 +336,8 @@ typedef struct H5F_t H5F_t;
#define H5F_NULL_FSM_ADDR(F) ((F)->shared->null_fsm_addr)
#define H5F_GET_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))
+#define H5F_VOL_CLS(F) ((F)->shared->vol_cls)
+#define H5F_VOL_OBJ(F) ((F)->vol_obj)
#else /* H5F_MODULE */
#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
@@ -395,6 +398,8 @@ typedef struct H5F_t H5F_t;
#define H5F_NULL_FSM_ADDR(F) (H5F_get_null_fsm_addr(F))
#define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F))
#define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V)))
+#define H5F_VOL_CLS(F) (H5F_get_vol_cls(F))
+#define H5F_VOL_OBJ(F) (H5F_get_vol_obj(F))
#endif /* H5F_MODULE */
@@ -427,7 +432,7 @@ typedef struct H5F_t H5F_t;
default: HDassert("bad sizeof size" && 0); \
}
-#define H5F_DECODE_LENGTH(f,p,l) H5F_DECODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f))
+#define H5F_DECODE_LENGTH(f,p,l) DECODE_VAR(p,l,H5F_SIZEOF_SIZE(f))
/*
* Macros that check for overflows. These are somewhat dangerous to fiddle
@@ -725,9 +730,10 @@ typedef enum H5F_prefix_open_t {
/***************************************/
/* Private functions */
+H5_DLL herr_t H5F_init(void);
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
-H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref);
+H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
@@ -755,6 +761,8 @@ H5_DLL hbool_t H5F_get_point_of_no_return(const H5F_t *f);
H5_DLL hbool_t H5F_get_null_fsm_addr(const H5F_t *f);
H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f);
H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize);
+H5_DLL const H5VL_class_t *H5F_get_vol_cls(const H5F_t *f);
+H5_DLL H5VL_object_t *H5F_get_vol_obj(const H5F_t *f);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index f36f348..68ad8e5 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -1279,3 +1279,86 @@ H5F_get_null_fsm_addr(const H5F_t *f)
FUNC_LEAVE_NOAPI(f->shared->null_fsm_addr)
} /* end H5F_get_null_fsm_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_vol_cls
+ *
+ * Purpose: Get the VOL class for the file
+ *
+ * Return: VOL class pointer for file, can't fail
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, August 17, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+const H5VL_class_t *
+H5F_get_vol_cls(const H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+ HDassert(f->shared);
+
+ FUNC_LEAVE_NOAPI(f->shared->vol_cls)
+} /* end H5F_get_vol_cls */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_vol_obj
+ *
+ * Purpose: Get the VOL object for the file
+ *
+ * Return: VOL object pointer for file, can't fail
+ *
+ *-------------------------------------------------------------------------
+ */
+H5VL_object_t *
+H5F_get_vol_obj(const H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->vol_obj)
+} /* end H5F_get_vol_obj */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_cont_info
+ *
+ * Purpose: Get the VOL container info for the file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, August 17, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+
+ /* Verify structure version */
+ if(info->version != H5VL_CONTAINER_INFO_VERSION)
+ HGOTO_ERROR(H5E_FILE, H5E_VERSION, FAIL, "wrong container info version #")
+
+ /* Set the container info fields */
+ info->feature_flags = 0; /* None currently defined */
+ info->token_size = H5F_SIZEOF_ADDR(f);
+ info->blob_id_size = H5HG_HEAP_ID_SIZE(f);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_get_cont_info */
+
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index f8e8f3f..e5d4cde 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -1394,7 +1394,7 @@ H5F__super_init(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo")
f->shared->fs_version = fsinfo.version;
- for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF;
if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo) < 0)
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 125d6cf..f8a40b2 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -344,10 +344,10 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t
*-------------------------------------------------------------------------
*/
static herr_t
-H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len,
+H5F__cache_superblock_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len,
void *_udata, size_t *actual_len)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
H5F_super_t sblock; /* Temporary file superblock */
htri_t ret_value = SUCCEED; /* Return value */
@@ -393,7 +393,7 @@ done:
static htri_t
H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
@@ -434,12 +434,12 @@ H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata
*-------------------------------------------------------------------------
*/
static void *
-H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata,
+H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
hbool_t H5_ATTR_UNUSED *dirty)
{
H5F_super_t *sblock = NULL; /* File's superblock */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_super_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -664,7 +664,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
void *_thing)
{
H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t *image = _image; /* Pointer into raw data buffer */
haddr_t rel_eof; /* Relative EOF for file */
herr_t ret_value = SUCCEED; /* Return value */
@@ -867,10 +867,10 @@ H5F__cache_drvrinfo_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *i
*-------------------------------------------------------------------------
*/
static herr_t
-H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len,
+H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len,
void *_udata, size_t *actual_len)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */
H5O_drvinfo_t drvrinfo; /* Driver info */
herr_t ret_value = SUCCEED; /* Return value */
@@ -911,12 +911,12 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata,
+H5F__cache_drvrinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
hbool_t H5_ATTR_UNUSED *dirty)
{
H5O_drvinfo_t *drvinfo = NULL; /* Driver info */
H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ const uint8_t *image = _image; /* Pointer into raw data buffer */
char drv_name[9]; /* Name of driver */
H5O_drvinfo_t *ret_value = NULL; /* Return value */
@@ -1006,11 +1006,11 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len,
+H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_thing)
{
H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t *image = _image; /* Pointer into raw data buffer */
uint8_t *dbuf; /* Pointer to beginning of driver info */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5G.c b/src/H5G.c
index fdf613c..a766e8a 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -144,6 +144,29 @@ static hbool_t H5G_top_package_initialize_s = FALSE;
/*-------------------------------------------------------------------------
+ * Function: H5G_init
+ *
+ * Purpose: Initialize the interface from some other layer.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_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 H5G_init() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5G__init_package
*
* Purpose: Initializes the H5G interface.
@@ -318,9 +341,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
hid_t gapl_id)
{
void *grp = NULL; /* Structure for new group */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ 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);
@@ -345,6 +368,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list")
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* 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")
@@ -410,7 +436,7 @@ hid_t
H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
{
void *grp = NULL; /* Structure for new group */
- H5VL_object_t *vol_obj = NULL; /* Object token for loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object for loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -472,10 +498,10 @@ done:
hid_t
H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
{
- void *grp = NULL; /* Group opened */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *grp = NULL; /* Group opened */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, gapl_id);
@@ -531,7 +557,7 @@ hid_t
H5Gget_create_plist(hid_t group_id)
{
H5VL_object_t *vol_obj = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", group_id);
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index fcb16d3..126456b 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -173,10 +173,9 @@ hid_t
H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
{
void *grp = NULL; /* New group created */
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
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)
@@ -228,7 +227,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
- if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, lcpl_id, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, 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 */
@@ -269,7 +269,7 @@ hid_t
H5Gopen1(hid_t loc_id, const char *name)
{
void *grp = NULL; /* Group opened */
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -289,7 +289,8 @@ H5Gopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the group */
- if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_GROUP_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Get an atom for the group */
@@ -316,7 +317,6 @@ 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;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -334,19 +334,19 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Create link */
if(type == H5L_TYPE_HARD) {
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object 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 */
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.obj_type = H5I_get_type(cur_loc_id);
loc_params1.loc_data.loc_by_name.name = cur_name;
- loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
/* get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
@@ -357,16 +357,17 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
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, vol_obj->data, &loc_params1) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, &loc_params1) < 0)
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_object_t *vol_obj; /* Object 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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(cur_loc_id);
/* get the location object */
@@ -374,7 +375,8 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* 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, cur_name) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@@ -397,7 +399,6 @@ 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;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -415,20 +416,20 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
- H5VL_object_t *vol_obj1; /* Object token of loc_id */
- H5VL_object_t *vol_obj2; /* Object token of loc_id */
+ H5VL_object_t *vol_obj1; /* Object of loc_id */
+ H5VL_object_t *vol_obj2; /* Object of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
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_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.obj_type = H5I_get_type(new_loc_id);
loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
/* get the location object */
if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id)))
@@ -437,11 +438,12 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* 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, vol_obj1->data, &loc_params1) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0)
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_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
/* Soft links only need one location, the new_loc_id, but it's possible that
@@ -451,7 +453,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = H5I_get_type(new_loc_id);
/* get the location object */
@@ -459,7 +461,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* 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, cur_name) < 0)
+ if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@@ -480,7 +483,7 @@ done:
herr_t
H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
@@ -495,18 +498,19 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
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_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.loc_data.loc_by_name.name = dst_name;
- loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
+ loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_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)
+ if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
@@ -525,9 +529,9 @@ herr_t
H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name)
{
- H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
+ H5VL_object_t *vol_obj1 = NULL; /* Object of src_id */
H5VL_loc_params_t loc_params1;
- H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object of dst_id */
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
@@ -541,13 +545,13 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* 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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params2.obj_type = H5I_get_type(dst_loc_id);
if(H5L_SAME_LOC != src_loc_id)
@@ -560,7 +564,8 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Move the 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)
+ if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
@@ -578,7 +583,7 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -622,7 +627,7 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -675,7 +680,7 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -700,7 +705,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set the comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
done:
@@ -734,7 +739,7 @@ done:
int
H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
ssize_t op_ret; /* Return value from operation */
int ret_value; /* Return value */
@@ -762,7 +767,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier")
/* Get the comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &op_ret) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf, bufsize, &op_ret) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value")
/* Set return value */
@@ -801,7 +806,7 @@ 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_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
H5G_link_iterate_t lnk_op; /* Link operator */
hsize_t last_obj; /* Index of last object looked at */
@@ -838,7 +843,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
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_NATIVE_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
+ if((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
/* Set the index we stopped at */
@@ -869,7 +874,7 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5I_type_t id_type; /* Type of ID */
H5VL_loc_params_t loc_params;
H5G_info_t grp_info; /* Group information */
@@ -926,7 +931,7 @@ herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
H5G_stat_t *statbuf/*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -934,11 +939,11 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
/* Check arguments */
- if (!name || !*name)
+ if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Set up collective metadata if appropriate */
- if (H5CX_set_loc(loc_id) < 0)
+ if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info");
/* Retrieve object info */
@@ -949,11 +954,11 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ 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_NATIVE_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0)
+ if(H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_GET_OBJINFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, (unsigned)follow_link, statbuf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name);
done:
@@ -984,52 +989,59 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c
FUNC_ENTER_STATIC;
/* Check if the name in this group resolved to a valid link */
- if (lnk == NULL && obj_loc == NULL)
+ 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) {
+ /* 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)
+ 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 */
+ if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
+ H5O_info2_t dm_info; /* Data model information */
+ H5O_native_info_t nat_info; /* Native information */
+ haddr_t obj_addr; /* Address of object */
- /* Go retrieve the object information */
+ /* Go retrieve the data model & native 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");
+ if(H5O_get_info(obj_loc->oloc, &dm_info, H5O_INFO_BASIC | H5O_INFO_TIME) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get data model object info")
+ if(H5O_get_native_info(obj_loc->oloc, &nat_info, H5O_INFO_HDR) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get native object info")
/* Get mapped object type */
- statbuf->type = H5G_map_obj_type(oinfo.type);
+ statbuf->type = H5G_map_obj_type(dm_info.type);
/* Get object number (i.e. address) for object */
- statbuf->objno[0] = (unsigned long)(oinfo.addr);
+ if(H5VL_native_token_to_addr(obj_loc->oloc->file, H5I_FILE, dm_info.token, &obj_addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+
+ statbuf->objno[0] = (unsigned long)(obj_addr);
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long));
+ statbuf->objno[1] = (unsigned long)(obj_addr >> 8 * sizeof(long));
#else
statbuf->objno[1] = 0;
#endif
/* Get # of hard links pointing to object */
- statbuf->nlink = oinfo.rc;
+ statbuf->nlink = dm_info.rc;
/* Get modification time for object */
- statbuf->mtime = oinfo.ctime;
+ statbuf->mtime = dm_info.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;
- }
- }
+ statbuf->ohdr.size = nat_info.hdr.space.total;
+ statbuf->ohdr.free = nat_info.hdr.space.free;
+ statbuf->ohdr.nmesgs = nat_info.hdr.nmesgs;
+ statbuf->ohdr.nchunks = nat_info.hdr.nchunks;
+ } /* end if */
+ } /* end if */
done:
/* Indicate that this callback didn't take ownership of the group *
@@ -1084,7 +1096,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
/* If we're pointing at a soft or UD link, get the real link length and type */
if (statbuf && follow_link == 0) {
- H5L_info_t linfo; /* Link information buffer */
+ H5L_info2_t linfo; /* Link information buffer */
herr_t ret;
/* Get information about link to the object. If this fails, e.g.
@@ -1137,7 +1149,7 @@ done:
ssize_t
H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
ssize_t ret_value; /* Return value */
@@ -1188,10 +1200,9 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object 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 */
+ H5O_info2_t oinfo; /* Object info (contains object type) */
H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
@@ -1211,8 +1222,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
/* 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_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_BASIC) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info")
/* Map to group object type */
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 049c696..a3849a6 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -58,6 +58,7 @@ typedef struct {
/* User data for application-style iteration over links in a group */
typedef struct {
hid_t gid; /* The group ID for the application callback */
+ H5O_loc_t *link_loc; /* The object location for the link */
H5G_link_iterate_t lnk_op; /* Application callback */
void *op_data; /* Application's op data */
} H5G_iter_appcall_ud_t;
@@ -72,7 +73,7 @@ typedef struct {
char *path; /* Path name of the link */
size_t curr_path_len; /* Current length of the path in the buffer */
size_t path_buf_size; /* Size of path buffer */
- H5L_iterate_t op; /* Application callback */
+ H5L_iterate2_t op; /* Application callback */
void *op_data; /* Application's op data */
} H5G_iter_visit_ud_t;
@@ -335,7 +336,7 @@ H5G_open(const H5G_loc_t *loc)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for group")
/* Shallow copy (take ownership) of the group location object */
- if(H5O_loc_copy(&(grp->oloc), loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&(grp->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy object location")
if(H5G_name_copy(&(grp->path), loc->path, H5_COPY_SHALLOW) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path")
@@ -752,10 +753,10 @@ H5G_iterate_cb(const H5O_link_t *lnk, void *_udata)
case H5G_LINK_OP_NEW:
{
- H5L_info_t info; /* Link info */
+ H5L_info2_t info; /* Link info */
/* Retrieve the info for the link */
- if(H5G_link_to_info(lnk, &info) < 0)
+ if(H5G_link_to_info(udata->link_loc, lnk, &info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link")
/* Make the application callback */
@@ -812,6 +813,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name,
/* Set up user data for callback */
udata.gid = gid;
+ udata.link_loc = &grp->oloc;
udata.lnk_op = *lnk_op;
udata.op_data = op_data;
@@ -872,7 +874,7 @@ static herr_t
H5G_visit_cb(const H5O_link_t *lnk, void *_udata)
{
H5G_iter_visit_ud_t *udata = (H5G_iter_visit_ud_t *)_udata; /* User data for callback */
- H5L_info_t info; /* Link info */
+ H5L_info2_t info; /* Link info */
H5G_loc_t obj_loc; /* Location of object */
H5G_name_t obj_path; /* Object's group hier. path */
H5O_loc_t obj_oloc; /* Object's object location */
@@ -908,7 +910,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata)
udata->curr_path_len += link_name_len;
/* Construct the link info from the link message */
- if(H5G_link_to_info(lnk, &info) < 0)
+ if(H5G_link_to_info(udata->curr_loc->oloc, lnk, &info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link")
/* Make the application callback */
@@ -1044,7 +1046,7 @@ done:
*/
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)
+ H5_iter_order_t order, H5L_iterate2_t op, void *op_data)
{
H5G_iter_visit_ud_t udata; /* User data for callback */
H5O_linfo_t linfo; /* Link info message */
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 04ccbc5..6c42f1d 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -41,6 +41,8 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property Lists */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -290,13 +292,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info)
+H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t *info)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(link_loc);
HDassert(lnk);
/* Get information from the link */
@@ -308,7 +311,9 @@ H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info)
switch(lnk->type) {
case H5L_TYPE_HARD:
- info->u.address = lnk->u.hard.addr;
+ /* Serialize the address into a VOL token */
+ if(H5VL_native_addr_to_token(link_loc->file, H5I_FILE, lnk->u.hard.addr, &info->u.token) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
break;
case H5L_TYPE_SOFT:
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 40d56c6..4d89abb 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -73,15 +73,24 @@ typedef struct {
H5G_loc_t *loc; /* Group location to set */
} H5G_loc_fbi_t;
-/* User data for getting an object's info in a group */
+/* User data for getting an object's data model info in a group */
typedef struct {
/* downward */
- unsigned fields; /* which fields in H5O_info_t struct to fill in */
+ unsigned fields; /* which fields in H5O_info2_t struct to fill in */
/* upward */
- H5O_info_t *oinfo; /* Object information to retrieve */
+ H5O_info2_t *oinfo; /* Object information to retrieve */
} H5G_loc_info_t;
+/* User data for getting an object's native info in a group */
+typedef struct {
+ /* downward */
+ unsigned fields; /* which fields in H5O_native_info_t struct to fill in */
+
+ /* upward */
+ H5O_native_info_t *oinfo; /* Object information to retrieve */
+} H5G_loc_native_info_t;
+
/* User data for setting an object's comment in a group */
typedef struct {
/* downward */
@@ -112,6 +121,12 @@ static herr_t H5G__loc_find_cb(H5G_loc_t *grp_loc, const char *name,
static herr_t H5G__loc_find_by_idx_cb(H5G_loc_t *grp_loc, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata,
H5G_own_loc_t *own_loc);
+static herr_t H5G__loc_addr_cb(H5G_loc_t *grp_loc, const char *name,
+ const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc);
+static herr_t H5G__loc_info_cb(H5G_loc_t *grp_loc, const char *name,
+ const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc);
+static herr_t H5G__loc_native_info_cb(H5G_loc_t *grp_loc, const char *name,
+ const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc);
static herr_t H5G__loc_set_comment_cb(H5G_loc_t *grp_loc, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata,
H5G_own_loc_t *own_loc);
@@ -684,9 +699,81 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_loc_info_cb
+ * Function: H5G__loc_addr_cb
*
- * Purpose: Callback for retrieving object info for an object in a group
+ * Purpose: Callback for retrieving the address for an object in a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, December 21, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G__loc_addr_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name,
+ const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc,
+ void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
+{
+ haddr_t *udata = (haddr_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid link */
+ if(obj_loc == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+ /* Set address of object */
+ *udata = obj_loc->oloc->addr;
+
+done:
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G__loc_addr_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G__loc_addr
+ *
+ * Purpose: Retrieve the information for an object from a group location
+ * and path to that object
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 23, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr/*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check args. */
+ HDassert(loc);
+ HDassert(name && *name);
+ HDassert(addr);
+
+ /* Traverse group hierarchy to locate object */
+ if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_addr_cb, addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G__loc_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G__loc_info_cb
+ *
+ * Purpose: Callback for retrieving data model info for an object in a group
*
* Return: Non-negative on success/Negative on failure
*
@@ -696,13 +783,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk,
+H5G__loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk,
H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5G_loc_info_t *udata = (H5G_loc_info_t *)_udata; /* User data passed in */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check if the name in this group resolved to a valid link */
if(obj_loc == NULL)
@@ -718,13 +805,13 @@ done:
*own_loc = H5G_OWN_NONE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_loc_info_cb() */
+} /* end H5G__loc_info_cb() */
/*-------------------------------------------------------------------------
* Function: H5G_loc_info
*
- * Purpose: Retrieve the information for an object from a group location
+ * Purpose: Retrieve the data model information for an object from a group location
* and path to that object
*
* Return: Non-negative on success/Negative on failure
@@ -735,7 +822,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, unsigned fields)
+H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo/*out*/, unsigned fields)
{
H5G_loc_info_t udata; /* User data for traversal callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -752,7 +839,7 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, u
udata.oinfo = oinfo;
/* Traverse group hierarchy to locate object */
- if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G_loc_info_cb, &udata) < 0)
+ if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_info_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object")
done:
@@ -761,6 +848,84 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5G__loc_native_info_cb
+ *
+ * Purpose: Callback for retrieving native info for an object in a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 23, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G__loc_native_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk,
+ H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
+{
+ H5G_loc_native_info_t *udata = (H5G_loc_native_info_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid link */
+ if(obj_loc == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+ /* Query object information */
+ if(H5O_get_native_info(obj_loc->oloc, udata->oinfo, udata->fields) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info")
+
+done:
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G__loc_native_info_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_loc_native_info
+ *
+ * Purpose: Retrieve the native information for an object from a group location
+ * and path to that object
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 23, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *oinfo/*out*/,
+ unsigned fields)
+{
+ H5G_loc_native_info_t udata; /* User data for traversal callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args. */
+ HDassert(loc);
+ HDassert(name && *name);
+ HDassert(oinfo);
+
+ /* Set up user data for locating object */
+ udata.fields = fields;
+ udata.oinfo = oinfo;
+
+ /* Traverse group hierarchy to locate object */
+ if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_native_info_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_loc_native_info() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5G__loc_set_comment_cb
*
* Purpose: Callback for (re)setting object comment for an object in a group
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 86a0c2f..4b0f04c 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -42,6 +42,8 @@
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory wrappers */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -1195,16 +1197,16 @@ done:
* Purpose: Callback for retrieving object's name by address
*
* Return: Positive if path is for object desired
- * 0 if not correct object
- * negative on failure.
+ * 0 if not correct object
+ * negative on failure.
*
* Programmer: Quincey Koziol
- * November 4 2007
+ * November 4 2007
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo,
+H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo,
void *_udata)
{
H5G_gnba_iter_t *udata = (H5G_gnba_iter_t *)_udata; /* User data for iteration */
@@ -1212,7 +1214,7 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo,
H5G_name_t obj_path; /* Object's group hier. path */
H5O_loc_t obj_oloc; /* Object's object location */
hbool_t obj_found = FALSE; /* Object at 'path' found */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1223,31 +1225,39 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo,
HDassert(udata->path == NULL);
/* Check for hard link with correct address */
- if(linfo->type == H5L_TYPE_HARD && udata->loc->addr == linfo->u.address) {
- H5G_loc_t grp_loc; /* Location of group */
-
- /* Get group's location */
- if(H5G_loc(gid, &grp_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location")
-
- /* Set up opened object location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object */
- if(H5G_loc_find(&grp_loc, path, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found")
- obj_found = TRUE;
-
- /* Check for object in same file (handles mounted files) */
- /* (re-verify address, in case we traversed a file mount) */
- if(udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) {
- if(NULL == (udata->path = H5MM_strdup(path)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string")
-
- /* We found a match so we return immediately */
- HGOTO_DONE(H5_ITER_STOP)
+ if(linfo->type == H5L_TYPE_HARD) {
+ haddr_t link_addr;
+
+ /* Retrieve hard link address from VOL token */
+ if(H5VL_native_token_to_addr(udata->loc->file, H5I_FILE, linfo->u.token, &link_addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+
+ if(udata->loc->addr == link_addr) {
+ H5G_loc_t grp_loc; /* Location of group */
+
+ /* Get group's location */
+ if(H5G_loc(gid, &grp_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location")
+
+ /* Set up opened object location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object */
+ if(H5G_loc_find(&grp_loc, path, &obj_loc/*out*/) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found")
+ obj_found = TRUE;
+
+ /* Check for object in same file (handles mounted files) */
+ /* (re-verify address, in case we traversed a file mount) */
+ if(udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) {
+ if(NULL == (udata->path = H5MM_strdup(path)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string")
+
+ /* We found a match so we return immediately */
+ HGOTO_DONE(H5_ITER_STOP)
+ } /* end if */
} /* end if */
} /* end if */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index b79b7d2..35b90f3 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -762,12 +762,11 @@ done:
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/,
+H5G_node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in,out*/,
hbool_t H5_ATTR_UNUSED *lt_key_changed/*out*/,
void *_udata/*in,out*/, void *_rt_key/*in,out*/,
hbool_t *rt_key_changed/*out*/)
{
- H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key;
H5G_bt_rm_t *udata = (H5G_bt_rm_t *)_udata;
H5G_node_t *sn = NULL;
@@ -781,7 +780,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/,
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(lt_key);
+ HDassert((H5G_node_key_t *)_lt_key);
HDassert(rt_key);
HDassert(udata && udata->common.heap);
@@ -1256,7 +1255,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr,
/* expand soft link */
if(H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) {
- H5O_info_t oinfo; /* Information about object pointed to by soft link */
+ haddr_t obj_addr; /* Address of object pointed to by soft link */
H5G_loc_t grp_loc; /* Group location holding soft link */
H5G_name_t grp_path; /* Path for group holding soft link */
char *link_name; /* Pointer to value of soft link */
@@ -1274,9 +1273,8 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr,
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name")
/* Check if the object pointed by the soft link exists in the source file */
- /* Only basic information is needed */
- if(H5G_loc_info(&grp_loc, link_name, &oinfo, H5O_INFO_BASIC) >= 0) {
- tmp_src_ent.header = oinfo.addr;
+ if(H5G__loc_addr(&grp_loc, link_name, &obj_addr) >= 0) {
+ tmp_src_ent.header = obj_addr;
src_ent = &tmp_src_ent;
} /* end if */
else
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 15dbd79..1892182 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -738,7 +738,7 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info)
H5G_loc_reset(&grp_loc);
/* Deep copy (duplicate) of the group location object */
- if(H5O_loc_copy(&grp_oloc, (H5O_loc_t *)oloc, H5_COPY_DEEP) < 0) /* (Casting away const OK - QAK) */
+ if(H5O_loc_copy_deep(&grp_oloc, oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy object location")
/* Open the group */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index f475bde..6dc025c 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -498,6 +498,8 @@ H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path);
*/
H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, const char *name,
H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info);
+H5_DLL herr_t H5G__loc_addr(const H5G_loc_t *loc, const char *name,
+ haddr_t *addr/*out*/);
/* Testing functions */
#ifdef H5G_TESTING
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index f149f29..19b120c 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -174,7 +174,7 @@ typedef struct {
#ifndef H5_NO_DEPRECATED_SYMBOLS
H5G_iterate_t op_old; /* "Old" application callback for each link */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- H5L_iterate_t op_new; /* "New" application callback for each link */
+ H5L_iterate2_t op_new; /* "New" application callback for each link */
} op_func;
} H5G_link_iterate_t;
@@ -186,6 +186,7 @@ typedef struct H5G_entry_t H5G_entry_t;
* Library prototypes... These are the ones that other packages routinely
* call.
*/
+H5_DLL herr_t H5G_init(void);
H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp);
H5_DLL H5F_t *H5G_fileof(H5G_t *grp);
@@ -213,12 +214,12 @@ 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(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);
+ H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data);
/*
* Functions that understand links in groups
*/
-H5_DLL herr_t H5G_link_to_info(const struct H5O_link_t *lnk, H5L_info_t *linfo);
+H5_DLL herr_t H5G_link_to_info(const struct H5O_loc_t *link_loc, const struct H5O_link_t *lnk, H5L_info2_t *linfo);
/*
* Functions that understand group objects
@@ -278,7 +279,9 @@ H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name,
H5G_loc_t *obj_loc/*out*/);
H5_DLL htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name,
- H5O_info_t *oinfo/*out*/, unsigned fields);
+ H5O_info2_t *oinfo/*out*/, unsigned fields);
+H5_DLL herr_t H5G_loc_native_info(const H5G_loc_t *loc, const char *name,
+ H5O_native_info_t *oinfo/*out*/, unsigned fields);
H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name,
const char *comment);
H5_DLL ssize_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name,
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 492b5b9..0f27880 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -132,7 +132,7 @@ H5G__traverse_slink_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc, const char H5_ATTR_UNU
} /* end if */
else {
/* Copy new location information for resolved object */
- H5O_loc_copy(udata->obj_loc->oloc, obj_loc->oloc, H5_COPY_DEEP);
+ H5O_loc_copy_deep(udata->obj_loc->oloc, obj_loc->oloc);
/* Indicate that the object exists */
udata->exists = TRUE;
@@ -201,11 +201,15 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* User-defined callback function */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/* (Backwardly compatible with v0 H5L_class_t traverssal callback) */
if(link_class->version == H5L_LINK_CLASS_T_VERS_0)
cb_return = (((const H5L_class_0_t *)link_class)->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl());
else
cb_return = (link_class->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl(), H5CX_get_dxpl());
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+ cb_return = (link_class->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl(), H5CX_get_dxpl());
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Check for failing to locate the object */
if(cb_return < 0) {
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 2d1c1f2..4a2ff91 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -403,7 +403,7 @@ H5HF__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len,
+H5HF__cache_hdr_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len,
void *_udata, size_t *actual_len)
{
H5HF_hdr_t hdr; /* Temporary fractal heap header */
@@ -749,7 +749,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
+H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_thing)
{
H5HF_hdr_t *hdr = (H5HF_hdr_t *)_thing; /* Fractal heap info */
@@ -979,8 +979,8 @@ H5HF__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN
*-------------------------------------------------------------------------
*/
static void *
-H5HF__cache_iblock_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty)
+H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
+ void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
{
H5HF_hdr_t *hdr; /* Shared fractal heap information */
H5HF_iblock_cache_ud_t *udata = (H5HF_iblock_cache_ud_t *)_udata; /* User data for callback */
@@ -1326,7 +1326,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t len,
+H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_thing)
{
H5HF_hdr_t *hdr; /* Shared fractal heap information */
@@ -1471,8 +1471,8 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)
else {
/* if this is a child iblock, verify that the pointers are */
/* either uninitialized or set up correctly. */
- H5HF_indirect_t *par_iblock = iblock->parent;
- unsigned indir_idx; /* Index in parent's child iblock pointer array */
+ H5HF_indirect_t H5_ATTR_NDEBUG_UNUSED *par_iblock = iblock->parent;
+ unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index in parent's child iblock pointer array */
/* Sanity check */
HDassert(par_iblock->child_iblocks);
@@ -2438,8 +2438,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len,
- void *_thing)
+H5HF__cache_dblock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image,
+ size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing)
{
H5HF_direct_t *dblock = (H5HF_direct_t *)_thing; /* Direct block info */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index f5ac8e5..c11bc34 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -1185,9 +1185,9 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5
H5HF_indirect_t *iblock; /* Indirect block that section's direct block resides in */
haddr_t dblock_addr; /* Direct block address */
size_t dblock_size; /* Direct block size */
- size_t dblock_overhead; /* Direct block's overhead */
unsigned dblock_status = 0; /* Direct block's status in the metadata cache */
- herr_t status; /* Generic status value */
+ size_t H5_ATTR_NDEBUG_UNUSED dblock_overhead; /* Direct block's overhead */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic status value */
/* Sanity check settings for section's direct block's parent */
iblock = sect->u.single.parent;
@@ -2038,7 +2038,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t
const H5HF_hdr_t *hdr; /* Fractal heap header */
const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Pointer to section to check */
const H5HF_free_section_t *indir_sect; /* Pointer to underlying indirect section */
- unsigned indir_idx; /* Index of row in underlying indirect section's row array */
+ unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index of row in underlying indirect section's row array */
FUNC_ENTER_STATIC_NOERR
@@ -4125,7 +4125,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect)
dir_nrows = (max_dir_row - start_row) + 1;
HDassert(dir_nrows == sect->u.indirect.dir_nrows);
for(u = 0; u < dir_nrows; u++) {
- const H5HF_free_section_t *tmp_row_sect; /* Pointer to row section */
+ const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect; /* Pointer to row section */
tmp_row_sect = sect->u.indirect.dir_rows[u];
HDassert(tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW
@@ -4133,7 +4133,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect)
HDassert(tmp_row_sect->u.row.under == sect);
HDassert(tmp_row_sect->u.row.row == (start_row + u));
if(u > 0) {
- const H5HF_free_section_t *tmp_row_sect2; /* Pointer to row section */
+ const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect2; /* Pointer to row section */
tmp_row_sect2 = sect->u.indirect.dir_rows[u - 1];
HDassert(tmp_row_sect2->u.row.row < tmp_row_sect->u.row.row);
@@ -4160,7 +4160,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect)
HDassert(tmp_child_sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT);
HDassert(tmp_child_sect->u.indirect.parent == sect);
if(u > 0) {
- const H5HF_free_section_t *tmp_child_sect2; /* Pointer to child indirect section */
+ const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_child_sect2; /* Pointer to child indirect section */
tmp_child_sect2 = sect->u.indirect.indir_ents[u - 1];
HDassert(H5F_addr_lt(tmp_child_sect2->sect_info.addr, tmp_child_sect->sect_info.addr));
diff --git a/src/H5HFspace.c b/src/H5HFspace.c
index 37a0502..ad5ff0f 100644
--- a/src/H5HFspace.c
+++ b/src/H5HFspace.c
@@ -447,7 +447,7 @@ H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size)
/* Get free space metadata size */
if(hdr->fspace) {
- if(H5FS_size(hdr->f, hdr->fspace, fs_size) < 0)
+ if(H5FS_size(hdr->fspace, fs_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
} /* end if */
else
diff --git a/src/H5HFtest.c b/src/H5HFtest.c
index 6f174bb..d6eecd7 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -481,7 +481,7 @@ H5HF_get_id_type_test(const void *_id, unsigned char *obj_type)
HDassert(obj_type);
/* Get the type for a heap ID */
- *obj_type = *id & H5HF_ID_TYPE_MASK;
+ *obj_type = (uint8_t)(*id & H5HF_ID_TYPE_MASK);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF_get_id_type_test() */
diff --git a/src/H5HG.c b/src/H5HG.c
index 231294b..2d05a2c 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -505,7 +505,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
+H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/)
{
size_t need; /*total space needed for object */
size_t idx;
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index 29e88df..18625cc 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -202,7 +202,7 @@ H5HG__cache_heap_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *imag
*-------------------------------------------------------------------------
*/
static herr_t
-H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len,
+H5HG__cache_heap_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len,
void *udata, size_t *actual_len)
{
H5HG_heap_t heap; /* Global heap */
@@ -432,7 +432,7 @@ H5HG__cache_heap_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len,
+H5HG__cache_heap_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, size_t len,
void *_thing)
{
H5HG_heap_t *heap = (H5HG_heap_t *)_thing;
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index 1c609e2..573ef39 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -49,9 +49,13 @@ typedef struct H5HG_heap_t H5HG_heap_t;
#define H5HG_FREE_SIZE(H) (H5HG_get_free_size(H))
#endif /* H5HG_MODULE */
+/* Size of encoded global heap ID */
+/* (size of file address + 32-bit integer) */
+#define H5HG_HEAP_ID_SIZE(F) ((size_t)H5F_SIZEOF_ADDR(F) + H5_SIZEOF_UINT32_T)
+
/* Main global heap routines */
-H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/);
+H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/);
H5_DLL void *H5HG_read(H5F_t *f, H5HG_t *hobj, void *object, size_t *buf_size/*out*/);
H5_DLL int H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust);
H5_DLL herr_t H5HG_get_obj_size(H5F_t *f, H5HG_t *hobj, size_t *obj_size);
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 8b04b47..b0ac05f 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -364,7 +364,7 @@ H5HL__cache_prefix_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *im
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL__cache_prefix_get_final_load_size(const void *_image, size_t image_len,
+H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len,
void *_udata, size_t *actual_len)
{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
@@ -415,8 +415,8 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty)
+H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
+ void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
{
H5HL_t *heap = NULL; /* Local heap */
H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */
@@ -555,7 +555,7 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len,
+H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_thing)
{
H5HL_prfx_t *prfx = (H5HL_prfx_t *)_thing; /* Pointer to local heap prefix to query */
@@ -826,8 +826,8 @@ H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len,
- void *_thing)
+H5HL__cache_datablock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image,
+ size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing)
{
H5HL_t *heap; /* Pointer to the local heap */
H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */
diff --git a/src/H5I.c b/src/H5I.c
index 76faab1..b233d23 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -215,7 +215,8 @@ H5I_term_package(void)
*-------------------------------------------------------------------------
*/
H5I_type_t
-H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func)
+H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved,
+ H5I_free_t free_func)
{
H5I_class_t *cls = NULL; /* New ID class */
H5I_type_t new_type; /* New ID type value */
@@ -1235,8 +1236,7 @@ H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id)
if(NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id)))
HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list")
- /* (Casting away const OK -QAK) */
- ret_value = (void *)curr_id->obj_ptr;
+ ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */
curr_id = H5FL_FREE(H5I_id_info_t, curr_id);
/* Decrement the number of IDs in the type */
@@ -2220,7 +2220,7 @@ 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_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
ssize_t ret_value; /* Return value */
@@ -2259,8 +2259,8 @@ done:
hid_t
H5Iget_file_id(hid_t obj_id)
{
- H5I_type_t type; /* ID type */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5I_type_t type; /* ID type */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", obj_id);
@@ -2269,8 +2269,15 @@ H5Iget_file_id(hid_t obj_id)
type = H5I_TYPE(obj_id);
/* Call internal function */
- if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- if ((ret_value = H5F_get_file_id(obj_id, type, TRUE)) < 0)
+ if(H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
+ H5VL_object_t *vol_obj; /* Object of obj_id */
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Get the file ID */
+ if((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID")
} /* end if */
else
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 79bc482..07c1965 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -78,7 +78,7 @@
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 */
+ H5VL_object_t *vol_obj; /* Object 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 */
@@ -96,7 +96,7 @@ H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
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)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
diff --git a/src/H5L.c b/src/H5L.c
index 24836d2..47e29c0 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -34,7 +34,7 @@
#include "H5Oprivate.h" /* File objects */
#include "H5Pprivate.h" /* Property lists */
#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5VLnative_private.h" /* Native VOL */
/****************/
/* Local Macros */
@@ -49,7 +49,7 @@
/* User data for path traversal routine for getting link info by name */
typedef struct {
- H5L_info_t *linfo; /* Buffer to return to user */
+ H5L_info2_t *linfo; /* Buffer to return to user */
} H5L_trav_gi_t;
/* User data for path traversal callback to creating a link */
@@ -93,6 +93,7 @@ typedef struct {
void *buf; /* User buffer */
} H5L_trav_gv_t;
+
/********************/
/* Local Prototypes */
/********************/
@@ -274,10 +275,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)
{
- H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
+ H5VL_object_t *vol_obj1 = NULL; /* Object of src_id */
H5VL_loc_params_t loc_params1;
- H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object of dst_id */
H5VL_loc_params_t loc_params2;
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -298,6 +300,9 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* 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)
@@ -329,8 +334,12 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
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);
+
/* Move the 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)
+ if(H5VL_link_move(&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 move link")
done:
@@ -356,11 +365,11 @@ 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)
{
- H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */
+ H5VL_object_t *vol_obj1 = NULL; /* Object of src_id */
H5VL_loc_params_t loc_params1;
- H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object of dst_id */
H5VL_loc_params_t loc_params2;
- H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -377,15 +386,18 @@ H5Lcopy(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;
+
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* 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")
- /* 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;
@@ -447,7 +459,7 @@ 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)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -468,10 +480,17 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
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 */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
+ /* 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")
+
/* Set location fields */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = link_name;
@@ -482,10 +501,6 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* 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(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, link_target) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
@@ -515,9 +530,9 @@ 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)
{
- 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_object_t *vol_obj1 = NULL; /* Object of cur_loc_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
@@ -544,6 +559,9 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* 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")
@@ -614,7 +632,7 @@ herr_t
H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -630,10 +648,13 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
if(!udata && udata_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata cannot be NULL if udata_size is non-zero")
- /* Check the group access property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* 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")
@@ -676,7 +697,7 @@ done:
herr_t
H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -733,7 +754,7 @@ 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)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -796,7 +817,7 @@ herr_t
H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -852,7 +873,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -908,7 +929,7 @@ done:
htri_t
H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
htri_t ret_value = FAIL; /* Return value */
@@ -945,13 +966,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lget_info
+ * Function: H5Lget_info2
*
- * Purpose: Gets metadata for a link.
+ * Purpose: Gets metadata for a link.
*
- * Return: Success: Non-negative with information in LINFO
- *
- * Failure: Negative
+ * Return: Success: Non-negative with information in LINFO
+ * Failure: Negative
*
* Programmer: James Laird
* Wednesday, June 21, 2006
@@ -959,12 +979,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
+H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ H5VL_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);
@@ -992,17 +1012,17 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Lget_info() */
+} /* end H5Lget_info2() */
/*-------------------------------------------------------------------------
- * Function: H5Lget_info_by_idx
+ * Function: H5Lget_info_by_idx2
*
- * Purpose: Gets metadata for a link, according to the order within an
+ * Purpose: Gets metadata for a link, according to the order within an
* index.
*
- * Return: Success: Non-negative with information in LINFO
- * Failure: Negative
+ * Return: Success: Non-negative with information in LINFO
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* Monday, November 6, 2006
@@ -1010,13 +1030,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
+H5Lget_info_by_idx2(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- H5L_info_t *linfo /*out*/, hid_t lapl_id)
+ H5L_info2_t *linfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo,
@@ -1052,7 +1072,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Lget_info_by_idx() */
+} /* end H5Lget_info_by_idx2() */
/*-------------------------------------------------------------------------
@@ -1095,6 +1115,10 @@ H5Lregister(const H5L_class_t *cls)
*/
if(cls->version > H5L_LINK_CLASS_T_VERS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number")
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+ if(cls->version < H5L_LINK_CLASS_T_VERS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "deprecated H5L_class_t version number (%d) and library built without deprecated symbol support", cls->version)
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
if(cls->id < H5L_TYPE_UD_MIN || cls->id > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number")
@@ -1209,7 +1233,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name /*out*/, size_t size, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
ssize_t ret_value = -1; /* Return value */
@@ -1252,7 +1276,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Literate
+ * Function: H5Literate2
*
* Purpose: Iterates over links in a group, with user callback routine,
* according to the order within an index.
@@ -1270,10 +1294,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-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)
+H5Literate2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t *idx_p, H5L_iterate2_t op, void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
H5I_type_t id_type; /* Type of ID */
herr_t ret_value; /* Return value */
@@ -1301,16 +1325,17 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
loc_params.obj_type = H5I_get_type(group_id);
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p,
+ op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Literate() */
+} /* end H5Literate2() */
/*-------------------------------------------------------------------------
- * Function: H5Literate_by_name
+ * Function: H5Literate_by_name2
*
* Purpose: Iterates over links in a group, with user callback routine,
* according to the order within an index.
@@ -1326,17 +1351,17 @@ done:
* of the operators.
*
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, November 16, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Literate_by_name(hid_t loc_id, const char *group_name,
+H5Literate_by_name2(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
- H5L_iterate_t op, void *op_data, hid_t lapl_id)
+ H5L_iterate2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
@@ -1371,7 +1396,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, 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:
@@ -1380,7 +1406,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Lvisit
+ * Function: H5Lvisit2
*
* Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
@@ -1403,15 +1429,15 @@ done:
* of the operators.
*
* Programmer: Quincey Koziol
- * November 24 2007
+ * November 24 2007
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
- H5L_iterate_t op, void *op_data)
+H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5L_iterate2_t op, void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
H5I_type_t id_type; /* Type of ID */
herr_t ret_value; /* Return value */
@@ -1439,16 +1465,17 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
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)
+ 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)
-} /* end H5Lvisit() */
+} /* end H5Lvisit2() */
/*-------------------------------------------------------------------------
- * Function: H5Lvisit_by_name
+ * Function: H5Lvisit_by_name2
*
* Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
@@ -1470,16 +1497,16 @@ done:
* library, or the negative value returned by one
* of the operators.
*
- * Programmer: Quincey Koziol
- * November 3 2007
+ * Programmer: Quincey Koziol
+ * November 3 2007
*
*-------------------------------------------------------------------------
*/
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)
+H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value; /* Return value */
@@ -1514,12 +1541,13 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
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)
+ 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)
-} /* end H5Lvisit_by_name() */
+} /* end H5Lvisit_by_name2() */
/*
*-------------------------------------------------------------------------
@@ -1845,8 +1873,8 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
/* Check for non-default link creation properties */
if(udata->lc_plist) {
/* Get character encoding property */
- if(H5P_get(udata->lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &udata->lnk->cset) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get property value for character encoding")
+ if(H5CX_get_encoding(&udata->lnk->cset) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property")
} /* end if */
else
udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
@@ -1882,7 +1910,7 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
* copy and wipe out grp_loc)
*/
H5G_name_reset(&temp_path);
- if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
temp_loc.oloc = &temp_oloc;
@@ -1987,8 +2015,8 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get intermediate group creation property */
- if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
+ if(H5CX_get_intermediate_group(&crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property")
if(crt_intmd_group > 0)
target_flags |= H5G_CRT_INTMD_GROUP;
@@ -2667,7 +2695,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
* copy and wipe out grp_loc)
*/
H5G_name_reset(&temp_path);
- if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
temp_loc.oloc = &temp_oloc;
@@ -2876,7 +2904,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get intermediate group creation property */
- if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
+ if(H5CX_get_intermediate_group(&crt_intmd_group) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
/* Set target flags for source and destination */
@@ -2884,7 +2912,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
dst_target_flags |= H5G_CRT_INTMD_GROUP;
/* Get character encoding property */
- if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &char_encoding) < 0)
+ if(H5CX_get_encoding(&char_encoding) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding")
} /* end if */
@@ -3123,7 +3151,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5L__get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name,
+H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char H5_ATTR_UNUSED *name,
const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/)
{
@@ -3137,7 +3165,7 @@ H5L__get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNU
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
/* Get information from the link */
- if(H5G_link_to_info(lnk, udata->linfo) < 0)
+ if(H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
done:
@@ -3152,9 +3180,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5L_get_info
*
- * Purpose: Returns metadata about a link.
+ * Purpose: Returns metadata about a link.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
* Monday, April 17 2006
@@ -3162,7 +3190,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/)
+H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo/*out*/)
{
H5L_trav_gi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3215,7 +3243,7 @@ H5L__get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A
lnk_copied = TRUE;
/* Get information from the link */
- if(H5G_link_to_info(&fnd_lnk, udata->linfo) < 0)
+ if(H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
done:
@@ -3243,7 +3271,7 @@ done:
*/
herr_t
H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/)
+ H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/)
{
H5L_trav_gibi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3496,7 +3524,7 @@ done:
*/
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)
+ H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op, void *op_data)
{
H5G_link_iterate_t lnk_op; /* Link operator */
hsize_t last_lnk; /* Index of last object looked at */
diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c
new file mode 100644
index 0000000..8b83230
--- /dev/null
+++ b/src/H5Ldeprec.c
@@ -0,0 +1,628 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Purpose: Deprecated functions from the H5L interface. These
+ * functions are here for compatibility purposes and may be
+ * removed in the future. Applications should switch to the
+ * newer APIs.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Lmodule.h" /* This source code file is part of the H5L module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lpkg.h" /* Links */
+
+#include "H5VLnative_private.h"
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Shim data for using native H5Literate/visit callbacks with the VOL */
+typedef struct H5L_shim_data_t {
+ H5L_iterate1_t real_op;
+ void *real_op_data;
+} H5L_shim_data_t;
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__iterate2_shim
+ *
+ * Purpose: Shim function for translating between H5L_info2_t and
+ * H5L_info1_t structures, as used by H5Literate2/H5Lvisit2
+ * and H5Literate1/H5Lvisit1, respectively.
+ *
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ * Failure: H5_ITER_ERROR
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__iterate2_shim(hid_t group_id, const char *name, const H5L_info2_t *linfo2, void *op_data)
+{
+ H5L_shim_data_t *shim_data = (H5L_shim_data_t *)op_data;
+ H5L_info1_t linfo;
+ herr_t ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_STATIC
+
+ /* Copy the new-style members into the old-style struct */
+ if (linfo2) {
+ linfo.type = linfo2->type;
+ linfo.corder_valid = linfo2->corder_valid;
+ linfo.corder = linfo2->corder;
+ linfo.cset = linfo2->cset;
+ if (H5L_TYPE_HARD == linfo2->type) {
+ if(H5VLnative_token_to_addr(group_id, linfo2->u.token, &linfo.u.address) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, H5_ITER_ERROR, "can't deserialize object token into address")
+ }
+ else
+ linfo.u.val_size = linfo2->u.val_size;
+ }
+
+ /* Invoke the real callback */
+ ret_value = shim_data->real_op(group_id, name, &linfo, shim_data->real_op_data);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__iterate2_shim() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Literate1
+ *
+ * Purpose: Iterates over links in a group, with user callback routine,
+ * according to the order within an index.
+ *
+ * Same pattern of behavior as H5Giterate.
+ *
+ * Note: Deprecated in favor of H5Literate2
+ *
+ * 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.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t *idx_p, H5L_iterate1_t op, void *op_data)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data);
+
+ /* Check arguments */
+ 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")
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Literate1 is only meant to be used with the native VOL connector")
+
+ /* Set location struct fields */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(group_id);
+
+ /* Set up shim */
+ shim_data.real_op = op;
+ shim_data.real_op_data = op_data;
+
+ /* Iterate over the links */
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p,
+ H5L__iterate2_shim, (void *)&shim_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Literate1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Literate_by_name1
+ *
+ * Purpose: Iterates over links in a group, with user callback routine,
+ * according to the order within an index.
+ *
+ * Same pattern of behavior as H5Giterate.
+ *
+ * Note: Deprecated in favor of H5Literate_by_name2
+ *
+ * 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.
+ *
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 16, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Literate_by_name1(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
+ H5L_iterate1_t op, void *op_data, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
+
+ 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)
+ 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")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Literate_by_name1 is only meant to be used with the native VOL connector")
+
+ /* 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;
+
+ /* Set up shim */
+ shim_data.real_op = op;
+ shim_data.real_op_data = op_data;
+
+ /* Iterate over the links */
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p,
+ H5L__iterate2_shim, (void *)&shim_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Literate_by_name1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Lget_info1
+ *
+ * Purpose: Gets metadata for a link.
+ *
+ * Note: Deprecated in favor of H5Lget_info2
+ *
+ * Return: Success: Non-negative with information in LINFO
+ * Failure: Negative
+ *
+ * Programmer: James Laird
+ * Wednesday, June 21, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/,
+ hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5L_info2_t linfo2; /* New-style link info */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id);
+
+ /* Check arguments */
+ if(!name || !*name)
+ 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lget_info1 is only meant to be used with the native VOL connector")
+
+ /* Get the link information */
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &linfo2) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+
+ /* Copy the new-style members into the old-style struct */
+ if(linfo) {
+ linfo->type = linfo2.type;
+ linfo->corder_valid = linfo2.corder_valid;
+ linfo->corder = linfo2.corder;
+ linfo->cset = linfo2.cset;
+ if(H5L_TYPE_HARD == linfo2.type) {
+ void *vol_obj_data;
+
+ if(NULL == (vol_obj_data = H5VL_object_data(vol_obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object")
+
+ if(H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+ } /* end if */
+ else
+ linfo->u.val_size = linfo2.u.val_size;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Lget_info1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Lget_info_by_idx1
+ *
+ * Purpose: Gets metadata for a link, according to the order within an
+ * index.
+ *
+ * Note: Deprecated in favor of H5Lget_info_by_idx2
+ *
+ * Return: Success: Non-negative with information in LINFO
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Lget_info_by_idx1(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ H5L_info1_t *linfo /*out*/, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5L_info2_t linfo2; /* New-style link info */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo,
+ lapl_id);
+
+ /* Check arguments */
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lget_info_by_idx1 is only meant to be used with the native VOL connector")
+
+ /* Get the link information */
+ if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &linfo2) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+
+ /* Copy the new-style members into the old-style struct */
+ if(linfo) {
+ linfo->type = linfo2.type;
+ linfo->corder_valid = linfo2.corder_valid;
+ linfo->corder = linfo2.corder;
+ linfo->cset = linfo2.cset;
+ if(H5L_TYPE_HARD == linfo2.type) {
+ void *vol_obj_data;
+
+ if(NULL == (vol_obj_data = H5VL_object_data(vol_obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object")
+
+ if(H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+ } /* end if */
+ else
+ linfo->u.val_size = linfo2.u.val_size;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Lget_info_by_idx1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Lvisit1
+ *
+ * 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
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Each _link_ reachable from the initial group will only be
+ * visited once. However, because an object may be reached from
+ * more than one link, the visitation may call the application's
+ * callback with more than one link that points to a particular
+ * _object_.
+ *
+ * Note: Deprecated in favor of H5Lvisit2
+ *
+ * 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.
+ *
+ * Programmer: Quincey Koziol
+ * November 24 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5L_iterate1_t op, void *op_data)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data);
+
+ /* Check args */
+ 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")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+
+ /* 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lvisit1 is only meant to be used with the native VOL connector")
+
+ /* Set up shim */
+ shim_data.real_op = op;
+ shim_data.real_op_data = op_data;
+
+ /* Iterate over the links */
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim, (void *)&shim_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Lvisit1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Lvisit_by_name1
+ *
+ * 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
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Each _link_ reachable from the initial group will only be
+ * visited once. However, because an object may be reached from
+ * more than one link, the visitation may call the application's
+ * callback with more than one link that points to a particular
+ * _object_.
+ *
+ * Note: Deprecated in favor of H5Lvisit_by_name2
+ *
+ * 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.
+ *
+ * Programmer: Quincey Koziol
+ * November 3 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5L_iterate1_t op, void *op_data, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
+
+ 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)
+ 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")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lvisit_by_name1 is only meant to be used with the native VOL connector")
+
+ /* 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;
+
+ /* Set up shim */
+ shim_data.real_op = op;
+ shim_data.real_op_data = op_data;
+
+ /* Visit the links */
+ if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim, (void *)&shim_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Lvisit_by_name1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 3c4ffcc..1b007b6 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -341,7 +341,7 @@ herr_t
H5Lcreate_external(const char *file_name, const char *obj_name,
hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
char *norm_obj_name = NULL; /* Pointer to normalized current name */
void *ext_link_buf = NULL; /* Buffer to contain external link */
@@ -364,10 +364,17 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
if(!link_name || !*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
- /* Check the group access property list */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
+ /* 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")
+
/* 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")
@@ -386,10 +393,6 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
p += file_name_len;
HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */
- /* 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;
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index fa3c097..ab68b84 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -63,12 +63,12 @@ typedef struct {
/* User data for path traversal routine for getting link info by index */
typedef struct {
/* In */
- H5_index_t idx_type; /* Index to use */
+ H5_index_t idx_type; /* Index to use */
H5_iter_order_t order; /* Order to iterate in index */
hsize_t n; /* Offset of link within index */
/* Out */
- H5L_info_t *linfo; /* Buffer to return to user */
+ H5L_info2_t *linfo; /* Buffer to return to user */
} H5L_trav_gibi_t;
/* User data for path traversal routine for getting name by index */
@@ -98,7 +98,6 @@ typedef struct H5L_elink_cb_t {
void *user_data;
} H5L_elink_cb_t;
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -124,13 +123,13 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name,
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*/);
+ H5L_info2_t *linkbuf/*out*/);
H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- H5L_info_t *linfo /*out*/);
+ H5L_info2_t *linfo /*out*/);
H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name /*out*/, size_t size);
@@ -142,7 +141,7 @@ H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name,
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);
+ H5L_iterate2_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 7bdb001..3bac5ac 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -27,6 +27,7 @@
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
#include "H5Ipublic.h" /* IDs */
+#include "H5Opublic.h" /* Object Headers */
#include "H5Tpublic.h" /* Datatypes */
/*****************/
@@ -43,9 +44,6 @@
/* Current version of the H5L_class_t struct */
#define H5L_LINK_CLASS_T_VERS 1
-/* Previous versions of the H5L_class_t struct */
-#define H5L_LINK_CLASS_T_VERS_0 0
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -72,17 +70,19 @@ typedef enum {
#define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT /* Maximum value link value for "built-in" link types */
#define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL /* Link ids at or above this value are "user-defined" link types. */
-/* Information struct for link (for H5Lget_info/H5Lget_info_by_idx) */
+/* Information struct for link (for H5Lget_info2/H5Lget_info_by_idx2)
+ * H5O_token_t version used in VOL layer and future public API calls
+ */
typedef struct {
H5L_type_t type; /* Type of link */
hbool_t corder_valid; /* Indicate if creation order is valid */
int64_t corder; /* Creation order */
H5T_cset_t cset; /* Character set of link name */
union {
- haddr_t address; /* Address hard link points to */
+ H5O_token_t token; /* Token of location that hard link points to */
size_t val_size; /* Size of a soft link or UD link value */
} u;
-} H5L_info_t;
+} H5L_info2_t;
/* The H5L_class_t struct can be used to override the behavior of a
* "user-defined" link class. Users should populate the struct with callback
@@ -102,8 +102,6 @@ typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc,
const void *lnkdata, size_t lnkdata_size);
/* Callback during link traversal */
-typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group,
- const void *lnkdata, size_t lnkdata_size, hid_t lapl_id);
typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group,
const void *lnkdata, size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id);
@@ -116,19 +114,6 @@ typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file,
typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata,
size_t lnkdata_size, void *buf /*out*/, size_t buf_size);
-/* User-defined link types */
-typedef struct {
- int version; /* Version number of this struct */
- H5L_type_t id; /* Link type ID */
- const char *comment; /* Comment for debugging */
- H5L_create_func_t create_func; /* Callback during link creation */
- H5L_move_func_t move_func; /* Callback after moving link */
- H5L_copy_func_t copy_func; /* Callback after copying link */
- H5L_traverse_0_func_t trav_func; /* Callback during link traversal */
- H5L_delete_func_t del_func; /* Callback for link deletion */
- H5L_query_func_t query_func; /* Callback for queries */
-} H5L_class_0_t;
-
typedef struct {
int version; /* Version number of this struct */
H5L_type_t id; /* Link type ID */
@@ -141,8 +126,10 @@ typedef struct {
H5L_query_func_t query_func; /* Callback for queries */
} H5L_class_t;
-/* Prototype for H5Literate/H5Literate_by_name() operator */
-typedef herr_t (*H5L_iterate_t)(hid_t group, const char *name, const H5L_info_t *info,
+/* Prototype for H5Literate2/H5Literate_by_name2() operator
+ * H5O_token_t version used in VOL layer and future public API calls
+ */
+typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info,
void *op_data);
/* Callback for external link traversal */
@@ -177,23 +164,23 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
void *buf/*out*/, size_t size, hid_t lapl_id);
H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id);
-H5_DLL herr_t H5Lget_info(hid_t loc_id, const char *name,
- H5L_info_t *linfo /*out*/, hid_t lapl_id);
-H5_DLL herr_t H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
+H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name,
+ H5L_info2_t *linfo /*out*/, hid_t lapl_id);
+H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- H5L_info_t *linfo /*out*/, hid_t lapl_id);
+ H5L_info2_t *linfo /*out*/, hid_t lapl_id);
H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name /*out*/, size_t size, hid_t lapl_id);
-H5_DLL herr_t H5Literate(hid_t grp_id, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5L_iterate_t op, void *op_data);
-H5_DLL herr_t H5Literate_by_name(hid_t loc_id, const char *group_name,
+H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data);
+H5_DLL herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
- H5L_iterate_t op, void *op_data, hid_t lapl_id);
-H5_DLL herr_t H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
- H5L_iterate_t op, void *op_data);
-H5_DLL 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,
+ H5L_iterate2_t op, void *op_data, hid_t lapl_id);
+H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5L_iterate2_t op, void *op_data);
+H5_DLL herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op,
void *op_data, hid_t lapl_id);
/* UD link functions */
@@ -210,6 +197,73 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval/*in*/, size_t link_siz
H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name,
hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id);
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/* Macros */
+
+/* Previous versions of the H5L_class_t struct */
+#define H5L_LINK_CLASS_T_VERS_0 0
+
+
+/* Typedefs */
+
+/* Information struct for link (for H5Lget_info1/H5Lget_info_by_idx1) */
+typedef struct {
+ H5L_type_t type; /* Type of link */
+ hbool_t corder_valid; /* Indicate if creation order is valid */
+ int64_t corder; /* Creation order */
+ H5T_cset_t cset; /* Character set of link name */
+ union {
+ haddr_t address; /* Address hard link points to */
+ size_t val_size; /* Size of a soft link or UD link value */
+ } u;
+} H5L_info1_t;
+
+/* Callback during link traversal */
+typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group,
+ const void *lnkdata, size_t lnkdata_size, hid_t lapl_id);
+
+/* User-defined link types */
+typedef struct {
+ int version; /* Version number of this struct */
+ H5L_type_t id; /* Link type ID */
+ const char *comment; /* Comment for debugging */
+ H5L_create_func_t create_func; /* Callback during link creation */
+ H5L_move_func_t move_func; /* Callback after moving link */
+ H5L_copy_func_t copy_func; /* Callback after copying link */
+ H5L_traverse_0_func_t trav_func; /* Callback during link traversal */
+ H5L_delete_func_t del_func; /* Callback for link deletion */
+ H5L_query_func_t query_func; /* Callback for queries */
+} H5L_class_0_t;
+
+/* Prototype for H5Literate1/H5Literate_by_name1() operator */
+typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info,
+ void *op_data);
+
+
+/* Function prototypes */
+H5_DLL herr_t H5Lget_info1(hid_t loc_id, const char *name,
+ H5L_info1_t *linfo /*out*/, hid_t lapl_id);
+H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ H5L_info1_t *linfo /*out*/, hid_t lapl_id);
+H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data);
+H5_DLL herr_t H5Literate_by_name1(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
+ H5L_iterate1_t op, void *op_data, hid_t lapl_id);
+H5_DLL herr_t H5Lvisit1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5L_iterate1_t op, void *op_data);
+H5_DLL herr_t H5Lvisit_by_name1(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op,
+ void *op_data, hid_t lapl_id);
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5M.c b/src/H5M.c
index adb4df0..4d76574 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -78,6 +78,29 @@ static hbool_t H5M_top_package_initialize_s = FALSE;
/*-------------------------------------------------------------------------
+ * Function: H5M_init
+ *
+ * Purpose: Initialize the interface from some other layer.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5M_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 H5M_init() */
+
+
+/*-------------------------------------------------------------------------
NAME
H5M__init_package -- Initialize interface-specific information
USAGE
@@ -197,7 +220,7 @@ H5M__close_cb(H5VL_object_t *map_vol_obj)
HDassert(map_vol_obj);
/* Close the map */
- if(H5VL_optional(map_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ if(H5VL_optional(map_vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map");
/* Free the VOL object */
@@ -233,7 +256,7 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id,
hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id)
{
void *map = NULL; /* New map's info */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -274,8 +297,8 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the map */
- if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, name, lcpl_id,
- key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &loc_params, name, lcpl_id, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
/* Get an atom for the map */
@@ -285,7 +308,7 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id,
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
FUNC_LEAVE_API(ret_value)
@@ -320,8 +343,8 @@ hid_t
H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id,
hid_t mcpl_id, hid_t mapl_id)
{
- void *map = NULL; /* map token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *map = NULL; /* map object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -348,8 +371,8 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the map */
- if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT,
- key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
/* Get an atom for the map */
@@ -359,7 +382,7 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id,
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
FUNC_LEAVE_API(ret_value)
@@ -384,8 +407,8 @@ done:
hid_t
H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
{
- void *map = NULL; /* map token from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *map = NULL; /* map object from VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -411,7 +434,7 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Open the map */
- if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_OPEN, &loc_params, name, mapl_id, &map) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, name, mapl_id, &map) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map")
/* Register an atom for the map */
@@ -421,7 +444,7 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
done:
/* Cleanup on failure */
if(H5I_INVALID_HID == ret_value)
- if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0)
+ if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
FUNC_LEAVE_API(ret_value)
@@ -489,7 +512,7 @@ H5Mget_key_type(hid_t map_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
/* get the datatype */
- if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
done:
@@ -524,7 +547,7 @@ H5Mget_val_type(hid_t map_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
/* get the datatype */
- if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
done:
@@ -559,7 +582,7 @@ H5Mget_create_plist(hid_t map_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
/* Get the map creation property list */
- if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MCPL, &ret_value) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MCPL, &ret_value) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties")
done:
@@ -597,7 +620,7 @@ H5Mget_access_plist(hid_t map_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
/* Get the map access property list */
- if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MAPL, &ret_value) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MAPL, &ret_value) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
done:
@@ -641,7 +664,7 @@ H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id)
H5CX_set_dxpl(dxpl_id);
/* Get the number of key-value pairs stored in the map */
- if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_COUNT, count) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_GET, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_COUNT, count) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
done:
@@ -697,7 +720,7 @@ H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key,
H5CX_set_dxpl(dxpl_id);
/* Set the key/value pair */
- if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_PUT, key_mem_type_id, key, val_mem_type_id, value) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_PUT, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, val_mem_type_id, value) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair")
done:
@@ -756,7 +779,7 @@ H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key,
H5CX_set_dxpl(dxpl_id);
/* Get the value for the key */
- if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_VAL, key_mem_type_id, key, val_mem_type_id, value) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_GET_VAL, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, val_mem_type_id, value) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map")
done:
@@ -806,7 +829,7 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists,
H5CX_set_dxpl(dxpl_id);
/* Check if key exists */
- if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_EXISTS, key_mem_type_id, key, exists)) < 0)
+ if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_EXISTS, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, exists)) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists")
done:
@@ -881,7 +904,7 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
loc_params.obj_type = H5I_get_type(map_id);
/* Iterate over keys */
- if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
+ if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys")
done:
@@ -964,7 +987,7 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* Iterate over keys */
- if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
+ if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys")
done:
@@ -1021,7 +1044,7 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key,
loc_params.obj_type = H5I_get_type(map_id);
/* Delete the key/value pair */
- if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0)
+ if(H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair")
done:
diff --git a/src/H5MF.c b/src/H5MF.c
index 14be37a..df1c88a 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -163,7 +163,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh)
* can merge with the metadata or small 'raw' data aggregator
*/
all_same = TRUE;
- 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; type++)
/* Check for any different type mappings */
if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_DEFAULT]) {
all_same = FALSE;
@@ -187,7 +187,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh)
/* One or more allocation type don't map to the same free list type */
/* Check if all the metadata allocation types map to the same type */
all_metadata_same = TRUE;
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++)
/* Skip checking raw data free list mapping */
/* (global heap is treated as raw data) */
if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) {
@@ -1686,7 +1686,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Iterate over all the free space types that have managers and
* get each free list's space
*/
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) {
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) {
/* Test to see if we need to switch rings -- do so if required */
if(H5MF__fsm_type_is_self_referential(f->shared, ptype))
needed_ring = H5AC_RING_MDFSM;
@@ -1708,7 +1708,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Iterate over all the free space types that have managers and
* get each free list's space
*/
- 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; type++) {
/* Test to see if we need to switch rings -- do so if required */
if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type))
needed_ring = H5AC_RING_MDFSM;
@@ -1807,9 +1807,9 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
*
* In passing, verify that all the free space managers are closed.
*/
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF;
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++)
fsinfo.fs_addr[type-1] = f->shared->fs_addr[type];
fsinfo.strategy = f->shared->fs_strategy;
fsinfo.persist = f->shared->fs_persist;
@@ -1824,7 +1824,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
/* Close the free space managers */
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) {
if(f->shared->fs_man[type]) {
/* Test to see if we need to switch rings -- do so if required */
if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type))
@@ -1877,7 +1877,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
HDassert(H5F_NULL_FSM_ADDR(f) || final_eoa == f->shared->eoa_fsm_fsalloc);
} /* end if */
else { /* super_vers can be 0, 1, 2 */
- 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; type++)
if(H5MF__close_delete_fstype(f, (H5F_mem_page_t)type) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
} /* end else */
@@ -1958,7 +1958,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF;
fsinfo.version = f->shared->fs_version;
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF;
if(f->shared->fs_persist) {
@@ -1980,7 +1980,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
* file space for the self referential free space managers. Other
* data was gathered above.
*/
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
fsinfo.fs_addr[ptype-1] = f->shared->fs_addr[ptype];
fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_fsm_fsalloc;
@@ -1990,7 +1990,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Close the free space managers */
/* use H5MF__close_fstype() for this? */
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) {
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) {
if(f->shared->fs_man[ptype]) {
/* Test to see if we need to switch rings -- do so if required */
if(H5MF__fsm_type_is_self_referential(f->shared, ptype))
@@ -2052,7 +2052,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Iterate over all the free space types that have managers
* and get each free list's space
*/
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
if(H5MF__close_delete_fstype(f, ptype) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager")
@@ -2125,7 +2125,7 @@ H5MF__close_shrink_eoa(H5F_t *f)
if(H5F_PAGED_AGGR(f)) {
/* Check the last section of each free-space manager */
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) {
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) {
if(f->shared->fs_man[ptype]) {
/* Test to see if we need to switch rings -- do so if required */
if(H5MF__fsm_type_is_self_referential(f->shared, ptype))
@@ -2149,7 +2149,7 @@ H5MF__close_shrink_eoa(H5F_t *f)
} /* end if */
else {
/* Check the last section of each free-space manager */
- 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; type++) {
if(f->shared->fs_man[type]) {
/* Test to see if we need to switch rings -- do so if required */
if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type))
@@ -2245,7 +2245,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
end_type = (H5F_mem_page_t)H5FD_MEM_NTYPES;
} /* end else */
- for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, tt))
+ for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; tt++)
if(HADDR_UNDEF == (fs_eoa[tt] = H5F_get_eoa(f, tt)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
@@ -2260,7 +2260,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
} /* end if */
/* Iterate over all the free space types that have managers and get each free list's space */
- for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) {
+ for(type = start_type; type < end_type; type++) {
fs_started[type] = FALSE;
/* Check if the free space for the file has been initialized */
@@ -2290,7 +2290,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
/* Retrieve free space size from free space manager */
if(H5FS_sect_stats(f->shared->fs_man[type], &type_fs_size, NULL) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats")
- if(H5FS_size(f, f->shared->fs_man[type], &type_meta_size) < 0)
+ if(H5FS_size(f->shared->fs_man[type], &type_meta_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space metadata stats")
/* Increment total free space for types */
@@ -2300,7 +2300,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size)
} /* end for */
/* Close the free-space managers if they were opened earlier in this routine */
- for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) {
+ for(type = start_type; type < end_type; type++) {
/* Test to see if we need to switch rings -- do so if required */
if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type))
needed_ring = H5AC_RING_MDFSM;
@@ -2387,7 +2387,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
if(H5F_PAGED_AGGR(f)) /* set to the corresponding LARGE free-space manager */
end_type = (H5F_mem_page_t)(end_type + H5FD_MEM_NTYPES);
else
- H5_INC_ENUM(H5F_mem_page_t, end_type);
+ end_type++;
} /* end else */
/* Set up user data for section iteration */
@@ -2403,7 +2403,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
curr_ring = H5AC_RING_RDFSM;
/* Iterate over memory types, retrieving the number of sections of each type */
- for(ty = start_type; ty < end_type; H5_INC_ENUM(H5F_mem_page_t, ty)) {
+ for(ty = start_type; ty < end_type; ty++) {
hbool_t fs_started = FALSE; /* The free-space manager is opened or not */
size_t nums = 0; /* The number of free-space sections */
@@ -2733,7 +2733,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
else /* no need for a second pass */
break;
- for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) {
+ for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) {
H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type);
if(pass_count == 0) { /* this is the first pass */
@@ -2834,7 +2834,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
* those addresses are unknown. This is OK -- we will write the correct
* values to the message at free space manager shutdown.
*/
- for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type))
+ for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++)
fsinfo.fs_addr[fsm_type - 1] = HADDR_UNDEF;
fsinfo.strategy = f->shared->fs_strategy;
fsinfo.persist = f->shared->fs_persist;
@@ -2867,7 +2867,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
*/
/* Reinitialize fsm_visited */
- for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type))
+ for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++)
fsm_visited[fsm_type] = FALSE;
for(pass_count = 0; pass_count <= 1; pass_count++) {
@@ -2878,7 +2878,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
else /* no need for a second pass */
break;
- for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) {
+ for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) {
H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type);
if(pass_count == 0) { /* this is the first pass */
@@ -2975,7 +2975,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
} /* end for */
/* verify that all opened FSMs were closed */
- for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type))
+ for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++)
HDassert(!fsm_opened[fsm_type]);
/* Indicate that the FSM was settled successfully */
diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c
index e11476b..7bb77e8 100644
--- a/src/H5MFdbg.c
+++ b/src/H5MFdbg.c
@@ -169,7 +169,7 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, type))
+ for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; type++)
if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) {
if(!f->shared->fs_man[type])
if(H5MF__open_fstype(f, type) < 0)
@@ -243,7 +243,7 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa);
if(H5F_PAGED_AGGR(f)) { /* File space paging */
H5F_mem_page_t ptype; /* Memory type for iteration -- page fs */
- for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) {
+ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) {
/* Print header for type */
HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)ptype);
@@ -289,7 +289,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC,
#endif /* H5MF_ALLOC_DEBUG */
/* Iterate over all the free space types that have managers and dump each free list's space */
- for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, atype)) {
+ for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; atype++) {
/* Print header for type */
HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)atype);
diff --git a/src/H5MM.c b/src/H5MM.c
index ac3c26e..94bd542 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -566,6 +566,31 @@ H5MM_xfree(void *mem)
/*-------------------------------------------------------------------------
+ * Function: H5MM_xfree_const
+ *
+ * Purpose: H5MM_xfree() wrapper that handles const pointers without
+ * warnings. Used for freeing buffers that should be regarded
+ * as const in use but need to be freed when no longer needed.
+ *
+ * Return: Success: NULL
+ * Failure: never fails
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5MM_xfree_const(const void *mem)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Cast through uintptr_t to de-const memory */
+ H5MM_xfree((void *)(uintptr_t)mem);
+
+ FUNC_LEAVE_NOAPI(NULL)
+} /* end H5MM_xfree_const() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5MM_memcpy
*
* Purpose: Like memcpy(3) but with sanity checks on the parameters,
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 2053215..240b931 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -45,6 +45,7 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size);
H5_DLL char *H5MM_xstrdup(const char *s);
H5_DLL char *H5MM_strdup(const char *s);
H5_DLL void *H5MM_xfree(void *mem);
+H5_DLL void *H5MM_xfree_const(const void *mem);
H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n);
#if defined H5_MEMORY_ALLOC_SANITY_CHECK
H5_DLL void H5MM_sanity_check_all(void);
diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h
index c841e75..3d0e8cc 100644
--- a/src/H5Mprivate.h
+++ b/src/H5Mprivate.h
@@ -65,6 +65,7 @@
/****************************/
/* Library Private Typedefs */
/****************************/
+H5_DLL herr_t H5M_init(void);
/*****************************/
diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h
index 9cbdb32..524ab0f 100644
--- a/src/H5Mpublic.h
+++ b/src/H5Mpublic.h
@@ -40,7 +40,8 @@
#define H5VL_MAP_PUT 5
#define H5VL_MAP_GET 6
#define H5VL_MAP_SPECIFIC 7
-#define H5VL_MAP_CLOSE 8
+#define H5VL_MAP_OPTIONAL 8
+#define H5VL_MAP_CLOSE 9
/*******************/
diff --git a/src/H5O.c b/src/H5O.c
index ed68ed0..d943e37 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -102,7 +102,7 @@
hid_t
H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
@@ -171,7 +171,7 @@ 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)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
@@ -217,71 +217,58 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oopen_by_addr
+ * Function: H5Oopen_by_token
*
- * Purpose: Warning! This function is EXTREMELY DANGEROUS!
- * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA,
- * and other VERY BAD THINGS!
+ * Purpose: Same as H5Oopen_by_addr, but uses VOL-independent tokens.
*
- * This function opens an object using its address within the
- * HDF5 file, similar to an HDF5 hard link. The open object
- * is identical to an object opened with H5Oopen() and should
- * be closed with H5Oclose() or a type-specific closing
- * function (such as H5Gclose() ).
- *
- * This function is very dangerous if called on an invalid
- * address. For this reason, H5Oincr_refcount() should be
- * used to prevent HDF5 from deleting any object that is
- * referenced by address (e.g. by a user-defined link).
- * H5Odecr_refcount() should be used when the object is
- * no longer being referenced by address (e.g. when the UD link
- * is deleted).
- *
- * The address of the HDF5 file on disk has no effect on
- * H5Oopen_by_addr(), nor does the use of any unusual file
- * drivers. The "address" is really the offset within the
- * HDF5 file, and HDF5's file drivers will transparently
- * map this to an address on disk for the filesystem.
+ * Return: Success: An open object identifier
+ * Failure: H5I_INVALID_HID
*
- * Return: Success: An open object identifier
- * Failure: H5I_INVALID_HID
- *
- * Programmer: James Laird
- * July 14 2006
+ * Programmer: Dana Robinson
+ * Winter 2019
*
*-------------------------------------------------------------------------
*/
hid_t
-H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
+H5Oopen_by_token(hid_t loc_id, H5O_token_t token)
{
- 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 */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5I_type_t opened_type; /* Opened object type */
+ void *opened_obj = NULL; /* Opened object */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE2("i", "ia", loc_id, addr);
+ H5TRACE2("i", "ik", loc_id, token);
- 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);
+ /* Check args */
+ if(H5O_IS_TOKEN_UNDEF(token))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "can't open H5O_TOKEN_UNDEF")
/* 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 object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &token;
+ loc_params.obj_type = vol_obj_type;
+
/* Open the 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 */
+ /* Register the object's ID */
if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Oopen_by_addr() */
+} /* end H5Oopen_by_token() */
/*-------------------------------------------------------------------------
@@ -309,9 +296,9 @@ herr_t
H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj1 = NULL; /* object 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_object_t *vol_obj1 = NULL; /* object of obj_id */
+ H5VL_object_t *vol_obj2 = NULL; /* object of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
@@ -332,10 +319,13 @@ 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 */
+ /* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* 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")
@@ -398,7 +388,7 @@ done:
herr_t
H5Oincr_refcount(hid_t object_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED;
@@ -448,7 +438,7 @@ done:
herr_t
H5Odecr_refcount(hid_t object_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -491,7 +481,7 @@ done:
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
htri_t ret_value = FAIL; /* Return value */
@@ -528,23 +518,21 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Oget_info2
+ * Function: H5Oget_info3
*
* 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
+ * Programmer: Dana Robinson
+ * Fall 2019
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
+H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -566,33 +554,31 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Oget_info2() */
+} /* end H5Oget_info3() */
/*-------------------------------------------------------------------------
- * Function: H5Oget_info_by_name2
+ * Function: H5Oget_info_by_name3
*
* 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
+ * Programmer: Dana Robinson
+ * Fall 2019
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
- unsigned fields, hid_t lapl_id)
+H5Oget_info_by_name3(hid_t loc_id, const char *name,
+ H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -624,35 +610,33 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Oget_info_by_name2() */
+} /* end H5Oget_info_by_name3() */
/*-------------------------------------------------------------------------
- * Function: H5Oget_info_by_idx2
+ * Function: H5Oget_info_by_idx3
*
- * Purpose: Retrieve information about an object, according to the order
- * of an index.
- *
- * NOTE: Add a parameter "fields" to indicate selection of object info.
+ * Purpose: Retrieve information about an object, according to
+ * the order of an index.
*
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Quincey Koziol
- * November 26 2006
+ * Programmer: Dana Robinson
+ * Fall 2019
*
*-------------------------------------------------------------------------
*/
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)
+H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -689,12 +673,176 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Oget_info_by_idx2() */
+} /* end H5Oget_info_by_idx3() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_native_info
+ *
+ * Purpose: Retrieve native file format information about an object.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields)
+{
+ H5VL_object_t *vol_obj; /* Object 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(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL")
+ if(fields & ~H5O_NATIVE_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(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_native_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_native_info_by_name
+ *
+ * Purpose: Retrieve native file format information about an object
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo,
+ unsigned fields, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj; /* Object 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(!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, "oinfo parameter cannot be NULL")
+ if(fields & ~H5O_NATIVE_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
+
+ /* 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(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object: '%s'", name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_native_info_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_native_info_by_idx
+ *
+ * Purpose: Retrieve native file format information about an object,
+ * according to the order of an index.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Dana Robinson
+ * Fall 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, unsigned fields, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo,
+ fields, lapl_id);
+
+ /* Check args */
+ 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)
+ 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(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(fields & ~H5O_NATIVE_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
+
+ /* 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")
+
+ 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(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_native_info_by_idx() */
/*-------------------------------------------------------------------------
@@ -717,7 +865,7 @@ done:
herr_t
H5Oset_comment(hid_t obj_id, const char *comment)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -737,7 +885,7 @@ H5Oset_comment(hid_t obj_id, const char *comment)
loc_params.obj_type = H5I_get_type(obj_id);
/* (Re)set the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
done:
@@ -766,7 +914,7 @@ herr_t
H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -792,7 +940,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* (Re)set the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name)
done:
@@ -819,9 +967,9 @@ done:
ssize_t
H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize);
@@ -835,7 +983,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
loc_params.obj_type = H5I_get_type(obj_id);
/* Retrieve the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object")
done:
@@ -863,9 +1011,9 @@ ssize_t
H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize,
hid_t lapl_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id);
@@ -889,7 +1037,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Retrieve the object's comment */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name)
done:
@@ -898,7 +1046,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Ovisit2
+ * Function: H5Ovisit3
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@@ -933,12 +1081,12 @@ done:
*-------------------------------------------------------------------------
*/
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)
+H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate2_t op, void *op_data, unsigned fields)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields);
@@ -967,11 +1115,11 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Ovisit2() */
+} /* end H5Ovisit3() */
/*-------------------------------------------------------------------------
- * Function: H5Ovisit_by_name2
+ * Function: H5Ovisit_by_name3
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@@ -1006,12 +1154,12 @@ done:
*-------------------------------------------------------------------------
*/
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)
+H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5VL_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,
@@ -1051,7 +1199,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Ovisit_by_name2() */
+} /* end H5Ovisit_by_name3() */
/*-------------------------------------------------------------------------
@@ -1156,7 +1304,7 @@ done:
herr_t
H5Odisable_mdc_flushes(hid_t object_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params; /* Location parameters */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1176,7 +1324,7 @@ H5Odisable_mdc_flushes(hid_t object_id)
loc_params.obj_type = H5I_get_type(object_id);
/* Cork the object */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, &loc_params) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object");
done:
@@ -1225,7 +1373,7 @@ done:
herr_t
H5Oenable_mdc_flushes(hid_t object_id)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params; /* Location parameters */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1233,11 +1381,11 @@ H5Oenable_mdc_flushes(hid_t object_id)
H5TRACE1("e", "i", object_id);
/* Make sure the ID is a file object */
- if (H5I_is_file_object(object_id) != TRUE)
+ if(H5I_is_file_object(object_id) != TRUE)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object");
/* Get the VOL object */
- if (NULL == (vol_obj = H5VL_vol_object(object_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID");
/* Fill in location struct fields */
@@ -1245,7 +1393,7 @@ H5Oenable_mdc_flushes(hid_t object_id)
loc_params.obj_type = H5I_get_type(object_id);
/* Uncork the object */
- if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, &loc_params) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object");
done:
@@ -1299,7 +1447,7 @@ done:
herr_t
H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
{
- H5VL_object_t *vol_obj; /* Object token of loc_id */
+ H5VL_object_t *vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params; /* Location parameters */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1307,15 +1455,15 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
H5TRACE2("e", "i*b", object_id, are_disabled);
/* Sanity check */
- if (!are_disabled)
+ if(!are_disabled)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID");
/* Make sure the ID is a file object */
- if (H5I_is_file_object(object_id) != TRUE)
+ if(H5I_is_file_object(object_id) != TRUE)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object");
/* Get the VOL object */
- if (NULL == (vol_obj = H5VL_vol_object(object_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID");
/* Fill in location struct fields */
@@ -1323,10 +1471,132 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
loc_params.obj_type = H5I_get_type(object_id);
/* Get the cork status */
- if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, &loc_params, are_disabled) < 0)
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, are_disabled) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status");
done:
FUNC_LEAVE_API(ret_value)
} /* H5Oare_mdc_flushes_disabled() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5Otoken_cmp
+ *
+ * Purpose: Compares two VOL connector object tokens
+ *
+ * Note: Both object tokens must be from the same VOL connector class
+ *
+ * Return: Success: Non-negative, with *cmp_value set to positive if
+ * token1 is greater than token2, negative if token2
+ * is greater than token1 and zero if token1 and
+ * token2 are equal.
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2,
+ int *cmp_value)
+{
+ H5VL_object_t *vol_obj; /* VOL object for ID */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "i*k*k*Is", loc_id, token1, token2, cmp_value);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if(NULL == cmp_value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer")
+
+ /* Compare the two tokens */
+ if(H5VL_token_cmp(vol_obj, token1, token2, cmp_value) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Otoken_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5Otoken_to_str
+ *
+ * Purpose: Serialize a connector's object token into a string
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str)
+{
+ H5VL_object_t *vol_obj; /* VOL object for ID */
+ H5I_type_t vol_obj_type; /* VOL object's type */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*k**s", loc_id, token, token_str);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if(NULL == token)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer")
+ if(NULL == token_str)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer")
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object type")
+
+ /* Serialize the token */
+ if(H5VL_token_to_str(vol_obj, vol_obj_type, token, token_str) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token serialization failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Otoken_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5Otoken_from_str
+ *
+ * Purpose: Deserialize a string into a connector object token
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token)
+{
+ H5VL_object_t *vol_obj; /* VOL object for ID */
+ H5I_type_t vol_obj_type; /* VOL object's type */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*s*k", loc_id, token_str, token);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ if(NULL == token)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer")
+ if(NULL == token_str)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer")
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object type")
+
+ /* Deserialize the token */
+ if(H5VL_token_from_str(vol_obj, vol_obj_type, token_str, token) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token deserialization failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Otoken_from_str() */
+
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index 7f4f17f..2d95ee9 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -194,7 +194,7 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co
*p++ = H5O_AINFO_VERSION;
/* The flags for the attribute indices */
- flags = ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0;
+ flags = (unsigned char)(ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0);
flags = (unsigned char)(flags | (ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0));
*p++ = flags;
@@ -334,7 +334,7 @@ H5O__ainfo_free(void *mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__ainfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg)
+H5O__ainfo_delete(H5F_t *f, H5O_t H5_ATTR_NDEBUG_UNUSED *open_oh, void *_mesg)
{
H5O_ainfo_t *ainfo = (H5O_ainfo_t *)_mesg;
herr_t ret_value = SUCCEED; /* Return value */
@@ -405,9 +405,9 @@ H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static void *
-H5O__ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
+H5O__ainfo_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, void *mesg_src, H5F_t *file_dst,
hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags,
- H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
+ H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata)
{
H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src;
H5O_ainfo_t *ainfo_dst = NULL;
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index c1f90cb..8850ef6 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -111,7 +111,7 @@ 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 H5_ATTR_NDEBUG_UNUSED *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 */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index f685a00c..573bb7a 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -329,7 +329,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* The character encoding for the attribute's name, in later versions */
if(attr->shared->version >= H5O_ATTR_VERSION_3)
- *p++ = attr->shared->encoding;
+ *p++ = (uint8_t)attr->shared->encoding;
/* Write the name including null terminator */
H5MM_memcpy(p, attr->shared->name, name_len);
@@ -674,7 +674,7 @@ H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_
/* Mark datatype as being on disk now. This step used to be done in a lower level
* by H5O_dtype_decode. But it has been moved up. Not an ideal place, but no better
* place than here. */
- if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, file_src, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, H5F_VOL_OBJ(file_src), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
if(NULL == (ret_value = H5A__attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info)))
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 57ec9b8..a4a746e 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -86,19 +86,6 @@ typedef struct {
hbool_t found; /* Whether the attribute was found */
} H5O_iter_ren_t;
-/* User data for iteration when iterating over attributes */
-typedef struct {
- /* down */
- H5F_t *f; /* Pointer to file attribute is in */
- hid_t loc_id; /* ID of object being iterated over */
- unsigned skip; /* # of attributes to skip over */
- H5A_operator_t op; /* Callback routine for each attribute */
- void *op_data; /* User data for callback */
-
- /* up */
- unsigned count; /* Count of attributes examined */
-} H5O_iter_itr_t;
-
/* User data for iteration when removing an attribute */
typedef struct {
/* down */
@@ -109,15 +96,6 @@ typedef struct {
hbool_t found; /* Found attribute to delete */
} H5O_iter_rm_t;
-/* User data for iteration when checking if an attribute exists */
-typedef struct {
- /* down */
- const char *name; /* Name of attribute to open */
-
- /* up */
- hbool_t found; /* Found attribute */
-} H5O_iter_xst_t;
-
/********************/
/* Package Typedefs */
@@ -535,7 +513,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name)
} /* end else */
/* Mark datatype as being on disk now */
- if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end else */
@@ -642,7 +620,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute")
} else {
/* Mark datatype as being on disk now */
- if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
} /* end if */
} /* end if */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 683d155..8bad181 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -201,7 +201,7 @@ H5O__cache_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__cache_get_final_load_size(const void *image, size_t image_len,
+H5O__cache_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len,
void *_udata, size_t *actual_len)
{
H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */
@@ -306,7 +306,7 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata)
*-------------------------------------------------------------------------
*/
static void *
-H5O__cache_deserialize(const void *image, size_t len, void *_udata,
+H5O__cache_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
hbool_t *dirty)
{
H5O_t *oh = NULL; /* Object header read in */
@@ -763,7 +763,7 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata)
*-------------------------------------------------------------------------
*/
static void *
-H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata,
+H5O__cache_chk_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
hbool_t *dirty)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 9578f95..469a9e0 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -85,12 +85,10 @@ static herr_t H5O__copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*
hid_t ocpypl_id, hid_t lcpl_id);
static herr_t H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
-static herr_t H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc,
- H5G_loc_t *dst_root_loc, H5O_copy_t *cpy_info);
static herr_t H5O__copy_free_comm_dt_cb(void *item, void *key, void *op_data);
static int H5O__copy_comm_dt_cmp(const void *dt1, const void *dt2);
static herr_t H5O__copy_search_comm_dt_cb(hid_t group, const char *name,
- const H5L_info_t *linfo, void *udata);
+ const H5L_info2_t *linfo, void *udata);
static htri_t H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src,
H5O_loc_t *oloc_dst/*in, out*/, H5O_copy_t *cpy_info);
static herr_t H5O__copy_insert_comm_dt(H5F_t *file_src, H5O_t *oh_src,
@@ -110,7 +108,6 @@ H5FL_DEFINE(H5O_copy_search_comm_dt_key_t);
/* Declare a free list to manage haddr_t variables */
H5FL_DEFINE(haddr_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -200,9 +197,9 @@ 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)
{
- H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */
+ H5VL_object_t *vol_obj1 = NULL; /* object of src_id */
H5VL_loc_params_t loc_params1;
- H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */
+ H5VL_object_t *vol_obj2 = NULL; /* object of dst_id */
H5VL_loc_params_t loc_params2;
herr_t ret_value = SUCCEED; /* Return value */
@@ -230,6 +227,9 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list")
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* 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")
@@ -1235,201 +1235,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__copy_obj_by_ref
- *
- * Purpose: Copy the object pointed by _src_ref.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Peter Cao
- * Aug 7 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc,
- H5G_loc_t *dst_root_loc, H5O_copy_t *cpy_info)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
-
- HDassert(src_oloc);
- HDassert(dst_oloc);
-
- /* Perform the copy, or look up existing copy */
- if((ret_value = H5O_copy_header_map(src_oloc, dst_oloc, cpy_info, FALSE, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
-
- /* Check if a new valid object is copied to the destination */
- if(H5F_addr_defined(dst_oloc->addr) && (ret_value > SUCCEED)) {
- char tmp_obj_name[80];
- H5G_name_t new_path;
- H5O_loc_t new_oloc;
- H5G_loc_t new_loc;
-
- /* Set up group location for new object */
- new_loc.oloc = &new_oloc;
- new_loc.path = &new_path;
- H5G_loc_reset(&new_loc);
- new_oloc.file = dst_oloc->file;
- new_oloc.addr = dst_oloc->addr;
-
- /* Pick a default name for the new object */
- HDsnprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr);
-
- /* Create a link to the newly copied object */
- /* Note: since H5O_copy_header_map actually copied the target object, it
- * must exist either in cache or on disk, therefore it is is safe to not
- * pass the obj_type and udata fields returned by H5O_copy_header_map.
- * This could be changed in the future to slightly improve performance
- * --NAF */
- if(H5L_link(dst_root_loc, tmp_obj_name, &new_loc, cpy_info->lcpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
-
- H5G_loc_free(&new_loc);
- } /* if (H5F_addr_defined(dst_oloc.addr)) */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__copy_obj_by_ref() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_copy_expand_ref
- *
- * Purpose: Copy the object pointed by _src_ref.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Peter Cao
- * Aug 7 2006
- *
- *-------------------------------------------------------------------------
- */
-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)
-{
- H5O_loc_t dst_oloc; /* Copied object object location */
- H5O_loc_t src_oloc; /* Temporary object location for source object */
- H5G_loc_t dst_root_loc; /* The location of root group of the destination file */
- const uint8_t *q; /* Pointer to source OID to store */
- uint8_t *p; /* Pointer to destination OID to store */
- size_t i; /* Local index variable */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(file_src);
- HDassert(_src_ref);
- HDassert(file_dst);
- HDassert(_dst_ref);
- HDassert(ref_count);
- HDassert(cpy_info);
-
- /* Initialize object locations */
- H5O_loc_reset(&src_oloc);
- H5O_loc_reset(&dst_oloc);
- src_oloc.file = file_src;
- dst_oloc.file = file_dst;
-
- /* Set up the root group in the destination file */
- if(NULL == (dst_root_loc.oloc = H5G_oloc(H5G_rootof(file_dst))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group")
- if(NULL == (dst_root_loc.path = H5G_nameof(H5G_rootof(file_dst))))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group")
-
- /* Copy object references */
- if(H5R_OBJECT == ref_type) {
- hobj_ref_t *src_ref = (hobj_ref_t *)_src_ref;
- hobj_ref_t *dst_ref = (hobj_ref_t *)_dst_ref;
-
- /* Making equivalent references in the destination file */
- for(i = 0; i < ref_count; i++) {
- /* Set up for the object copy for the reference */
- q = (uint8_t *)(&src_ref[i]);
- H5F_addr_decode(src_oloc.file, (const uint8_t **)&q, &(src_oloc.addr));
- dst_oloc.addr = HADDR_UNDEF;
-
- /* Attempt to copy object from source to destination file */
- if(src_oloc.addr != (haddr_t)0) {
- if(H5O__copy_obj_by_ref(&src_oloc, &dst_oloc, &dst_root_loc, cpy_info) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
- } /* end if */
- else
- /* Set parameters so the reference is written as all 0's */
- HDmemset(&dst_oloc.addr, 0, sizeof(dst_oloc.addr));
-
- /* Set the object reference info for the destination file */
- p = (uint8_t *)(&dst_ref[i]);
- H5F_addr_encode(dst_oloc.file, &p, dst_oloc.addr);
- } /* end for */
- } /* end if */
- /* Copy region references */
- else if(H5R_DATASET_REGION == ref_type) {
- hdset_reg_ref_t *src_ref = (hdset_reg_ref_t *)_src_ref;
- hdset_reg_ref_t *dst_ref = (hdset_reg_ref_t *)_dst_ref;
- uint8_t *buf = NULL; /* Buffer to store serialized selection in */
- H5HG_t hobjid; /* Heap object ID */
- size_t buf_size; /* Length of object in heap */
-
- /* Making equivalent references in the destination file */
- for(i = 0; i < ref_count; i++) {
- /* Get the heap ID for the dataset region */
- q = (const uint8_t *)(&src_ref[i]);
- H5F_addr_decode(src_oloc.file, (const uint8_t **)&q, &(hobjid.addr));
- UINT32DECODE(q, hobjid.idx);
-
- if(hobjid.addr != (haddr_t)0) {
- /* Get the dataset region from the heap (allocate inside routine) */
- if((buf = (uint8_t *)H5HG_read(src_oloc.file, &hobjid, NULL, &buf_size)) == NULL)
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
-
- /* Get the object oid for the dataset */
- q = (const uint8_t *)buf;
- H5F_addr_decode(src_oloc.file, (const uint8_t **)&q, &(src_oloc.addr));
- dst_oloc.addr = HADDR_UNDEF;
-
- /* copy the object pointed by the ref to the destination */
- if(H5O__copy_obj_by_ref(&src_oloc, &dst_oloc, &dst_root_loc, cpy_info) < 0) {
- H5MM_xfree(buf);
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
- } /* end if */
-
- /* Serialize object ID */
- p = (uint8_t *)buf;
- H5F_addr_encode(dst_oloc.file, &p, dst_oloc.addr);
-
- /* Save the serialized buffer to the destination */
- if(H5HG_insert(dst_oloc.file, buf_size, buf, &hobjid) < 0) {
- H5MM_xfree(buf);
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "Unable to write dataset region information")
- } /* end if */
- } /* end if */
- else
- /* Set parameters so the reference is written as all 0's */
- HDmemset(&hobjid, 0, sizeof(hobjid));
-
- /* Set the dataset region reference info for the destination file */
- p = (uint8_t *)(&dst_ref[i]);
- H5F_addr_encode(dst_oloc.file, &p, hobjid.addr);
- UINT32ENCODE(p, hobjid.idx);
-
- /* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
- } /* end for */
- } /* end if */
- else
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_copy_expand_ref() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O__copy_free_comm_dt_cb
*
* Purpose: Frees the merge committed dt skip list key and object.
@@ -1718,7 +1523,7 @@ done:
*/
static herr_t
H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name,
- const H5L_info_t *linfo, void *_udata)
+ const H5L_info2_t *linfo, void *_udata)
{
H5O_copy_search_comm_dt_ud_t *udata = (H5O_copy_search_comm_dt_ud_t *)_udata; /* Skip list of dtypes in dest file */
H5G_loc_t obj_loc; /* Location of object */
diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c
new file mode 100644
index 0000000..0de661f
--- /dev/null
+++ b/src/H5Ocopy_ref.c
@@ -0,0 +1,499 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Ocopy_ref.c
+ *
+ * Purpose: Object with references copying routines.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Omodule.h" /* This source code file is part of the H5O module */
+#define H5R_FRIEND /* Suppress error about including H5Rpkg */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Fprivate.h" /* File */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Rpkg.h" /* References */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static herr_t H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc,
+ H5G_loc_t *dst_root_loc, H5O_copy_t *cpy_info);
+static herr_t H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc,
+ const void *buf_src, H5O_loc_t *dst_oloc, H5G_loc_t *dst_root_loc,
+ void *buf_dst, size_t ref_count, H5O_copy_t *cpy_info);
+static herr_t H5O__copy_expand_ref_region1(H5O_loc_t *src_oloc,
+ const void *buf_src, H5O_loc_t *dst_oloc, H5G_loc_t *dst_root_loc,
+ void *buf_dst, size_t ref_count, H5O_copy_t *cpy_info);
+static herr_t H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src,
+ H5T_t *dt_src, const void *buf_src, size_t nbytes_src, H5O_loc_t *dst_oloc,
+ H5G_loc_t *dst_root_loc, void *buf_dst, size_t ref_count,
+ H5O_copy_t *cpy_info);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Declare extern the free list to manage blocks of type conversion data */
+H5FL_BLK_EXTERN(type_conv);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__copy_obj_by_ref
+ *
+ * Purpose: Copy the object pointed to by src_oloc.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc,
+ H5G_loc_t *dst_root_loc, H5O_copy_t *cpy_info)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(src_oloc);
+ HDassert(dst_oloc);
+
+ /* Perform the copy, or look up existing copy */
+ if((ret_value = H5O_copy_header_map(src_oloc, dst_oloc, cpy_info, FALSE, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+ /* Check if a new valid object is copied to the destination */
+ if(H5F_addr_defined(dst_oloc->addr) && (ret_value > SUCCEED)) {
+ char tmp_obj_name[80];
+ H5G_name_t new_path;
+ H5O_loc_t new_oloc;
+ H5G_loc_t new_loc;
+
+ /* Set up group location for new object */
+ new_loc.oloc = &new_oloc;
+ new_loc.path = &new_path;
+ H5G_loc_reset(&new_loc);
+ new_oloc.file = dst_oloc->file;
+ new_oloc.addr = dst_oloc->addr;
+
+ /* Pick a default name for the new object */
+ HDsnprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr);
+
+ /* Create a link to the newly copied object */
+ /* Note: since H5O_copy_header_map actually copied the target object, it
+ * must exist either in cache or on disk, therefore it is is safe to not
+ * pass the obj_type and udata fields returned by H5O_copy_header_map.
+ * This could be changed in the future to slightly improve performance
+ * --NAF */
+ if(H5L_link(dst_root_loc, tmp_obj_name, &new_loc, cpy_info->lcpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
+
+ H5G_loc_free(&new_loc);
+ } /* if (H5F_addr_defined(dst_oloc.addr)) */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__copy_obj_by_ref() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__copy_expand_ref_object1
+ *
+ * Purpose: Copy the object pointed by a deprecated object reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src,
+ H5O_loc_t *dst_oloc, H5G_loc_t *dst_root_loc, void *buf_dst,
+ size_t ref_count, H5O_copy_t *cpy_info)
+{
+ const hobj_ref_t *src_ref = (const hobj_ref_t *)buf_src;
+ hobj_ref_t *dst_ref = (hobj_ref_t *)buf_dst;
+ const unsigned char zeros[H5R_OBJ_REF_BUF_SIZE] = { 0 };
+ size_t buf_size = H5R_OBJ_REF_BUF_SIZE;
+ size_t i; /* Local index variable */
+ size_t token_size = H5F_SIZEOF_ADDR(src_oloc->file);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Making equivalent references in the destination file */
+ for(i = 0; i < ref_count; i++) {
+ const unsigned char *src_buf = (const unsigned char *)&src_ref[i];
+ unsigned char *dst_buf = (unsigned char *)&dst_ref[i];
+ H5O_token_t tmp_token = { 0 };
+
+ /* If data is not initialized, copy zeros and skip */
+ if(0 == HDmemcmp(src_buf, zeros, buf_size)) {
+ HDmemset(dst_buf, 0, buf_size);
+ continue;
+ }
+
+ /* Set up for the object copy for the reference */
+ if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address")
+ if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+
+ if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer")
+ dst_oloc->addr = HADDR_UNDEF;
+
+ /* Attempt to copy object from source to destination file */
+ if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+ /* Set the object reference info for the destination file */
+ if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
+ if(H5R__encode_token_obj_compat((const H5O_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address")
+ } /* end for */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__copy_expand_ref_object1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__copy_expand_ref_region1
+ *
+ * Purpose: Copy the object pointed by a deprecated region reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__copy_expand_ref_region1(H5O_loc_t *src_oloc, const void *buf_src,
+ H5O_loc_t *dst_oloc, H5G_loc_t *dst_root_loc, void *buf_dst,
+ size_t ref_count, H5O_copy_t *cpy_info)
+{
+ const hdset_reg_ref_t *src_ref = (const hdset_reg_ref_t *)buf_src;
+ hdset_reg_ref_t *dst_ref = (hdset_reg_ref_t *)buf_dst;
+ const unsigned char zeros[H5R_DSET_REG_REF_BUF_SIZE] = { 0 };
+ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE;
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Making equivalent references in the destination file */
+ for(i = 0; i < ref_count; i++) {
+ const unsigned char *src_buf = (const unsigned char *)&src_ref[i];
+ unsigned char *dst_buf = (unsigned char *)&dst_ref[i];
+ unsigned char *data = NULL;
+ size_t data_size;
+ const uint8_t *p;
+ uint8_t *q;
+
+ /* If data is not initialized, copy zeros and skip */
+ if(0 == HDmemcmp(src_buf, zeros, buf_size)) {
+ HDmemset(dst_buf, 0, buf_size);
+ continue;
+ }
+
+ /* Read from heap */
+ if(H5R__decode_heap(src_oloc->file, src_buf, &buf_size, &data, &data_size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode dataset region information")
+
+ /* Get object address */
+ p = (const uint8_t *)data;
+ H5F_addr_decode(src_oloc->file, &p, &src_oloc->addr);
+ if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) {
+ H5MM_free(data);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer")
+ }
+ dst_oloc->addr = HADDR_UNDEF;
+
+ /* Attempt to copy object from source to destination file */
+ if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) {
+ H5MM_free(data);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
+ } /* end if */
+
+ /* Serialize object addr */
+ q = (uint8_t *)data;
+ H5F_addr_encode(dst_oloc->file, &q, dst_oloc->addr);
+
+ /* Write to heap */
+ if(H5R__encode_heap(dst_oloc->file, dst_buf, &buf_size, data, (size_t)data_size) < 0) {
+ H5MM_free(data);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode dataset region information")
+ }
+
+ /* Free the buffer allocated in H5R__decode_heap() */
+ H5MM_free(data);
+ } /* end for */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__copy_expand_ref_region1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__copy_expand_ref_object2
+ *
+ * Purpose: Copy the object pointed by a reference (object, region, attribute).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src,
+ const void *buf_src, size_t nbytes_src, H5O_loc_t *dst_oloc,
+ H5G_loc_t *dst_root_loc, void *buf_dst, size_t ref_count,
+ H5O_copy_t *cpy_info)
+{
+ H5T_t *dt_mem = NULL; /* Memory datatype */
+ H5T_t *dt_dst = NULL; /* Destination datatype */
+ hid_t tid_mem = H5I_INVALID_HID; /* Datatype ID for memory datatype */
+ hid_t tid_dst = H5I_INVALID_HID; /* Datatype ID for memory datatype */
+ H5T_path_t *tpath_src_mem = NULL,
+ *tpath_mem_dst = NULL; /* Datatype conversion paths */
+ size_t i; /* Local index variable */
+ hbool_t reg_tid_src = (tid_src == H5I_INVALID_HID);
+ hid_t dst_loc_id = H5I_INVALID_HID;
+ void *conv_buf = NULL; /* Buffer for converting data */
+ size_t conv_buf_size = 0; /* Buffer size */
+ void *reclaim_buf = NULL; /* Buffer for reclaiming data */
+ H5S_t *buf_space = NULL; /* Dataspace describing buffer */
+ hsize_t buf_dim[1] = {ref_count}; /* Dimension for buffer */
+ size_t token_size = H5F_SIZEOF_ADDR(src_oloc->file);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Create datatype ID for src datatype. */
+ if((tid_src == H5I_INVALID_HID) && (tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
+
+ /* create a memory copy of the reference datatype */
+ if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy")
+ if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
+ (void)H5T_close_real(dt_mem);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
+ } /* end if */
+
+ /* create reference datatype at the destinaton file */
+ if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy")
+ if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(dst_oloc->file), H5T_LOC_DISK) < 0) {
+ (void)H5T_close_real(dt_dst);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
+ } /* end if */
+ if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
+ (void)H5T_close_real(dt_dst);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
+ } /* end if */
+
+ /* Set up the conversion functions */
+ if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
+ if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
+
+ /* Use extra conversion buffer (TODO we should avoid using an extra buffer once the H5Ocopy code has been reworked) */
+ conv_buf_size = MAX(H5T_get_size(dt_src), H5T_get_size(dt_mem)) * ref_count;
+ if(NULL == (conv_buf = H5FL_BLK_MALLOC(type_conv, conv_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
+ H5MM_memcpy(conv_buf, buf_src, nbytes_src);
+
+ /* Convert from source file to memory */
+ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, ref_count, (size_t)0, (size_t)0, conv_buf, NULL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
+
+ /* Retrieve loc ID */
+ if((dst_loc_id = H5F_get_id(dst_oloc->file)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Making equivalent references in the destination file */
+ for(i = 0; i < ref_count; i++) {
+ H5R_ref_t *ref_ptr = (H5R_ref_t *)conv_buf;
+ H5R_ref_priv_t *ref = (H5R_ref_priv_t *)&ref_ptr[i];
+ H5O_token_t tmp_token = { 0 };
+
+ /* Get src object address */
+ if(H5R__get_obj_token(ref, &tmp_token, &token_size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token")
+ if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+
+ /* Attempt to copy object from source to destination file */
+ if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+ /* Set dst object address */
+ if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
+ if(H5R__set_obj_token(ref, (const H5O_token_t *)&tmp_token, token_size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token")
+ /* Do not set app_ref since references are released once the copy is done */
+ if(H5R__set_loc_id(ref, dst_loc_id, TRUE, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set destination loc id")
+ } /* end for */
+
+ /* Copy into another buffer, to reclaim memory later */
+ if(NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, conv_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
+ H5MM_memcpy(reclaim_buf, conv_buf, conv_buf_size);
+ if(NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
+
+ /* Convert from memory to destination file */
+ if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, ref_count, (size_t)0, (size_t)0, conv_buf, NULL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
+ H5MM_memcpy(buf_dst, conv_buf, nbytes_src);
+
+ /* Reclaim space from reference data */
+ if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim reference data")
+
+done:
+ if(buf_space && (H5S_close(buf_space) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't close dataspace")
+ /* Don't decrement ID, we want to keep underlying datatype */
+ if(reg_tid_src && (tid_src > 0) && (NULL == H5I_remove(tid_src)))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
+ if((tid_mem > 0) && H5I_dec_ref(tid_mem) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
+ if((tid_dst > 0) && H5I_dec_ref(tid_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
+ if(reclaim_buf)
+ reclaim_buf = H5FL_BLK_FREE(type_conv, reclaim_buf);
+ if(conv_buf)
+ conv_buf = H5FL_BLK_FREE(type_conv, conv_buf);
+ if((dst_loc_id != H5I_INVALID_HID) && (H5I_dec_ref(dst_loc_id) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement refcount on location id")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__copy_expand_ref_object2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_copy_expand_ref
+ *
+ * Purpose: Copy the object pointed by a reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_copy_expand_ref(H5F_t *file_src, hid_t tid_src, H5T_t *dt_src,
+ void *buf_src, size_t nbytes_src, H5F_t *file_dst, void *buf_dst,
+ H5O_copy_t *cpy_info)
+{
+ H5O_loc_t dst_oloc; /* Copied object object location */
+ H5O_loc_t src_oloc; /* Temporary object location for source object */
+ H5G_loc_t dst_root_loc; /* The location of root group of the destination file */
+ size_t ref_count;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(file_src);
+ HDassert(buf_src);
+ HDassert(file_dst);
+ HDassert(buf_dst);
+ HDassert(nbytes_src);
+ HDassert(cpy_info);
+
+ /* Initialize object locations */
+ H5O_loc_reset(&src_oloc);
+ H5O_loc_reset(&dst_oloc);
+ src_oloc.file = file_src;
+ dst_oloc.file = file_dst;
+
+ /* Set up the root group in the destination file */
+ if(NULL == (dst_root_loc.oloc = H5G_oloc(H5G_rootof(file_dst))))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group")
+ if(NULL == (dst_root_loc.path = H5G_nameof(H5G_rootof(file_dst))))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group")
+
+ /* Determine # of reference elements to copy */
+ ref_count = nbytes_src / H5T_get_size(dt_src);
+
+ /* Copy object references */
+ switch(H5T_get_ref_type(dt_src)) {
+ case H5R_OBJECT1:
+ if(H5O__copy_expand_ref_object1(&src_oloc, buf_src, &dst_oloc, &dst_root_loc, buf_dst, ref_count, cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand H5R_OBJECT1 reference")
+ break;
+ case H5R_DATASET_REGION1:
+ if(H5O__copy_expand_ref_region1(&src_oloc, buf_src, &dst_oloc, &dst_root_loc, buf_dst, ref_count, cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand H5R_DATASET_REGION1 reference")
+ break;
+ case H5R_DATASET_REGION2:
+ case H5R_ATTR:
+ case H5R_OBJECT2:
+ if(H5O__copy_expand_ref_object2(&src_oloc, tid_src, dt_src, buf_src, nbytes_src, &dst_oloc, &dst_root_loc, buf_dst, ref_count, cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand reference")
+ break;
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+ break;
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_copy_expand_ref() */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index b8190ae..3c91cae 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -153,7 +153,7 @@ H5O__assert(const H5O_t *oh)
/* Loop over all messages in object header */
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
- uint8_t *curr_hdr; /* Start of current message header */
+ uint8_t H5_ATTR_NDEBUG_UNUSED *curr_hdr; /* Start of current message header */
size_t curr_tot_size; /* Total size of current message (including header) */
curr_hdr = curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh);
@@ -164,7 +164,7 @@ H5O__assert(const H5O_t *oh)
free_space += curr_tot_size;
else if(H5O_CONT_ID == curr_msg->type->id) {
H5O_cont_t *cont = (H5O_cont_t *)curr_msg->native;
- hbool_t found_chunk = FALSE; /* Found a chunk that matches */
+ hbool_t H5_ATTR_NDEBUG_UNUSED found_chunk = FALSE; /* Found a chunk that matches */
HDassert(cont);
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 7aefc67..e43213d 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -39,6 +39,7 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/****************/
/* Local Macros */
@@ -49,6 +50,13 @@
/* Local Typedefs */
/******************/
+/* Adapter for using deprecated H5Ovisit1 callbacks with the VOL */
+typedef struct H5O_visit1_adapter_t {
+ H5O_iterate1_t real_op; /* Application callback to invoke */
+ unsigned fields; /* Original fields passed to H5Ovisit */
+ void *real_op_data; /* Application op_data */
+} H5O_visit1_adapter_t;
+
/********************/
/* Package Typedefs */
@@ -58,7 +66,10 @@
/********************/
/* Local Prototypes */
/********************/
-
+static herr_t H5O__reset_info1(H5O_info1_t *oinfo);
+static herr_t H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, void *op_data);
+static herr_t H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params,
+ H5O_info1_t *oinfo, unsigned fields);
/*********************/
/* Package Variables */
@@ -75,7 +86,295 @@
/*******************/
-#ifndef H5_NO_DEPRECATED_SYMBOLS
+/*-------------------------------------------------------------------------
+ * Function: H5O__reset_info1
+ *
+ * Purpose: Resets/initializes an H5O_info1_t struct.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__reset_info1(H5O_info1_t *oinfo)
+{
+ FUNC_ENTER_STATIC_NOERR;
+
+ /* Reset the passed-in info struct */
+ HDmemset(oinfo, 0, sizeof(H5O_info1_t));
+ oinfo->type = H5O_TYPE_UNKNOWN;
+ oinfo->addr = HADDR_UNDEF;
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* end H5O__reset_info1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__iterate1_adapter
+ *
+ * Purpose: Retrieve information about an object, according to the order
+ * of an index.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 26 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
+ void *op_data)
+{
+ H5O_visit1_adapter_t *shim_data = (H5O_visit1_adapter_t *)op_data;
+ H5O_info1_t oinfo; /* Deprecated object info struct */
+ unsigned dm_fields; /* Fields for data model query */
+ unsigned nat_fields; /* Fields for native query */
+ H5VL_object_t *vol_obj; /* Object of obj_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for VOL callback */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(oinfo2);
+ HDassert(op_data);
+
+ /* Reset the legacy info struct */
+ if(H5O__reset_info1(&oinfo) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct")
+
+ /* Check for retrieving data model information */
+ dm_fields = shim_data->fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS);
+ if(dm_fields) {
+ /* Set the data model fields */
+ if(shim_data->fields & H5O_INFO_BASIC) {
+ oinfo.fileno = oinfo2->fileno;
+ oinfo.type = oinfo2->type;
+ oinfo.rc = oinfo2->rc;
+
+ /* Deserialize VOL object token into object address */
+ if(H5VLnative_token_to_addr(obj_id, oinfo2->token, &oinfo.addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+ }
+ if(shim_data->fields & H5O_INFO_TIME) {
+ oinfo.atime = oinfo2->atime;
+ oinfo.mtime = oinfo2->mtime;
+ oinfo.ctime = oinfo2->ctime;
+ oinfo.btime = oinfo2->btime;
+ }
+ if(shim_data->fields & H5O_INFO_NUM_ATTRS)
+ oinfo.num_attrs = oinfo2->num_attrs;
+ }
+
+ /* Fill out location struct */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
+
+ /* Check for retrieving native information */
+ nat_fields = shim_data->fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE);
+ if(nat_fields) {
+ H5O_native_info_t nat_info; /* Native object info */
+
+ /* Retrieve the object's native information */
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &nat_info, nat_fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object")
+
+ /* Set the native fields */
+ if(shim_data->fields & H5O_INFO_HDR)
+ HDmemcpy(&(oinfo.hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
+ if(shim_data->fields & H5O_INFO_META_SIZE) {
+ HDmemcpy(&(oinfo.meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
+ HDmemcpy(&(oinfo.meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
+ }
+ }
+
+ /* Invoke the application callback */
+ ret_value = (shim_data->real_op)(obj_id, name, &oinfo, shim_data->real_op_data);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5O__iterate1_adapter() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__get_info_old
+ *
+ * Purpose: Retrieve deprecated info about an object.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * December 21 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params,
+ H5O_info1_t *oinfo, unsigned fields)
+{
+ unsigned dm_fields; /* Fields for data model query */
+ unsigned nat_fields; /* Fields for native query */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(loc_params);
+
+ /* Reset the passed-in info struct */
+ if(H5O__reset_info1(oinfo) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct")
+
+ /* Check for retrieving data model information */
+ dm_fields = fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS);
+ if(dm_fields) {
+ H5O_info2_t dm_info; /* Data model object info */
+
+ /* Retrieve the object's data model information */
+ if(H5VL_object_get(vol_obj, loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &dm_info, dm_fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
+
+ /* Set the data model fields */
+ if(fields & H5O_INFO_BASIC) {
+ void *vol_obj_data;
+
+ if(NULL == (vol_obj_data = H5VL_object_data(vol_obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object")
+
+ oinfo->fileno = dm_info.fileno;
+ oinfo->type = dm_info.type;
+ oinfo->rc = dm_info.rc;
+
+ /* Deserialize VOL object token into object address */
+ if(H5VL_native_token_to_addr(vol_obj_data, loc_params->obj_type, dm_info.token, &oinfo->addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+ } /* end if */
+ if(fields & H5O_INFO_TIME) {
+ oinfo->atime = dm_info.atime;
+ oinfo->mtime = dm_info.mtime;
+ oinfo->ctime = dm_info.ctime;
+ oinfo->btime = dm_info.btime;
+ } /* end if */
+ if(fields & H5O_INFO_NUM_ATTRS)
+ oinfo->num_attrs = dm_info.num_attrs;
+ } /* end if */
+
+ /* Check for retrieving native information */
+ nat_fields = fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE);
+ if(nat_fields) {
+ H5O_native_info_t nat_info; /* Native object info */
+
+ /* Retrieve the object's native information */
+ if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, &nat_info, nat_fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object")
+
+ /* Set the native fields */
+ if(fields & H5O_INFO_HDR)
+ HDmemcpy(&(oinfo->hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
+ if(fields & H5O_INFO_META_SIZE) {
+ HDmemcpy(&(oinfo->meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
+ HDmemcpy(&(oinfo->meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__get_info_old() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oopen_by_addr
+ *
+ * Purpose: Warning! This function is EXTREMELY DANGEROUS!
+ * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA,
+ * and other VERY BAD THINGS!
+ *
+ * This function opens an object using its address within the
+ * HDF5 file, similar to an HDF5 hard link. The open object
+ * is identical to an object opened with H5Oopen() and should
+ * be closed with H5Oclose() or a type-specific closing
+ * function (such as H5Gclose() ).
+ *
+ * This function is very dangerous if called on an invalid
+ * address. For this reason, H5Oincr_refcount() should be
+ * used to prevent HDF5 from deleting any object that is
+ * referenced by address (e.g. by a user-defined link).
+ * H5Odecr_refcount() should be used when the object is
+ * no longer being referenced by address (e.g. when the UD link
+ * is deleted).
+ *
+ * The address of the HDF5 file on disk has no effect on
+ * H5Oopen_by_addr(), nor does the use of any unusual file
+ * drivers. The "address" is really the offset within the
+ * HDF5 file, and HDF5's file drivers will transparently
+ * map this to an address on disk for the filesystem.
+ *
+ * Return: Success: An open object identifier
+ * Failure: H5I_INVALID_HID
+ *
+ * Programmer: James Laird
+ * July 14 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
+{
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5I_type_t opened_type; /* Opened object type */
+ void *opened_obj = NULL; /* Opened object */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ hbool_t is_native_vol_obj;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE2("i", "ia", loc_id, addr);
+
+ /* 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 object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object")
+ if(is_native_vol_obj) {
+ /* This is a native-specific routine that requires serialization of the token */
+ if(H5VLnative_addr_to_token(loc_id, addr, &obj_token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, H5I_INVALID_HID, "can't serialize address into object token")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oopen_by_addr is only meant to be used with the native VOL connector")
+
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = vol_obj_type;
+
+ /* Open the 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 object's ID */
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oopen_by_addr() */
/*-------------------------------------------------------------------------
@@ -89,9 +388,9 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
+H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -111,8 +410,8 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+ if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object")
done:
FUNC_LEAVE_API(ret_value)
@@ -130,9 +429,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
+H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -162,8 +461,8 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_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)
+ if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object")
done:
FUNC_LEAVE_API(ret_value)
@@ -186,9 +485,9 @@ done:
*/
herr_t
H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id)
+ H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -223,8 +522,8 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
- if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+ if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object")
done:
FUNC_LEAVE_API(ret_value)
@@ -232,6 +531,197 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Oget_info2
+ *
+ * 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_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields)
+{
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*xIu", loc_id, oinfo, fields);
+
+ /* Check args */
+ if(!oinfo)
+ 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info2 is only meant to be used with the native VOL connector")
+
+ /* Retrieve deprecated info struct */
+ if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* 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: SUCCEED/FAIL
+ *
+ * Programmer: Neil Fortner
+ * July 7 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo,
+ unsigned fields, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hbool_t is_native_vol_obj;
+ 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(!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, "oinfo parameter cannot be NULL")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
+
+ /* 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info_by_name2 is only meant to be used with the native VOL connector")
+
+ /* Retrieve deprecated info struct */
+ if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info_by_name2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_idx2
+ *
+ * Purpose: Retrieve information about an object, according to the order
+ * of an index.
+ *
+ * NOTE: Add a parameter "fields" to indicate selection of object info.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 26 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, unsigned fields, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo,
+ fields, lapl_id);
+
+ /* Check args */
+ 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)
+ 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(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
+
+ /* 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")
+
+ 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info_by_idx2 is only meant to be used with the native VOL connector")
+
+ /* Retrieve deprecated info struct */
+ if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info_by_idx2() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Ovisit1
*
* Purpose: Recursively visit an object and all the objects reachable
@@ -265,10 +755,11 @@ done:
*/
herr_t
H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
- H5O_iterate_t op, void *op_data)
+ H5O_iterate1_t op, void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -290,8 +781,13 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
+ /* Set up adapter */
+ shim_data.real_op = op;
+ shim_data.fields = H5O_INFO_ALL;
+ shim_data.real_op_data = op_data;
+
/* Visit the objects */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -333,10 +829,11 @@ done:
*/
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)
+ H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
- H5VL_loc_params_t loc_params;
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -369,13 +866,203 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up adapter */
+ shim_data.real_op = op;
+ shim_data.fields = H5O_INFO_ALL;
+ shim_data.real_op_data = op_data;
+
/* Visit the objects */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0)
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, H5O_INFO_ALL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ovisit_by_name1() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Ovisit2
+ *
+ * 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
+ * specified index (unless the specified index does not exist for
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Soft links and user-defined links are ignored during
+ * this operation.
+ *
+ * NOTE: Each _object_ reachable from the initial group will only
+ * be visited once. If multiple hard links point to the same
+ * object, the first link to the object's path (according to the
+ * iteration index and iteration order given) will be used to in
+ * the callback about the object.
+ *
+ * NOTE: Add a a parameter "fields" to indicate selection of
+ * 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.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ * Programmer: Quincey Koziol
+ * November 25 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate1_t op, void *op_data, unsigned fields)
+{
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields);
+
+ /* Check args */
+ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
+
+ /* Get the location object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Ovisit2 is only meant to be used with the native VOL connector")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Set up adapter */
+ shim_data.real_op = op;
+ shim_data.fields = fields;
+ shim_data.real_op_data = op_data;
+
+ /* Visit the objects */
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ovisit2() */
+
+
+/*-------------------------------------------------------------------------
+ * 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
+ * linked to from that group will be visited. Links within
+ * each group are visited according to the order within the
+ * specified index (unless the specified index does not exist for
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Soft links and user-defined links are ignored during
+ * this operation.
+ *
+ * NOTE: Each _object_ reachable from the initial group will only
+ * be visited once. If multiple hard links point to the same
+ * object, the first link to the object's path (according to the
+ * iteration index and iteration order given) will be used to in
+ * the callback about the object.
+ *
+ * NOTE: Add a a parameter "fields" to indicate selection of
+ * 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.
+ *
+ * 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
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate1_t op, void *op_data, unsigned fields, hid_t lapl_id)
+{
+ H5VL_object_t *vol_obj; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
+
+ 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)
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+ if(fields & ~H5O_INFO_ALL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
+
+ /* 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")
+
+ /* Check if the VOL object is a native VOL connector object */
+ if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object")
+ if(!is_native_vol_obj)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Ovisit_by_name2 is only meant to be used with the native VOL connector")
+
+ /* 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);
+
+ /* Set up adapter */
+ shim_data.real_op = op;
+ shim_data.fields = fields;
+ shim_data.real_op_data = op_data;
+
+ /* Visit the objects */
+ if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, fields)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ovisit_by_name2() */
+
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 8f301af..c27ece0 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -129,7 +129,7 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t *dt)
+H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t *dt)
{
unsigned flags, version;
unsigned i;
@@ -145,7 +145,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Version, class & flags */
UINT32DECODE(*pp, flags);
version = (flags>>4) & 0x0f;
- if(version < H5O_DTYPE_VERSION_1 || version > H5O_DTYPE_VERSION_3)
+ if(version < H5O_DTYPE_VERSION_1 || version > H5O_DTYPE_VERSION_LATEST)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "bad version number for datatype message")
dt->shared->version = version;
dt->shared->type = (H5T_class_t)(flags & 0x0f);
@@ -331,7 +331,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Decode the field's datatype information */
- if((can_upgrade = H5O_dtype_decode_helper(f, ioflags, pp, temp_type)) < 0) {
+ if((can_upgrade = H5O_dtype_decode_helper(ioflags, pp, temp_type)) < 0) {
for(j = 0; j <= i; j++)
H5MM_xfree(dt->shared->u.compnd.memb[j].name);
H5MM_xfree(dt->shared->u.compnd.memb);
@@ -438,16 +438,28 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Set reference type */
dt->shared->u.atomic.u.r.rtype = (H5R_type_t)(flags & 0x0f);
-
- /* Set extra information for object references, so the hobj_ref_t gets swizzled correctly */
- if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT) {
- /* Mark location this type as undefined for now. The caller function should
- * decide the location. */
- dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC;
-
- /* This type needs conversion */
- dt->shared->force_conv = TRUE;
- } /* end if */
+ if(dt->shared->u.atomic.u.r.rtype <= H5R_BADTYPE
+ || dt->shared->u.atomic.u.r.rtype >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "invalid reference type");
+
+ /* Set generic flag */
+ if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT2
+ || dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION2
+ || dt->shared->u.atomic.u.r.rtype == H5R_ATTR) {
+ dt->shared->u.atomic.u.r.opaque = TRUE;
+ dt->shared->u.atomic.u.r.version = (unsigned)((flags >> 4) & 0x0f);
+ if(dt->shared->u.atomic.u.r.version != H5R_ENCODE_VERSION)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "reference version does not match");
+ } else
+ dt->shared->u.atomic.u.r.opaque = FALSE;
+
+ /* This type needs conversion */
+ dt->shared->force_conv = TRUE;
+
+ /* Mark location of this type as undefined for now. The caller
+ * function should decide the location. */
+ if(H5T_set_loc(dt, NULL, H5T_LOC_BADLOC) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
break;
case H5T_ENUM:
@@ -457,7 +469,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
dt->shared->u.enumer.nmembs = dt->shared->u.enumer.nalloc = flags & 0xffff;
if(NULL == (dt->shared->parent = H5T__alloc()))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(H5O_dtype_decode_helper(f, ioflags, pp, dt->shared->parent) < 0)
+ if(H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode parent datatype")
/* Check if the parent of this enum has a version greater than the
@@ -499,7 +511,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Decode base type of VL information */
if(NULL == (dt->shared->parent = H5T__alloc()))
HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(H5O_dtype_decode_helper(f, ioflags, pp, dt->shared->parent) < 0)
+ if(H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode VL parent type")
/* Check if the parent of this vlen has a version greater than the
@@ -511,7 +523,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Mark location this type as undefined for now. The caller function should
* decide the location. */
- if(H5T_set_loc(dt, f, H5T_LOC_BADLOC) < 0)
+ if(H5T_set_loc(dt, NULL, H5T_LOC_BADLOC) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
break;
@@ -540,7 +552,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Decode base type of array */
if(NULL == (dt->shared->parent = H5T__alloc()))
HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(H5O_dtype_decode_helper(f, ioflags, pp, dt->shared->parent) < 0)
+ if(H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode array parent type")
/* Check if the parent of this array has a version greater than the
@@ -596,7 +608,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
+H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
{
unsigned flags = 0;
uint8_t *hdr = (uint8_t *)*pp;
@@ -956,7 +968,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
} /* end if */
/* Subtype */
- if(H5O_dtype_encode_helper(f, pp, dt->shared->u.compnd.memb[i].type) < 0)
+ if(H5O_dtype_encode_helper(pp, dt->shared->u.compnd.memb[i].type) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode member type")
} /* end for */
}
@@ -964,6 +976,8 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
case H5T_REFERENCE:
flags |= (dt->shared->u.atomic.u.r.rtype & 0x0f);
+ if(dt->shared->u.atomic.u.r.opaque)
+ flags = (unsigned)(flags | (((unsigned)dt->shared->u.atomic.u.r.version & 0x0f) << 4));
break;
case H5T_ENUM:
@@ -976,7 +990,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
flags = dt->shared->u.enumer.nmembs & 0xffff;
/* Parent type */
- if(H5O_dtype_encode_helper(f, pp, dt->shared->parent) < 0)
+ if(H5O_dtype_encode_helper(pp, dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode parent datatype")
/* Names, each a multiple of eight bytes */
@@ -1012,7 +1026,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
} /* end if */
/* Encode base type of VL information */
- if(H5O_dtype_encode_helper(f, pp, dt->shared->parent) < 0)
+ if(H5O_dtype_encode_helper(pp, dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type")
break;
@@ -1050,7 +1064,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
} /* end if */
/* Encode base type of array's information */
- if(H5O_dtype_encode_helper(f, pp, dt->shared->parent) < 0)
+ if(H5O_dtype_encode_helper(pp, dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type")
break;
@@ -1091,7 +1105,7 @@ done:
function using malloc() and is returned to the caller.
--------------------------------------------------------------------------*/
static void *
-H5O_dtype_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
+H5O_dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
unsigned *ioflags/*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5T_t *dt = NULL;
@@ -1107,7 +1121,7 @@ H5O_dtype_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Perform actual decode of message */
- if(H5O_dtype_decode_helper(f, ioflags, &p, dt) < 0)
+ if(H5O_dtype_decode_helper(ioflags, &p, dt) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode type")
/* Set return value */
@@ -1136,7 +1150,7 @@ done:
message in the "raw" disk form.
--------------------------------------------------------------------------*/
static herr_t
-H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg)
+H5O_dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg)
{
const H5T_t *dt = (const H5T_t *) mesg;
herr_t ret_value = SUCCEED; /* Return value */
@@ -1149,7 +1163,7 @@ H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg)
HDassert(dt);
/* encode */
- if(H5O_dtype_encode_helper(f, &p, dt) < 0)
+ if(H5O_dtype_encode_helper(&p, dt) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode type")
done:
@@ -1545,7 +1559,7 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
/* Set the location of the source datatype to describe the disk form of the data */
- if(H5T_set_loc(udata->src_dtype, file_src, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(udata->src_dtype, H5F_VOL_OBJ(file_src), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
@@ -1582,7 +1596,7 @@ H5O__dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
/* The datatype will be in the new file; set its location. */
- if(H5T_set_loc(dst_mesg, file_dst, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dst_mesg, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to set location")
ret_value = dst_mesg;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index df39d19..cb75bc3 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -408,10 +408,10 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
if(fill->version < H5O_FILL_VERSION_3) {
/* Space allocation time */
- *p++ = fill->alloc_time;
+ *p++ = (uint8_t)fill->alloc_time;
/* Fill value writing time */
- *p++ = fill->fill_time;
+ *p++ = (uint8_t)fill->fill_time;
/* Whether fill value is defined */
*p++ = (uint8_t)fill->fill_defined;
@@ -742,7 +742,7 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create scalar dataspace")
/* Reclaim any variable length components of the fill value */
- if(H5D_vlen_reclaim(fill_type_id, fill_space, fill->buf) < 0) {
+ if(H5T_reclaim(fill_type_id, fill_space, fill->buf) < 0) {
H5S_close(fill_space);
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim variable-length fill value data")
} /* end if */
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index a03cfa1..b441840 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -72,7 +72,7 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
herr_t
H5Oflush(hid_t obj_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object token */
+ H5VL_object_t *vol_obj = NULL; /* Object of obj_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -236,7 +236,7 @@ done:
herr_t
H5Orefresh(hid_t oid)
{
- H5VL_object_t *vol_obj = NULL; /* Object token */
+ H5VL_object_t *vol_obj = NULL; /* Object of oid */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index e5e6741..78e8e19 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -112,7 +112,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF;
/* Version of message */
@@ -141,7 +141,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
fsinfo->threshold = threshold;
if(HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)) )
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size")
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++)
H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1]));
break;
@@ -181,7 +181,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
/* Decode addresses of free space managers, if persisting */
if(fsinfo->persist) {
- for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1]));
} /* end if */
@@ -223,8 +223,8 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
HDassert(p);
HDassert(fsinfo);
- *p++ = (uint8_t)fsinfo->version; /* message version */
- *p++ = fsinfo->strategy; /* File space strategy */
+ *p++ = (uint8_t)fsinfo->version; /* message version */
+ *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */
*p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */
H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */
@@ -235,7 +235,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
/* Store addresses of free-space managers, if persisting */
if(fsinfo->persist) {
/* Addresses of free-space managers */
- for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]);
} /* end if */
@@ -480,7 +480,7 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream,
"eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc);
if(fsinfo->persist) {
- for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++)
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Free space manager address:", fsinfo->fs_addr[ptype-1]);
} /* end if */
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 4b34a52..d6190c6 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -171,7 +171,7 @@ static herr_t
H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
- unsigned char flags; /* Flags for encoding group info */
+ unsigned char flags = 0; /* Flags for encoding group info */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -183,7 +183,7 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared,
*p++ = H5O_GINFO_VERSION;
/* The flags for the group info */
- flags = ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0;
+ flags = (unsigned char)(ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0);
flags = (unsigned char)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0));
*p++ = flags;
diff --git a/src/H5Oint.c b/src/H5Oint.c
index ecf347c..04220af 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -31,6 +31,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
@@ -42,6 +43,8 @@
#include "H5Opkg.h" /* Object headers */
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -55,9 +58,9 @@
/* User data for recursive traversal over objects from a group */
typedef struct {
hid_t obj_id; /* The ID for the starting group */
- H5G_loc_t *start_loc; /* Location of starting group */
+ H5G_loc_t *start_loc; /* Location of starting group */
H5SL_t *visited; /* Skip list for tracking visited nodes */
- H5O_iterate_t op; /* Application callback */
+ H5O_iterate2_t op; /* Application callback */
void *op_data; /* Application's op data */
unsigned fields; /* Selection of object info */
} H5O_iter_visit_ud_t;
@@ -77,9 +80,11 @@ static herr_t H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type);
static herr_t H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr);
static herr_t H5O__free_visit_visited(void *item, void *key,
void *operator_data/*in,out*/);
-static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info_t *linfo,
+static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info2_t *linfo,
void *_udata);
static const H5O_obj_class_t *H5O__obj_class_real(const H5O_t *oh);
+static herr_t H5O__reset_info2(H5O_info2_t *oinfo);
+
/*********************/
/* Package Variables */
@@ -150,6 +155,13 @@ H5FL_BLK_DEFINE(chunk_image);
/* Declare external the free list for H5O_cont_t sequences */
H5FL_SEQ_EXTERN(H5O_cont_t);
+/* The canonical 'undefined' token */
+const H5O_token_t H5O_TOKEN_UNDEF_g = {{
+ 255, 255, 255, 255,
+ 255, 255, 255, 255,
+ 255, 255, 255, 255,
+ 255, 255, 255, 255}};
+
/*****************************/
/* Library Private Variables */
@@ -239,7 +251,7 @@ H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx
version = H5O_VERSION_1;
/* Upgrade to the version indicated by the file's low bound if higher */
- version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
+ version = (uint8_t)MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
/* Version bounds check */
if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)])
@@ -352,8 +364,18 @@ H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list")
/* Get any object header status flags set by properties */
- if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ if(H5P_DATASET_CREATE_DEFAULT == ocpl_id)
+ {
+ /* If the OCPL is the default DCPL, we can get the header flags from the
+ * API context. Otherwise we have to call H5P_get */
+ if(H5CX_get_ohdr_flags(&oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ }
+ else
+ {
+ if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ }
if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header")
@@ -1891,27 +1913,19 @@ H5O_loc_reset(H5O_loc_t *loc)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_loc_reset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_loc_copy
*
- * Purpose: Copy object location information
+ * Purpose: Copy object location information, according to the depth.
*
* Return: Success: Non-negative
- * Failure: Negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Monday, September 19, 2005
*
- * Notes: 'depth' parameter determines how much of the group entry
- * structure we want to copy. The values are:
- * H5_COPY_SHALLOW - Copy all the field values from the source
- * to the destination, but not copying objects pointed to.
- * (Destination "takes ownership" of objects pointed to)
- * H5_COPY_DEEP - Copy all the fields from the source to
- * the destination, deep copying objects pointed to.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1924,25 +1938,88 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
HDassert(dst);
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
+ /* Invoke correct routine */
+ if(depth == H5_COPY_SHALLOW)
+ H5O_loc_copy_shallow(dst, src);
+ else
+ H5O_loc_copy_deep(dst, src);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_loc_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_copy_shallow
+ *
+ * Purpose: Shallow copy object location information. Copies all the field
+ * values from the source to the destination, but not copying
+ * objects pointed to. (i.e. destination "takes ownership" of
+ * objects pointed to)
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_copy_shallow(H5O_loc_t *dst, H5O_loc_t *src)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(src);
+ HDassert(dst);
+
/* Copy the top level information */
H5MM_memcpy(dst, src, sizeof(H5O_loc_t));
- /* Deep copy the names */
- if(depth == H5_COPY_DEEP) {
- /* If the original entry was holding open the file, this one should
- * hold it open, too.
- */
- if(src->holding_file)
- H5F_INCR_NOPEN_OBJS(dst->file);
- }
- else if(depth == H5_COPY_SHALLOW) {
- H5O_loc_reset(src);
- }
+ /* Reset the source location, as the destination 'owns' it now */
+ H5O_loc_reset(src);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_loc_copy() */
+} /* end H5O_loc_copy_shallow() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_copy_deep
+ *
+ * Purpose: Deep copy object location information. Copies all the fields
+ * from the source to the destination, deep copying objects
+ * pointed to.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_copy_deep(H5O_loc_t *dst, const H5O_loc_t *src)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(src);
+ HDassert(dst);
+
+ /* Copy the top level information */
+ H5MM_memcpy(dst, src, sizeof(H5O_loc_t));
+
+ /* If the original entry was holding open the file, this one should
+ * hold it open, too.
+ */
+ if(src->holding_file)
+ H5F_INCR_NOPEN_OBJS(dst->file);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_loc_copy_deep() */
+
/*-------------------------------------------------------------------------
* Function: H5O_loc_hold_file
*
@@ -2144,9 +2221,7 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
/*-------------------------------------------------------------------------
* Function: H5O_get_info
*
- * Purpose: Retrieve the information for an object
- *
- * Note: Add a parameter "fields" to indicate selection of object info.
+ * Purpose: Retrieve the data model information for an object
*
* Return: Success: Non-negative
* Failure: Negative
@@ -2157,7 +2232,7 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
+H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields)
{
const H5O_obj_class_t *obj_class; /* Class of object for header */
H5O_t *oh = NULL; /* Object header */
@@ -2178,15 +2253,17 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
/* Reset the object info structure */
- HDmemset(oinfo, 0, sizeof(*oinfo));
+ if(H5O__reset_info2(oinfo) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct")
/* Get basic information, if requested */
if(fields & H5O_INFO_BASIC) {
/* Retrieve the file's fileno */
H5F_GET_FILENO(loc->file, oinfo->fileno);
- /* Set the object's address */
- oinfo->addr = loc->addr;
+ /* Set the object's address into the token */
+ if(H5VL_native_addr_to_token(loc->file, H5I_FILE, loc->addr, &oinfo->token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
/* Retrieve the type of the object */
oinfo->type = obj_class->type;
@@ -2238,31 +2315,11 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields)
} /* end else */
} /* end if */
- /* Get the information for the object header, if requested */
- if(fields & H5O_INFO_HDR)
- if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
-
/* Retrieve # of attributes */
if(fields & H5O_INFO_NUM_ATTRS)
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 */
- if(fields & H5O_INFO_META_SIZE) {
- /* Check for 'bh_info' callback for this type of object */
- if(obj_class->bh_info)
- /* Call the object's class 'bh_info' routine */
- if((obj_class->bh_info)(loc, oh, &oinfo->meta_size.obj) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
-
- /* Get B-tree & heap info for any attributes */
- if(!(fields & H5O_INFO_NUM_ATTRS) || oinfo->num_attrs > 0) {
- if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
- } /* end if */
- } /* end if */
-
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
@@ -2272,60 +2329,66 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__get_info_by_idx
- *
- * Purpose: Internal routine to retrieve an object's info according to
- * an index within a group.
+ * Function: H5O_get_native_info
*
- *
- * Note: Add a parameter "fields" to indicate selection of object info.
+ * Purpose: Retrieve the native file-format information for an object
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
- * December 28, 2017
+ * November 21 2006
*
*-------------------------------------------------------------------------
*/
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)
+H5O_get_native_info(const H5O_loc_t *loc, H5O_native_info_t *oinfo, unsigned fields)
{
- 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 */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_obj_class_t *obj_class; /* Class of object for header */
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL)
- /* Check arguments */
+ /* Check args */
HDassert(loc);
- HDassert(group_name && *group_name);
HDassert(oinfo);
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
+ /* 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")
- /* Find the object's location, according to the order in the index */
- if(H5G_loc_find_by_idx(loc, group_name, idx_type, order, n, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
+ /* Get class for object */
+ if(NULL == (obj_class = H5O__obj_class_real(oh)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
- /* Retrieve the object's information */
- if(H5O_get_info(obj_loc.oloc, oinfo, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
+ /* Reset the object info structure */
+ HDmemset(oinfo, 0, sizeof(*oinfo));
+
+ /* Get the information for the object header, if requested */
+ if(fields & H5O_NATIVE_INFO_HDR)
+ if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
+
+ /* Get B-tree & heap metadata storage size, if requested */
+ if(fields & H5O_NATIVE_INFO_META_SIZE) {
+ /* Check for 'bh_info' callback for this type of object */
+ if(obj_class->bh_info)
+ /* Call the object's class 'bh_info' routine */
+ if((obj_class->bh_info)(loc, oh, &oinfo->meta_size.obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
+
+ /* Get B-tree & heap info for any attributes */
+ if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
+ } /* end if */
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")
+ if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__get_info_by_idx() */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5O_get_native_info() */
/*-------------------------------------------------------------------------
@@ -2368,7 +2431,7 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list")
/* Mask off non-"user visible" flags */
- ohdr_flags = oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES);
+ H5_CHECKED_ASSIGN(ohdr_flags, uint8_t, oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES), int);
/* Set object header flags */
if(H5P_set(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -2639,7 +2702,7 @@ H5O__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *linfo,
+H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *linfo,
void *_udata)
{
H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */
@@ -2677,7 +2740,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li
/* Check if we've seen the object the link references before */
if(NULL == H5SL_search(udata->visited, &obj_pos)) {
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
/* Get the object's info */
if(H5O_get_info(&obj_oloc, &oinfo, udata->fields) < 0)
@@ -2753,14 +2816,14 @@ done:
*/
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_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields)
{
H5O_iter_visit_ud_t udata; /* User data for callback */
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 */
+ H5O_info2_t oinfo; /* Object info struct */
void *obj = NULL; /* Object */
H5I_type_t opened_type; /* ID type of object */
hid_t obj_id = H5I_INVALID_HID; /* ID of object */
@@ -2836,7 +2899,10 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
/* Construct unique "position" for this object */
obj_pos->fileno = oinfo.fileno;
- obj_pos->addr = oinfo.addr;
+
+ /* De-serialize object token into an object address */
+ if(H5VL_native_token_to_addr(loc->oloc->file, H5I_FILE, oinfo.token, &(obj_pos->addr)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
/* Add to list of visited objects */
if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0)
@@ -3073,3 +3139,25 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__free() */
+/*-------------------------------------------------------------------------
+ * Function: H5O__reset_info2
+ *
+ * Purpose: Resets/initializes an H5O_info2_t struct.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__reset_info2(H5O_info2_t *oinfo)
+{
+ FUNC_ENTER_STATIC_NOERR;
+
+ /* Reset the passed-in info struct */
+ HDmemset(oinfo, 0, sizeof(H5O_info2_t));
+ oinfo->type = H5O_TYPE_UNKNOWN;
+ oinfo->token = H5O_TOKEN_UNDEF;
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* end H5O__reset_info2() */
+
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 138f219..2a2a07b 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -570,7 +570,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
H5O_LAYOUT_VERSION_3 : mesg->version);
/* Layout class */
- *p++ = mesg->type;
+ *p++ = (uint8_t)mesg->type;
/* Write out layout class specific information */
switch(mesg->type) {
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 9827b6a..a2f88d9 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -203,7 +203,7 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co
*p++ = H5O_LINFO_VERSION;
/* The flags for the link indices */
- index_flags = linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0;
+ index_flags = (uint8_t)(linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0);
index_flags = (uint8_t)(index_flags | (linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0));
*p++ = index_flags;
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 4bd952b..1f0c6c7 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -316,7 +316,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con
/* Store the type of a non-default link */
if(link_flags & H5O_LINK_STORE_LINK_TYPE)
- *p++ = lnk->type;
+ *p++ = (uint8_t)lnk->type;
/* Store the link creation order in the file, if its valid */
if(lnk->corder_valid)
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 18f3706..d66ea69 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1686,17 +1686,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_msg_reset_share(unsigned type_id, void *mesg)
+H5O_msg_reset_share(unsigned H5_ATTR_NDEBUG_UNUSED type_id, void *mesg)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
-
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(type_id < NELMTS(H5O_msg_class_g));
- type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- HDassert(type);
- HDassert(type->share_flags & H5O_SHARE_IS_SHARABLE);
+ HDassert(H5O_msg_class_g[type_id]); /* map the type ID to the actual type object */
+ HDassert(H5O_msg_class_g[type_id]->share_flags & H5O_SHARE_IS_SHARABLE);
HDassert(mesg);
/* Reset the shared component in the message to zero. */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 4afa452..fb08f7d 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -556,10 +556,8 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
/* Package-local function prototypes */
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__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__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_iter_order_t order, H5O_iterate2_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);
H5_DLL herr_t H5O__free(H5O_t *oh);
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index bcb8299..ceaa96d 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -877,6 +877,7 @@ typedef struct {
void *new_obj; /* Pointer to new object created */
} H5O_obj_create_t;
+
/* Forward declarations for prototype arguments */
struct H5P_genplist_t;
@@ -906,7 +907,8 @@ H5_DLL herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned mesg_id, unsigned mesg_
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_delete(H5F_t *f, haddr_t addr);
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_get_info(const H5O_loc_t *oloc, H5O_info2_t *oinfo, unsigned fields);
+H5_DLL herr_t H5O_get_native_info(const H5O_loc_t *oloc, H5O_native_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 void *H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type/*out*/);
@@ -981,8 +983,8 @@ H5_DLL herr_t H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disable
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
H5O_copy_t *cpy_info, hbool_t inc_depth,
H5O_type_t *obj_type, void **udata);
-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,
+H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, hid_t tid_src, H5T_t *dt_src,
+ void *buf_src, size_t nbytes_src, H5F_t *file_dst, void *buf_dst,
H5O_copy_t *cpy_info);
H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name,
H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
@@ -995,6 +997,8 @@ H5_DLL herr_t H5O_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent,
/* These functions operate on object locations */
H5_DLL herr_t H5O_loc_reset(H5O_loc_t *loc);
H5_DLL herr_t H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5O_loc_copy_shallow(H5O_loc_t *dst, H5O_loc_t *src);
+H5_DLL herr_t H5O_loc_copy_deep(H5O_loc_t *dst, const H5O_loc_t *src);
H5_DLL herr_t H5O_loc_hold_file(H5O_loc_t *loc);
H5_DLL herr_t H5O_loc_free(H5O_loc_t *loc);
H5_DLL H5O_loc_t *H5O_get_loc(hid_t id);
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 234f4f0..d0f8ab3 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -75,14 +75,24 @@
/* Flags for H5Oget_info.
* Theses flags determine which fields will be filled in in the H5O_info_t
- * struct.
+ * struct.
*/
#define H5O_INFO_BASIC 0x0001u /* Fill in the fileno, addr, type, and rc fields */
#define H5O_INFO_TIME 0x0002u /* Fill in the atime, mtime, ctime, and btime fields */
#define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */
-#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */
-#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
-#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE)
+#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS)
+
+/* Flags for H5Oget_native_info.
+ * Theses flags determine which fields will be filled in in the H5O_native_info_t
+ * struct.
+ */
+#define H5O_NATIVE_INFO_HDR 0x0008u /* Fill in the hdr field */
+#define H5O_NATIVE_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
+#define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE)
+
+/* Convenience macro to check if the token is the 'undefined' token value */
+#define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t)))
+
/*******************/
/* Public Typedefs */
@@ -116,30 +126,36 @@ typedef struct H5O_hdr_info_t {
} mesg;
} H5O_hdr_info_t;
-/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
-typedef struct H5O_info_t {
- unsigned long fileno; /* File number that object is located in */
- haddr_t addr; /* Object address in file */
- H5O_type_t type; /* Basic object type (group, dataset, etc.) */
- unsigned rc; /* Reference count of object */
- time_t atime; /* Access time */
- time_t mtime; /* Modification time */
- time_t ctime; /* Change time */
- time_t btime; /* Birth time */
- hsize_t num_attrs; /* # of attributes attached to object */
+/* Data model information struct for objects */
+/* (For H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx version 3) */
+typedef struct H5O_info2_t {
+ unsigned long fileno; /* File number that object is located in */
+ H5O_token_t token; /* Token representing the object */
+ H5O_type_t type; /* Basic object type (group, dataset, etc.) */
+ unsigned rc; /* Reference count of object */
+ time_t atime; /* Access time */
+ time_t mtime; /* Modification time */
+ time_t ctime; /* Change time */
+ time_t btime; /* Birth time */
+ hsize_t num_attrs; /* # of attributes attached to object */
+} H5O_info2_t;
+
+/* Native file format information struct for objects */
+/* (For H5Oget_native_info / H5Oget_native_info_by_name / H5Oget_native_info_by_idx) */
+typedef struct H5O_native_info_t {
H5O_hdr_info_t hdr; /* Object header information */
/* Extra metadata storage for obj & attributes */
struct {
H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
H5_ih_info_t attr; /* v2 B-tree & heap for attributes */
} meta_size;
-} H5O_info_t;
+} H5O_native_info_t;
/* Typedef for message creation indexes */
typedef uint32_t H5O_msg_crt_idx_t;
-/* Prototype for H5Ovisit/H5Ovisit_by_name() operator */
-typedef herr_t (*H5O_iterate_t)(hid_t obj, const char *name, const H5O_info_t *info,
+/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (version 3) */
+typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info,
void *op_data);
typedef enum H5O_mcdt_search_ret_t {
@@ -165,15 +181,21 @@ extern "C" {
#endif
H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id);
-H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
+H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token);
H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id);
H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id);
-H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields);
-H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
+H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields);
+H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo,
unsigned fields, hid_t lapl_id);
-H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo,
+H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo,
+ unsigned fields, hid_t lapl_id);
+H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields);
+H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo,
+ unsigned fields, hid_t lapl_id);
+H5_DLL herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo,
unsigned fields, hid_t lapl_id);
H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name,
hid_t lcpl_id, hid_t lapl_id);
@@ -187,10 +209,10 @@ H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name,
H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize);
H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name,
char *comment, size_t bufsize, hid_t lapl_id);
-H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
- H5O_iterate_t op, void *op_data, unsigned fields);
-H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op,
+H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate2_t op, void *op_data, unsigned fields);
+H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name,
+ H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op,
void *op_data, unsigned fields, hid_t lapl_id);
H5_DLL herr_t H5Oclose(hid_t object_id);
H5_DLL herr_t H5Oflush(hid_t obj_id);
@@ -198,6 +220,14 @@ H5_DLL herr_t H5Orefresh(hid_t oid);
H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id);
H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
+H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2,
+ int *cmp_value);
+H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str);
+H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token);
+
+/* The canonical 'undefined' token value */
+#define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g)
+H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g;
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -207,6 +237,12 @@ H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled
/* Macros */
+/* Deprecated flags for earlier versions of H5Oget_info* */
+#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */
+#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
+#undef H5O_INFO_ALL
+#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE)
+
/* Typedefs */
/* A struct that's part of the H5G_stat_t structure (deprecated) */
@@ -217,19 +253,56 @@ typedef struct H5O_stat_t {
unsigned nchunks; /* Number of object header chunks */
} H5O_stat_t;
+/* Information struct for object */
+/* (For H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx versions 1 & 2) */
+typedef struct H5O_info1_t {
+ unsigned long fileno; /* File number that object is located in */
+ haddr_t addr; /* Object address in file */
+ H5O_type_t type; /* Basic object type (group, dataset, etc.) */
+ unsigned rc; /* Reference count of object */
+ time_t atime; /* Access time */
+ time_t mtime; /* Modification time */
+ time_t ctime; /* Change time */
+ time_t btime; /* Birth time */
+ hsize_t num_attrs; /* # of attributes attached to object */
+ H5O_hdr_info_t hdr; /* Object header information */
+ /* Extra metadata storage for obj & attributes */
+ struct {
+ H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
+ H5_ih_info_t attr; /* v2 B-tree & heap for attributes */
+ } meta_size;
+} H5O_info1_t;
+
+/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (versions 1 & 2) */
+typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info,
+ void *op_data);
+
+
/* Function prototypes */
-H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo);
-H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo,
+H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
+H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo);
+H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo,
hid_t lapl_id);
H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo,
hid_t lapl_id);
-
+H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields);
+H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo,
+ unsigned fields, hid_t lapl_id);
+H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo,
+ unsigned fields, hid_t lapl_id);
H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
- H5O_iterate_t op, void *op_data);
+ H5O_iterate1_t op, void *op_data);
H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op,
+ H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op,
void *op_data, hid_t lapl_id);
+H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate1_t op, void *op_data, unsigned fields);
+H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name,
+ H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op,
+ void *op_data, unsigned fields, hid_t lapl_id);
+
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index b4f00ea..33310dc 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -257,7 +257,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* Dataspace type */
if(sdim->version > H5O_SDSPACE_VERSION_1)
- *p++ = sdim->type;
+ *p++ = (uint8_t)sdim->type;
else {
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 67ca76f..b49e501 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -589,9 +589,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
+H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst,
const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst,
- hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info,
+ hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info,
void H5_ATTR_UNUSED *udata)
{
const H5O_shared_t *shared_src = (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 8040a6a..e4ad980 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -381,7 +381,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_INLINE herr_t
-H5O_SHARED_POST_COPY_FILE(const H5O_loc_t *oloc_src, const void *mesg_src,
+H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const void *mesg_src,
H5O_loc_t *oloc_dst, void *mesg_dst, unsigned *mesg_flags,
H5O_copy_t *cpy_info)
{
diff --git a/src/H5PL.c b/src/H5PL.c
index fc42554..0f0f88a 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -210,13 +210,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PLreplace(const char *search_path, unsigned int index)
+H5PLreplace(const char *search_path, unsigned int idx)
{
unsigned num_paths; /* Current number of stored paths */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "*sIu", search_path, index);
+ H5TRACE2("e", "*sIu", search_path, idx);
/* Check args */
if (NULL == search_path)
@@ -228,11 +228,11 @@ H5PLreplace(const char *search_path, unsigned int index)
num_paths = H5PL__get_num_paths();
if (0 == num_paths)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty")
- else if (index >= num_paths)
+ else if (idx >= num_paths)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index path out of bounds for table - can't be more than %u", (num_paths - 1))
/* Insert the search path into the path table */
- if (H5PL__replace_path(search_path, index) < 0)
+ if (H5PL__replace_path(search_path, idx) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to replace search path")
done:
@@ -252,13 +252,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PLinsert(const char *search_path, unsigned int index)
+H5PLinsert(const char *search_path, unsigned int idx)
{
unsigned num_paths; /* Current number of stored paths */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "*sIu", search_path, index);
+ H5TRACE2("e", "*sIu", search_path, idx);
/* Check args */
if (NULL == search_path)
@@ -268,11 +268,11 @@ H5PLinsert(const char *search_path, unsigned int index)
/* Check index */
num_paths = H5PL__get_num_paths();
- if ((0 != num_paths) && (index >= num_paths))
+ if ((0 != num_paths) && (idx >= num_paths))
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index path out of bounds for table - can't be more than %u", (num_paths - 1))
/* Insert the search path into the path table */
- if (H5PL__insert_path(search_path, index) < 0)
+ if (H5PL__insert_path(search_path, idx) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to insert search path")
done:
@@ -294,23 +294,23 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PLremove(unsigned int index)
+H5PLremove(unsigned int idx)
{
unsigned num_paths; /* Current number of stored paths */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "Iu", index);
+ H5TRACE1("e", "Iu", idx);
/* Check index */
num_paths = H5PL__get_num_paths();
if (0 == num_paths)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty")
- else if (index >= num_paths)
+ else if (idx >= num_paths)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index path out of bounds for table - can't be more than %u", (num_paths - 1))
/* Delete the search path from the path table */
- if (H5PL__remove_path(index) < 0)
+ if (H5PL__remove_path(idx) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTDELETE, FAIL, "unable to remove search path")
done:
@@ -343,7 +343,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5PLget(unsigned int index, char *path_buf, size_t buf_size)
+H5PLget(unsigned int idx, char *path_buf, size_t buf_size)
{
unsigned num_paths; /* Current number of stored paths */
const char *path = NULL; /* path from table */
@@ -351,13 +351,13 @@ H5PLget(unsigned int index, char *path_buf, size_t buf_size)
ssize_t ret_value = 0; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("Zs", "Iu*sz", index, path_buf, buf_size);
+ H5TRACE3("Zs", "Iu*sz", idx, path_buf, buf_size);
/* Check index */
num_paths = H5PL__get_num_paths();
if (0 == num_paths)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty")
- else if (index >= num_paths)
+ else if (idx >= num_paths)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index path out of bounds for table - can't be more than %u", (num_paths - 1))
/* Check if the search table is empty */
@@ -365,7 +365,7 @@ H5PLget(unsigned int index, char *path_buf, size_t buf_size)
HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, (-1), "plugin search path table is empty")
/* Get the path at the specified index and its length */
- if (NULL == (path = H5PL__get_path(index)))
+ if (NULL == (path = H5PL__get_path(idx)))
HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, (-1), "no path stored at that index")
path_len = HDstrlen(path);
diff --git a/src/H5PLint.c b/src/H5PLint.c
index 8dec14b..b69a788 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -304,8 +304,7 @@ done:
* get_plugin_info function pointer, but early (4.4.7, at least) gcc
* only allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpedantic"
+H5_GCC_DIAG_OFF(pedantic)
herr_t
H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key,
hbool_t *success, const void **plugin_info)
@@ -417,7 +416,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__open() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(pedantic)
/*-------------------------------------------------------------------------
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index e270c73..ba23fd3 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -62,9 +62,9 @@
/* Local Prototypes */
/********************/
-static herr_t H5PL__insert_at(const char *path, unsigned int index);
-static herr_t H5PL__make_space_at(unsigned int index);
-static herr_t H5PL__replace_at(const char *path, unsigned int index);
+static herr_t H5PL__insert_at(const char *path, unsigned int idx);
+static herr_t H5PL__make_space_at(unsigned int idx);
+static herr_t H5PL__replace_at(const char *path, unsigned int idx);
static herr_t H5PL__expand_path_table(void);
static herr_t H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *found, const char *dir, const void **plugin_info);
@@ -105,7 +105,7 @@ static unsigned H5PL_path_capacity_g = H5PL_INITIAL_PATH_CAPACITY;
*-------------------------------------------------------------------------
*/
static herr_t
-H5PL__insert_at(const char *path, unsigned int index)
+H5PL__insert_at(const char *path, unsigned int idx)
{
char *path_copy = NULL; /* copy of path string (for storing) */
herr_t ret_value = SUCCEED; /* Return value */
@@ -132,12 +132,12 @@ H5PL__insert_at(const char *path, unsigned int index)
#endif /* H5_HAVE_WIN32_API */
/* If the table entry is in use, make some space */
- if (H5PL_paths_g[index])
- if (H5PL__make_space_at(index) < 0)
+ if (H5PL_paths_g[idx])
+ if (H5PL__make_space_at(idx) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "unable to make space in the table for the new entry")
/* Insert the copy of the search path into the table at the specified index */
- H5PL_paths_g[index] = path_copy;
+ H5PL_paths_g[idx] = path_copy;
H5PL_num_paths_g++;
done:
@@ -156,7 +156,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5PL__make_space_at(unsigned int index)
+H5PL__make_space_at(unsigned int idx)
{
unsigned u; /* iterator */
herr_t ret_value = SUCCEED; /* Return value */
@@ -164,13 +164,13 @@ H5PL__make_space_at(unsigned int index)
FUNC_ENTER_STATIC_NOERR
/* Check args - Just assert on package functions */
- HDassert(index < H5PL_path_capacity_g);
+ HDassert(idx < H5PL_path_capacity_g);
/* Copy the paths back to make a space */
- for (u = H5PL_num_paths_g; u > index; u--)
+ for (u = H5PL_num_paths_g; u > idx; u--)
H5PL_paths_g[u] = H5PL_paths_g[u-1];
- H5PL_paths_g[index] = NULL;
+ H5PL_paths_g[idx] = NULL;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__make_space_at() */
@@ -188,7 +188,7 @@ H5PL__make_space_at(unsigned int index)
*-------------------------------------------------------------------------
*/
static herr_t
-H5PL__replace_at(const char *path, unsigned int index)
+H5PL__replace_at(const char *path, unsigned int idx)
{
char *path_copy = NULL; /* copy of path string (for storing) */
herr_t ret_value = SUCCEED; /* Return value */
@@ -200,8 +200,8 @@ H5PL__replace_at(const char *path, unsigned int index)
HDassert(HDstrlen(path));
/* Check that the table entry is in use */
- if (!H5PL_paths_g[index])
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, FAIL, "path entry at index %u in the table is NULL", index)
+ if (!H5PL_paths_g[idx])
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, FAIL, "path entry at index %u in the table is NULL", idx)
/* Copy the path for storage so the caller can dispose of theirs */
if (NULL == (path_copy = H5MM_strdup(path)))
@@ -214,10 +214,10 @@ H5PL__replace_at(const char *path, unsigned int index)
#endif /* H5_HAVE_WIN32_API */
/* Free the existing path entry */
- H5PL_paths_g[index] = (char *)H5MM_xfree(H5PL_paths_g[index]);
+ H5PL_paths_g[idx] = (char *)H5MM_xfree(H5PL_paths_g[idx]);
/* Copy the search path into the table at the specified index */
- H5PL_paths_g[index] = path_copy;
+ H5PL_paths_g[idx] = path_copy;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -448,7 +448,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PL__replace_path(const char *path, unsigned int index)
+H5PL__replace_path(const char *path, unsigned int idx)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -457,10 +457,10 @@ H5PL__replace_path(const char *path, unsigned int index)
/* Check args - Just assert on package functions */
HDassert(path);
HDassert(HDstrlen(path));
- HDassert(index < H5PL_path_capacity_g);
+ HDassert(idx < H5PL_path_capacity_g);
/* Insert the path at the requested index */
- if (H5PL__replace_at(path, index) < 0)
+ if (H5PL__replace_at(path, idx) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to replace search path")
done:
@@ -479,7 +479,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PL__insert_path(const char *path, unsigned int index)
+H5PL__insert_path(const char *path, unsigned int idx)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -488,10 +488,10 @@ H5PL__insert_path(const char *path, unsigned int index)
/* Check args - Just assert on package functions */
HDassert(path);
HDassert(HDstrlen(path));
- HDassert(index < H5PL_path_capacity_g);
+ HDassert(idx < H5PL_path_capacity_g);
/* Insert the path at the requested index */
- if (H5PL__insert_at(path, index) < 0)
+ if (H5PL__insert_at(path, idx) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to insert search path")
done:
@@ -510,7 +510,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PL__remove_path(unsigned int index)
+H5PL__remove_path(unsigned int idx)
{
unsigned u; /* iterator */
herr_t ret_value = SUCCEED; /* Return value */
@@ -518,18 +518,18 @@ H5PL__remove_path(unsigned int index)
FUNC_ENTER_PACKAGE
/* Check args - Just assert on package functions */
- HDassert(index < H5PL_path_capacity_g);
+ HDassert(idx < H5PL_path_capacity_g);
/* Check if the path at that index is set */
- if (!H5PL_paths_g[index])
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTDELETE, FAIL, "search path at index %u is NULL", index)
+ if (!H5PL_paths_g[idx])
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTDELETE, FAIL, "search path at index %u is NULL", idx)
/* Delete the path */
H5PL_num_paths_g--;
- H5PL_paths_g[index] = (char *)H5MM_xfree(H5PL_paths_g[index]);
+ H5PL_paths_g[idx] = (char *)H5MM_xfree(H5PL_paths_g[idx]);
/* Shift the paths down to close the gap */
- for (u = index; u < H5PL_num_paths_g; u++)
+ for (u = idx; u < H5PL_num_paths_g; u++)
H5PL_paths_g[u] = H5PL_paths_g[u+1];
/* Set the (former) last path to NULL */
@@ -551,17 +551,17 @@ done:
*-------------------------------------------------------------------------
*/
const char *
-H5PL__get_path(unsigned int index)
+H5PL__get_path(unsigned int idx)
{
char *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
/* Get the path at the requested index */
- if (index >= H5PL_num_paths_g)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "path index %u is out of range in table", index)
+ if (idx >= H5PL_num_paths_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "path index %u is out of range in table", idx)
- return H5PL_paths_g[index];
+ return H5PL_paths_g[idx];
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__replace_path() */
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index cd0b4d6..c58828f 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -253,8 +253,7 @@ done:
/* See the other use of H5PL_GET_LIB_FUNC() for an explanation
* for why we disable -Wpedantic here.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpedantic"
+H5_GCC_DIAG_OFF(pedantic)
herr_t
H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found, const void **plugin_info)
{
@@ -303,5 +302,5 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__find_plugin_in_cache() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(pedantic)
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 721ba89..09ba2ee 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -2353,7 +2353,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
+H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx)
{
H5P_genplist_t *plist; /* Property list pointer */
H5O_layout_t layout; /* Layout information */
@@ -2361,7 +2361,7 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("i", "iz", dcpl_id, index);
+ H5TRACE2("i", "iz", dcpl_id, idx);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -2374,10 +2374,10 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual space */
- if(index >= layout.storage.u.virt.list_nused)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ if(idx >= layout.storage.u.virt.list_nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)")
HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
- if(NULL == (space = H5S_copy(layout.storage.u.virt.list[index].source_dset.virtual_select, FALSE, TRUE)))
+ if(NULL == (space = H5S_copy(layout.storage.u.virt.list[idx].source_dset.virtual_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
/* Register ID */
@@ -2411,7 +2411,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
+H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx)
{
H5P_genplist_t *plist; /* Property list pointer */
H5O_layout_t layout; /* Layout information */
@@ -2419,7 +2419,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("i", "iz", dcpl_id, index);
+ H5TRACE2("i", "iz", dcpl_id, idx);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -2431,28 +2431,28 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
if(H5D_VIRTUAL != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
- /* Check index */
- if(index >= layout.storage.u.virt.list_nused)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ /* Check idx */
+ if(idx >= layout.storage.u.virt.list_nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)")
HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
/* Attempt to open source dataset and patch extent if extent status is not
* H5O_VIRTUAL_STATUS_CORRECT? -NAF */
/* If source space status is H5O_VIRTUAL_STATUS_INVALID, patch with bounds
* of selection */
- if((H5O_VIRTUAL_STATUS_INVALID == layout.storage.u.virt.list[index].source_space_status)
- && (layout.storage.u.virt.list[index].unlim_dim_source < 0)) {
+ if((H5O_VIRTUAL_STATUS_INVALID == layout.storage.u.virt.list[idx].source_space_status)
+ && (layout.storage.u.virt.list[idx].unlim_dim_source < 0)) {
hsize_t bounds_start[H5S_MAX_RANK];
hsize_t bounds_end[H5S_MAX_RANK];
int rank;
int i;
/* Get rank of source space */
- if((rank = H5S_GET_EXTENT_NDIMS(layout.storage.u.virt.list[index].source_select)) < 0)
+ if((rank = H5S_GET_EXTENT_NDIMS(layout.storage.u.virt.list[idx].source_select)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get source space rank")
/* Get bounds of selection */
- if(H5S_SELECT_BOUNDS(layout.storage.u.virt.list[index].source_select, bounds_start, bounds_end) < 0)
+ if(H5S_SELECT_BOUNDS(layout.storage.u.virt.list[idx].source_select, bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection bounds")
/* Adjust bounds to extent */
@@ -2460,15 +2460,15 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
bounds_end[i]++;
/* Set extent */
- if(H5S_set_extent_simple(layout.storage.u.virt.list[index].source_select, (unsigned)rank, bounds_end, NULL) < 0)
+ if(H5S_set_extent_simple(layout.storage.u.virt.list[idx].source_select, (unsigned)rank, bounds_end, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set source space extent")
/* Update source space status */
- layout.storage.u.virt.list[index].source_space_status = H5O_VIRTUAL_STATUS_SEL_BOUNDS;
+ layout.storage.u.virt.list[idx].source_space_status = H5O_VIRTUAL_STATUS_SEL_BOUNDS;
} /* end if */
/* Get the source space */
- if(NULL == (space = H5S_copy(layout.storage.u.virt.list[index].source_select, FALSE, TRUE)))
+ if(NULL == (space = H5S_copy(layout.storage.u.virt.list[idx].source_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection")
/* Register ID */
@@ -2515,7 +2515,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/,
+H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name/*out*/,
size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
@@ -2523,7 +2523,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/,
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("Zs", "izxz", dcpl_id, index, name, size);
+ H5TRACE4("Zs", "izxz", dcpl_id, idx, name, size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -2536,13 +2536,13 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual filename */
- if(index >= layout.storage.u.virt.list_nused)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ if(idx >= layout.storage.u.virt.list_nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)")
HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
- HDassert(layout.storage.u.virt.list[index].source_file_name);
+ HDassert(layout.storage.u.virt.list[idx].source_file_name);
if(name && (size > 0))
- (void)HDstrncpy(name, layout.storage.u.virt.list[index].source_file_name, size);
- ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[index].source_file_name);
+ (void)HDstrncpy(name, layout.storage.u.virt.list[idx].source_file_name, size);
+ ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[idx].source_file_name);
done:
FUNC_LEAVE_API(ret_value)
@@ -2578,7 +2578,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/,
+H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name/*out*/,
size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
@@ -2586,7 +2586,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/,
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("Zs", "izxz", dcpl_id, index, name, size);
+ H5TRACE4("Zs", "izxz", dcpl_id, idx, name, size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -2599,13 +2599,13 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual filename */
- if(index >= layout.storage.u.virt.list_nused)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ if(idx >= layout.storage.u.virt.list_nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)")
HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
- HDassert(layout.storage.u.virt.list[index].source_dset_name);
+ HDassert(layout.storage.u.virt.list[idx].source_dset_name);
if(name && (size > 0))
- (void)HDstrncpy(name, layout.storage.u.virt.list[index].source_dset_name, size);
- ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[index].source_dset_name);
+ (void)HDstrncpy(name, layout.storage.u.virt.list[idx].source_dset_name, size);
+ ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[idx].source_dset_name);
done:
FUNC_LEAVE_API(ret_value)
@@ -3324,19 +3324,19 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/)
*/
if(H5T_get_size(type) >= H5T_get_size(fill.type)) {
buf = value;
- if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(type))))
+ if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(type))))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion")
} /* end if */
else {
- if(NULL == (buf = H5MM_malloc(H5T_get_size(fill.type))))
+ if(NULL == (buf = H5MM_calloc(H5T_get_size(fill.type))))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion")
- if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(fill.type))))
+ if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(fill.type))))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion")
} /* end else */
H5MM_memcpy(buf, fill.buf, H5T_get_size(fill.type));
/* Do the conversion */
- if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_TRANSIENT), FALSE)) < 0)
+ if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_ALL), FALSE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed")
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index df9cf4e..9baa201 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -1519,7 +1519,7 @@ done:
*
* Purpose: Sets the memory allocate/free pair for VL datatypes. The
* allocation routine is called when data is read into a new
- * array and the free routine is called when H5Dvlen_reclaim is
+ * array and the free routine is called when H5Treclaim is
* called. The alloc_info and free_info are user parameters
* which are passed to the allocation and freeing functions
* respectively. To reset the allocate/free functions to the
@@ -1563,7 +1563,7 @@ done:
*
* Purpose: Sets the memory allocate/free pair for VL datatypes. The
* allocation routine is called when data is read into a new
- * array and the free routine is called when H5Dvlen_reclaim is
+ * array and the free routine is called when H5Treclaim is
* called. The alloc_info and free_info are user parameters
* which are passed to the allocation and freeing functions
* respectively. To reset the allocate/free functions to the
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 22252d3..7866464 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -1158,27 +1158,17 @@ H5P__file_driver_free(void *value)
/* Copy the driver & info, if there is one */
if(info->driver_id > 0) {
- if(info->driver_info) {
- H5FD_class_t *driver; /* Pointer to driver */
-
- /* Retrieve the driver for the ID */
- if(NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID")
- /* Allow driver to free info or do it ourselves */
- if(driver->fapl_free) {
- if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
- } /* end if */
- else
- H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */
- } /* end if */
+ /* Free the driver info, if it exists */
+ if(info->driver_info)
+ if(H5FD_free_driver_info(info->driver_id, info->driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
/* Decrement reference count for driver */
if(H5I_dec_ref(info->driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID")
- } /* end if */
- } /* end if */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4489,7 +4479,8 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
+H5Pset_evict_on_close(hid_t fapl_id,
+ hbool_t H5_ATTR_PARALLEL_UNUSED evict_on_close)
{
H5P_genplist_t *plist; /* property list pointer */
herr_t ret_value = SUCCEED; /* return value */
@@ -5407,7 +5398,7 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info)
/* Prepare the VOL connector property */
vol_prop.connector_id = vol_id;
- vol_prop.connector_info = (void *)vol_info;
+ vol_prop.connector_info = vol_info;
/* Set the connector ID & info property */
if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0)
@@ -5753,10 +5744,10 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED
{
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 */
+ H5VL_class_t *cls1, *cls2; /* connector class for each property */
+ int cmp_value = 0; /* Value from comparison */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Status from info comparison */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 36367d7..0810427 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -169,6 +169,8 @@ hid_t H5P_CLS_STRING_CREATE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_STRING_CREATE_g = NULL;
hid_t H5P_CLS_VOL_INITIALIZE_ID_g = H5I_INVALID_HID;
H5P_genclass_t *H5P_CLS_VOL_INITIALIZE_g = NULL;
+hid_t H5P_CLS_REFERENCE_ACCESS_ID_g = H5I_INVALID_HID;
+H5P_genclass_t *H5P_CLS_REFERENCE_ACCESS_g = NULL;
/*
* Predefined property lists for each predefined class. These are initialized
@@ -192,6 +194,7 @@ hid_t H5P_LST_OBJECT_COPY_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_LINK_CREATE_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_LINK_ACCESS_ID_g = H5I_INVALID_HID;
hid_t H5P_LST_VOL_INITIALIZE_ID_g = H5I_INVALID_HID;
+hid_t H5P_LST_REFERENCE_ACCESS_ID_g = H5I_INVALID_HID;
/* Root property list class library initialization object */
const H5P_libclass_t H5P_CLS_ROOT[1] = {{
@@ -312,6 +315,25 @@ const H5P_libclass_t H5P_CLS_VINI[1] = {{
NULL /* Class close callback info */
}};
+/* Reference access property list class library initialization object */
+/* (move to proper source code file when used for real) */
+const H5P_libclass_t H5P_CLS_RACC[1] = {{
+ "reference access", /* Class name for debugging */
+ H5P_TYPE_REFERENCE_ACCESS, /* Class type */
+
+ &H5P_CLS_FILE_ACCESS_g, /* Parent class */
+ &H5P_CLS_REFERENCE_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_REFERENCE_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_REFERENCE_ACCESS_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 */
+}};
/* Library property list classes defined in other code modules */
/* (And not present in src/H5Pprivate.h) */
@@ -364,7 +386,8 @@ static H5P_libclass_t const * const init_class[] = {
H5P_CLS_ACRT, /* Attribute creation */
H5P_CLS_AACC, /* Attribute access */
H5P_CLS_LCRT, /* Link creation */
- H5P_CLS_VINI /* VOL initialization */
+ H5P_CLS_VINI, /* VOL initialization */
+ H5P_CLS_RACC /* Reference access */
};
/* Declare a free list to manage the H5P_genclass_t struct */
@@ -440,7 +463,7 @@ H5P__init_package(void)
FUNC_ENTER_PACKAGE
/* Sanity check */
- HDcompile_assert(H5P_TYPE_MAP_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
+ HDcompile_assert(H5P_TYPE_REFERENCE_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
/*
* Initialize the Generic Property class & object groups.
@@ -564,6 +587,7 @@ H5P_term_package(void)
H5P_LST_LINK_CREATE_ID_g =
H5P_LST_LINK_ACCESS_ID_g =
H5P_LST_VOL_INITIALIZE_ID_g =
+ H5P_LST_REFERENCE_ACCESS_ID_g =
H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID;
} /* end if */
} /* end if */
@@ -594,6 +618,7 @@ H5P_term_package(void)
H5P_CLS_LINK_CREATE_g =
H5P_CLS_LINK_ACCESS_g =
H5P_CLS_VOL_INITIALIZE_g =
+ H5P_CLS_REFERENCE_ACCESS_g =
H5P_CLS_FILE_MOUNT_g = NULL;
H5P_CLS_ROOT_ID_g =
@@ -616,6 +641,7 @@ H5P_term_package(void)
H5P_CLS_LINK_CREATE_ID_g =
H5P_CLS_LINK_ACCESS_ID_g =
H5P_CLS_VOL_INITIALIZE_ID_g =
+ H5P_CLS_REFERENCE_ACCESS_ID_g =
H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID;
} /* end if */
} /* end if */
@@ -2754,8 +2780,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
- void *_udata)
+H5P__poke_plist_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_ATTR_NDEBUG_UNUSED *name,
+ H5P_genprop_t *prop, void *_udata)
{
H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2801,7 +2827,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
+H5P__poke_pclass_cb(H5P_genplist_t *plist, const char H5_ATTR_NDEBUG_UNUSED *name, H5P_genprop_t *prop,
void *_udata)
{
H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */
@@ -4234,10 +4260,9 @@ property list class.
REVISION LOG
--------------------------------------------------------------------------*/
static int
-H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata)
+H5P__iterate_pclass_cb(void *_item, void H5_ATTR_NDEBUG_UNUSED *_key, void *_udata)
{
H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */
- char *key = (char *)_key; /* Pointer to the property's name */
H5P_iter_pclass_ud_t *udata = (H5P_iter_pclass_ud_t *)_udata; /* Pointer to user data */
int ret_value = 0; /* Return value */
@@ -4245,7 +4270,7 @@ H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata)
/* Sanity check */
HDassert(item);
- HDassert(key);
+ HDassert((char *)_key);
/* Check if we've found the correctly indexed property */
if(*udata->curr_idx_ptr >= udata->prev_idx) {
@@ -4371,8 +4396,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5P__peek_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop,
- void *_udata)
+H5P__peek_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_ATTR_NDEBUG_UNUSED *name,
+ H5P_genprop_t *prop, void *_udata)
{
H5P_prop_get_ud_t *udata = (H5P_prop_get_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5453,8 +5478,8 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
FUNC_ENTER_PACKAGE
/* Sanity checks */
- HDcompile_assert(H5P_TYPE_MAP_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
- HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_MAP_ACCESS);
+ HDcompile_assert(H5P_TYPE_REFERENCE_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
+ HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_REFERENCE_ACCESS);
/* Check arguments */
if(type == H5P_TYPE_USER)
@@ -5544,6 +5569,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
class_id = H5P_CLS_VOL_INITIALIZE_ID_g;
break;
+ case H5P_TYPE_REFERENCE_ACCESS:
+ class_id = H5P_CLS_REFERENCE_ACCESS_ID_g;
+ break;
+
case H5P_TYPE_USER: /* shut compiler warnings up */
case H5P_TYPE_ROOT:
case H5P_TYPE_MAX_TYPE:
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 7a7cc23..6e582fb 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -270,8 +270,8 @@ H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED
if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list")
- if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list")
+ if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list")
} /* end if */
done:
@@ -313,8 +313,8 @@ H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED
if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list")
- if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list")
+ if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list")
} /* end if */
done:
@@ -329,8 +329,8 @@ done:
* property in the dataset access property list is
* encoded.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* Wednesday, August 15, 2012
@@ -401,8 +401,8 @@ done:
* property in the dataset access property list is
* decoded.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* Wednesday, August 15, 2012
@@ -454,15 +454,15 @@ done:
/*--------------------------------------------------------------------------
- * Function: H5P__lacc_elink_fapl_del
+ * Function: H5P__lacc_elink_fapl_del
*
- * Purpose: Close the FAPL for link access
+ * Purpose: Close the FAPL for link access
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Vailin Choi
- * Tuesday, Sept 23, 2008
+ * Programmer: Vailin Choi
+ * Tuesday, Sept 23, 2008
*
*--------------------------------------------------------------------------
*/
@@ -482,7 +482,7 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED
/* Close the FAPL */
if(l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -490,15 +490,15 @@ done:
/*--------------------------------------------------------------------------
- * Function: H5P__lacc_elink_fapl_copy
+ * Function: H5P__lacc_elink_fapl_copy
*
- * Purpose: Copy the FAPL for link access
+ * Purpose: Copy the FAPL for link access
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Vailin Choi
- * Tuesday, Sept 23, 2008
+ * Programmer: Vailin Choi
+ * Tuesday, Sept 23, 2008
*
*--------------------------------------------------------------------------
*/
@@ -522,8 +522,8 @@ H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED
if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list")
- if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list")
+ if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list")
} /* end if */
done:
@@ -567,7 +567,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_
if(obj1 == NULL && obj2 != NULL) HGOTO_DONE(1);
if(obj1 != NULL && obj2 == NULL) HGOTO_DONE(-1);
if(obj1 && obj2) {
- herr_t status;
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
status = H5P__cmp_plist(obj1, obj2, &ret_value);
HDassert(status >= 0);
@@ -579,23 +579,23 @@ done:
/*--------------------------------------------------------------------------
- * Function: H5P__lacc_elink_fapl_close
+ * Function: H5P__lacc_elink_fapl_close
*
- * Purpose: Close the FAPL for link access
+ * Purpose: Close the FAPL for link access
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Vailin Choi
- * Tuesday, Sept 23, 2008
+ * Programmer: Vailin Choi
+ * Tuesday, Sept 23, 2008
*
*---------------------------------------------------------------------------
*/
static herr_t
H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
{
- hid_t l_fapl_id;
- herr_t ret_value = SUCCEED;
+ hid_t l_fapl_id;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -607,7 +607,7 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE
/* Close the FAPL */
if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c
index fe5be0f..3a3f619 100644
--- a/src/H5Pmapl.c
+++ b/src/H5Pmapl.c
@@ -137,6 +137,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__macc_reg_prop() */
+#ifdef H5_HAVE_MAP_API
/*-------------------------------------------------------------------------
* Function: H5Pset_map_iterate_hints
@@ -214,4 +215,4 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_a
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_map_iterate_hints() */
-
+#endif
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 9fc1acc..f7253a0 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -81,6 +81,7 @@ typedef enum H5P_plist_type_t {
H5P_TYPE_VOL_INITIALIZE = 19,
H5P_TYPE_MAP_CREATE = 20,
H5P_TYPE_MAP_ACCESS = 21,
+ H5P_TYPE_REFERENCE_ACCESS = 22,
H5P_TYPE_MAX_TYPE
} H5P_plist_type_t;
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 9f26b8b..bb33561 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -71,6 +71,7 @@
#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g)
#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g)
#define H5P_VOL_INITIALIZE (H5OPEN H5P_CLS_VOL_INITIALIZE_ID_g)
+#define H5P_REFERENCE_ACCESS (H5OPEN H5P_CLS_REFERENCE_ACCESS_ID_g)
/*
* The library's default property lists
@@ -93,6 +94,7 @@
#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g)
#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g)
#define H5P_VOL_INITIALIZE_DEFAULT (H5OPEN H5P_LST_VOL_INITIALIZE_ID_g)
+#define H5P_REFERENCE_ACCESS_DEFAULT (H5OPEN H5P_LST_REFERENCE_ACCESS_ID_g)
/* Common creation order flags (for links in groups and attributes on objects) */
#define H5P_CRT_ORDER_TRACKED 0x0001
@@ -204,6 +206,7 @@ H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g;
H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_CLS_VOL_INITIALIZE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_REFERENCE_ACCESS_ID_g;
/* Default roperty list IDs */
/* (Internal to library, do not use! Use macros above) */
@@ -225,6 +228,7 @@ H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g;
H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g;
H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_VOL_INITIALIZE_ID_g;
+H5_DLLVAR hid_t H5P_LST_REFERENCE_ACCESS_ID_g;
/*********************/
/* Public Prototypes */
diff --git a/src/H5R.c b/src/H5R.c
index 7d3686e..8b9c979 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -11,22 +11,24 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ * Purpose: Reference routines.
+ */
+
/****************/
/* Module Setup */
/****************/
#include "H5Rmodule.h" /* This source code file is part of the H5R module */
-
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Rpkg.h" /* References */
#include "H5Sprivate.h" /* Dataspaces */
@@ -61,330 +63,859 @@
/*******************/
-/*--------------------------------------------------------------------------
- NAME
- H5Rcreate
- PURPOSE
- Creates a particular kind of reference for the user
- USAGE
- herr_t H5Rcreate(ref, loc_id, name, ref_type, space_id)
- void *ref; OUT: Reference created
- hid_t loc_id; IN: Location ID used to locate object pointed to
- const char *name; IN: Name of object at location LOC_ID of object
- pointed to
- H5R_type_t ref_type; IN: Type of reference to create
- hid_t space_id; IN: Dataspace ID with selection, used for Dataset
- Region references.
-
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Creates a particular type of reference specified with REF_TYPE, in the
- space pointed to by REF. The LOC_ID and NAME are used to locate the object
- pointed to and the SPACE_ID is used to choose the region pointed to (for
- Dataset Region references).
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Rcreate_object
+ *
+ * Purpose: Creates an object reference. The LOC_ID and NAME are used
+ * to locate the object pointed to.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
-H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
+H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr)
{
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID;/* File ID */
+ H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
+ H5TRACE4("e", "i*si*Rr", loc_id, name, oapl_id, ref_ptr);
/* Check args */
- if (ref == NULL)
+ if(ref_ptr == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- 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)
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported")
- if(space_id == (-1) && ref_type == H5R_DATASET_REGION)
+ if(oapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get object access property list */
+ if(H5P_DEFAULT == oapl_id)
+ oapl_id = H5P_LINK_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get object type */
+ if((obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get the file for the object */
+ if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Retrieve VOL file object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get container info */
+ if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
+
+ /* Set 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 = oapl_id;
+ loc_params.obj_type = obj_type;
+
+ /* Get the object token */
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
+
+ /* Create the reference (do not pass filename, since file_id is attached) */
+ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE);
+ if(H5R__create_object((const H5O_token_t *)&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference")
+
+ /* Attach loc_id to reference and hold reference to it */
+ if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference")
+
+done:
+ if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file")
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rcreate_object() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rcreate_region
+ *
+ * Purpose: Creates a region reference. The LOC_ID and NAME are used to
+ * locate the object pointed to and the SPACE_ID is used to
+ * choose the region pointed to.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id,
+ hid_t oapl_id, H5R_ref_t *ref_ptr)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID;/* File ID */
+ H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ struct H5S_t *space = NULL; /* Pointer to dataspace containing region */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "i*sii*Rr", loc_id, name, space_id, oapl_id, ref_ptr);
+
+ /* Check args */
+ if(ref_ptr == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+ if((space_id == H5I_BADID) || (space_id == H5S_ALL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
+ if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(oapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get object access property list */
+ if(H5P_DEFAULT == oapl_id)
+ oapl_id = H5P_LINK_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get object type */
+ if((obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get the file for the object */
+ if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Retrieve VOL file object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get container info */
+ if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
+
+ /* Set 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 = oapl_id;
+ loc_params.obj_type = obj_type;
+
+ /* Get the object token */
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
+
+ /* Create the reference (do not pass filename, since file_id is attached) */
+ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE);
+ if(H5R__create_region((const H5O_token_t *)&obj_token, cont_info.token_size, space, (H5R_ref_priv_t *)ref_ptr) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference")
+
+ /* Attach loc_id to reference and hold reference to it */
+ if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference")
+
+done:
+ if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file")
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rcreate_region() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rcreate_attr
+ *
+ * Purpose: Creates an attribute reference. The LOC_ID, NAME and
+ * ATTR_NAME are used to locate the attribute pointed to.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name,
+ hid_t oapl_id, H5R_ref_t *ref_ptr)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID;/* File ID */
+ H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "i*s*si*Rr", loc_id, name, attr_name, oapl_id, ref_ptr);
+
+ /* Check args */
+ if(ref_ptr == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+ if(!attr_name || !*attr_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name given")
+ if(oapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get object access property list */
+ if(H5P_DEFAULT == oapl_id)
+ oapl_id = H5P_LINK_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get object type */
+ if((obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get the file for the object */
+ if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Retrieve VOL file object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_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_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Get container info */
+ if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+ 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 = oapl_id;
+ loc_params.obj_type = obj_type;
- /* 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")
+ /* Get the object token */
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
- /* 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 the reference (do not pass filename, since file_id is attached) */
+ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE);
+ if(H5R__create_attr((const H5O_token_t *)&obj_token, cont_info.token_size, attr_name, (H5R_ref_priv_t *)ref_ptr) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create attribute reference")
- /* Create reference */
- if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, (int)ref_type, space_id)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference")
+ /* Attach loc_id to reference and hold reference to it */
+ if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference")
done:
+ if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file")
FUNC_LEAVE_API(ret_value)
-} /* end H5Rcreate() */
+} /* end H5Rcreate_attr() */
-/*--------------------------------------------------------------------------
- NAME
- H5Rdereference2
- PURPOSE
- Opens the HDF5 object referenced.
- USAGE
- hid_t H5Rdereference2(ref)
- hid_t id; IN: Dataset reference object is in or location ID of
- object that the dataset is located within.
- hid_t oapl_id; IN: Property list of the object being referenced.
- H5R_type_t ref_type; IN: Type of reference to create
- void *ref; IN: Reference to open.
-
- RETURNS
- Valid ID on success, H5I_INVALID_HID on failure
- DESCRIPTION
- Given a reference to some object, open that object and return an ID for
- that object.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
- Raymond Lu
- 13 July 2011
- I added the OAPL_ID parameter for the object being referenced. It only
- supports dataset access property list currently.
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Rdestroy
+ *
+ * Purpose: Destroy reference and free resources allocated during
+ * H5Rcreate.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Rdestroy(H5R_ref_t *ref_ptr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "*Rr", ref_ptr);
+
+ /* Check args */
+ if(NULL == ref_ptr)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid reference pointer")
+
+ /* Destroy reference */
+ if(H5R__destroy((H5R_ref_priv_t *)ref_ptr) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "unable to destroy reference")
+
+ /* Memset back to 0 for safety */
+ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rdestroy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_type
+ *
+ * Purpose: Given a reference to some object, return the type of that
+ * reference.
+ *
+ * Return: Reference type / H5R_BADTYPE on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+H5R_type_t
+H5Rget_type(const H5R_ref_t *ref_ptr)
+{
+ H5R_type_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5R_BADTYPE)
+ H5TRACE1("Rt", "*Rr", ref_ptr);
+
+ /* Check args */
+ if(NULL == ref_ptr)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5R_BADTYPE, "invalid reference pointer")
+
+ /* Get reference type */
+ ret_value = H5R__get_type((const H5R_ref_priv_t *)ref_ptr);
+ if((ret_value <= H5R_BADTYPE) || (ret_value >= H5R_MAXTYPE))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_BADVALUE, H5R_BADTYPE, "invalid reference type")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rget_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Requal
+ *
+ * Purpose: Compare two references
+ *
+ * Return: TRUE if equal, FALSE if unequal, FAIL if error
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr)
+{
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("t", "*Rr*Rr", ref1_ptr, ref2_ptr);
+
+ /* Check args */
+ if(!ref1_ptr || !ref2_ptr)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+
+ /* Compare references */
+ if((ret_value = H5R__equal((const H5R_ref_priv_t *)ref2_ptr, (const H5R_ref_priv_t *)ref2_ptr)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare references")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Requal() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rcopy
+ *
+ * Purpose: Copy a reference
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "*Rr*Rr", src_ref_ptr, dst_ref_ptr);
+
+ /* Check args */
+ if(NULL == src_ref_ptr || NULL == dst_ref_ptr)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid reference pointer")
+
+ /* Copy reference */
+ if(H5R__copy((const H5R_ref_priv_t *)src_ref_ptr, (H5R_ref_priv_t *)dst_ref_ptr) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "cannot copy reference")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rcopy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Ropen_object
+ *
+ * Purpose: Given a reference to some object, open that object and
+ * return an ID for that object.
+ *
+ * Return: Valid ID on success / H5I_INVALID_HID on failure
+ *
+ *-------------------------------------------------------------------------
+ */
hid_t
-H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_ref)
+H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id)
{
- 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 */
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5I_type_t opened_type; /* Opened object type */
+ void *opened_obj = NULL; /* Opened object */
+ 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);
+ H5TRACE3("i", "*Rrii", ref_ptr, rapl_id, oapl_id);
/* Check args */
+ if(ref_ptr == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+ if(H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE
+ || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
+ if(rapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
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)
- 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")
+
+ /* Retrieve loc_id from reference */
+ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ /* Attempt to re-open file and pass rapl_id as a fapl_id */
+ if((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file")
+ }
+
+ /* Get object token */
+ if(H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token")
/* 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")
+ if(H5CX_set_apl(&oapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* 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")
+ 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_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);
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = H5I_get_type(loc_id);
- /* Dereference */
+ /* Open object by token */
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")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token")
+ /* Register 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() */
+} /* end H5Ropen_object() */
-/*--------------------------------------------------------------------------
- NAME
- H5Rget_region
- PURPOSE
- Retrieves a dataspace with the region pointed to selected.
- USAGE
- hid_t H5Rget_region(id, ref_type, ref)
- hid_t id; IN: Dataset reference object is in or location ID of
- object that the dataset is located within.
- H5R_type_t ref_type; IN: Type of reference to get region of
- void *ref; IN: Reference to open.
-
- RETURNS
- Valid ID on success, H5I_INVALID_HID on failure
- DESCRIPTION
- Given a reference to some object, creates a copy of the dataset pointed
- to's dataspace and defines a selection in the copy which is the region
- pointed to.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Ropen_region
+ *
+ * Purpose: Given a reference to some object, creates a copy of the dataset
+ * pointed to's dataspace and defines a selection in the copy
+ * which is the region pointed to.
+ *
+ * Return: Valid ID on success / H5I_INVALID_HID on failure
+ *
+ *-------------------------------------------------------------------------
+ */
hid_t
-H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
+H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id)
{
- 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 */
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5I_type_t opened_type; /* Opened object type */
+ void *opened_obj = NULL; /* Opened object */
+ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */
+ H5S_t *space = NULL; /* Dataspace pointer (copy) */
+ hid_t space_id = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE3("i", "iRt*x", id, ref_type, ref);
+ H5TRACE3("i", "*Rrii", ref_ptr, rapl_id, oapl_id);
/* Check args */
- if(ref_type != H5R_DATASET_REGION)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
- if(ref == NULL)
+ if(ref_ptr == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+ if((H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_DATASET_REGION1)
+ && (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_DATASET_REGION2))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
+ if(rapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+ if(oapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+
+ /* Retrieve loc_id from reference */
+ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ /* Attempt to re-open file and pass rapl_id as a fapl_id */
+ if((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file")
+ }
+
+ /* Get object token */
+ if(H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token")
+
+ /* Get the VOL 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(id);
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Open object by token */
+ 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 open object by token")
+
+ /* Register object */
+ if((opened_obj_id = H5VL_register(opened_type, opened_obj, vol_obj->connector, FALSE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+
+ /* Get VOL object object */
+ if(NULL == (opened_obj = H5VL_vol_object(opened_obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* 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 dataspace from object */
+ if(H5VL_dataset_get(opened_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &space_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace from dataset")
+ if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
/* Get the dataspace with the correct region selected */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, (int)ref_type, ref) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace")
+ if(H5R__get_region((const H5R_ref_priv_t *)ref_ptr, space) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get selection on dataspace")
+
+ /* Simply return space_id */
+ ret_value = space_id;
done:
+ if((opened_obj_id != H5I_INVALID_HID) && (H5I_dec_ref(opened_obj_id) < 0))
+ HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object")
+ if(H5I_INVALID_HID == ret_value) /* Cleanup on failure */
+ if((space_id != H5I_INVALID_HID) && (H5I_dec_ref(space_id) < 0))
+ HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close dataspace")
+
FUNC_LEAVE_API(ret_value)
-} /* end H5Rget_region() */
+} /* end H5Ropen_region() */
-/*--------------------------------------------------------------------------
- NAME
- H5Rget_obj_type2
- PURPOSE
- Retrieves the type of object that an object reference points to
- USAGE
- herr_t H5Rget_obj_type2(id, ref_type, ref, obj_type)
- hid_t id; IN: Dataset reference object is in or location ID of
- object that the dataset is located within.
- H5R_type_t ref_type; IN: Type of reference to query
- void *ref; IN: Reference to query.
- H5O_type_t *obj_type; OUT: Type of object reference points to
-
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Given a reference to some object, this function retrieves the type of
- object pointed to.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Ropen_attr
+ *
+ * Purpose: Given a reference to some attribute, open that attribute and
+ * return an ID for that attribute.
+ *
+ * Return: Valid ID on success / H5I_INVALID_HID on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id)
+{
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5I_type_t opened_type; /* Opened object type */
+ void *opened_obj = NULL; /* Opened object */
+ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */
+ void *opened_attr = NULL; /* Opened attribute */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE3("i", "*Rrii", ref_ptr, rapl_id, aapl_id);
+
+ /* Check args */
+ if(ref_ptr == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+ if(H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_ATTR)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
+ if(rapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+ if(aapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+
+ /* Retrieve loc_id from reference */
+ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ /* Attempt to re-open file and pass rapl_id as a fapl_id */
+ if((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file")
+ }
+
+ /* Get object token */
+ if(H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token")
+
+ /* Get the VOL 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_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Open object by token */
+ 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 open object by token")
+
+ /* Register object */
+ if((opened_obj_id = H5VL_register(opened_type, opened_obj, vol_obj->connector, FALSE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+
+ /* 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_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = opened_type;
+
+ /* Get VOL object object */
+ if(NULL == (opened_obj = H5VL_vol_object(opened_obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Open the attribute */
+ if(NULL == (opened_attr = H5VL_attr_open(opened_obj, &loc_params, H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr), aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr))
+
+ /* Register the attribute and get an ID for it */
+ if((ret_value = H5VL_register(H5I_ATTR, opened_attr, vol_obj->connector, TRUE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
+
+done:
+ if((opened_obj_id != H5I_INVALID_HID) && (H5I_dec_ref(opened_obj_id) < 0))
+ HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object")
+ if(H5I_INVALID_HID == ret_value) /* Cleanup on failure */
+ if(opened_attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ropen_attr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_obj_type3
+ *
+ * Purpose: Given a reference to some object, this function returns the
+ * type of object pointed to.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
-H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
- H5O_type_t *obj_type)
+H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type);
+ H5TRACE3("e", "*Rri*Ot", ref_ptr, rapl_id, obj_type);
/* Check args */
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if(ref == NULL)
+ if(ref_ptr == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ if(H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE
+ || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+ if(rapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- /* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(id);
+ /* Retrieve loc_id from reference */
+ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ /* Attempt to re-open file and pass rapl_id as a fapl_id */
+ if((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, FAIL, "cannot re-open referenced file")
+ }
+
+ /* Get object token */
+ if(H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get object token")
- /* 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 VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location 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, (int)ref_type, ref) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type")
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Retrieve object's type */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Rget_obj_type2() */
+} /* end H5Rget_obj_type3() */
-/*--------------------------------------------------------------------------
- NAME
- H5Rget_name
- PURPOSE
- Determines a name for the object referenced
- USAGE
- ssize_t H5Rget_name(loc_id, ref_type, ref, name, size)
- hid_t loc_id; IN: Dataset reference object is in or location ID of
- object that the dataset is located within.
- H5R_type_t ref_type; IN: Type of reference
- void *ref; IN: Reference to query.
- char *name; OUT: Buffer to place name of object referenced. If NULL
- then this call will return the size in bytes of name.
- size_t size; IN: Size of name buffer (user needs to include NULL terminator
- when passing in the size)
-
- RETURNS
- Non-negative length of the path on success, -1 on failure
- DESCRIPTION
- Given a reference to some object, determine a path to the object
- referenced in the file.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This may not be the only path to that object.
- EXAMPLES
- REVISION LOG
- M. Scot Breitenfeld
- 22 January 2014
- Changed the behavior for the returned value of the function when name is NULL.
- If name is NULL then size is ignored and the function returns the size
- of the name buffer (not including the NULL terminator), it still returns
- negative on failure.
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_file_name
+ *
+ * Purpose: Given a reference to some object, determine a file name of the
+ * object located into.
+ *
+ * Return: Non-negative length of the path on success / -1 on failure
+ *
+ *-------------------------------------------------------------------------
+ */
ssize_t
-H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name,
- size_t size)
+H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size)
{
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ hid_t loc_id; /* Reference location ID */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
- H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size);
+ H5TRACE3("Zs", "*Rr*sz", ref_ptr, buf, size);
/* Check args */
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if(ref_ptr == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer")
+ if(H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE
+ || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type")
- if(_ref == NULL)
+
+ /* Get name */
+ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ /* Un-opened external references do not have loc_id set but hold a
+ * copy of the filename */
+ if((ret_value = H5R__get_file_name((const H5R_ref_priv_t *)ref_ptr, buf, size)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to retrieve file name")
+ }
+ else {
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+
+ /* Retrieve VOL file object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5I_FILE, size, buf, &ret_value) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get file name")
+ }
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rget_file_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_obj_name
+ *
+ * Purpose: Given a reference to some object, determine a path to the
+ * object referenced in the file.
+ *
+ * Return: Non-negative length of the path on success / -1 on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size)
+{
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ ssize_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_API((-1))
+ H5TRACE4("Zs", "*Rri*sz", ref_ptr, rapl_id, buf, size);
+
+ /* Check args */
+ if(ref_ptr == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer")
+ if(H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE
+ || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type")
+ if(rapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a property list")
+
+ /* Retrieve loc_id from reference */
+ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ /* Attempt to re-open file and pass rapl_id as a fapl_id */
+ if((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, (-1), "cannot re-open referenced file")
+ }
+
+ /* Get object token */
+ if(H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get object token")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(id);
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = H5I_get_type(loc_id);
- /* Get the file object */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+ /* Retrieve object's name */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, buf, size) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name")
- /* Get name */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, (int)ref_type, _ref) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path")
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rget_obj_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_attr_name
+ *
+ * Purpose: Given a reference to some attribute, determine its name.
+ *
+ * Return: Non-negative length of the path on success / -1 on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size)
+{
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_API((-1))
+ H5TRACE3("Zs", "*Rr*sz", ref_ptr, buf, size);
+
+ /* Check args */
+ if(ref_ptr == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer")
+ if(H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_ATTR)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type")
+
+ /* Get attribute name */
+ if((ret_value = H5R__get_attr_name((const H5R_ref_priv_t *)ref_ptr, buf, size)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine attribute name")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Rget_name() */
+} /* end H5Rget_attr_name() */
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index ab8d3b4..4e44683 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -37,14 +37,15 @@
#include "H5Ppublic.h" /* Property lists */
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
-#include "H5Oprivate.h" /* Object headers */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Rpkg.h" /* References */
+#include "H5Sprivate.h" /* Dataspaces */
/****************/
@@ -81,21 +82,14 @@
/* Local Variables */
/*******************/
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: H5Rget_obj_type1
*
- * Purpose: Retrieves the type of the object that an object points to.
+ * Purpose: Retrieves the type of the object that a reference points to.
*
- * Parameters:
- * id IN: Dataset reference object is in or location ID of
- * object that the dataset is located within
- * ref_type IN: Type of reference to query
- * ref IN: Reference to query
- *
- * Return: Success: An object type (as defined in H5Gpublic.h)
+ * Return: Success: Object type (as defined in H5Gpublic.h)
* Failure: H5G_UNKNOWN
*
*-------------------------------------------------------------------------
@@ -103,31 +97,43 @@
H5G_obj_t
H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
{
- 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 */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5O_type_t obj_type; /* Object type */
+ const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE3("Go", "iRt*x", id, ref_type, ref);
/* Check args */
- if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type")
- if (ref == NULL)
+ if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer")
+ if(ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type")
- /* 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 location identifier")
- /* Get the vol object */
- if (NULL == (vol_obj = H5VL_vol_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier")
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
- /* Get the object information */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, (int)ref_type, ref) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type")
+ /* Get object token */
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5G_UNKNOWN, "unable to get object token")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = vol_obj_type;
+
+ /* Retrieve object's type */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type")
/* Set return value */
ret_value = H5G_map_obj_type(obj_type);
@@ -140,54 +146,59 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Rdereference1
*
- * Purpose: Opens the HDF5 object referenced.
- *
- * Parameters:
- * id IN: Dataset reference object is in or location ID of
- * object that the dataset is located within
- * ref_type IN: Type of reference to create
- * ref IN: Reference to open
+ * Purpose: Given a reference to some object, open that object and return
+ * an ID for that object.
*
- * Return: Success: Valid HDF5 ID
+ * Return: Success: Valid ID
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
-H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
+H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref)
{
- 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 */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5I_type_t opened_type; /* Opened object type */
+ void *opened_obj = NULL; /* Opened object */
+ const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref);
+ H5TRACE3("i", "iRt*x", obj_id, ref_type, ref);
/* Check args */
- 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(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+ if(ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
/* 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")
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location 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);
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(obj_id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Get object token */
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = vol_obj_type;
/* 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")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token")
- /* Get an atom for the object */
+ /* Register 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")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -195,3 +206,390 @@ done:
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rcreate
+ *
+ * Purpose: Creates a particular type of reference specified with REF_TYPE,
+ * in the space pointed to by REF. The LOC_ID and NAME are used to
+ * locate the object pointed to and the SPACE_ID is used to choose
+ * the region pointed to (for Dataset Region references).
+ *
+ * Return: Non-negative on success / negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type,
+ hid_t space_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
+ void *vol_obj_file = NULL;
+ unsigned char *buf = (unsigned char *)ref; /* Return reference pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
+
+ /* Check args */
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+ if(ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+
+ /* 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")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(vol_obj, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ 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 = name;
+ loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = vol_obj_type;
+
+ /* Get the object token */
+ if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
+
+ /* Get the file for the object */
+ if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Retrieve VOL object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get container info */
+ if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
+
+ /* Create reference */
+ if(ref_type == H5R_OBJECT1) {
+ size_t buf_size = H5R_OBJ_REF_BUF_SIZE;
+
+ if((ret_value = H5R__encode_token_obj_compat((const H5O_token_t *)&obj_token, cont_info.token_size, buf, &buf_size)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode object reference")
+ } /* end if */
+ else {
+ H5F_t *f = NULL;
+ H5S_t *space = NULL; /* Pointer to dataspace containing region */
+ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE;
+
+ /* Retrieve space */
+ if(space_id == H5I_BADID)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
+ if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Encode dataset region */
+ if((ret_value = H5R__encode_token_region_compat(f, (const H5O_token_t *)&obj_token, cont_info.token_size, space, buf, &buf_size)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode region reference")
+ } /* end else */
+
+done:
+ if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file")
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rcreate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_obj_type2
+ *
+ * Purpose: Given a reference to some object, this function returns the
+ * type of object pointed to.
+ *
+ * Return: Non-negative on success / negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
+ H5O_type_t *obj_type)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type);
+
+ /* Check args */
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ if(ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get object token */
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = vol_obj_type;
+
+ /* Retrieve object's type */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rget_obj_type2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rdereference2
+ *
+ * Purpose: Given a reference to some object, open that object and return
+ * an ID for that object.
+ *
+ * Return: Success: Valid ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type,
+ const void *ref)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5I_type_t opened_type; /* Opened object type */
+ void *opened_obj = NULL; /* Opened object */
+ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
+ 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(oapl_id < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+ if(ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
+
+ /* 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, H5I_INVALID_HID, "can't set access property list info")
+
+ /* 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")
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(obj_id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Get object token */
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = vol_obj_type;
+
+ /* Open object by token */
+ 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 open object by token")
+
+ /* Register 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() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_region
+ *
+ * Purpose: Given a reference to some object, creates a copy of the dataset
+ * pointed to's dataspace and defines a selection in the copy
+ * which is the region pointed to.
+ *
+ * Return: Success: Valid ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ void *vol_obj_file = NULL; /* VOL file */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5F_t *f = NULL; /* Native file */
+ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; /* Reference buffer size */
+ H5S_t *space = NULL; /* Dataspace object */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
+ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE3("i", "iRt*x", id, ref_type, ref);
+
+ /* Check args */
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+ if(ref_type != H5R_DATASET_REGION1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(vol_obj, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Get the file for the object */
+ if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object")
+
+ /* Retrieve VOL object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Get container info */
+ if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get container info")
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object")
+
+ /* Get the dataspace with the correct region selected */
+ if(H5R__decode_token_region_compat(f, buf, &buf_size, NULL, cont_info.token_size, &space) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
+
+ /* Atomize */
+ if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
+
+done:
+ if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file")
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rget_region1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_name
+ *
+ * Purpose: Given a reference to some object, determine a path to the
+ * object referenced in the file.
+ *
+ * Return: Success: Non-negative length of the path
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name,
+ size_t size)
+{
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
+ ssize_t ret_value = -1; /* Return value */
+
+ FUNC_ENTER_API((-1))
+ H5TRACE5("Zs", "iRt*x*sz", id, ref_type, ref, name, size);
+
+ /* Check args */
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer")
+ if(ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type")
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(id)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+
+ /* Get object token */
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, (-1), "unable to get object token")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &obj_token;
+ loc_params.obj_type = vol_obj_type;
+
+ /* Retrieve object's name */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Rget_name() */
+
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 07efae2..1df8a20 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -35,11 +35,95 @@
#include "H5Sprivate.h" /* Dataspaces */
#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
/* Local Macros */
/****************/
+#define H5R_MAX_STRING_LEN (1 << 16) /* Max encoded string length */
+
+/* Encode macro */
+#define H5R_ENCODE(func, val, buf, buf_size, actual, m) do {\
+ size_t __nalloc = buf_size; \
+ if(func(val, buf, &__nalloc) < 0) \
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, m) \
+ if(buf && buf_size >= __nalloc) { \
+ buf += __nalloc; \
+ buf_size -= __nalloc; \
+ } \
+ actual += __nalloc; \
+} while(0)
+
+#define H5R_ENCODE_VAR(func, var, size, buf, buf_size, actual, m) do { \
+ size_t __nalloc = buf_size; \
+ if(func(var, size, buf, &__nalloc) < 0) \
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, m) \
+ if(buf && buf_size >= __nalloc) { \
+ p += __nalloc; \
+ buf_size -= __nalloc; \
+ } \
+ actual += __nalloc; \
+} while(0)
+
+/* Decode macro */
+#define H5R_DECODE(func, val, buf, buf_size, actual, m) do {\
+ size_t __nbytes = buf_size; \
+ if(func(buf, &__nbytes, val) < 0) \
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, m) \
+ buf += __nbytes; \
+ buf_size -= __nbytes; \
+ actual += __nbytes; \
+} while(0)
+
+#define H5R_DECODE_VAR(func, var, size, buf, buf_size, actual, m) do { \
+ size_t __nbytes = buf_size; \
+ if(func(buf, &__nbytes, var, size) < 0) \
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, m) \
+ p += __nbytes; \
+ buf_size -= __nbytes; \
+ actual += __nbytes; \
+} while(0)
+
+/* Debug */
+//#define H5R_DEBUG
+#ifdef H5R_DEBUG
+#define H5R_LOG_DEBUG(...) do { \
+ HDfprintf(stdout, " # %s(): ", __func__); \
+ HDfprintf(stdout, __VA_ARGS__); \
+ HDfprintf(stdout, "\n"); \
+ HDfflush(stdout); \
+ } while (0)
+static const char *
+H5R__print_token(const H5O_token_t token) {
+ static char string[64];
+
+ /* Print the raw token. */
+ HDsnprintf(string, 64, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+ (unsigned char)token.__data[15],
+ (unsigned char)token.__data[14],
+ (unsigned char)token.__data[13],
+ (unsigned char)token.__data[12],
+ (unsigned char)token.__data[11],
+ (unsigned char)token.__data[10],
+ (unsigned char)token.__data[9],
+ (unsigned char)token.__data[8],
+ (unsigned char)token.__data[7],
+ (unsigned char)token.__data[6],
+ (unsigned char)token.__data[5],
+ (unsigned char)token.__data[4],
+ (unsigned char)token.__data[3],
+ (unsigned char)token.__data[2],
+ (unsigned char)token.__data[1],
+ (unsigned char)token.__data[0]
+ );
+
+ return string;
+}
+#else
+#define H5R_LOG_DEBUG(...) do { } while (0)
+#endif
+
/******************/
/* Local Typedefs */
/******************/
@@ -48,6 +132,13 @@
/* Local Prototypes */
/********************/
+static herr_t H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc);
+static herr_t H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, uint8_t *token_size);
+static herr_t H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc);
+static herr_t H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr);
+static herr_t H5R__encode_string(const char *string, unsigned char *buf, size_t *nalloc);
+static herr_t H5R__decode_string(const unsigned char *buf, size_t *nbytes, char **string_ptr);
+
/*********************/
/* Package Variables */
/*********************/
@@ -66,7 +157,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5R_top_package_initialize_s = FALSE;
-
+
/*--------------------------------------------------------------------------
NAME
H5R__init_package -- Initialize interface-specific information
@@ -82,17 +173,18 @@ DESCRIPTION
herr_t
H5R__init_package(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
-
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Mark "top" of interface as initialized */
H5R_top_package_initialize_s = TRUE;
- FUNC_LEAVE_NOAPI(ret_value)
+ /* Sanity check, if assert fails, H5R_REF_BUF_SIZE must be increased */
+ HDcompile_assert(sizeof(H5R_ref_priv_t) <= H5R_REF_BUF_SIZE);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5R__init_package() */
-
+
/*--------------------------------------------------------------------------
NAME
H5R_top_term_package
@@ -114,7 +206,7 @@ H5R__init_package(void)
int
H5R_top_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -126,7 +218,7 @@ H5R_top_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5R_top_term_package() */
-
+
/*--------------------------------------------------------------------------
NAME
H5R_term_package
@@ -150,7 +242,7 @@ H5R_top_term_package(void)
int
H5R_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -166,572 +258,1560 @@ H5R_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5R_term_package() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5R__create
- PURPOSE
- Creates a particular kind of reference for the user
- USAGE
- herr_t H5R__create(ref, loc, name, ref_type, space)
- void *ref; OUT: Reference created
- H5G_loc_t *loc; IN: File location used to locate object pointed to
- const char *name; IN: Name of object at location LOC_ID of object
- pointed to
- H5R_type_t ref_type; IN: Type of reference to create
- H5S_t *space; IN: Dataspace ID with selection, used for Dataset
- Region references.
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Creates a particular type of reference specified with REF_TYPE, in the
- space pointed to by REF. The LOC_ID and NAME are used to locate the object
- pointed to and the SPACE_ID is used to choose the region pointed to (for
- Dataset Region references).
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5R__create_object
+ *
+ * Purpose: Creates an object reference
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__create_object(const H5O_token_t *obj_token, size_t token_size,
+ H5R_ref_priv_t *ref)
+{
+ size_t encode_size;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(ref);
+
+ /* Create new reference */
+ ref->info.obj.filename = NULL;
+ ref->loc_id = H5I_INVALID_HID;
+ ref->type = (uint8_t)H5R_OBJECT2;
+ if(H5R__set_obj_token(ref, obj_token, token_size) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token")
+
+ /* Cache encoding size (assume no external reference) */
+ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size")
+ ref->encode_size = (uint32_t)encode_size;
+
+ H5R_LOG_DEBUG("Created object reference, %d, filename=%s, obj_addr=%s, encode size=%u",
+ (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token),
+ ref->encode_size);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__create_object() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__create_region
+ *
+ * Purpose: Creates a region reference
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
-H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space)
+H5R__create_region(const H5O_token_t *obj_token, size_t token_size,
+ H5S_t *space, H5R_ref_priv_t *ref)
{
- H5G_loc_t obj_loc; /* Group hier. location of object */
- H5G_name_t path; /* Object group hier. path */
- H5O_loc_t oloc; /* Object object location */
- hbool_t obj_found = FALSE; /* Object location found */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t encode_size;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- HDassert(_ref);
- HDassert(loc);
- HDassert(name);
- HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
+ HDassert(space);
+ HDassert(ref);
+
+ /* Create new reference */
+ ref->info.obj.filename = NULL;
+ if(NULL == (ref->info.reg.space = H5S_copy(space, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace")
+
+ ref->loc_id = H5I_INVALID_HID;
+ ref->type = (uint8_t)H5R_DATASET_REGION2;
+ if(H5R__set_obj_token(ref, obj_token, token_size) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token")
- /* Set up object location to fill in */
- obj_loc.oloc = &oloc;
- obj_loc.path = &path;
- H5G_loc_reset(&obj_loc);
+ /* Cache encoding size (assume no external reference) */
+ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size")
+ ref->encode_size = (uint32_t)encode_size;
- /* Set the FAPL for the API context */
- H5CX_set_libver_bounds(loc->oloc->file);
+ H5R_LOG_DEBUG("Created region reference, %d, filename=%s, obj_addr=%s, encode size=%u",
+ (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token),
+ ref->encode_size);
- /* Find the object */
- if(H5G_loc_find(loc, name, &obj_loc) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found")
- obj_found = TRUE;
+done:
+ if(ret_value < 0)
+ if(ref->info.reg.space) {
+ H5S_close(ref->info.reg.space);
+ ref->info.reg.space = NULL;
+ } /* end if */
- switch (ref_type) {
- case H5R_OBJECT:
- {
- hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5R__create_region */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__create_attr
+ *
+ * Purpose: Creates an attribute reference
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__create_attr(const H5O_token_t *obj_token, size_t token_size,
+ const char *attr_name, H5R_ref_priv_t *ref)
+{
+ size_t encode_size;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(attr_name);
+ HDassert(ref);
+
+ /* Make sure that attribute name is not longer than supported encode size */
+ if(HDstrlen(attr_name) > H5R_MAX_STRING_LEN)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN)
+
+ /* Create new reference */
+ ref->info.obj.filename = NULL;
+ if(NULL == (ref->info.attr.name = HDstrdup(attr_name)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name")
+
+ ref->loc_id = H5I_INVALID_HID;
+ ref->type = (uint8_t)H5R_ATTR;
+ if(H5R__set_obj_token(ref, obj_token, token_size) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token")
+
+ /* Cache encoding size (assume no external reference) */
+ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size")
+ ref->encode_size = (uint32_t)encode_size;
+
+ H5R_LOG_DEBUG("Created attribute reference, %d, filename=%s, obj_addr=%s, attr name=%s, encode size=%u",
+ (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token),
+ ref->info.attr.name, ref->encode_size);
+
+done:
+ if(ret_value < 0) {
+ H5MM_xfree(ref->info.attr.name);
+ ref->info.attr.name = NULL;
+ } /* end if */
- *ref = obj_loc.oloc->addr;
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5R__create_attr */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__destroy
+ *
+ * Purpose: Destroy a reference
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__destroy(H5R_ref_priv_t *ref)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(ref != NULL);
+
+ H5MM_xfree(ref->info.obj.filename);
+ ref->info.obj.filename = NULL;
+
+ switch(ref->type) {
+ case H5R_OBJECT2:
break;
- }
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
- hssize_t buf_size; /* Size of buffer needed to serialize selection */
- uint8_t *p; /* Pointer to OID to store */
- uint8_t *buf; /* Buffer to store serialized selection in */
- unsigned heapid_found; /* Flag for non-zero heap ID found */
- unsigned u; /* local index */
-
- /* Set up information for dataset region */
-
- /* Return any previous heap block to the free list if we are
- * garbage collecting
- */
- if (H5F_GC_REF(loc->oloc->file)) {
- /* Check for an existing heap ID in the reference */
- for (u = 0, heapid_found = 0, p = (uint8_t *)ref; u < H5R_DSET_REG_REF_BUF_SIZE; u++)
- if (p[u] != 0) {
- heapid_found = 1;
- break;
- }
-
- if (heapid_found != 0) {
- /* Return heap block to free list */
- }
- }
-
- /* Zero the heap ID out, may leak heap space if user is re-using
- * reference and doesn't have garbage collection turned on
- */
- HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE);
-
- /* Get the amount of space required to serialize the selection */
- if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection")
-
- /* Increase buffer size to allow for the dataset OID */
- buf_size += (hssize_t)sizeof(haddr_t);
-
- /* Allocate the space to store the serialized information */
- H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t);
- if (NULL == (buf = (uint8_t *)H5MM_malloc((size_t)buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Serialize information for dataset OID into heap buffer */
- p = (uint8_t *)buf;
- H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr);
-
- /* Serialize the selection into heap buffer */
- if (H5S_SELECT_SERIALIZE(space, &p) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection")
-
- /* Save the serialized buffer for later */
- H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t);
- if(H5HG_insert(loc->oloc->file, (size_t)buf_size, buf, &hobjid) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection")
-
- /* Serialize the heap ID and index for storage in the file */
- p = (uint8_t *)ref;
- H5F_addr_encode(loc->oloc->file, &p, hobjid.addr);
- UINT32ENCODE(p, hobjid.idx);
-
- /* Free the buffer we serialized data in */
- H5MM_xfree(buf);
+ case H5R_DATASET_REGION2:
+ if(H5S_close(ref->info.reg.space) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace")
+ ref->info.reg.space = NULL;
break;
- } /* end case H5R_DATASET_REGION */
+ case H5R_ATTR:
+ H5MM_xfree(ref->info.attr.name);
+ ref->info.attr.name = NULL;
+ break;
+
+ case H5R_OBJECT1:
+ case H5R_DATASET_REGION1:
+ break;
case H5R_BADTYPE:
case H5R_MAXTYPE:
+ HDassert("invalid reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)")
+
default:
HDassert("unknown reference type" && 0);
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
} /* end switch */
-done:
- if (obj_found)
- H5G_loc_free(&obj_loc);
+ /* Decrement refcount of attached loc_id */
+ if(ref->type && (ref->loc_id != H5I_INVALID_HID)) {
+ if(ref->app_ref) {
+ if(H5I_dec_app_ref(ref->loc_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed")
+ } else {
+ if(H5I_dec_ref(ref->loc_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed")
+ }
+ }
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R__create() */
+} /* end H5R__destroy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__set_loc_id
+ *
+ * Purpose: Attach location ID to reference and increment location refcount.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
-
-/*--------------------------------------------------------------------------
- NAME
- H5R__dereference
- PURPOSE
- Opens the HDF5 object referenced.
- USAGE
- hid_t H5R__dereference(ref, oapl_id, ref_type, ref)
- H5F_t *file; IN: File the object being dereferenced is within
- hid_t oapl_id; IN: Object access property list ID
- H5R_type_t ref_type; IN: Type of reference
- void *ref; IN: Reference to open.
+ FUNC_ENTER_PACKAGE
- RETURNS
- Valid ID on success, Negative on failure
- DESCRIPTION
- Given a reference to some object, open that object and return an ID for
- that object.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- Currently only set up to work with references to datasets
- EXAMPLES
- REVISION LOG
- Raymond Lu
- 13 July 2011
- I added the OAPL_ID parameter for the object being referenced. It only
- supports dataset access property list currently.
-
- M. Scot Breitenfeld
- 3 March 2015
- Added a check for undefined reference pointer.
---------------------------------------------------------------------------*/
+ HDassert(ref != NULL);
+ HDassert(id != H5I_INVALID_HID);
+
+ /* If a location ID was previously assigned, decrement refcount and
+ * assign new one */
+ if((ref->loc_id != H5I_INVALID_HID)) {
+ if(ref->app_ref) {
+ if(H5I_dec_app_ref(ref->loc_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed")
+ } else {
+ if(H5I_dec_ref(ref->loc_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed")
+ }
+ }
+ ref->loc_id = id;
+
+ /* Prevent location ID from being freed until reference is destroyed,
+ * set app_ref if necessary as references are exposed to users and are
+ * expected to be destroyed, this allows the loc_id to be cleanly released
+ * on shutdown if users fail to call H5Rdestroy(). */
+ if(inc_ref && H5I_inc_ref(ref->loc_id, app_ref) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed")
+ ref->app_ref = app_ref;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__set_loc_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__get_loc_id
+ *
+ * Purpose: Retrieve location ID attached to existing reference.
+ *
+ * Return: Valid ID on success / H5I_INVALID_HID on failure
+ *
+ *-------------------------------------------------------------------------
+ */
hid_t
-H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_ref)
+H5R__get_loc_id(const H5R_ref_priv_t *ref)
{
- H5O_loc_t oloc; /* Object location */
- H5G_name_t path; /* Path of object */
- H5G_loc_t loc; /* Group location */
- unsigned rc; /* Reference count of object */
- H5O_type_t obj_type; /* Type of object */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ FUNC_ENTER_PACKAGE_NOERR
+
+ HDassert(ref != NULL);
+
+ ret_value = ref->loc_id;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__get_loc_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__reopen_file
+ *
+ * Purpose: Re-open referenced file using file access property list.
+ *
+ * Return: Valid ID on success / H5I_INVALID_HID on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id)
+{
+ H5P_genplist_t *plist; /* Property list for FAPL */
+ void *new_file = NULL; /* File object opened */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_object_t *vol_obj = NULL; /* VOL object for file */
+ hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */
+ hid_t ret_value = H5I_INVALID_HID;
+
FUNC_ENTER_PACKAGE
- HDassert(_ref);
- HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
- HDassert(file);
+ /* TODO add search path */
- /* Initialize the object location */
- H5O_loc_reset(&oloc);
- oloc.file = file;
+ /* 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_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- switch (ref_type) {
- case H5R_OBJECT:
- {
- oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
- if (!H5F_addr_defined(oloc.addr) || oloc.addr == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "Undefined reference pointer")
- break;
- }
+ /* 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_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+
+ /* Stash a copy of the "top-level" connector property, before any pass-through
+ * connectors modify or unwrap it.
+ */
+ if(H5CX_set_vol_connector_prop(&connector_prop) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
+
+ /* Open the file */
+ /* (Must open file read-write to allow for object modifications) */
+ if(NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file")
+
+ /* 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_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+
+ /* Get the file object */
+ if(NULL == (vol_obj = H5VL_vol_object(ret_value)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier")
+
+ /* Make the 'post open' callback */
+ supported = FALSE;
+ if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation")
+ if(supported)
+ if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback")
+
+ /* Attach loc_id to reference */
+ if(H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference")
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- uint8_t *buf; /* Buffer to store serialized selection in */
- const uint8_t *p; /* Pointer to OID to store */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__reopen_file() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__get_type
+ *
+ * Purpose: Given a reference to some object, return the type of that
+ * reference.
+ *
+ * Return: Type of the reference
+ *
+ *-------------------------------------------------------------------------
+ */
+H5R_type_t
+H5R__get_type(const H5R_ref_priv_t *ref)
+{
+ H5R_type_t ret_value = H5R_BADTYPE;
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
+ FUNC_ENTER_PACKAGE_NOERR
- if (!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "Undefined reference pointer")
+ HDassert(ref != NULL);
+ ret_value = (H5R_type_t)ref->type;
- /* Get the dataset region from the heap (allocate inside routine) */
- if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)))
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, H5I_INVALID_HID, "Unable to read dataset region information")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__get_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__equal
+ *
+ * Purpose: Compare two references
+ *
+ * Return: TRUE if equal, FALSE if unequal, FAIL if error
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2)
+{
+ htri_t ret_value = TRUE;
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+ FUNC_ENTER_PACKAGE
- /* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
+ HDassert(ref1 != NULL);
+ HDassert(ref2 != NULL);
+
+ /* Compare reference types */
+ if(ref1->type != ref2->type)
+ HGOTO_DONE(FALSE);
+
+ /* Compare object addresses */
+ if(ref1->token_size != ref2->token_size)
+ HGOTO_DONE(FALSE);
+ if(0 != HDmemcmp(&ref1->info.obj.token, &ref2->info.obj.token, ref1->token_size))
+ HGOTO_DONE(FALSE);
+
+ /* Compare filenames */
+ if((ref1->info.obj.filename && (NULL == ref2->info.obj.filename))
+ || ((NULL == ref1->info.obj.filename) && ref2->info.obj.filename))
+ HGOTO_DONE(FALSE);
+ if(ref1->info.obj.filename && ref1->info.obj.filename
+ && (0 != HDstrcmp(ref1->info.obj.filename, ref2->info.obj.filename)))
+ HGOTO_DONE(FALSE);
+
+ switch(ref1->type) {
+ case H5R_OBJECT2:
break;
- } /* end case H5R_DATASET_REGION */
-
+ case H5R_DATASET_REGION2:
+ if((ret_value = H5S_extent_equal(ref1->info.reg.space, ref2->info.reg.space)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare dataspace extents")
+ break;
+ case H5R_ATTR:
+ HDassert(ref1->info.attr.name && ref2->info.attr.name);
+ if(0 != HDstrcmp(ref1->info.attr.name, ref2->info.attr.name))
+ HGOTO_DONE(FALSE);
+ break;
+ case H5R_OBJECT1:
+ case H5R_DATASET_REGION1:
case H5R_BADTYPE:
case H5R_MAXTYPE:
+ HDassert("invalid reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)")
default:
HDassert("unknown reference type" && 0);
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, H5I_INVALID_HID, "internal error (unknown reference type)")
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
} /* end switch */
- /* Get the # of links for object, and its type
- * (To check to make certain that this object hasn't been deleted
- * since the reference was created)
- */
- if(H5O_get_rc_and_type(&oloc, &rc, &obj_type) < 0 || 0 == rc)
- HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, H5I_INVALID_HID, "dereferencing deleted object")
-
- /* Construct a group location for opening the object */
- H5G_name_reset(&path);
- loc.oloc = &oloc;
- loc.path = &path;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__equal() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__copy
+ *
+ * Purpose: Copy a reference
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref)
+{
+ herr_t ret_value = SUCCEED;
- /* Open the object */
- switch (obj_type) {
- case H5O_TYPE_GROUP:
- {
- H5G_t *group; /* Pointer to group to open */
+ FUNC_ENTER_PACKAGE
- if(NULL == (group = H5G_open(&loc)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5I_INVALID_HID, "not found")
+ HDassert((src_ref != NULL) && (dst_ref != NULL));
- /* Create an atom for the group */
- 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")
- }
+ H5MM_memcpy(&dst_ref->info.obj.token, &src_ref->info.obj.token, sizeof(H5O_token_t));
+ dst_ref->encode_size = src_ref->encode_size;
+ dst_ref->type = src_ref->type;
+ dst_ref->token_size = src_ref->token_size;
+ switch(src_ref->type) {
+ case H5R_OBJECT2:
break;
- }
-
- case H5O_TYPE_NAMED_DATATYPE:
- {
- H5T_t *type; /* Pointer to datatype to open */
-
- if(NULL == (type = H5T_open(&loc)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, H5I_INVALID_HID, "not found")
-
- /* Create an atom for the datatype */
- 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")
- }
-
+ case H5R_DATASET_REGION2:
+ if(NULL == (dst_ref->info.reg.space = H5S_copy(src_ref->info.reg.space, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace")
break;
- }
+ case H5R_ATTR:
+ if(NULL == (dst_ref->info.attr.name = HDstrdup(src_ref->info.attr.name)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name")
+ break;
+ case H5R_OBJECT1:
+ case H5R_DATASET_REGION1:
+ HDassert("invalid reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)")
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ HDassert("unknown reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ } /* end switch */
- case H5O_TYPE_DATASET:
- {
- H5D_t *dset; /* Pointer to dataset to open */
+ /* We only need to keep a copy of the filename if we don't have the loc_id */
+ if(src_ref->loc_id == H5I_INVALID_HID) {
+ HDassert(src_ref->info.obj.filename);
- /* Open the dataset */
- if(NULL == (dset = H5D_open(&loc, oapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, H5I_INVALID_HID, "not found")
+ if(NULL == (dst_ref->info.obj.filename = HDstrdup(src_ref->info.obj.filename)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy filename")
+ dst_ref->loc_id = H5I_INVALID_HID;
+ }
+ else {
+ dst_ref->info.obj.filename = NULL;
- /* Create an atom for the dataset */
- 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")
- }
+ /* Set location ID and hold reference to it */
+ if(H5R__set_loc_id(dst_ref, src_ref->loc_id, TRUE, TRUE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "cannot set reference location ID")
+ }
- break;
- }
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__get_obj_token
+ *
+ * Purpose: Given a reference to some object, get the encoded token.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token,
+ size_t *token_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
- case H5O_TYPE_MAP:
- HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, H5I_INVALID_HID, "maps not supported in native VOL connector")
+ HDassert(ref != NULL);
+ HDassert(ref->token_size <= H5O_MAX_TOKEN_SIZE);
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, H5I_INVALID_HID, "can't identify type of object referenced")
- } /* end switch */
+ if(obj_token) {
+ if(0 == ref->token_size)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size")
+ H5MM_memcpy(obj_token, &ref->info.obj.token, sizeof(H5O_token_t));
+ }
+ if(token_size)
+ *token_size = ref->token_size;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R__dereference() */
+} /* end H5R__get_obj_token() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__set_obj_token
+ *
+ * Purpose: Given a reference to some object, set the encoded token.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token,
+ size_t token_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
-
-/*--------------------------------------------------------------------------
- NAME
- H5R__get_region
- PURPOSE
- Retrieves a dataspace with the region pointed to selected.
- USAGE
- H5S_t *H5R__get_region(file, ref)
- H5F_t *file; IN: File the object being dereferenced is within
- void *ref; IN: Reference to open.
+ FUNC_ENTER_PACKAGE_NOERR
- RETURNS
- Pointer to the dataspace on success, NULL on failure
- DESCRIPTION
- Given a reference to some object, creates a copy of the dataset pointed
- to's dataspace and defines a selection in the copy which is the region
- pointed to.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5S_t *
-H5R__get_region(H5F_t *file, const void *_ref)
+ HDassert(ref != NULL);
+ HDassert(obj_token);
+ HDassert(token_size);
+ HDassert(token_size <= H5O_MAX_TOKEN_SIZE);
+
+ H5MM_memcpy(&ref->info.obj.token, obj_token, sizeof(H5O_token_t));
+ HDassert(token_size <= 255);
+ ref->token_size = (uint8_t)token_size;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__set_obj_token() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__get_region
+ *
+ * Purpose: Given a reference to some object, creates a copy of the
+ * dataset pointed to's dataspace and defines a selection in
+ * the copy which is the region pointed to.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space)
{
- H5O_loc_t oloc; /* Object location */
- 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 */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- HDassert(_ref);
- HDassert(file);
+ HDassert(ref != NULL);
+ HDassert(ref->type == H5R_DATASET_REGION2);
+ HDassert(space);
- /* Initialize the object location */
- H5O_loc_reset(&oloc);
- oloc.file = file;
+ /* Copy reference selection to destination */
+ if(H5S_select_copy(space, ref->info.reg.space, FALSE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy selection")
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__get_region() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__get_file_name
+ *
+ * Purpose: Given a reference to some object, determine a file name of
+ * the object located into.
+ *
+ * Return: Non-negative length of the path on success / -1 on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size)
+{
+ size_t copy_len;
+ ssize_t ret_value = -1; /* Return value */
- /* Get the dataset region from the heap (allocate inside routine) */
- if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)))
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information")
+ FUNC_ENTER_PACKAGE
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+ /* Check args */
+ HDassert(ref != NULL);
- /* Open and copy the dataset's dataspace */
- if(NULL == (ret_value = H5S_read(&oloc)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found")
+ /* Return if that reference has no filename set */
+ if(!ref->info.obj.filename)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, (-1), "no filename available for that reference")
- /* Unserialize the selection */
- if(H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection")
+ /* Get the file name length */
+ copy_len = HDstrlen(ref->info.obj.filename);
+ HDassert(copy_len <= H5R_MAX_STRING_LEN);
-done:
- /* Free the buffer allocated in H5HG_read() */
- if(buf)
- H5MM_xfree(buf);
+ /* Copy the file name */
+ if(buf) {
+ copy_len = MIN(copy_len, size - 1);
+ H5MM_memcpy(buf, ref->info.obj.filename, copy_len);
+ buf[copy_len] = '\0';
+ }
+ ret_value = (ssize_t)(copy_len + 1);
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R__get_region() */
+} /* end H5R__get_file_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__get_attr_name
+ *
+ * Purpose: Given a reference to some attribute, determine its name.
+ *
+ * Return: Non-negative length of the path on success / -1 on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size)
+{
+ ssize_t ret_value = -1; /* Return value */
+ size_t attr_name_len; /* Length of the attribute name */
-
-/*--------------------------------------------------------------------------
- NAME
- H5R__get_obj_type
- PURPOSE
- Retrieves the type of object that an object reference points to
- USAGE
- H5O_type_t H5R__get_obj_type(file, ref_type, ref)
- H5F_t *file; IN: File the object being dereferenced is within
- H5R_type_t ref_type; IN: Type of reference to query
- void *ref; IN: Reference to query.
- H5O_type_t *obj_type; OUT: The type of the object, set on success
+ FUNC_ENTER_PACKAGE_NOERR
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Given a reference to some object, this function returns the type of object
- pointed to.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+ /* Check args */
+ HDassert(ref != NULL);
+ HDassert(ref->type == H5R_ATTR);
+
+ /* Get the attribute name length */
+ attr_name_len = HDstrlen(ref->info.attr.name);
+ HDassert(attr_name_len <= H5R_MAX_STRING_LEN);
+
+ /* Get the attribute name */
+ if(buf) {
+ size_t copy_len = MIN(attr_name_len, size - 1);
+ H5MM_memcpy(buf, ref->info.attr.name, copy_len);
+ buf[copy_len] = '\0';
+ }
+
+ ret_value = (ssize_t)(attr_name_len + 1);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__get_attr_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__encode
+ *
+ * Purpose: Private function for H5Rencode
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
-H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref,
- H5O_type_t *obj_type)
+H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf,
+ size_t *nalloc, unsigned flags)
{
- H5O_loc_t oloc; /* Object location */
- unsigned rc; /* Reference count of object */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t *p = (uint8_t *)buf;
+ size_t buf_size = 0, encode_size = 0;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
- HDassert(file);
- HDassert(_ref);
+ HDassert(ref);
+ HDassert(nalloc);
+
+ /**
+ * Encoding format:
+ * | Reference type (8 bits) | Flags (8 bits) | Token (token size)
+ * | |
+ * | |----> H5R_IS_EXTERNAL: File info
+ * |
+ * |----> H5R_DATASET_REGION2: Serialized selection
+ * |
+ * |----> H5R_ATTR: Attribute name len + name
+ *
+ */
- /* Initialize the symbol table entry */
- H5O_loc_reset(&oloc);
- oloc.file = file;
+ /* Don't encode if buffer size isn't big enough or buffer is empty */
+ if(buf && *nalloc >= H5R_ENCODE_HEADER_SIZE) {
+ /* Encode the type of the reference */
+ *p++ = (uint8_t)ref->type;
+
+ /* Encode the flags */
+ *p++ = (uint8_t)flags;
+
+ buf_size = *nalloc - H5R_ENCODE_HEADER_SIZE;
+ } /* end if */
+ encode_size += H5R_ENCODE_HEADER_SIZE;
+
+ /* Encode object token */
+ H5R_ENCODE_VAR(H5R__encode_obj_token, &ref->info.obj.token, ref->token_size,
+ p, buf_size, encode_size, "Cannot encode object address");
+
+ /**
+ * TODO Encode VOL info
+ * When we have a better way of storing blobs, we should add
+ * support for referencing files in external VOLs.
+ * There are currently multiple limitations:
+ * - avoid duplicating VOL info on each reference
+ * - must query terminal VOL connector to avoid passthrough confusion
+ */
+ if(flags & H5R_IS_EXTERNAL)
+ /* Encode file name */
+ H5R_ENCODE(H5R__encode_string, filename, p, buf_size, encode_size,
+ "Cannot encode filename");
- switch (ref_type) {
- case H5R_OBJECT:
- {
- /* Get the object oid */
- oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
+ switch(ref->type) {
+ case H5R_OBJECT2:
break;
- }
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- const uint8_t *p; /* Pointer to reference to decode */
- uint8_t *buf; /* Buffer to store serialized selection in */
+ case H5R_DATASET_REGION2:
+ /* Encode dataspace */
+ H5R_ENCODE(H5R__encode_region, ref->info.reg.space, p, buf_size,
+ encode_size, "Cannot encode region");
+ break;
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
+ case H5R_ATTR:
+ /* Encode attribute name */
+ H5R_ENCODE(H5R__encode_string, ref->info.attr.name, p, buf_size,
+ encode_size, "Cannot encode attribute name");
+ break;
- /* Get the dataset region from the heap (allocate inside routine) */
- if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)))
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
+ case H5R_OBJECT1:
+ case H5R_DATASET_REGION1:
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ HDassert("invalid reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)")
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+ default:
+ HDassert("unknown reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ } /* end switch */
- /* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
+ *nalloc = encode_size;
- break;
- }
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode
+ *
+ * Purpose: Private function for H5Rdecode
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref)
+{
+ const uint8_t *p = (const uint8_t *)buf;
+ size_t buf_size = 0, decode_size = 0;
+ uint8_t flags;
+ herr_t ret_value = SUCCEED;
+ FUNC_ENTER_PACKAGE
+
+ HDassert(buf);
+ HDassert(nbytes);
+ HDassert(ref);
+ buf_size = *nbytes;
+
+ /* Don't decode if buffer size isn't big enough */
+ if(buf_size < H5R_ENCODE_HEADER_SIZE)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ /* Set new reference */
+ ref->type = (int8_t)*p++;
+ if(ref->type <= H5R_BADTYPE || ref->type >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+
+ /* Set flags */
+ flags = *p++;
+
+ buf_size -= H5R_ENCODE_HEADER_SIZE;
+ decode_size += H5R_ENCODE_HEADER_SIZE;
+
+ /* Decode object token */
+ H5R_DECODE_VAR(H5R__decode_obj_token, &ref->info.obj.token, &ref->token_size,
+ p, buf_size, decode_size, "Cannot decode object address");
+
+ /* We do not need to store the filename if the reference is internal */
+ if(flags & H5R_IS_EXTERNAL) {
+ /* Decode file name */
+ H5R_DECODE(H5R__decode_string, &ref->info.obj.filename, p, buf_size,
+ decode_size, "Cannot decode filename");
+ }
+ else
+ ref->info.obj.filename = NULL;
+
+ switch(ref->type) {
+ case H5R_OBJECT2:
+ break;
+ case H5R_DATASET_REGION2:
+ /* Decode dataspace */
+ H5R_DECODE(H5R__decode_region, &ref->info.reg.space, p, buf_size,
+ decode_size, "Cannot decode region");
+ break;
+ case H5R_ATTR:
+ /* Decode attribute name */
+ H5R_DECODE(H5R__decode_string, &ref->info.attr.name, p, buf_size,
+ decode_size, "Cannot decode attribute name");
+ break;
+ case H5R_OBJECT1:
+ case H5R_DATASET_REGION1:
case H5R_BADTYPE:
case H5R_MAXTYPE:
+ HDassert("invalid reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)")
default:
HDassert("unknown reference type" && 0);
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
} /* end switch */
- /* Get the # of links for object, and its type */
- /* (To check to make certain that this object hasn't been deleted since the reference was created) */
- if(H5O_get_rc_and_type(&oloc, &rc, obj_type) < 0 || 0 == rc)
- HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
+ /* Set loc ID to invalid */
+ ref->loc_id = H5I_INVALID_HID;
+
+ /* Set encoding size */
+ ref->encode_size = (uint32_t)decode_size;
+
+ H5R_LOG_DEBUG("Decoded reference, filename=%s, obj_addr=%s, encode size=%u",
+ ref->info.obj.filename, H5R__print_token(ref->info.obj.token),
+ ref->encode_size);
+
+ *nbytes = decode_size;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R__get_obj_type() */
+} /* end H5R__decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__encode_obj_token
+ *
+ * Purpose: Encode an object address.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size,
+ unsigned char *buf, size_t *nalloc)
+{
+ herr_t ret_value = SUCCEED;
-
-/*--------------------------------------------------------------------------
- NAME
- H5R__get_name
- PURPOSE
- Internal routine to determine a name for the object referenced
- USAGE
- ssize_t H5R__get_name(f, ref_type, ref, name, size)
- H5F_t *f; IN: Pointer to the file that the reference is pointing
- into
- hid_t lapl_id; IN: LAPL to use for operation
- hid_t id; IN: Location ID given for reference
- H5R_type_t ref_type; IN: Type of reference
- void *_ref; IN: Reference to query.
- char *name; OUT: Buffer to place name of object referenced
- size_t size; IN: Size of name buffer
+ FUNC_ENTER_STATIC_NOERR
- RETURNS
- Non-negative length of the path on success, -1 on failure
- DESCRIPTION
- Given a reference to some object, determine a path to the object
- referenced in the file.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This may not be the only path to that object.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-ssize_t
-H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref,
- char *name, size_t size)
+ HDassert(nalloc);
+
+ /* Don't encode if buffer size isn't big enough or buffer is empty */
+ if(buf && *nalloc >= token_size) {
+ uint8_t *p = (uint8_t *)buf;
+
+ /* Encode token size */
+ *p++ = (uint8_t)(token_size & 0xff);
+
+ /* Encode token */
+ H5MM_memcpy(p, obj_token, token_size);
+ }
+ *nalloc = token_size + H5_SIZEOF_UINT8_T;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__encode_obj_token() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode_obj_token
+ *
+ * Purpose: Decode an object address.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes,
+ H5O_token_t *obj_token, uint8_t *token_size)
{
- H5O_loc_t oloc; /* Object location describing object for reference */
- ssize_t ret_value = -1; /* Return value */
+ const uint8_t *p = (const uint8_t *)buf;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(buf);
+ HDassert(nbytes);
+ HDassert(obj_token);
+ HDassert(token_size);
+
+ /* Don't decode if buffer size isn't big enough */
+ if(*nbytes < H5_SIZEOF_UINT8_T)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ /* Get token size */
+ *token_size = *p++;
+ if(*token_size > sizeof(H5O_token_t))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Invalid token size (%u)", *token_size)
+
+ /* Make sure that token is initialized */
+ HDmemset(obj_token, 0, sizeof(H5O_token_t));
+
+ /* Decode token */
+ H5MM_memcpy(obj_token, p, *token_size);
+
+ *nbytes = (size_t)(*token_size + H5_SIZEOF_UINT8_T);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__decode_obj_token() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__encode_region
+ *
+ * Purpose: Encode a selection.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
+{
+ uint8_t *p = NULL; /* Pointer to data to store */
+ hssize_t buf_size = 0;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(space);
+ HDassert(nalloc);
+
+ /* Get the amount of space required to serialize the selection */
+ if((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot determine amount of space needed for serializing selection")
+
+ /* Don't encode if buffer size isn't big enough or buffer is empty */
+ if(buf && *nalloc >= ((size_t)buf_size + 2 * H5_SIZEOF_UINT32_T)) {
+ int rank;
+ p = (uint8_t *)buf;
+
+ /* Encode the size for safety check */
+ UINT32ENCODE(p, (uint32_t)buf_size);
+
+ /* Encode the extent rank */
+ if((rank = H5S_get_simple_extent_ndims(space)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get extent rank for selection")
+ UINT32ENCODE(p, (uint32_t)rank);
+
+ /* Serialize the selection */
+ if(H5S_SELECT_SERIALIZE(space, (unsigned char **)&p) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "can't serialize selection")
+ } /* end if */
+ *nalloc = (size_t)buf_size + 2 * H5_SIZEOF_UINT32_T;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__encode_region() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode_region
+ *
+ * Purpose: Decode a selection.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr)
+{
+ const uint8_t *p = (const uint8_t *)buf;
+ size_t buf_size = 0;
+ unsigned rank;
+ H5S_t *space;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(buf);
+ HDassert(nbytes);
+ HDassert(space_ptr);
+
+ /* Don't decode if buffer size isn't big enough */
+ if(*nbytes < (2 * H5_SIZEOF_UINT32_T))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ /* Decode the selection size */
+ UINT32DECODE(p, buf_size);
+ buf_size += H5_SIZEOF_UINT32_T;
+
+ /* Decode the extent rank */
+ UINT32DECODE(p, rank);
+ buf_size += H5_SIZEOF_UINT32_T;
+
+ /* Don't decode if buffer size isn't big enough */
+ if(*nbytes < buf_size)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ /* Deserialize the selection (dataspaces need the extent rank information) */
+ if(NULL == (space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+ if(H5S_set_extent_simple(space, rank, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set extent rank for selection")
+ if(H5S_SELECT_DESERIALIZE(&space, &p) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "can't deserialize selection")
+
+ *nbytes = buf_size;
+ *space_ptr = space;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__decode_region() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__encode_string
+ *
+ * Purpose: Encode a string.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5R__encode_string(const char *string, unsigned char *buf, size_t *nalloc)
+{
+ size_t string_len, buf_size;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(string);
+ HDassert(nalloc);
+
+ /* Get the amount of space required to serialize the string */
+ string_len = HDstrlen(string);
+ if(string_len > H5R_MAX_STRING_LEN)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "string too long")
+
+ /* Compute buffer size, allow for the attribute name length and object address */
+ buf_size = string_len + sizeof(uint16_t);
+
+ if(buf && *nalloc >= buf_size) {
+ uint8_t *p = (uint8_t *)buf;
+ /* Serialize information for string length into the buffer */
+ UINT16ENCODE(p, string_len);
+ /* Copy the string into the buffer */
+ H5MM_memcpy(p, string, string_len);
+ }
+ *nalloc = buf_size;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__encode_string() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode_string
+ *
+ * Purpose: Decode a string.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5R__decode_string(const unsigned char *buf, size_t *nbytes, char **string_ptr)
+{
+ const uint8_t *p = (const uint8_t *)buf;
+ size_t string_len;
+ char *string = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(buf);
+ HDassert(nbytes);
+ HDassert(string_ptr);
+
+ /* Don't decode if buffer size isn't big enough */
+ if(*nbytes < sizeof(uint16_t))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ /* Get the string length */
+ UINT16DECODE(p, string_len);
+ HDassert(string_len <= H5R_MAX_STRING_LEN);
+
+ /* Allocate the string */
+ if(NULL == (string = (char *)H5MM_malloc(string_len + 1)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, FAIL, "Cannot allocate string")
+
+ /* Copy the string */
+ H5MM_memcpy(string, p, string_len);
+ string[string_len] = '\0';
+
+ *string_ptr = string;
+ *nbytes = sizeof(uint16_t) + string_len;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__decode_string() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__encode_heap
+ *
+ * Purpose: Encode data and insert into heap (native only).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc,
+ const unsigned char *data, size_t data_size)
+{
+ size_t buf_size;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
- /* Check args */
HDassert(f);
- HDassert(_ref);
+ HDassert(nalloc);
- /* Initialize the object location */
- H5O_loc_reset(&oloc);
- oloc.file = f;
+ buf_size = H5HG_HEAP_ID_SIZE(f);
+ if(buf && *nalloc >= buf_size) {
+ H5HG_t hobjid;
+ uint8_t *p = (uint8_t *)buf;
- /* Get address for reference */
- switch (ref_type) {
- case H5R_OBJECT:
- {
- oloc.addr = *(const hobj_ref_t *)_ref;
- break;
- }
+ /* Write the reference information to disk (allocates space also) */
+ if(H5HG_insert(f, data_size, data, &hobjid) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to write reference information")
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- uint8_t *buf; /* Buffer to store serialized selection in */
- const uint8_t *p; /* Pointer to OID to store */
+ /* Encode the heap information */
+ H5F_addr_encode(f, &p, hobjid.addr);
+ UINT32ENCODE(p, hobjid.idx);
+ } /* end if */
+ *nalloc = buf_size;
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__encode_heap() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode_heap
+ *
+ * Purpose: Decode data inserted into heap (native only).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes,
+ unsigned char **data_ptr, size_t *data_size)
+{
+ const uint8_t *p = (const uint8_t *)buf;
+ H5HG_t hobjid;
+ size_t buf_size;
+ herr_t ret_value = SUCCEED;
- /* Get the dataset region from the heap (allocate inside routine) */
- 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")
+ FUNC_ENTER_PACKAGE
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+ HDassert(f);
+ HDassert(buf);
+ HDassert(nbytes);
+ HDassert(data_ptr);
+
+ buf_size = H5HG_HEAP_ID_SIZE(f);
+ /* Don't decode if buffer size isn't big enough */
+ if(*nbytes < buf_size)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ /* Get the heap information */
+ H5F_addr_decode(f, &p, &(hobjid.addr));
+ if(!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
+ UINT32DECODE(p, hobjid.idx);
- /* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
+ /* Read the information from disk */
+ if(NULL == (*data_ptr = (unsigned char *)H5HG_read(f, &hobjid, (void *)*data_ptr, data_size)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read reference data")
- break;
- }
+ *nbytes = buf_size;
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- default:
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)")
- } /* end switch */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__decode_heap() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__free_heap
+ *
+ * Purpose: Remove data previously inserted into heap (native only).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes)
+{
+ H5HG_t hobjid;
+ const uint8_t *p = (const uint8_t *)buf;
+ size_t buf_size;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(f);
+ HDassert(buf);
+
+ buf_size = H5HG_HEAP_ID_SIZE(f);
+ /* Don't decode if buffer size isn't big enough */
+ if(nbytes < buf_size)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ /* Get the heap information */
+ H5F_addr_decode(f, &p, &(hobjid.addr));
+ if(!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
+ UINT32DECODE(p, hobjid.idx);
+
+ /* Free heap object */
+ if(hobjid.addr > 0) {
+ /* Free heap object */
+ if(H5HG_remove(f, &hobjid) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__free_heap() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode_token_compat
+ *
+ * Purpose: Decode an object token. (native only)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type,
+ const unsigned char *buf, H5O_token_t *obj_token)
+{
+ hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
+ H5VL_object_t *vol_obj_file = NULL;
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(vol_obj, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Get the file for the object */
+ if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Retrieve VOL object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get container info */
+ if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
+
+ if(ref_type == H5R_OBJECT1) {
+ size_t buf_size = H5R_OBJ_REF_BUF_SIZE;
- /* Get name, length, etc. */
- if((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name")
+ /* Get object address */
+ if(H5R__decode_token_obj_compat(buf, &buf_size, obj_token, cont_info.token_size) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token")
+ } /* end if */
+ else {
+ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE;
+ H5F_t *f = NULL;
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Get object address */
+ if(H5R__decode_token_region_compat(f, buf, &buf_size, obj_token, cont_info.token_size, NULL) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address")
+ } /* end else */
+
+done:
+ if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__decode_token_compat() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__encode_token_obj_compat
+ *
+ * Purpose: Encode an object token. (native only)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size,
+ unsigned char *buf, size_t *nalloc)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ HDassert(obj_token);
+ HDassert(token_size);
+ HDassert(nalloc);
+
+ /* Don't encode if buffer size isn't big enough or buffer is empty */
+ if(buf && *nalloc >= token_size)
+ H5MM_memcpy(buf, obj_token, token_size);
+
+ *nalloc = token_size;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__encode_token_obj_compat() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode_token_obj_compat
+ *
+ * Purpose: Decode an object token. (native only)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes,
+ H5O_token_t *obj_token, size_t token_size)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(buf);
+ HDassert(nbytes);
+ HDassert(obj_token);
+ HDassert(token_size);
+
+ /* Don't decode if buffer size isn't big enough */
+ if(*nbytes < token_size)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
+
+ H5MM_memcpy(obj_token, buf, token_size);
+
+ *nbytes = token_size;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5R__decode_token_obj_compat() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__encode_token_region_compat
+ *
+ * Purpose: Encode dataset selection and insert data into heap
+ * (native only).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token,
+ size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc)
+{
+ size_t buf_size;
+ unsigned char *data = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(f);
+ HDassert(obj_token);
+ HDassert(token_size);
+ HDassert(space);
+ HDassert(nalloc);
+
+ /* Get required buffer size */
+ if(H5R__encode_heap(f, NULL, &buf_size, NULL, (size_t)0) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ if(buf && *nalloc >= buf_size) {
+ ssize_t data_size;
+ uint8_t *p;
+
+ /* Pass the correct encoding version for the selection depending on the
+ * file libver bounds, this is later retrieved in H5S hyper encode */
+ H5CX_set_libver_bounds(f);
+
+ /* Zero the heap ID out, may leak heap space if user is re-using
+ * reference and doesn't have garbage collection turned on
+ */
+ HDmemset(buf, 0, buf_size);
+
+ /* Get the amount of space required to serialize the selection */
+ if((data_size = H5S_SELECT_SERIAL_SIZE(space)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection")
+
+ /* Increase buffer size to allow for the dataset token */
+ data_size += (hssize_t)token_size;
+
+ /* Allocate the space to store the serialized information */
+ H5_CHECK_OVERFLOW(data_size, hssize_t, size_t);
+ if(NULL == (data = (uint8_t *)H5MM_malloc((size_t)data_size)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Serialize information for dataset OID into heap buffer */
+ p = (uint8_t *)data;
+ H5MM_memcpy(p, obj_token, token_size);
+ p += token_size;
+
+ /* Serialize the selection into heap buffer */
+ if(H5S_SELECT_SERIALIZE(space, &p) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection")
+
+ /* Write to heap */
+ if(H5R__encode_heap(f, buf, nalloc, data, (size_t)data_size) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ }
+ *nalloc = buf_size;
+
+done:
+ H5MM_free(data);
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5R__encode_token_region_compat() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5R__decode_token_region_compat
+ *
+ * Purpose: Decode dataset selection from data inserted into heap
+ * (native only).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
+ size_t *nbytes, H5O_token_t *obj_token, size_t token_size,
+ H5S_t **space_ptr)
+{
+ unsigned char *data = NULL;
+ H5O_token_t token = { 0 };
+ size_t data_size;
+ const uint8_t *p;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(f);
+ HDassert(buf);
+ HDassert(nbytes);
+ HDassert(token_size);
+
+ /* Read from heap */
+ if(H5R__decode_heap(f, buf, nbytes, &data, &data_size) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Get object address */
+ p = (const uint8_t *)data;
+ H5MM_memcpy(&token, p, token_size);
+ p += token_size;
+
+ if(space_ptr) {
+ H5O_loc_t oloc; /* Object location */
+ H5S_t *space = NULL;
+
+ /* Initialize the object location */
+ H5O_loc_reset(&oloc);
+ oloc.file = f;
+
+ if(H5VL_native_token_to_addr(f, H5I_FILE, token, &oloc.addr) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+
+ /* Open and copy the dataset's dataspace */
+ if(NULL == (space = H5S_read(&oloc)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "not found")
+
+ /* Unserialize the selection */
+ if(H5S_SELECT_DESERIALIZE(&space, &p) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "can't deserialize selection")
+
+ *space_ptr = space;
+ }
+ if(obj_token)
+ H5MM_memcpy(obj_token, &token, sizeof(H5O_token_t));
done:
+ H5MM_free(data);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R__get_name() */
+} /* end H5R__decode_token_region_compat() */
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index 1c1c8eb..36cf805 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -36,11 +36,51 @@
/* Package Private Macros */
/**************************/
+/* Encode flags */
+#define H5R_IS_EXTERNAL 0x1 /* Set when encoding reference to external file */
+
+/* Macros for convenience */
+#define H5R_REF_FILENAME(x) ((x)->info.obj.filename)
+#define H5R_REF_ATTRNAME(x) ((x)->info.attr.name)
+
+/* Header size */
+#define H5R_ENCODE_HEADER_SIZE (2 * H5_SIZEOF_UINT8_T)
/****************************/
/* Package Private Typedefs */
/****************************/
+/* Object reference */
+typedef struct H5R_ref_priv_obj_t {
+ H5O_token_t token; /* Object token */
+ char *filename; /* File name */
+} H5R_ref_priv_obj_t;
+
+/* Region reference */
+typedef struct H5R_ref_priv_reg_t {
+ H5R_ref_priv_obj_t obj; /* Object reference */
+ H5S_t *space; /* Selection */
+} H5R_ref_priv_reg_t;
+
+/* Attribute reference */
+typedef struct H5R_ref_priv_attr_t {
+ H5R_ref_priv_obj_t obj; /* Object reference */
+ char *name; /* Attribute name */
+} H5R_ref_priv_attr_t;
+
+/* Generic reference type (keep it cache aligned) */
+typedef struct H5R_ref_priv_t {
+ union {
+ H5R_ref_priv_obj_t obj;/* Object reference */
+ H5R_ref_priv_reg_t reg;/* Region reference */
+ H5R_ref_priv_attr_t attr;/* Attribute Reference */
+ } info;
+ hid_t loc_id; /* Cached location identifier */
+ uint32_t encode_size; /* Cached encoding size */
+ int8_t type; /* Reference type */
+ uint8_t token_size; /* Cached token size */
+ hbool_t app_ref; /* App ref on loc_id */
+} H5R_ref_priv_t;
/*****************************/
/* Package Private Variables */
@@ -50,11 +90,41 @@
/******************************/
/* 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 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, H5R_type_t ref_type, const void *_ref, char *name, size_t size);
+H5_DLL herr_t H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref);
+H5_DLL herr_t H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref);
+H5_DLL herr_t H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref);
+H5_DLL herr_t H5R__destroy(H5R_ref_priv_t *ref);
+
+H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref);
+H5_DLL hid_t H5R__get_loc_id(const H5R_ref_priv_t *ref);
+H5_DLL hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id);
+
+H5_DLL H5R_type_t H5R__get_type(const H5R_ref_priv_t *ref);
+H5_DLL htri_t H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2);
+H5_DLL herr_t H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref);
+
+H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *token_size);
+H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t token_size);
+H5_DLL herr_t H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space);
+
+H5_DLL ssize_t H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size);
+H5_DLL ssize_t H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size);
+
+H5_DLL herr_t H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, size_t *nalloc, unsigned flags);
+H5_DLL herr_t H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref);
+
+/* Native HDF5 specific routines */
+H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, const unsigned char *data, size_t data_size);
+H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size);
+H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes);
+
+H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5O_token_t *obj_token);
+
+H5_DLL herr_t H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc);
+H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size);
+
+H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc);
+H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr);
#endif /* _H5Rpkg_H */
diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h
index 1bf2e92..870deaf 100644
--- a/src/H5Rprivate.h
+++ b/src/H5Rprivate.h
@@ -25,6 +25,8 @@
/* Library Private Macros */
/**************************/
+#define H5R_ENCODE_VERSION 0x1 /* Version for encoding references */
+
/****************************/
/* Library Private Typedefs */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 598bafd..13d82d7 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -26,47 +26,71 @@
/* Public Macros */
/*****************/
-/* Note! Be careful with the sizes of the references because they should really
- * depend on the run-time values in the file. Unfortunately, the arrays need
- * to be defined at compile-time, so we have to go with the worst case sizes
- * for them. -QAK
- */
+/* Deprecated reference buffer sizes that are kept for backward compatibility */
#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
+#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
-/* 4 is used instead of sizeof(int) to permit portability between the Crays
- * and other machines (the heap ID is always encoded as an int32 anyway).
+/* Default reference buffer size.
+ * Note! Be careful with the sizes of the references because they should really
+ * depend on the run-time values in the file.
*/
-#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
+#define H5R_REF_BUF_SIZE (64)
/*******************/
/* Public Typedefs */
/*******************/
-/* Reference types */
-typedef enum H5R_type_t {
- H5R_BADTYPE = (-1), /* Invalid Reference Type */
- H5R_OBJECT, /* Object reference */
- H5R_DATASET_REGION, /* Dataset Region Reference */
- H5R_MAXTYPE /* Highest type (Invalid as true type) */
+/*
+ * Reference types allowed.
+ * DO NOT CHANGE THE ORDER or VALUES as reference type values are encoded into
+ * the datatype message header.
+ */
+typedef enum {
+ H5R_BADTYPE = (-1), /* Invalid reference type */
+ H5R_OBJECT1 = 0, /* Backward compatibility (object) */
+ H5R_DATASET_REGION1 = 1, /* Backward compatibility (region) */
+ H5R_OBJECT2 = 2, /* Object reference */
+ H5R_DATASET_REGION2 = 3, /* Region reference */
+ H5R_ATTR = 4, /* Attribute Reference */
+ H5R_MAXTYPE = 5 /* Highest type (invalid) */
} H5R_type_t;
-/* Object reference structure for user's code
- * This needs to be large enough to store largest haddr_t on a worst case
- * machine (8 bytes currently).
+/* Deprecated types are kept for backward compatibility with previous versions */
+
+/**
+ * Deprecated object reference type that is used with deprecated reference APIs.
+ * Note! This type can only be used with the "native" HDF5 VOL connector.
*/
typedef haddr_t hobj_ref_t;
-/* Dataset Region reference structure for user's code
+/**
+ * Dataset region reference type that is used with deprecated reference APIs.
* (Buffer to store heap ID and index)
* This needs to be large enough to store largest haddr_t in a worst case
- * machine (8 bytes currently) plus an int
+ * machine (8 bytes currently) plus an int.
+ * Note! This type can only be used with the "native" HDF5 VOL connector.
*/
-typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];
+typedef struct {
+ uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE];
+} hdset_reg_ref_t;
+
+/**
+ * Opaque reference type. The same reference type is used for object,
+ * dataset region and attribute references. This is the type that
+ * should always be used with the current reference API.
+ */
+typedef struct {
+ union {
+ uint8_t __data[H5R_REF_BUF_SIZE]; /* opaque data */
+ int64_t align; /* ensures alignment */
+ } u;
+} H5R_ref_t;
/********************/
/* Public Variables */
/********************/
+
/*********************/
/* Public Prototypes */
/*********************/
@@ -75,30 +99,57 @@ typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];
extern "C" {
#endif
-H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name,
- H5R_type_t ref_type, hid_t space_id);
-H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
-H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
-H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *_ref,
- H5O_type_t *obj_type);
-H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref,
- char *name /*out*/, size_t size);
+/* Constructors */
+H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr);
+H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr);
+H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr);
+H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr);
+
+/* Info */
+H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr);
+H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr);
+H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr);
+
+/* Dereference */
+H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
+H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
+H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id);
+
+/* Get type */
+H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type);
+
+/* Get name */
+H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size);
+H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size);
+H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
- * Use of these symbols is deprecated.
+ * Use of these symbols is or will be deprecated.
*/
-#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/* Macros */
+
+/* Versions for compatibility */
+#define H5R_OBJECT H5R_OBJECT1
+#define H5R_DATASET_REGION H5R_DATASET_REGION1
/* Function prototypes */
-H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *_ref);
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref);
H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
+H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type);
+H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
+H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
+H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, char *name, size_t size);
+
#ifdef __cplusplus
}
#endif
#endif /* _H5Rpublic_H */
-
diff --git a/src/H5S.c b/src/H5S.c
index 6018798..ddfd064 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1357,7 +1357,6 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
/* Check args */
HDassert(rank <= H5S_MAX_RANK);
- HDassert(0 == rank || dims);
/* shift out of the previous state to a "simple" dataspace. */
if(H5S__extent_release(&space->extent) < 0)
@@ -1378,7 +1377,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
space->extent.size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
/* Copy the dimensions & compute the number of elements in the extent */
- for(u = 0, nelem = 1; u < space->extent.rank; u++) {
+ for(u = 0, nelem = 1; dims && (u < space->extent.rank); u++) {
space->extent.size[u] = dims[u];
nelem *= dims[u];
} /* end for */
@@ -1390,7 +1389,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
if(max != NULL)
H5MM_memcpy(space->extent.max, max, sizeof(hsize_t) * rank);
else
- for(u = 0; u < space->extent.rank; u++)
+ for(u = 0; dims && (u < space->extent.rank); u++)
space->extent.max[u] = dims[u];
} /* end else */
diff --git a/src/H5SL.c b/src/H5SL.c
index 5f00fb8..ff8edb8 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -652,7 +652,7 @@ int H5SL_term_package(void)
/* Terminate all the factories */
if(H5SL_fac_nused_g > 0) {
size_t i;
- herr_t ret;
+ herr_t H5_ATTR_NDEBUG_UNUSED ret;
for(i = 0; i < H5SL_fac_nused_g; i++) {
ret = H5FL_fac_term(H5SL_fac_g[i]);
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 49ce2b4..6d0f2b0 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -212,8 +212,8 @@ H5SM__cache_table_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU
*-------------------------------------------------------------------------
*/
static void *
-H5SM__cache_table_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty)
+H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
+ void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
{
H5F_t *f; /* File pointer -- from user data */
H5SM_master_table_t *table = NULL; /* Shared message table that we deserializing */
@@ -364,7 +364,7 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len,
+H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_thing)
{
H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; /* Shared message table to encode */
@@ -397,7 +397,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len,
*image++ = H5SM_LIST_VERSION;
/* Is message index a list or a B-tree? */
- *image++ = table->indexes[u].index_type;
+ *image++ = (uint8_t)table->indexes[u].index_type;
/* Type of messages in the index */
UINT16ENCODE(image, table->indexes[u].mesg_types);
@@ -568,8 +568,8 @@ H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo
*-------------------------------------------------------------------------
*/
static void *
-H5SM__cache_list_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty)
+H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
+ void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
{
H5SM_list_t *list = NULL; /* The SOHM list being read in */
H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */
@@ -687,7 +687,7 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len,
+H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_thing)
{
H5SM_list_t *list = (H5SM_list_t *)_thing ; /* Instance being serialized */
diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c
index 0cca6bb..e085204 100644
--- a/src/H5SMmessage.c
+++ b/src/H5SMmessage.c
@@ -298,7 +298,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx)
/* Sanity check */
HDassert(ctx);
- *raw++ = message->location;
+ *raw++ = (uint8_t)message->location;
UINT32ENCODE(raw, message->hash);
if(message->location == H5SM_IN_HEAP) {
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 9d0a65a..4a4245d 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -66,6 +66,7 @@ static htri_t H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__all_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__all_adjust_s(H5S_t *space, const hssize_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(const H5S_t *space, H5S_sel_iter_t *iter);
@@ -112,6 +113,7 @@ const H5S_select_class_t H5S_sel_all[1] = {{
H5S__all_shape_same,
H5S__all_intersect_block,
H5S__all_adjust_u,
+ H5S__all_adjust_s,
H5S__all_project_scalar,
H5S__all_project_simple,
H5S__all_iter_init,
@@ -1043,6 +1045,37 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
} /* end H5S__all_adjust_u() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__all_adjust_s
+ PURPOSE
+ Adjust an "all" selection by subtracting an offset
+ USAGE
+ herr_t H5S__all_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__all_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *offset)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(offset);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__all_adjust_s() */
+
+
/*-------------------------------------------------------------------------
* Function: H5S__all_project_scalar
*
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 9feb8de..dc97ea2 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -96,6 +96,7 @@ typedef struct {
hsize_t skip; /* Number of elements to skip in projected space */
hsize_t nelem; /* Number of elements to add to projected space (after skip) */
uint64_t op_gen; /* Operation generation for counting elements */
+ hbool_t share_selection; /* Whether span trees in dst_space can be shared with proj_space */
} H5S_hyper_project_intersect_ud_t;
/* Assert that H5S_MAX_RANK is <= 32 so our trick with using a 32 bit bitmap
@@ -112,6 +113,9 @@ typedef struct {
static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high,
H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
static H5S_hyper_span_info_t *H5S__hyper_new_span_info(unsigned rank);
+static H5S_hyper_span_info_t *H5S__hyper_copy_span_helper(
+ H5S_hyper_span_info_t *spans, unsigned rank, unsigned op_info_i,
+ uint64_t op_gen);
static H5S_hyper_span_info_t *H5S__hyper_copy_span(H5S_hyper_span_info_t *spans,
unsigned rank);
static hbool_t H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
@@ -132,7 +136,7 @@ static herr_t H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans,
H5S_hyper_span_info_t **a_and_b, H5S_hyper_span_info_t **b_not_a);
static herr_t H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
static hsize_t H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans,
- uint64_t op_gen);
+ unsigned op_info_i, uint64_t op_gen);
static hsize_t H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans);
static herr_t H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
static H5S_hyper_span_info_t *H5S__hyper_make_spans(unsigned rank,
@@ -190,6 +194,7 @@ static htri_t H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__hyper_adjust_s(H5S_t *space, const hssize_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(const H5S_t *space, H5S_sel_iter_t *iter);
@@ -236,6 +241,7 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S__hyper_shape_same,
H5S__hyper_intersect_block,
H5S__hyper_adjust_u,
+ H5S__hyper_adjust_s,
H5S__hyper_project_scalar,
H5S__hyper_project_simple,
H5S__hyper_iter_init,
@@ -2852,9 +2858,10 @@ done:
PURPOSE
Helper routine to copy a hyperslab span tree
USAGE
- H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans, rank)
+ H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans, rank, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to copy
unsigned rank; IN: Rank of span tree
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Pointer to the copied span tree on success, NULL on failure
@@ -2867,7 +2874,7 @@ done:
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
- uint64_t op_gen)
+ unsigned op_info_i, uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span */
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
@@ -2881,9 +2888,9 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(spans);
/* Check if the span tree was already copied */
- if(spans->op_gen == op_gen) {
+ if(spans->op_info[op_info_i].op_gen == op_gen) {
/* Just return the value of the already copied span tree */
- ret_value = spans->u.copied;
+ ret_value = spans->op_info[op_info_i].u.copied;
/* Increment the reference count of the span tree */
ret_value->count++;
@@ -2899,10 +2906,10 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
ret_value->count = 1;
/* Set the operation generation for the span info, to avoid future copies */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
/* Set the 'copied' pointer in the node being copied to the newly allocated node */
- spans->u.copied = ret_value;
+ spans->op_info[op_info_i].u.copied = ret_value;
/* Copy over the nodes in the span list */
span = spans->head;
@@ -2920,7 +2927,7 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recurse to copy the 'down' spans, if there are any */
if(span->down != NULL) {
- if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_gen)))
+ if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_info_i, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab spans")
new_span->down = new_down;
} /* end if */
@@ -2976,7 +2983,9 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans, unsigned rank)
op_gen = H5S__hyper_get_op_gen();
/* Copy the hyperslab span tree */
- if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, op_gen)))
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, 0, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
done:
@@ -3315,8 +3324,9 @@ done:
PURPOSE
Helper routine to count the number of blocks in a span tree
USAGE
- hsize_t H5S__hyper_span_nblocks_helper(spans)
+ hsize_t H5S__hyper_span_nblocks_helper(spans, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to count blocks of
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Number of blocks in span tree on success; negative on failure
@@ -3328,7 +3338,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
+H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i,
+ uint64_t op_gen)
{
hsize_t ret_value = 0; /* Return value */
@@ -3338,9 +3349,9 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
HDassert(spans);
/* Check if the span tree was already counted */
- if(spans->op_gen == op_gen)
+ if(spans->op_info[op_info_i].op_gen == op_gen)
/* Just return the # of blocks in the already counted span tree */
- ret_value = spans->u.nblocks;
+ ret_value = spans->op_info[op_info_i].u.nblocks;
else { /* Count the number of elements in the span tree */
H5S_hyper_span_t *span; /* Hyperslab span */
@@ -3348,7 +3359,7 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
if(span->down) {
while(span) {
/* If there are down spans, add the total down span blocks */
- ret_value += H5S__hyper_span_nblocks_helper(span->down, op_gen);
+ ret_value += H5S__hyper_span_nblocks_helper(span->down, op_info_i, op_gen);
/* Advance to next span */
span = span->next;
@@ -3365,10 +3376,10 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
} /* end else */
/* Set the operation generation for this span tree, to avoid re-computing */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
/* Hold a copy of the # of blocks */
- spans->u.nblocks = ret_value;
+ spans->op_info[op_info_i].u.nblocks = ret_value;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
@@ -3406,7 +3417,10 @@ H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans)
/* Acquire an operation generation value for this operation */
op_gen = H5S__hyper_get_op_gen();
- ret_value = H5S__hyper_span_nblocks_helper(spans, op_gen);
+ /* Count the blocks */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ ret_value = H5S__hyper_span_nblocks_helper(spans, 0, op_gen);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -3674,7 +3688,7 @@ H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_
/* Determine the encoding size */
enc2 = H5S__hyper_get_enc_size_real(max2);
- *enc_size = MAX(enc1, enc2);
+ *enc_size = (uint8_t)MAX(enc1, enc2);
} /* end if */
else {
hsize_t max_size = block_count;
@@ -4251,6 +4265,9 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p)
/* Decode version */
UINT32DECODE(pp, version);
+ if(version < H5S_HYPER_VERSION_1 || version > H5S_HYPER_VERSION_LATEST)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for hyperslab selection")
+
if(version >= (uint32_t)H5S_HYPER_VERSION_2) {
/* Decode flags */
flags = *(pp)++;
@@ -5946,7 +5963,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
/* Check if we've compared the 'stop' span's "down tree" to
* this span's "down tree" already.
*/
- if(tmp_span->down->op_gen != op_gen) {
+ if(tmp_span->down->op_info[0].op_gen != op_gen) {
if(H5S__hyper_cmp_spans(tmp_span->down, stop_span->down))
attempt_merge_spans = TRUE;
@@ -5954,7 +5971,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
/* (Because it wasn't the same as the 'stop' span's down tree
* and we don't need to compare it again)
*/
- tmp_span->down->op_gen = op_gen;
+ tmp_span->down->op_info[0].op_gen = op_gen;
} /* end if */
} /* end else */
@@ -6159,11 +6176,12 @@ done:
PURPOSE
Helper routine to detect intersections in span trees
USAGE
- hbool_t H5S__hyper_intersect_block_helper(spans, start, end)
+ hbool_t H5S__hyper_intersect_block_helper(spans, rank, start, end, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
hsize_t *start; IN: Starting coordinate for block
hsize_t *end; IN: Ending coordinate for block
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURN
Non-negative (TRUE/FALSE) on success, can't fail
@@ -6176,7 +6194,8 @@ done:
--------------------------------------------------------------------------*/
static hbool_t
H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
- unsigned rank, const hsize_t *start, const hsize_t *end, uint64_t op_gen)
+ unsigned rank, const hsize_t *start, const hsize_t *end, unsigned op_info_i,
+ uint64_t op_gen)
{
hbool_t ret_value = FALSE; /* Return value */
@@ -6188,7 +6207,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
HDassert(end);
/* Check if we've already visited this span tree */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
unsigned u; /* Local index variable */
@@ -6221,7 +6240,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
/* If there is an intersection in the "down" dimensions,
* the span trees overlap.
*/
- if(H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_gen))
+ if(H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_info_i, op_gen))
HGOTO_DONE(TRUE)
/* No intersection in down dimensions, advance to next span */
@@ -6231,7 +6250,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
} /* end while */
/* Set the tree's operation generation */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
/* Fall through with 'FALSE' return value */
@@ -6267,7 +6286,7 @@ H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(space);
@@ -6363,7 +6382,9 @@ H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize
op_gen = H5S__hyper_get_op_gen();
/* Perform the span-by-span intersection check */
- ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, start, end, op_gen);
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, start, end, 0, op_gen);
} /* end else */
done:
@@ -6377,10 +6398,11 @@ done:
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- void H5S__hyper_adjust_u_helper(spans, offset)
+ void H5S__hyper_adjust_u_helper(spans, rank, offset, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
const hsize_t *offset; IN: Offset to subtract
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
None
@@ -6393,7 +6415,7 @@ done:
--------------------------------------------------------------------------*/
static void
H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
- const hsize_t *offset, uint64_t op_gen)
+ const hsize_t *offset, unsigned op_info_i, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
@@ -6402,7 +6424,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(offset);
/* Check if we've already set this span tree */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
unsigned u; /* Local index variable */
@@ -6423,14 +6445,14 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
- H5S__hyper_adjust_u_helper(span->down, rank - 1, offset + 1, op_gen);
+ H5S__hyper_adjust_u_helper(span->down, rank - 1, offset + 1, op_info_i, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
/* Set the tree's operation generation */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@@ -6458,36 +6480,50 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
static herr_t
H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
{
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
+ unsigned u; /* Local index variable */
+
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(space);
HDassert(offset);
- /* Subtract the offset from the "regular" coordinates, if they exist */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
- unsigned u; /* Local index variable */
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
- for(u = 0; u < space->extent.rank; u++) {
- HDassert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]);
- space->select.sel_info.hslab->diminfo.opt[u].start -= offset[u];
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset) {
+ /* Subtract the offset from the "regular" coordinates, if they exist */
+ /* (No need to rebuild the dimension info yet -QAK) */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ for(u = 0; u < space->extent.rank; u++) {
+ HDassert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]);
+ space->select.sel_info.hslab->diminfo.opt[u].start -= offset[u];
- /* Adjust the low & high bounds */
- HDassert(space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]);
- space->select.sel_info.hslab->diminfo.low_bounds[u] -= offset[u];
- space->select.sel_info.hslab->diminfo.high_bounds[u] -= offset[u];
- } /* end for */
- } /* end if */
+ /* Adjust the low & high bounds */
+ HDassert(space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]);
+ space->select.sel_info.hslab->diminfo.low_bounds[u] -= offset[u];
+ space->select.sel_info.hslab->diminfo.high_bounds[u] -= offset[u];
+ } /* end for */
+ } /* end if */
- /* Subtract the offset from the span tree coordinates, if they exist */
- if(space->select.sel_info.hslab->span_lst) {
- uint64_t op_gen; /* Operation generation value */
+ /* Subtract the offset from the span tree coordinates, if they exist */
+ if(space->select.sel_info.hslab->span_lst) {
+ uint64_t op_gen; /* Operation generation value */
- /* Acquire an operation generation value for this operation */
- op_gen = H5S__hyper_get_op_gen();
+ /* Acquire an operation generation value for this operation */
+ op_gen = H5S__hyper_get_op_gen();
- H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
+ /* Perform adjustment */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, 0, op_gen);
+ } /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -6897,10 +6933,11 @@ done:
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- void H5S__hyper_adjust_s_helper(spans, offset)
+ void H5S__hyper_adjust_s_helper(spans, rank, offset, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
const hssize_t *offset; IN: Offset to subtract
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
None
@@ -6913,7 +6950,7 @@ done:
--------------------------------------------------------------------------*/
static void
H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
- const hssize_t *offset, uint64_t op_gen)
+ const hssize_t *offset, unsigned op_info_i, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
@@ -6922,7 +6959,7 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(offset);
/* Check if we've already set this span tree */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
unsigned u; /* Local index variable */
@@ -6943,14 +6980,14 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
- H5S__hyper_adjust_s_helper(span->down, rank - 1, offset + 1, op_gen);
+ H5S__hyper_adjust_s_helper(span->down, rank - 1, offset + 1, op_info_i, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
/* Set the tree's operation generation */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@@ -6959,11 +6996,11 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust_s
+ H5S__hyper_adjust_s
PURPOSE
Adjust a hyperslab selection by subtracting an offset
USAGE
- herr_t H5S_hyper_adjust_s(space,offset)
+ herr_t H5S__hyper_adjust_s(space,offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hssize_t *offset; IN: Offset to subtract
RETURNS
@@ -6975,8 +7012,8 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
-H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
+static herr_t
+H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
unsigned u; /* Local index variable */
@@ -7018,54 +7055,16 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
/* Acquire an operation generation value for this operation */
op_gen = H5S__hyper_get_op_gen();
- H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
+ /* Perform the adjustment */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, 0, op_gen);
} /* end if */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_adjust_s() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5Shyper_adjust_s
- PURPOSE
- Adjust a hyperslab selection by subtracting an offset
- USAGE
- herr_t H5Shyper_adjust_s(space_id,offset)
- hid_t space_id; IN: ID of the dataspace to adjust
- const hssize_t *offset; IN: Offset to subtract
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Moves a hyperslab selection by subtracting an offset from it.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset)
-{
- H5S_t *space;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Hs", space_id, offset);
-
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
- if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
- if(NULL == offset)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer")
-
- if(H5S_hyper_adjust_s(space, offset) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Shyper_adjust_s() */
+} /* end H5S__hyper_adjust_s() */
/*--------------------------------------------------------------------------
@@ -7111,7 +7110,7 @@ H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset)
} /* end for */
/* Call the 'adjust' routine */
- if(H5S_hyper_adjust_s(space, space->select.offset) < 0)
+ if(H5S__hyper_adjust_s(space, space->select.offset) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
/* Zero out the selection offset */
@@ -7159,7 +7158,7 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset)
HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
/* Call the 'adjust' routine */
- if(H5S_hyper_adjust_s(space, old_offset) < 0)
+ if(H5S__hyper_adjust_s(space, old_offset) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
/* Copy the selection offset over */
@@ -8281,8 +8280,9 @@ done:
PURPOSE
Count the number of elements in a span tree
USAGE
- hsize_t H5S__hyper_spans_nelem_helper(spans, op_gen)
+ hsize_t H5S__hyper_spans_nelem_helper(spans, op_info_i, op_gen)
const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of
+ unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Number of elements in span tree on success; negative on failure
@@ -8294,7 +8294,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
+H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i,
+ uint64_t op_gen)
{
hsize_t ret_value = 0; /* Return value */
@@ -8304,9 +8305,9 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
HDassert(spans);
/* Check if the span tree was already counted */
- if(spans->op_gen == op_gen)
+ if(spans->op_info[op_info_i].op_gen == op_gen)
/* Just return the # of elements in the already counted span tree */
- ret_value = spans->u.nelmts;
+ ret_value = spans->op_info[op_info_i].u.nelmts;
else { /* Count the number of elements in the span tree */
const H5S_hyper_span_t *span; /* Hyperslab span */
@@ -8328,7 +8329,7 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
nelmts = (span->high - span->low) + 1;
/* Multiply the size of this span by the total down span elements */
- ret_value += nelmts * H5S__hyper_spans_nelem_helper(span->down, op_gen);
+ ret_value += nelmts * H5S__hyper_spans_nelem_helper(span->down, op_info_i, op_gen);
/* Advance to next span */
span = span->next;
@@ -8336,10 +8337,10 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
} /* end else */
/* Set the operation generation for this span tree, to avoid re-computing */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
/* Hold a copy of the # of elements */
- spans->u.nelmts = ret_value;
+ spans->op_info[op_info_i].u.nelmts = ret_value;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
@@ -8378,7 +8379,9 @@ H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans)
op_gen = H5S__hyper_get_op_gen();
/* Count the number of elements in the span tree */
- ret_value = H5S__hyper_spans_nelem_helper(spans, op_gen);
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
+ ret_value = H5S__hyper_spans_nelem_helper(spans, 0, op_gen);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_spans_nelem() */
@@ -8808,10 +8811,8 @@ H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op,
(It can be recovered with regular selection)
USAGE
herr_t H5S__hyper_rebuild_helper(space)
- const H5S_hyper_span_t *span; IN: Portion of span tree to check
- H5S_hyper_dim_t span_slab[]; OUT: Rebuilt section of hyperslab description
- unsigned rank; IN: Current dimension to work on
- uint64_t op_gen; IN: Operation generation
+ const H5S_hyper_span_t *spans; IN: Portion of span tree to check
+ H5S_hyper_dim_t span_slab_info[]; OUT: Rebuilt section of hyperslab description
RETURNS
TRUE/FALSE for hyperslab selection rebuilt
DESCRIPTION
@@ -10833,6 +10834,7 @@ done:
--------------------------------------------------------------------------*/
static herr_t
H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
+ H5S_hyper_span_info_t *copied_span_info = NULL; /* Temporary span info pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -10852,15 +10854,15 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
/* If we will run out of elements to skip in this span,
* advance to the first not fully skipped span and break
* out of this loop (start moving downwards) */
- if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->skip %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
break;
} /* end if */
/* Skip over this entire span */
- udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
+ udata->skip -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
} /* end if */
} /* end if */
@@ -10919,15 +10921,15 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
/* If we will run out of elements to skip in this span,
* advance to the first not fully skipped span and
* continue down */
- if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
+ udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->skip %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
break;
} /* end if */
/* Skip over this entire span */
- udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
+ udata->skip -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
/* Advance to next span */
@@ -10972,27 +10974,59 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
* any complete spans, advance to the first not fully added
* span, and break out of this loop (start moving downwards)
*/
- if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
- udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
- udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
- udata->ds_span[udata->depth]->down) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
+ if(udata->nelem >= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) {
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
} /* end if */
break;
} /* end if */
/* Append span tree for entire span */
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_span[udata->depth]->high,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
} /* end if */
} /* end if */
@@ -11063,27 +11097,59 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
* span and continue down
*/
HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high);
- if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
+ if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
- if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
- udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
- udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
- udata->ds_span[udata->depth]->down) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
- udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
+ if(udata->nelem >= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) {
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ udata->ds_span[udata->depth]->down) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
+ udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
} /* end if */
break;
} /* end if */
/* Append span tree for entire span */
- if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ if(udata->share_selection) {
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
- udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
+ } /* end if */
+ else {
+ /* If we're not sharing the destination space's
+ * spans, we must copy it first (then release it
+ * afterwards) */
+ if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
+ if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
+ udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
+ udata->ds_span[udata->depth]->high,
+ copied_span_info) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end else */
+ udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
/* Advance to next span */
@@ -11128,6 +11194,13 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
udata->ps_clean_bitmap = 0;
done:
+ /* Cleanup on failure */
+ if(copied_span_info) {
+ HDassert(ret_value < 0);
+ H5S__hyper_free_span_info(copied_span_info);
+ copied_span_info = NULL;
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_proj_int_build_proj() */
@@ -11217,7 +11290,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
/* Add skipped elements if there's a pre-gap */
if(ss_low < sis_low) {
low = sis_low;
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (sis_low - ss_low), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (sis_low - ss_low), FAIL);
} /* end if */
else
low = ss_low;
@@ -11273,7 +11346,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
if(ss_span->high < sis_low) {
/* Add skipped elements */
if(ss_span->down)
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
else
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL);
@@ -11295,10 +11368,10 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
if(ss_span && !((depth == 0) && (u == count - 1))) {
/* Count remaining elements in ss_span_info */
if(ss_span->down) {
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
ss_span = ss_span->next;
while(ss_span) {
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL);
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL);
ss_span = ss_span->next;
} /* end while */
} /* end if */
@@ -11356,7 +11429,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
} /* end if */
else if(depth > 0)
/* Just count skipped elements */
- H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */
+ H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, 0, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */
/* Clean up if we are done */
if(depth == 0) {
@@ -11391,11 +11464,12 @@ done:
src_intersect_space within the selection of src_space as a selection
within the selection of dst_space
USAGE
- herr_t H5S__hyper_project_intersection(src_space,dst_space,src_intersect_space,proj_space)
+ herr_t H5S__hyper_project_intersection(src_space,dst_space,src_intersect_space,proj_space,share_selection)
H5S_t *src_space; IN: Selection that is mapped to dst_space, and intersected with src_intersect_space
H5S_t *dst_space; IN: Selection that is mapped to src_space, and which contains the result
H5S_t *src_intersect_space; IN: Selection whose intersection with src_space is projected to dst_space to obtain the result
H5S_t *proj_space; OUT: Will contain the result (intersection of src_intersect_space and src_space projected from src_space to dst_space) after the operation
+ hbool_t share_selection; IN: Whether we are allowed to share structures inside dst_space with proj_space
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
@@ -11414,7 +11488,8 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t *proj_space)
+ const H5S_t *src_intersect_space, H5S_t *proj_space,
+ hbool_t share_selection)
{
H5S_hyper_project_intersect_ud_t udata; /* User data for subroutines */
const H5S_hyper_span_info_t *ss_span_info;
@@ -11431,7 +11506,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(src_intersect_space);
HDassert(proj_space);
- /* Assert that src_space and src_intersect_space have same extent and there
+ /* Assert that src_space and src_intersect_space have same rank and there
* are no point selections */
HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space));
@@ -11485,12 +11560,14 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source intersect hyperslab selection")
/* Initialize udata */
+ /* We will use op_info[0] for nelem and op_info[1] for copied spans */
HDmemset(&udata, 0, sizeof(udata));
udata.ds_span[0] = ds_span_info->head;
udata.ds_low[0] = udata.ds_span[0]->low;
udata.ss_rank = H5S_GET_EXTENT_NDIMS(src_space);
udata.ds_rank = H5S_GET_EXTENT_NDIMS(dst_space);
udata.op_gen = H5S__hyper_get_op_gen();
+ udata.share_selection = share_selection;
/* Iterate over selections and build projected span tree */
if(H5S__hyper_proj_int_iterate(ss_span_info, src_intersect_space->select.sel_info.hslab->span_lst, 1, 0, &udata) < 0)
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index aeec566..6397f4b 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -42,11 +42,10 @@
/* Local Macros */
/****************/
#define H5S_MPIO_INITIAL_ALLOC_COUNT 256
-#define TWO_GIG_LIMIT 2147483648
-#ifndef H5S_MAX_MPI_COUNT
-#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */
-#endif
+/*******************/
+/* Local Variables */
+/*******************/
/******************/
/* Local Typedefs */
@@ -87,9 +86,7 @@ static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
static herr_t H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list);
static herr_t H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
- H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen);
-static herr_t H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
- MPI_Datatype old_type, MPI_Datatype *new_type);
+ H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen);
/*****************************/
@@ -102,40 +99,9 @@ static herr_t H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_
/*********************/
-/*******************/
-/* Local Variables */
-/*******************/
-static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
-
/* Declare a free list to manage the H5S_mpio_mpitype_node_t struct */
H5FL_DEFINE_STATIC(H5S_mpio_mpitype_node_t);
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_mpio_set_bigio_count
- *
- * Purpose: Allow us to programatically change the switch point
- * when we utilize derived datatypes. This is of
- * particular interest for allowing nightly testing
- *
- * Return: The current/previous value of bigio_count.
- *
- * Programmer: Richard Warren, March 10, 2017
- *
- *-------------------------------------------------------------------------
- */
-hsize_t
-H5S_mpio_set_bigio_count(hsize_t new_count)
-{
- hsize_t orig_count = bigio_count;
-
- if((new_count > 0) && (new_count < TWO_GIG_LIMIT))
- bigio_count = new_count;
-
- return orig_count;
-} /* end H5S_mpio_set_bigio_count() */
-
/*-------------------------------------------------------------------------
* Function: H5S__mpio_all_type
@@ -160,6 +126,7 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
hsize_t total_bytes;
hssize_t snelmts; /* Total number of elmts (signed) */
hsize_t nelmts; /* Total number of elmts */
+ hsize_t bigio_count; /* Transition point to create derived type */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -173,6 +140,7 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
total_bytes = (hsize_t)elmt_size * nelmts;
+ bigio_count = H5_mpi_get_bigio_count();
/* Verify that the size can be expressed as a 32 bit integer */
if(bigio_count >= total_bytes) {
@@ -183,7 +151,7 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
} /* end if */
else {
/* Create a LARGE derived datatype for this transfer */
- if(H5S__mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0)
+ if(H5_mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large datatype from the all selection")
*count = 1;
*is_derived_type = TRUE;
@@ -250,6 +218,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
int *blocks = NULL; /* Array of block sizes for MPI hindexed create call */
hsize_t u; /* Local index variable */
#endif
+ hsize_t bigio_count; /* Transition point to create derived type */
int mpi_code; /* MPI error code */
herr_t ret_value = SUCCEED; /* Return value */
@@ -260,6 +229,8 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
elmt_type_created = TRUE;
+ bigio_count = H5_mpi_get_bigio_count();
+
/* Check whether standard or BIGIO processing will be employeed */
if(bigio_count >= num_points) {
#if MPI_VERSION >= 3
@@ -322,8 +293,8 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
for(i = 0; i < num_big_types; i++) {
#if MPI_VERSION >= 3
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count,
- 1, &disp[i*bigio_count], elmt_type, &inner_types[i])))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)bigio_count,
+ 1, &disp[(hsize_t)i*bigio_count], elmt_type, &inner_types[i])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code)
#else
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count,
@@ -337,7 +308,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
if(remaining_points) {
#if MPI_VERSION >= 3
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points,
- 1, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
+ 1, &disp[(hsize_t)num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code)
#else
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points,
@@ -432,8 +403,11 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ
curr = space->select.sel_info.pnt_lst->head;
for(u = 0 ; u < num_points ; u++) {
/* Calculate the displacement of the current point */
- disp[u] = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt);
- disp[u] *= elmt_size;
+ hsize_t disp_tmp = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt);
+ if(disp_tmp > LONG_MAX) /* Maximum value of type long */
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "disp overflow")
+ disp[u] = (MPI_Aint)disp_tmp;
+ disp[u] *= (MPI_Aint)elmt_size;
/* This is a File Space used to set the file view, so adjust the displacements
* to have them monotonically non-decreasing.
@@ -452,7 +426,7 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ
*/
if(do_permute) {
if(u > 0 && disp[u] < disp[u - 1]) {
- unsigned s = 0, l = u, m = u / 2;
+ hsize_t s = 0, l = u, m = u / 2;
*is_permuted = TRUE;
do {
@@ -518,7 +492,7 @@ done:
* selection and so the memory datatype has to be permuted using the
* permutation map created by the file selection.
*
- * Note: This routine is called from H5S_mpio_space_type(), which is
+ * Note: This routine is called from H5_mpio_space_type(), which is
* called first for the file dataspace and creates
*
* Return: Non-negative on success, negative on failure.
@@ -594,7 +568,9 @@ H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
/* Loop, while bytes left in sequence */
while(curr_len > 0) {
/* Set the displacement of the current point */
- disp[u] = curr_off;
+ if(curr_off > LONG_MAX)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "curr_off overflow")
+ disp[u] = (MPI_Aint)curr_off;
/* This is a memory displacement, so for each point selected,
* apply the map that was generated by the file selection */
@@ -678,6 +654,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
hsize_t count;
} d[H5S_MAX_RANK];
+ hsize_t bigio_count; /* Transition point to create derived type */
hsize_t offset[H5S_MAX_RANK];
hsize_t max_xtent[H5S_MAX_RANK];
H5S_hyper_dim_t *diminfo; /* [rank] */
@@ -696,6 +673,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
HDassert(space);
HDassert(sizeof(MPI_Aint) >= sizeof(elmt_size));
+ bigio_count = H5_mpi_get_bigio_count();
/* Initialize selection iterator */
if(H5S_select_iter_init(&sel_iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
@@ -824,7 +802,7 @@ if(H5DEBUG(S)) {
} /* end if */
else
/* Create the compound datatype for this operation (> 2GB) */
- if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0)
+ if(H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large inner datatype in hyper selection")
/*******************************************************
@@ -878,7 +856,7 @@ if(H5DEBUG(S))
* Again we need to check that the number of BLOCKS can fit into
* a 32 bit integer */
if(bigio_count < d[i].block) {
- if(H5S__mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0)
+ if(H5_mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large block datatype in hyper selection")
} /* end if */
else
@@ -899,7 +877,7 @@ if(H5DEBUG(S))
* we call the large type creation function to handle that
*/
if(bigio_count < d[i].count) {
- if(H5S__mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0)
+ if(H5_mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large outer datatype in hyper selection")
} /* end if */
/* otherwise a regular create_hvector will do */
@@ -920,8 +898,14 @@ if(H5DEBUG(S))
****************************************/
/* Calculate start and extent values of this dimension */
- start_disp = d[i].start * offset[i] * elmt_size;
- new_extent = (MPI_Aint)elmt_size * max_xtent[i];
+ /* Check if value overflow to cast to type MPI_Aint */
+ if(d[i].start > LONG_MAX || offset[i] > LONG_MAX || elmt_size > LONG_MAX)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow")
+ start_disp = (MPI_Aint)d[i].start * (MPI_Aint)offset[i] * (MPI_Aint)elmt_size;
+
+ if(max_xtent[i] > LONG_MAX)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "max_xtent overflow")
+ new_extent = (MPI_Aint)elmt_size * (MPI_Aint)max_xtent[i];
if(MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code)
@@ -1001,6 +985,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype elmt_type; /* MPI datatype for an element */
hbool_t elmt_type_is_derived = FALSE; /* Whether the element type has been created */
MPI_Datatype span_type; /* MPI datatype for overall span tree */
+ hsize_t bigio_count; /* Transition point to create derived type */
hsize_t down[H5S_MAX_RANK]; /* 'down' sizes for each dimension */
uint64_t op_gen; /* Operation generation value */
int mpi_code; /* MPI return code */
@@ -1014,13 +999,14 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
HDassert(space->select.sel_info.hslab->span_lst);
HDassert(space->select.sel_info.hslab->span_lst->head);
+ bigio_count = H5_mpi_get_bigio_count();
/* Create the base type for an element */
if(bigio_count >= elmt_size) {
if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
} /* end if */
else
- if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0)
+ if(H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
elmt_type_is_derived = TRUE;
@@ -1032,8 +1018,10 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
op_gen = H5S__hyper_get_op_gen();
/* Obtain derived MPI data type */
+ /* Always use op_info[0] since we own this op_info, so there can be no
+ * simultaneous operations */
type_list.head = type_list.tail = NULL;
- if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, op_gen) < 0)
+ if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, 0, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
if(MPI_SUCCESS != (mpi_code = MPI_Type_dup(span_type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
@@ -1121,11 +1109,13 @@ done:
static herr_t
H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
- H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen)
+ H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span to iterate with */
+ hsize_t bigio_count; /* Transition point to create derived type */
+
size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */
- size_t outercount; /* Number of span tree nodes at this level */
+ size_t outercount = 0; /* Number of span tree nodes at this level */
MPI_Datatype *inner_type = NULL;
hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */
int *blocklen = NULL;
@@ -1140,8 +1130,9 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
HDassert(spans);
HDassert(type_list);
+ bigio_count = H5_mpi_get_bigio_count();
/* Check if we've visited this span tree before */
- if(spans->op_gen != op_gen) {
+ if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_mpio_mpitype_node_t *type_node; /* Pointer to new node in MPI data type list */
/* Allocate the initial displacement & block length buffers */
@@ -1181,11 +1172,11 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
nelmts = (span->high - span->low) + 1;
/* Store displacement & block length */
- disp[outercount] = (MPI_Aint)elmt_size * span->low;
+ disp[outercount] = (MPI_Aint)elmt_size * (MPI_Aint)span->low;
H5_CHECK_OVERFLOW(nelmts, hsize_t, int)
blocklen[outercount] = (int)nelmts;
- if(bigio_count < blocklen[outercount])
+ if(bigio_count < (hsize_t)blocklen[outercount])
large_block = TRUE; /* at least one block type is large, so set this flag to true */
span = span->next;
@@ -1194,7 +1185,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Everything fits into integers, so cast them and use hindexed */
if(bigio_count >= outercount && large_block == FALSE) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->u.down_type)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->op_info[op_info_i].u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
} /* end if */
else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
@@ -1202,8 +1193,8 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
MPI_Datatype temp_type = MPI_DATATYPE_NULL;
/* create the block type from elmt_type while checking the 32 bit int limit */
- if(blocklen[u] > bigio_count) {
- if(H5S__mpio_create_large_type(blocklen[u], 0, *elmt_type, &temp_type) < 0)
+ if((hsize_t)(blocklen[u]) > bigio_count) {
+ if(H5_mpio_create_large_type((hsize_t)blocklen[u], 0, *elmt_type, &temp_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
} /* end if */
else
@@ -1212,17 +1203,17 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Combine the current datatype that is created with this current block type */
if(0 == u) /* first iteration, there is no combined datatype yet */
- spans->u.down_type = temp_type;
+ spans->op_info[op_info_i].u.down_type = temp_type;
else {
int bl[2] = {1, 1};
MPI_Aint ds[2] = {disp[u - 1], disp[u]};
- MPI_Datatype dt[2] = {spans->u.down_type, temp_type};
+ MPI_Datatype dt[2] = {spans->op_info[op_info_i].u.down_type, temp_type};
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, /* count */
bl, /* blocklength */
ds, /* stride in bytes*/
dt, /* old type */
- &spans->u.down_type))) /* new type */
+ &spans->op_info[op_info_i].u.down_type))) /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Release previous temporary datatype */
@@ -1239,7 +1230,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
/* Calculate the total bytes of the lower dimension */
- stride = (*down) * elmt_size;
+ stride = (MPI_Aint)(*down) * (MPI_Aint)elmt_size;
/* Loop over span nodes */
outercount = 0;
@@ -1271,11 +1262,11 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Displacement should be in byte and should have dimension information */
/* First using MPI Type vector to build derived data type for this span only */
/* Need to calculate the disp in byte for this dimension. */
- disp[outercount] = span->low * stride;
+ disp[outercount] = (MPI_Aint)span->low * stride;
blocklen[outercount] = 1;
/* Generate MPI datatype for next dimension down */
- if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_gen) < 0)
+ if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_info_i, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
/* Compute the number of elements to attempt in this span */
@@ -1292,7 +1283,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Building the whole vector datatype */
H5_CHECK_OVERFLOW(outercount, size_t, int)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->u.down_type)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->op_info[op_info_i].u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Release inner node types */
@@ -1307,7 +1298,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate MPI data type list node")
/* Set up MPI type node */
- type_node->type = spans->u.down_type;
+ type_node->type = spans->op_info[op_info_i].u.down_type;
type_node->next = NULL;
/* Add MPI type node to list */
@@ -1319,11 +1310,11 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
} /* end else */
/* Remember that we've visited this span tree */
- spans->op_gen = op_gen;
+ spans->op_info[op_info_i].op_gen = op_gen;
} /* end else */
/* Return MPI data type for span tree */
- *span_type = spans->u.down_type;
+ *span_type = spans->op_info[op_info_i].u.down_type;
done:
/* General cleanup */
@@ -1453,113 +1444,5 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_mpio_space_type() */
-
-/*-------------------------------------------------------------------------
- * Function: H5S__mpio_create_large_type
- *
- * Purpose: Create a large datatype of size larger than what a 32 bit integer
- * can hold.
- *
- * Return: Non-negative on success, negative on failure.
- *
- * *new_type the new datatype created
- *
- * Programmer: Mohamad Chaarawi
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
- MPI_Datatype old_type, MPI_Datatype *new_type)
-{
- int num_big_types; /* num times the 2G datatype will be repeated */
- int remaining_bytes; /* the number of bytes left that can be held in an int value */
- hsize_t leftover;
- int block_len[2];
- int mpi_code; /* MPI return code */
- MPI_Datatype inner_type, outer_type, leftover_type, type[2];
- MPI_Aint disp[2], old_extent;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Calculate how many Big MPI datatypes are needed to represent the buffer */
- num_big_types = (int)(num_elements/bigio_count);
- leftover = num_elements - num_big_types * (hsize_t)bigio_count;
- H5_CHECKED_ASSIGN(remaining_bytes, int, leftover, hsize_t);
-
- /* Create a contiguous datatype of size equal to the largest
- * number that a 32 bit integer can hold x size of old type.
- * If the displacement is 0, then the type is contiguous, otherwise
- * use type_hvector to create the type with the displacement provided
- */
- if (0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count, old_type, &inner_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- } /* end if */
- else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(bigio_count, 1, stride_bytes, old_type, &inner_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
-
- /* Create a contiguous datatype of the buffer (minus the remaining < 2GB part)
- * If a stride is present, use hvector type
- */
- if(0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types, inner_type, &outer_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- } /* end if */
- else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(num_big_types, 1, stride_bytes, inner_type, &outer_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
-
- MPI_Type_free(&inner_type);
-
- /* If there is a remaining part create a contiguous/vector datatype and then
- * use a struct datatype to encapsulate everything.
- */
- if(remaining_bytes) {
- if(stride_bytes == 0) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(remaining_bytes, old_type, &leftover_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- } /* end if */
- else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)(num_elements - (hsize_t)num_big_types * bigio_count), 1, stride_bytes, old_type, &leftover_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
-
- /* 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;
- type[1] = leftover_type;
- block_len[0] = 1;
- block_len[1] = 1;
- disp[0] = 0;
- disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count;
-
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
-
- MPI_Type_free(&outer_type);
- MPI_Type_free(&leftover_type);
- } /* end if */
- else
- /* There are no remaining bytes so just set the new type to
- * the outer type created */
- *new_type = outer_type;
-
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S__mpio_create_large_type() */
-
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index c262d18..0949b2a 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -66,6 +66,7 @@ static htri_t H5S__none_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__none_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__none_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space,
hsize_t *offset);
@@ -113,6 +114,7 @@ const H5S_select_class_t H5S_sel_none[1] = {{
H5S__none_shape_same,
H5S__none_intersect_block,
H5S__none_adjust_u,
+ H5S__none_adjust_s,
H5S__none_project_scalar,
H5S__none_project_simple,
H5S__none_iter_init,
@@ -954,6 +956,37 @@ H5S__none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *of
} /* end H5S__none_adjust_u() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__none_adjust_s
+ PURPOSE
+ Adjust an "none" selection by subtracting an offset
+ USAGE
+ herr_t H5S__none_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__none_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *offset)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(offset);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__none_adjust_s() */
+
+
/*-------------------------------------------------------------------------
* Function: H5S__none_project_scalar
*
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 278f08d..e139bce 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -41,9 +41,10 @@
#define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR)
/* Versions for H5S_SEL_HYPER selection info */
-#define H5S_HYPER_VERSION_1 1
-#define H5S_HYPER_VERSION_2 2
-#define H5S_HYPER_VERSION_3 3
+#define H5S_HYPER_VERSION_1 1
+#define H5S_HYPER_VERSION_2 2
+#define H5S_HYPER_VERSION_3 3
+#define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3
/* Versions for H5S_SEL_POINTS selection info */
#define H5S_POINT_VERSION_1 1
@@ -147,6 +148,21 @@ struct H5S_hyper_span_t {
struct H5S_hyper_span_t *next; /* Pointer to next span in list */
};
+/* "Operation info" struct. Used to hold temporary information during copies,
+ * 'adjust', 'nelem', and 'rebuild' operations, and higher level algorithms that
+ * generate this information. */
+typedef struct H5S_hyper_op_info_t {
+ uint64_t op_gen; /* Generation of the scratch info */
+ union {
+ struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
+ hsize_t nelmts; /* # of elements */
+ hsize_t nblocks; /* # of blocks */
+#ifdef H5_HAVE_PARALLEL
+ MPI_Datatype down_type; /* MPI datatype for span tree */
+#endif /* H5_HAVE_PARALLEL */
+ }u;
+} H5S_hyper_op_info_t;
+
/* Information about a list of hyperslab spans in one dimension (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_info_t {
unsigned count; /* Ref. count of number of spans which share this span */
@@ -165,17 +181,10 @@ struct H5S_hyper_span_info_t {
hsize_t *low_bounds; /* The smallest element selected in each dimension */
hsize_t *high_bounds; /* The largest element selected in each dimension */
- /* "Operation generation" fields */
+ /* "Operation info" fields */
/* (Used during copies, 'adjust', 'nelem', and 'rebuild' operations) */
- uint64_t op_gen; /* Generation of the scratch info */
- union {
- struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
- hsize_t nelmts; /* # of elements */
- hsize_t nblocks; /* # of blocks */
-#ifdef H5_HAVE_PARALLEL
- MPI_Datatype down_type; /* MPI datatype for span tree */
-#endif /* H5_HAVE_PARALLEL */
- }u;
+ /* Currently the maximum number of simultaneous operations is 2 */
+ H5S_hyper_op_info_t op_info[2];
struct H5S_hyper_span_t *head; /* Pointer to the first span of list of spans in the current dimension */
struct H5S_hyper_span_t *tail; /* Pointer to the last span of list of spans in the current dimension */
@@ -253,6 +262,8 @@ typedef htri_t (*H5S_sel_shape_same_func_t)(const H5S_t *space1, const H5S_t *sp
typedef htri_t (*H5S_sel_intersect_block_func_t)(const H5S_t *space, const hsize_t *start, const hsize_t *end);
/* Method to adjust a selection by an offset */
typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
+/* Method to adjust a selection by an offset (signed) */
+typedef herr_t (*H5S_sel_adjust_s_func_t)(H5S_t *space, const hssize_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 */
@@ -281,6 +292,7 @@ typedef struct {
H5S_sel_shape_same_func_t shape_same; /* Method to determine if two dataspaces' selections are the same shape */
H5S_sel_intersect_block_func_t intersect_block; /* Method to determine if a dataspaces' selection intersects a block */
H5S_sel_adjust_u_func_t adjust_u; /* Method to adjust a selection by an offset */
+ H5S_sel_adjust_s_func_t adjust_s; /* Method to adjust a selection by an offset (signed) */
H5S_sel_project_scalar project_scalar; /* Method to construct scalar dataspace projection */
H5S_sel_project_simple project_simple; /* Method to construct simple dataspace projection */
H5S_sel_iter_init_func_t iter_init; /* Method to initialize iterator for current selection */
@@ -377,7 +389,8 @@ H5_DLL uint64_t H5S__hyper_get_op_gen(void);
H5_DLL void H5S__hyper_rebuild(H5S_t *space);
H5_DLL herr_t H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
- const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
+ const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space,
+ hbool_t share_space);
/* Testing functions */
#ifdef H5S_TESTING
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index ea6c9c5..721211e 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -78,7 +78,8 @@ static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2);
static htri_t H5S__point_intersect_block(const H5S_t *space, const hsize_t *start,
const hsize_t *end);
static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__point_adjust_s(H5S_t *space, const hssize_t *offset);
+static herr_t H5S__point_project_scalar(const H5S_t *spasce, hsize_t *offset);
static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space,
hsize_t *offset);
static herr_t H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
@@ -128,6 +129,7 @@ const H5S_select_class_t H5S_sel_point[1] = {{
H5S__point_shape_same,
H5S__point_intersect_block,
H5S__point_adjust_u,
+ H5S__point_adjust_s,
H5S__point_project_scalar,
H5S__point_project_simple,
H5S__point_iter_init,
@@ -2078,6 +2080,7 @@ done:
static herr_t
H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
{
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
unsigned u; /* Local index variable */
@@ -2087,31 +2090,110 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(space);
HDassert(offset);
- /* Iterate through the nodes, checking the bounds on each element */
- node = space->select.sel_info.pnt_lst->head;
- rank = space->extent.rank;
- while(node) {
- /* Adjust each coordinate for point node */
- for(u = 0; u < rank; u++) {
- /* Check for offset moving selection negative */
- HDassert(node->pnt[u] >= offset[u]);
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
+
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset) {
+ /* Iterate through the nodes, checking the bounds on each element */
+ node = space->select.sel_info.pnt_lst->head;
+ rank = space->extent.rank;
+ while(node) {
+ /* Adjust each coordinate for point node */
+ for(u = 0; u < rank; u++) {
+ /* Check for offset moving selection negative */
+ HDassert(node->pnt[u] >= offset[u]);
+
+ /* Adjust node's coordinate location */
+ node->pnt[u] -= offset[u];
+ } /* end for */
+
+ /* Advance to next point node in selection */
+ node = node->next;
+ } /* end while */
- /* Adjust node's coordinate location */
- node->pnt[u] -= offset[u];
+ /* update the bound box of the selection */
+ for(u = 0; u < rank; u++) {
+ space->select.sel_info.pnt_lst->low_bounds[u] -= offset[u];
+ space->select.sel_info.pnt_lst->high_bounds[u] -= offset[u];
} /* end for */
+ } /* end if */
- /* Advance to next point node in selection */
- node = node->next;
- } /* end while */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__point_adjust_u() */
- /* update the bound box of the selection */
- for(u = 0; u < rank; u++) {
- space->select.sel_info.pnt_lst->low_bounds[u] -= offset[u];
- space->select.sel_info.pnt_lst->high_bounds[u] -= offset[u];
- } /* end for */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S__point_adjust_s
+ PURPOSE
+ Adjust a "point" selection by subtracting an offset
+ USAGE
+ herr_t H5S__point_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a point selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S__point_adjust_s(H5S_t *space, const hssize_t *offset)
+{
+ hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
+ H5S_pnt_node_t *node; /* Point node */
+ unsigned rank; /* Dataspace rank */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDassert(space);
+ HDassert(offset);
+
+ /* Check for an all-zero offset vector */
+ for(u = 0; u < space->extent.rank; u++)
+ if(0 != offset[u]) {
+ non_zero_offset = TRUE;
+ break;
+ } /* end if */
+
+ /* Only perform operation if the offset is non-zero */
+ if(non_zero_offset) {
+ /* Iterate through the nodes, checking the bounds on each element */
+ node = space->select.sel_info.pnt_lst->head;
+ rank = space->extent.rank;
+ while(node) {
+ /* Adjust each coordinate for point node */
+ for(u = 0; u < rank; u++) {
+ /* Check for offset moving selection negative */
+ HDassert((hssize_t)node->pnt[u] >= offset[u]);
+
+ /* Adjust node's coordinate location */
+ node->pnt[u] = (hsize_t)((hssize_t)node->pnt[u] - offset[u]);
+ } /* end for */
+
+ /* Advance to next point node in selection */
+ node = node->next;
+ } /* end while */
+
+ /* update the bound box of the selection */
+ for(u = 0; u < rank; u++) {
+ HDassert((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] >= offset[u]);
+ space->select.sel_info.pnt_lst->low_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] - offset[u]);
+ space->select.sel_info.pnt_lst->high_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->high_bounds[u] - offset[u]);
+ } /* end for */
+ } /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__point_adjust_u() */
+} /* end H5S__point_adjust_s() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 0a9d2e7..a61c505 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -145,6 +145,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_IS_SINGLE(S) ((*(S)->select.type->is_single)(S))
#define H5S_SELECT_IS_REGULAR(S) ((*(S)->select.type->is_regular)(S))
#define H5S_SELECT_ADJUST_U(S,O) ((*(S)->select.type->adjust_u)(S, O))
+#define H5S_SELECT_ADJUST_S(S,O) ((*(S)->select.type->adjust_s)(S, O))
#define H5S_SELECT_PROJECT_SCALAR(S,O) ((*(S)->select.type->project_scalar)(S, O))
#define H5S_SELECT_PROJECT_SIMPLE(S,NS, O) ((*(S)->select.type->project_simple)(S, NS, O))
#define H5S_SELECT_ITER_COORDS(ITER,COORDS) ((*(ITER)->type->iter_coords)(ITER,COORDS))
@@ -170,6 +171,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_IS_SINGLE(S) (H5S_select_is_single(S))
#define H5S_SELECT_IS_REGULAR(S) (H5S_select_is_regular(S))
#define H5S_SELECT_ADJUST_U(S,O) (H5S_select_adjust_u(S, O))
+#define H5S_SELECT_ADJUST_S(S,O) (H5S_select_adjust_s(S, O))
#define H5S_SELECT_PROJECT_SCALAR(S,O) (H5S_select_project_scalar(S, O))
#define H5S_SELECT_PROJECT_SIMPLE(S,NS,O) (H5S_select_project_simple(S, NS, O))
#define H5S_SELECT_ITER_COORDS(ITER,COORDS) (H5S_select_iter_coords(ITER,COORDS))
@@ -236,7 +238,7 @@ H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *spac
H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size,
const H5S_t *space, void *buf);
H5_DLL htri_t H5S_select_valid(const H5S_t *space);
-H5_DLL hssize_t H5S_get_select_npoints(const H5S_t *space);
+H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space);
H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset);
H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space);
@@ -257,11 +259,12 @@ 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 herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
+H5_DLL herr_t H5S_select_adjust_s(H5S_t *space, const hssize_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,
const H5S_t *dst_space, const H5S_t *src_intersect_space,
- H5S_t **new_space_ptr);
+ H5S_t **new_space_ptr, hbool_t share_space);
H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space);
/* Operations on all selections */
@@ -282,7 +285,6 @@ H5_DLL herr_t H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op,
const hsize_t *block, H5S_t **new_space);
H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
const hsize_t *coords);
-H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
H5_DLL herr_t H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset);
H5_DLL herr_t H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size);
@@ -307,7 +309,6 @@ H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_sel_iter_close(H5S_sel_iter_t *sel_iter);
#ifdef H5_HAVE_PARALLEL
-H5_DLL hsize_t H5S_mpio_set_bigio_count(hsize_t new_count);
H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size,
/* out: */ MPI_Datatype *new_type,
int *count,
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index a04f3c1..f7c5ae7 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -143,7 +143,7 @@ H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
-H5_DLL herr_t H5Sselect_adjust_u(hid_t spaceid, const hsize_t *offset);
+H5_DLL herr_t H5Sselect_adjust(hid_t spaceid, const hssize_t *offset);
H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
hsize_t end[]);
H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id);
@@ -171,7 +171,8 @@ H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
hsize_t numblocks, hsize_t buf[/*numblocks*/]);
-H5_DLL herr_t H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset);
+H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id,
+ hid_t dst_space_id, hid_t src_intersect_space_id);
/* Operations on dataspace selection iterators */
H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 1a13f2c..13233ce 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -431,7 +431,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-H5_ATTR_PURE hssize_t
+H5_ATTR_PURE hsize_t
H5S_get_select_npoints(const H5S_t *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -439,7 +439,7 @@ H5S_get_select_npoints(const H5S_t *space)
/* Check args */
HDassert(space);
- FUNC_LEAVE_NOAPI((hssize_t)space->select.num_elem)
+ FUNC_LEAVE_NOAPI(space->select.num_elem)
} /* end H5S_get_select_npoints() */
@@ -947,8 +947,6 @@ H5S_select_is_regular(const H5S_t *space)
herr_t
H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
{
- hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -957,23 +955,55 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(space);
HDassert(offset);
- /* Check for an all-zero offset vector */
- for(u = 0; u < space->extent.rank; u++)
- if(0 != offset[u]) {
- non_zero_offset = TRUE;
- break;
- } /* end if */
-
- /* Only perform operation if the offset is non-zero */
- if(non_zero_offset)
- ret_value = (*space->select.type->adjust_u)(space, offset);
+ /* Perform operation */
+ ret_value = (*space->select.type->adjust_u)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_adjust_u() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_select_adjust_s
+ PURPOSE
+ Adjust a selection by subtracting an offset
+ USAGE
+ herr_t H5S_select_adjust_u(space, offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hssize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_select_adjust_s(H5S_t *space, const hssize_t *offset)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check args */
+ HDassert(space);
+ HDassert(offset);
+
+ /* Perform operation */
+ ret_value = (*space->select.type->adjust_s)(space, offset);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_select_adjust_s() */
+
+
/*--------------------------------------------------------------------------
NAME
- H5Sselect_adjust_u
+ H5Sselect_adjust
PURPOSE
Adjust a selection by subtracting an offset
USAGE
@@ -990,25 +1020,35 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sselect_adjust_u(hid_t space_id, const hsize_t *offset)
+H5Sselect_adjust(hid_t space_id, const hssize_t *offset)
{
H5S_t *space;
+ hsize_t low_bounds[H5S_MAX_RANK];
+ hsize_t high_bounds[H5S_MAX_RANK];
+ unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*h", space_id, offset);
+ H5TRACE2("e", "i*Hs", space_id, offset);
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
if(NULL == offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer")
- if(H5S_select_adjust_u(space, offset) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection");
+ /* Check bounds */
+ if(H5S_SELECT_BOUNDS(space, low_bounds, high_bounds) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
+ for(u = 0; u < space->extent.rank; u++)
+ if(offset[u] > (hssize_t)low_bounds[u])
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjustment would move selection below zero offset")
+
+ if(H5S_select_adjust_s(space, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sselect_adjust_u() */
+} /* end H5Sselect_adjust() */
/*--------------------------------------------------------------------------
@@ -2533,11 +2573,12 @@ done:
within the selection of dst_space
USAGE
- herr_t H5S_select_project_intersection(src_space,dst_space,src_intersect_space,proj_space)
+ herr_t H5S_select_project_intersection(src_space,dst_space,src_intersect_space,proj_space,share_selection)
H5S_t *src_space; IN: Selection that is mapped to dst_space, and intersected with src_intersect_space
- H5S_t *dst_space; IN: Selection that is mapped to src_space, and which contains the result
+ H5S_t *dst_space; IN: Selection that is mapped to src_space
H5S_t *src_intersect_space; IN: Selection whose intersection with src_space is projected to dst_space to obtain the result
H5S_t **new_space_ptr; OUT: Will contain the result (intersection of src_intersect_space and src_space projected from src_space to dst_space) after the operation
+ hbool_t share_selection; IN: Whether we are allowed to share structures inside dst_space with proj_space
RETURNS
Non-negative on success/Negative on failure.
@@ -2555,9 +2596,15 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t **new_space_ptr)
+ const H5S_t *src_intersect_space, H5S_t **new_space_ptr,
+ hbool_t share_selection)
{
- H5S_t *new_space = NULL; /* New dataspace constructed */
+ H5S_t *new_space = NULL; /* New dataspace constructed */
+ H5S_t *tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */
+ H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */
+ hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */
+ H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */
+ hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2567,6 +2614,13 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(dst_space);
HDassert(src_intersect_space);
HDassert(new_space_ptr);
+ HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space));
+ HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
+
+ if(NULL == (ss_iter = H5FL_CALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+ if(NULL == (ds_iter = H5FL_CALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Create new space, using dst extent. Start with "all" selection. */
if(NULL == (new_space = H5S_create(H5S_SIMPLE)))
@@ -2576,7 +2630,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* If the intersecting space is "all", the intersection must be equal to the
* source space and the projection must be equal to the destination space */
- if(src_intersect_space->select.type->type == H5S_SEL_ALL) {
+ if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_ALL) {
/* Copy the destination selection. */
if(H5S_select_copy(new_space, dst_space, FALSE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection")
@@ -2590,20 +2644,136 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if(H5S_select_none(new_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
} /* end if */
- /* If any of the spaces use point selection, fall back to general algorithm */
- else if((src_intersect_space->select.type->type == H5S_SEL_POINTS)
- || (src_space->select.type->type == H5S_SEL_POINTS)
- || (dst_space->select.type->type == H5S_SEL_POINTS))
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
else {
- HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS);
- HDassert(src_space->select.type->type != H5S_SEL_NONE);
- HDassert(dst_space->select.type->type != H5S_SEL_NONE);
-
- /* Intersecting space is hyperslab selection. Call the hyperslab
- * routine to project to another hyperslab selection. */
- if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab ondot destination selection")
+ /* Handle scalar dataspaces. It should not be possible for the source
+ * intersect space or the source space to be scalar since scalar spaces
+ * only support all or none selections, and both of those cases are
+ * covered above, and the source intersect space must have the same
+ * rank, so it also cannot be scalar, as scalar dataspaces have a rank
+ * of 0. */
+ HDassert(H5S_GET_EXTENT_TYPE(src_space) != H5S_SCALAR);
+ HDassert(H5S_GET_EXTENT_TYPE(src_intersect_space) != H5S_SCALAR);
+
+ /* Check for scalar dst_space. In this case we simply check if the
+ * (single) point selected in src_space intersects src_intersect_space,
+ * if so select all in new_space, otherwise select none. */
+ if(H5S_GET_EXTENT_TYPE(dst_space) == H5S_SCALAR) {
+ hsize_t coords_start[H5S_MAX_RANK];
+ hsize_t coords_end[H5S_MAX_RANK];
+ htri_t intersect;
+
+ /* Get source space bounds. Should be a single point. */
+ if(H5S_SELECT_BOUNDS(src_space, coords_start, coords_end) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source space bounds")
+ HDassert(0 == HDmemcmp(coords_start, coords_end, H5S_GET_EXTENT_NDIMS(src_space) * sizeof(coords_start[0])));
+
+ /* Check for intersection */
+ if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords_start, coords_end)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection")
+
+ /* Select all or none as appropriate */
+ if(intersect) {
+ if(H5S_select_all(new_space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't select all")
+ } /* end if */
+ else
+ if(H5S_select_none(new_space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+ } /* end if */
+ else {
+ /* If the source intersect space is a point selection, convert it to a
+ * hyperslab (discarding ordering). We can get away with this because
+ * the order does not matter for the source intersect space */
+ /* Maybe we should just leave it as a point selection for the point by
+ * point algorithm? The search through the selection in
+ * H5S_SELECT_INTERSECT_BLOCK will likely be O(N) either way. -NAF */
+ if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_POINTS) {
+ H5S_pnt_node_t *curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head;
+
+ /* Create dataspace and copy extent */
+ if(NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create temporary source intersect dataspace")
+ if(H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy source intersect space extent")
+
+ /* Iterate over points */
+ for(curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; curr_pnt = curr_pnt->next)
+ /* Add point to hyperslab selection */
+ if(H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to temporary dataspace selection")
+
+ /* Redirect local src_intersect_space pointer (will not affect
+ * calling function) */
+ src_intersect_space = tmp_src_intersect_space;
+ } /* end for */
+
+ /* By this point, src_intersect_space must be a hyperslab selection */
+ HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS);
+
+ /* If either the source space or the destination space is a point
+ * selection, iterate element by element */
+ if((H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_POINTS)
+ || (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_POINTS)) {
+ hsize_t coords[H5S_MAX_RANK];
+ htri_t intersect;
+
+ /* Start with "none" selection */
+ if(H5S_select_none(new_space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+
+ /* Initialize iterators */
+ if(H5S_select_iter_init(ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator")
+ ss_iter_init = TRUE;
+ if(H5S_select_iter_init(ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator")
+ ds_iter_init = TRUE;
+
+ /* Iterate over points */
+ do {
+ HDassert(ss_iter->elmt_left > 0);
+ HDassert(ss_iter->elmt_left > 0);
+
+ /* Get SS coords */
+ if(H5S_SELECT_ITER_COORDS(ss_iter, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates")
+
+ /* Check for intersection */
+ if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection")
+
+ /* Add point if it intersects */
+ if(intersect) {
+ /* Get DS coords */
+ if(H5S_SELECT_ITER_COORDS(ds_iter, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates")
+
+ /* Add point to new_space */
+ if(H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to new selection")
+ } /* end if */
+
+ /* Advance iterators */
+ if(H5S_SELECT_ITER_NEXT(ss_iter, 1) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator")
+ ss_iter->elmt_left--;
+ if(H5S_SELECT_ITER_NEXT(ds_iter, 1) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator")
+ ds_iter->elmt_left--;
+ } while(ss_iter->elmt_left > 0);
+ HDassert(H5S_SELECT_ITER_NELMTS(ds_iter) == 0);
+ } /* end if */
+ else {
+ HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE);
+ HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE);
+
+ /* Source and destination selections are all or hyperslab,
+ * intersecting selection is hyperslab. Call the hyperslab routine
+ * to project to another hyperslab selection. */
+ if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection")
+ } /* end else */
+ } /* end else */
} /* end else */
/* load the address of the new space into *new_space_ptr */
@@ -2615,12 +2785,100 @@ done:
if(new_space && H5S_close(new_space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ /* General cleanup */
+ if(tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace")
+ if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator")
+ if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator")
+
+ ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter);
+ ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_project_intersection() */
/*--------------------------------------------------------------------------
NAME
+ H5Sselect_project_intersection
+
+ PURPOSE
+ Projects the intersection of of the selections of src_space_id and
+ src_intersect_space_id within the selection of src_space_id as a
+ selection within the selection of dst_space_id.
+
+ USAGE
+ hid_t H5Sselect_project_intersection(src_space_id,dst_space_d,src_intersect_space_id)
+ hid_t src_space_id; IN: Selection that is mapped to dst_space_id, and intersected with src_intersect_space_id
+ hid_t dst_space_id; IN: Selection that is mapped to src_space_id
+ hid_t src_intersect_space_id; IN: Selection whose intersection with src_space_id is projected to dst_space_id to obtain the result
+
+ RETURNS
+ A dataspace with a selection equal to the intersection of
+ src_intersect_space_id and src_space_id projected from src_space to
+ dst_space on success, negative on failure.
+
+ DESCRIPTION
+ Projects the intersection of of the selections of src_space and
+ src_intersect_space within the selection of src_space as a selection
+ within the selection of dst_space. The result is placed in the
+ selection of new_space_ptr.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+hid_t
+H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id,
+ hid_t src_intersect_space_id)
+{
+ H5S_t *src_space, *dst_space, *src_intersect_space; /* Input dataspaces */
+ H5S_t *proj_space = NULL; /* Output dataspace */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("i", "iii", src_space_id, dst_space_id, src_intersect_space_id);
+
+ /* Check args */
+ if(NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Check numbers of points selected matches in source and destination */
+ if(H5S_GET_SELECT_NPOINTS(src_space) != H5S_GET_SELECT_NPOINTS(dst_space))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "number of points selected in source space does not match that in destination space")
+
+ /* Check numbers of dimensions matches in source and source intersect spaces
+ */
+ if(H5S_GET_EXTENT_NDIMS(src_space) != H5S_GET_EXTENT_NDIMS(src_intersect_space))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "rank of source space does not match rank of source intersect space")
+
+ /* Perform operation */
+ if(H5S_select_project_intersection(src_space, dst_space,
+ src_intersect_space, &proj_space, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection")
+
+ /* Atomize */
+ if((ret_value = H5I_register(H5I_DATASPACE, proj_space, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+
+done:
+ if(ret_value < 0)
+ if(proj_space && H5S_close(proj_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Sselect_project_intersection() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S_select_subtract
PURPOSE
@@ -2836,7 +3094,7 @@ H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes,
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "length array pointer is NULL")
/* Get the sequences of bytes */
- if(maxseq > 0 && maxbytes > 0) {
+ if(maxseq > 0 && maxbytes > 0 && sel_iter->elmt_left > 0) {
if(H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, maxseq, maxbytes, nseq, nbytes, off, len) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed")
} /* end if */
diff --git a/src/H5T.c b/src/H5T.c
index fd48d6a..5d3c4a1 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -226,18 +226,35 @@
#define H5T_INIT_TYPE_REF_COMMON { \
H5T_INIT_TYPE_ALLOC_COMMON(H5T_REFERENCE) \
H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \
+ dt->shared->force_conv = TRUE; \
+ dt->shared->u.atomic.u.r.file = NULL; \
+ dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \
+ dt->shared->u.atomic.u.r.cls = NULL; \
}
#define H5T_INIT_TYPE_OBJREF_CORE { \
H5T_INIT_TYPE_REF_COMMON \
- dt->shared->force_conv = TRUE; \
- dt->shared->u.atomic.u.r.rtype = H5R_OBJECT; \
- dt->shared->u.atomic.u.r.loc = H5T_LOC_MEMORY; \
+ dt->shared->u.atomic.u.r.rtype = H5R_OBJECT1; \
+ dt->shared->u.atomic.u.r.opaque = FALSE; \
+ dt->shared->u.atomic.u.r.version = 0; \
}
#define H5T_INIT_TYPE_REGREF_CORE { \
H5T_INIT_TYPE_REF_COMMON \
- dt->shared->u.atomic.u.r.rtype = H5R_DATASET_REGION; \
+ dt->shared->u.atomic.u.r.rtype = H5R_DATASET_REGION1; \
+ dt->shared->u.atomic.u.r.opaque = FALSE; \
+ dt->shared->u.atomic.u.r.version = 0; \
+}
+
+/* rtype value is only used as a placeholder to differentiate the type from
+ * other types, any opaque (i.e. "new") reference type could be used.
+ */
+#define H5T_INIT_TYPE_REF_CORE { \
+ H5T_INIT_TYPE_REF_COMMON \
+ dt->shared->u.atomic.u.r.rtype = H5R_OBJECT2; \
+ dt->shared->u.atomic.u.r.opaque = TRUE; \
+ dt->shared->u.atomic.u.r.version = H5R_ENCODE_VERSION; \
+ dt->shared->version = H5O_DTYPE_VERSION_4; \
}
/* Define the code templates for the "SIZE_TMPL" in the H5T_INIT_TYPE macro */
@@ -284,6 +301,9 @@
/* Local Typedefs */
/******************/
+/* Typedef for recursive const-correct datatype copying routines */
+typedef H5T_t *(*H5T_copy_func_t)(H5T_t *old_dt);
+
/********************/
/* Local Prototypes */
@@ -295,7 +315,12 @@ 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 hbool_t H5T__detect_reg_ref(const H5T_t *dt);
+static hbool_t H5T__detect_vlen_ref(const H5T_t *dt);
+static H5T_t *H5T__initiate_copy(const H5T_t *old_dt);
+static H5T_t *H5T__copy_transient(H5T_t *old_dt);
+static H5T_t *H5T__copy_all(H5T_t *old_dt);
+static herr_t H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt,
+ H5T_shared_t *reopened_fo, hbool_t set_memory_type, H5T_copy_func_t copyfn);
/*****************************/
@@ -354,6 +379,7 @@ hid_t H5T_STD_B64BE_g = FAIL;
hid_t H5T_STD_B64LE_g = FAIL;
hid_t H5T_STD_REF_OBJ_g = FAIL;
hid_t H5T_STD_REF_DSETREG_g = FAIL;
+hid_t H5T_STD_REF_g = FAIL;
hid_t H5T_UNIX_D32BE_g = FAIL;
hid_t H5T_UNIX_D32LE_g = FAIL;
@@ -444,6 +470,7 @@ size_t H5T_POINTER_COMP_ALIGN_g = 0;
size_t H5T_HVL_COMP_ALIGN_g = 0;
size_t H5T_HOBJREF_COMP_ALIGN_g = 0;
size_t H5T_HDSETREGREF_COMP_ALIGN_g = 0;
+size_t H5T_REF_COMP_ALIGN_g = 0;
/*
* Alignment constraints for native types. These are initialized at run time
@@ -514,7 +541,7 @@ const unsigned H5O_dtype_ver_bounds[] = {
H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */
- H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V112 */
+ H5O_DTYPE_VERSION_4, /* H5F_LIBVER_V112 */
H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -737,7 +764,9 @@ H5T__init_package(void)
H5T_t *enum_type=NULL; /* Datatype structure for enum objects */
H5T_t *vlen=NULL; /* Datatype structure for vlen objects */
H5T_t *array=NULL; /* Datatype structure for array objects */
- H5T_t *objref=NULL; /* Datatype structure for object reference objects */
+ H5T_t *objref=NULL; /* Datatype structure for deprecated reference objects */
+ H5T_t *regref=NULL; /* Datatype structure for deprecated region references */
+ H5T_t *ref=NULL; /* Datatype structure for opaque references */
hsize_t dim[1]={1}; /* Dimension info for array datatype */
herr_t status;
hbool_t copied_dtype = TRUE; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */
@@ -989,12 +1018,23 @@ H5T__init_package(void)
*------------------------------------------------------------
*/
- /* Object reference (i.e. object header address in file) */
- H5T_INIT_TYPE(OBJREF, H5T_STD_REF_OBJ_g, ALLOC, -, SET, H5R_OBJ_REF_BUF_SIZE)
+ /* Deprecated object reference type */
+ H5T_INIT_TYPE(OBJREF, H5T_STD_REF_OBJ_g, ALLOC, -, NOSET, -)
+ if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
objref = dt; /* Keep type for later */
- /* Dataset Region reference (i.e. selection inside a dataset) */
- H5T_INIT_TYPE(REGREF, H5T_STD_REF_DSETREG_g, ALLOC, -, SET, H5R_DSET_REG_REF_BUF_SIZE)
+ /* Deprecated region reference type */
+ H5T_INIT_TYPE(REGREF, H5T_STD_REF_DSETREG_g, ALLOC, -, NOSET, -)
+ if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
+ regref = dt; /* Keep type for later */
+
+ /* Opaque reference type */
+ H5T_INIT_TYPE(REF, H5T_STD_REF_g, ALLOC, -, NOSET, -)
+ if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
+ ref = dt; /* Keep type for later */
/*
* Register conversion functions beginning with the most general and
@@ -1029,7 +1069,11 @@ H5T__init_package(void)
status |= H5T__register_int(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric);
status |= H5T__register_int(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen);
status |= H5T__register_int(H5T_PERS_SOFT, "array", array, array, H5T__conv_array);
- status |= H5T__register_int(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt);
+ status |= H5T__register_int(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_noop);
+ status |= H5T__register_int(H5T_PERS_SOFT, "regref", regref, regref, H5T__conv_noop);
+ status |= H5T__register_int(H5T_PERS_SOFT, "ref", ref, ref, H5T__conv_ref);
+ status |= H5T__register_int(H5T_PERS_SOFT, "objref_ref", objref, ref, H5T__conv_ref);
+ status |= H5T__register_int(H5T_PERS_SOFT, "regref_ref", regref, ref, H5T__conv_ref);
/*
* Native conversions should be listed last since we can use hardware to
@@ -1473,6 +1517,7 @@ H5T_top_term_package(void)
H5T_STD_B64LE_g = FAIL;
H5T_STD_REF_OBJ_g = FAIL;
H5T_STD_REF_DSETREG_g = FAIL;
+ H5T_STD_REF_g = FAIL;
H5T_UNIX_D32BE_g = FAIL;
H5T_UNIX_D32LE_g = FAIL;
@@ -2883,6 +2928,56 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Treclaim
+ *
+ * Purpose: Frees the buffers allocated for storing variable-length data
+ * in memory. Only frees the VL data in the selection defined in the
+ * dataspace. The dataset transfer property list is required to find the
+ * correct allocation/free methods for the VL data in the buffer.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, June 10, 1999
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Treclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf)
+{
+ H5S_t *space; /* Dataspace for iteration */
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "iii*x", type_id, space_id, dxpl_id, buf);
+
+ /* Check args */
+ if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
+ 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)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
+
+ /* 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 xfer parms")
+
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
+ /* Call internal routine */
+ ret_value = H5T_reclaim(type_id, space, buf);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Treclaim() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Tencode
*
* Purpose: Given an datatype ID, converts the object description into
@@ -3217,129 +3312,152 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__create() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5T_copy
+ * Function: H5T__initiate_copy
*
- * Purpose: Copies datatype OLD_DT. The resulting data type is not
- * locked and is a transient type.
+ * Purpose: Allocates datatype structures, copies core fields, and initializes
+ * VOL fields.
*
* Return: Success: Pointer to a new copy of the OLD_DT argument.
- *
* Failure: NULL
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Note: Common code for both H5T_copy and H5T_copy_reopen, as part of
+ * the const-correct datatype copying routines.
+ *
+ * Programmer: David Young
+ * January 18, 2020
*
*-------------------------------------------------------------------------
*/
-H5T_t *
-H5T_copy(H5T_t *old_dt, H5T_copy_t method)
+static H5T_t *
+H5T__initiate_copy(const H5T_t *old_dt)
{
- H5T_t *new_dt = NULL, *tmp = NULL;
- H5T_shared_t *reopened_fo = NULL;
- unsigned i;
- char *s;
- H5T_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
+ H5T_t *new_dt = NULL; /* Copy of datatype */
+ H5T_t *ret_value = NULL; /* Return value */
- /* check args */
- HDassert(old_dt);
+ FUNC_ENTER_STATIC
/* Allocate space */
if(NULL == (new_dt = H5FL_MALLOC(H5T_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "H5T_t 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_DATATYPE, H5E_CANTALLOC, NULL, "H5T_shared_t memory allocation failed")
- /* Copy shared information (entry information is copied last) */
+ /* Copy shared information */
*(new_dt->shared) = *(old_dt->shared);
- /* No VOL object */
+ /* Reset VOL fields */
new_dt->vol_obj = NULL;
+ new_dt->shared->owned_vol_obj = NULL;
- /* Check what sort of copy we are making */
- switch (method) {
- case H5T_COPY_TRANSIENT:
- /*
- * Return an unlocked transient type.
- */
- new_dt->shared->state = H5T_STATE_TRANSIENT;
- break;
+ /* Set return value */
+ ret_value = new_dt;
- case H5T_COPY_ALL:
- /*
- * Return a transient type (locked or unlocked) or an unopened named
- * type. Immutable transient types are degraded to read-only.
- */
- if(H5T_STATE_OPEN==old_dt->shared->state)
- new_dt->shared->state = H5T_STATE_NAMED;
- else if(H5T_STATE_IMMUTABLE==old_dt->shared->state)
- new_dt->shared->state = H5T_STATE_RDONLY;
- break;
+done:
+ if(ret_value == NULL)
+ if(new_dt) {
+ if(new_dt->shared)
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ new_dt = H5FL_FREE(H5T_t, new_dt);
+ } /* end if */
- case H5T_COPY_REOPEN:
- /*
- * Return a transient type (locked or unlocked) or an opened named
- * type. Immutable transient types are degraded to read-only.
- */
- if(old_dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
- /* Check if the object is already open */
- if(NULL == (reopened_fo = (H5T_shared_t *)H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) {
- /* Clear any errors from H5FO_opened() */
- H5E_clear_stack(NULL);
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__initiate_copy() */
- /* Open named datatype again */
- if(H5O_open(&old_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type")
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__copy_transient
+ *
+ * Purpose: Part of recursive framework for const-correct datatype copying.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5T_t *
+H5T__copy_transient(H5T_t *old_dt)
+{
+ H5T_t *ret_value = NULL; /* Return value */
- /* 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)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, "can't insert datatype into list of open objects")
+ FUNC_ENTER_STATIC
- /* Increment object count for the object in the top file */
- if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
+ /* Copy datatype, with correct method */
+ if(NULL == (ret_value = H5T_copy(old_dt, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'transient' copy of datatype")
- new_dt->shared->fo_count = 1;
- } /* end if */
- else {
- /* The object is already open. Free the H5T_shared_t struct
- * we had been using and use the one that already exists.
- * Not terribly efficient. */
- new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
- new_dt->shared = reopened_fo;
-
- reopened_fo->fo_count++;
-
- /* Check if the object has been opened through the top file yet */
- if(H5FO_top_count(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) == 0) {
- /* Open the object through this top file */
- if(H5O_open(&old_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header")
- } /* end if */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__copy_transient() */
- /* Increment object count for the object in the top file */
- if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
- } /* end else */
- new_dt->shared->state = H5T_STATE_OPEN;
- }
- else if(H5T_STATE_IMMUTABLE == old_dt->shared->state) {
- new_dt->shared->state = H5T_STATE_RDONLY;
- }
- break;
- default:
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid copy method type")
- } /* end switch */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__copy_all
+ *
+ * Purpose: Part of recursive framework for const-correct datatype copying.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5T_t *
+H5T__copy_all(H5T_t *old_dt)
+{
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Copy datatype, with correct method */
+ if(NULL == (ret_value = H5T_copy(old_dt, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'all' copy of datatype")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__copy_transient() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__complete_copy
+ *
+ * Purpose: Completes copying datatype fields, as part of the recursive
+ * const-correct datatype copy routines.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Note: Common code for both H5T_copy and H5T_copy_reopen.
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo,
+ hbool_t set_memory_type, H5T_copy_func_t copyfn)
+{
+ H5T_t *tmp = NULL; /* Temporary copy of compound field's datatype */
+ char *s; /* Temporary copy of compound field name / enum value name */
+ unsigned i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
/* Update fields in the new struct, if we aren't sharing an already opened
* committed datatype */
if(!reopened_fo) {
/* Copy parent information */
if(old_dt->shared->parent)
- new_dt->shared->parent = H5T_copy(old_dt->shared->parent, method);
+ if(NULL == (new_dt->shared->parent = (*copyfn)(old_dt->shared->parent)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy datatype's parent type")
switch(new_dt->shared->type) {
case H5T_COMPOUND:
@@ -3353,10 +3471,8 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
*/
/* Only malloc if space has been allocated for members - NAF */
if(new_dt->shared->u.compnd.nalloc > 0) {
- 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")
+ if(NULL == (new_dt->shared->u.compnd.memb = H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t))))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed")
H5MM_memcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
@@ -3366,15 +3482,17 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
unsigned j;
int old_match;
- s = new_dt->shared->u.compnd.memb[i].name;
- new_dt->shared->u.compnd.memb[i].name = H5MM_xstrdup(s);
- tmp = H5T_copy (old_dt->shared->u.compnd.memb[i].type, method);
+ if(NULL == (s = H5MM_xstrdup(new_dt->shared->u.compnd.memb[i].name)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy string for compound field's name")
+ new_dt->shared->u.compnd.memb[i].name = s;
+ if(NULL == (tmp = (*copyfn)(old_dt->shared->u.compnd.memb[i].type)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy compound field's datatype")
new_dt->shared->u.compnd.memb[i].type = tmp;
HDassert(tmp != NULL);
/* 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")
+ if((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "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;
@@ -3389,7 +3507,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, FAIL, "fields in datatype corrupted")
} /* end if */
else
old_match = (int) i;
@@ -3404,8 +3522,8 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
} /* end for */
/* 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")
+ if((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "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;
@@ -3418,27 +3536,25 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
* of each new member with copied values. That is, H5T_copy() is a
* deep copy.
*/
- new_dt->shared->u.enumer.name =
- (char **)H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char*));
- 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")
+ if(NULL == (new_dt->shared->u.enumer.name = H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char*))))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam name array memory allocation failed")
+ if(NULL == (new_dt->shared->u.enumer.value = H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam value array memory allocation failed")
H5MM_memcpy(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++) {
- s = old_dt->shared->u.enumer.name[i];
- new_dt->shared->u.enumer.name[i] = H5MM_xstrdup(s);
+ if(NULL == (s = H5MM_xstrdup(old_dt->shared->u.enumer.name[i])))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy string for enum value's name")
+ new_dt->shared->u.enumer.name[i] = s;
} /* end for */
break;
case H5T_VLEN:
case H5T_REFERENCE:
- if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) {
+ if(set_memory_type)
/* 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")
- } /* end if */
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
break;
case H5T_OPAQUE:
@@ -3450,7 +3566,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
case H5T_ARRAY:
/* Re-compute the array's size, in case it's base type changed size */
- new_dt->shared->size=new_dt->shared->u.array.nelem*new_dt->shared->parent->shared->size;
+ new_dt->shared->size = new_dt->shared->u.array.nelem * new_dt->shared->parent->shared->size;
break;
case H5T_NO_CLASS:
@@ -3469,15 +3585,15 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
* type and the new type is also named.
*/
if(H5O_loc_reset(&new_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, NULL, "unable to initialize location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to initialize location")
if(H5G_name_reset(&new_dt->path) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reset path")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path")
if(new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN) {
- if(H5O_loc_copy(&(new_dt->oloc), &(old_dt->oloc), H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location")
+ if(H5O_loc_copy_deep(&(new_dt->oloc), &(old_dt->oloc)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy object location")
if(H5G_name_copy(&(new_dt->path), &(old_dt->path), H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to copy path")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy path")
} /* end if */
/* Copy shared location information if the new type is named or if it is
@@ -3486,28 +3602,194 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
if((old_dt->sh_loc.type == H5O_SHARE_TYPE_SOHM || old_dt->sh_loc.type == H5O_SHARE_TYPE_HERE) ||
new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN) {
if(H5O_set_shared(&(new_dt->sh_loc), &(old_dt->sh_loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy shared information")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy shared information")
} /* end if */
else
/* Reset shared component info */
H5O_msg_reset_share(H5O_DTYPE_ID, new_dt);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__complete_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_copy
+ *
+ * Purpose: Copies datatype OLD_DT. The resulting data type is not
+ * locked and is a transient type.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, December 4, 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_t *
+H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
+{
+ H5T_t *new_dt = NULL; /* New datatype */
+ H5T_copy_func_t copyfn; /* Pointer to correct copy routine */
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* check args */
+ HDassert(old_dt);
+
+ /* Allocate and copy core datatype information */
+ if(NULL == (new_dt = H5T__initiate_copy(old_dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info")
+
+ /* Check what sort of copy we are making */
+ switch (method) {
+ case H5T_COPY_TRANSIENT:
+ /*
+ * Return an unlocked transient type.
+ */
+ new_dt->shared->state = H5T_STATE_TRANSIENT;
+ copyfn = H5T__copy_transient;
+ break;
+
+ case H5T_COPY_ALL:
+ /*
+ * Return a transient type (locked or unlocked) or an unopened named
+ * type. Immutable transient types are degraded to read-only.
+ */
+ if(H5T_STATE_OPEN==old_dt->shared->state)
+ new_dt->shared->state = H5T_STATE_NAMED;
+ else if(H5T_STATE_IMMUTABLE==old_dt->shared->state)
+ new_dt->shared->state = H5T_STATE_RDONLY;
+ copyfn = H5T__copy_all;
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid copy method type")
+ } /* end switch */
+
+ /* Finish making the copy of the datatype */
+ if(H5T__complete_copy(new_dt, old_dt, NULL, (method == H5T_COPY_TRANSIENT), copyfn) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization")
+
/* Set return value */
ret_value = new_dt;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(new_dt) {
- if(new_dt->shared)
- new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ HDassert(new_dt->shared);
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_copy() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_copy_reopen
+ *
+ * Purpose: Copy a datatype, possibly reopening a named datatype, as part
+ * the const-correct datatype copying routines.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_t *
+H5T_copy_reopen(H5T_t *old_dt)
+{
+ H5T_t *new_dt = NULL; /* New datatype */
+ H5T_shared_t *reopened_fo = NULL; /* Pointer to reopened existing named datatype */
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* check args */
+ HDassert(old_dt);
+ /* Allocate and copy core datatype information */
+ if(NULL == (new_dt = H5T__initiate_copy(old_dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info")
+
+ /*
+ * Return a transient type (locked or unlocked) or an opened named
+ * type. Immutable transient types are degraded to read-only.
+ */
+ if(old_dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
+ /* Check if the object is already open */
+ if(NULL == (reopened_fo = (H5T_shared_t *)H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) {
+ /* Clear any errors from H5FO_opened() */
+ H5E_clear_stack(NULL);
+
+ /* Open named datatype again */
+ if(H5O_open(&old_dt->oloc) < 0)
+ 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)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, "can't insert datatype into list of open objects")
+
+ /* Increment object count for the object in the top file */
+ if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
+
+ new_dt->shared->fo_count = 1;
+ } /* end if */
+ else {
+ /* The object is already open. Free the H5T_shared_t struct
+ * we had been using and use the one that already exists.
+ * Not terribly efficient. */
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ new_dt->shared = reopened_fo;
+
+ reopened_fo->fo_count++;
+
+ /* Check if the object has been opened through the top file yet */
+ if(H5FO_top_count(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) == 0) {
+ /* Open the object through this top file */
+ if(H5O_open(&old_dt->oloc) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header")
+ } /* end if */
+
+ /* Increment object count for the object in the top file */
+ if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
+ } /* end else */
+
+ /* Set state for new datatype */
+ new_dt->shared->state = H5T_STATE_OPEN;
+ } /* end if */
+ else
+ /* Downgrade immutable datatypes to read-only */
+ if(H5T_STATE_IMMUTABLE == old_dt->shared->state)
+ new_dt->shared->state = H5T_STATE_RDONLY;
+
+ /* Finish making the copy of the datatype */
+ if(H5T__complete_copy(new_dt, old_dt, reopened_fo, TRUE, H5T_copy_reopen) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization")
+
+ /* Set return value */
+ ret_value = new_dt;
+
+done:
+ if(ret_value == NULL)
+ if(new_dt) {
+ HDassert(new_dt->shared);
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ new_dt = H5FL_FREE(H5T_t, new_dt);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_copy_reopen() */
+
+
/*-------------------------------------------------------------------------
* Function: H5T_lock
*
@@ -3680,6 +3962,11 @@ H5T__free(H5T_t *dt)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type")
dt->shared->parent = NULL;
+ /* Close the owned VOL object */
+ if(dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
+ dt->shared->owned_vol_obj = NULL;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__free() */
@@ -4327,9 +4614,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
}
/* Don't allow VL types in different files to compare as equal */
- if(dt1->shared->u.vlen.f < dt2->shared->u.vlen.f)
+ if(dt1->shared->u.vlen.file < dt2->shared->u.vlen.file)
HGOTO_DONE(-1);
- if(dt1->shared->u.vlen.f > dt2->shared->u.vlen.f)
+ if(dt1->shared->u.vlen.file > dt2->shared->u.vlen.file)
HGOTO_DONE(1);
break;
@@ -4456,28 +4743,10 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
HGOTO_DONE(-1);
if(dt1->shared->u.atomic.u.r.rtype > dt2->shared->u.atomic.u.r.rtype)
HGOTO_DONE(1);
-
- switch(dt1->shared->u.atomic.u.r.rtype) {
- case H5R_OBJECT:
- if(dt1->shared->u.atomic.u.r.loc < dt2->shared->u.atomic.u.r.loc)
- HGOTO_DONE(-1);
- if(dt1->shared->u.atomic.u.r.loc > dt2->shared->u.atomic.u.r.loc)
- HGOTO_DONE(1);
- break;
-
- case H5R_DATASET_REGION:
- /* Does this need more to distinguish it? -QAK 11/30/98 */
- /*void */
- break;
-
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- HDassert("invalid type" && 0);
- break;
- default:
- HDassert("not implemented yet" && 0);
- break;
- }
+ if(dt1->shared->u.atomic.u.r.loc < dt2->shared->u.atomic.u.r.loc)
+ HGOTO_DONE(-1);
+ if(dt1->shared->u.atomic.u.r.loc > dt2->shared->u.atomic.u.r.loc)
+ HGOTO_DONE(1);
break;
case H5T_NO_CLASS:
@@ -5330,7 +5599,7 @@ done:
htri_t H5T_set_loc(dt,f,loc)
H5T_t *dt; IN/OUT: Pointer to the datatype to mark
H5F_t *f; IN: Pointer to the file the datatype is in
- H5T_vlen_type_t loc IN: location of type
+ H5T_loc_t loc IN: location of type
RETURNS
One of two values on success:
@@ -5343,7 +5612,7 @@ done:
--------------------------------------------------------------------------
*/
htri_t
-H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
+H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
htri_t changed; /* Whether H5T_set_loc changed the type (even if the size didn't change) */
htri_t ret_value = 0; /* Indicate that success, but no location change */
@@ -5367,7 +5636,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
old_size=dt->shared->parent->shared->size;
/* Mark the VL, compound or array type */
- if((changed=H5T_set_loc(dt->shared->parent,f,loc))<0)
+ if((changed=H5T_set_loc(dt->shared->parent, file, loc))<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed>0)
ret_value=changed;
@@ -5407,7 +5676,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
old_size = memb_type->shared->size;
/* Mark the VL, compound, enum or array type */
- if((changed = H5T_set_loc(memb_type,f,loc)) < 0)
+ if((changed = H5T_set_loc(memb_type, file, loc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
@@ -5441,31 +5710,23 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Recurse if it's VL, compound, enum or array */
/* (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)
+ if((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
} /* end if */
/* Mark this VL sequence */
- if((changed = H5T__vlen_set_loc(dt, f, loc)) < 0)
+ if((changed = H5T__vlen_set_loc(dt, file, loc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
if(changed > 0)
ret_value = changed;
break;
case H5T_REFERENCE:
- /* Only need to change location of object references */
- if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT) {
- /* Mark this reference */
- if(loc != dt->shared->u.atomic.u.r.loc) {
- /* Set the location */
- dt->shared->u.atomic.u.r.loc = loc;
-
- /* Indicate that the location changed */
- ret_value = TRUE;
- } /* end if */
- } /* end if */
+ /* Reference types go through type conversion */
+ if((ret_value = H5T__ref_set_loc(dt, file, loc)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "Unable to set reference location");
break;
case H5T_NO_CLASS:
@@ -5492,7 +5753,7 @@ done:
*
* Purpose: Check if a datatype will change between disk and memory.
*
- * Notes: Currently, only variable-length and object references change
+ * Notes: Currently, only variable-length and references change
* between disk & memory (see cases where things are changed in
* the H5T_set_loc() code above).
*
@@ -5527,9 +5788,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_detect_reg_ref
+ * Function: H5T__detect_vlen_ref
*
- * Purpose: Check whether a datatype contains (or is) a region reference
+ * Purpose: Check whether a datatype contains (or is) a vlen reference
* datatype.
*
* Return: TRUE (1) or FALSE (0) on success
@@ -5541,7 +5802,7 @@ done:
*-------------------------------------------------------------------------
*/
static hbool_t
-H5T__detect_reg_ref(const H5T_t *dt)
+H5T__detect_vlen_ref(const H5T_t *dt)
{
unsigned u; /* Local index variable */
hbool_t ret_value = FALSE; /* Return value */
@@ -5551,8 +5812,9 @@ H5T__detect_reg_ref(const H5T_t *dt)
/* Sanity checks */
HDassert(dt);
- /* Check if this datatype is a region reference */
- if(H5T_REFERENCE == dt->shared->type && H5R_DATASET_REGION == dt->shared->u.atomic.u.r.rtype)
+ /* Check if this datatype is a vlen reference */
+ /* TODO currently H5T_STD_REF is always considered as a vlen type */
+ if(H5T_REFERENCE == dt->shared->type && !dt->shared->u.atomic.u.r.opaque)
HGOTO_DONE(TRUE);
/* Check for types that might have the correct type as a component */
@@ -5561,14 +5823,14 @@ H5T__detect_reg_ref(const H5T_t *dt)
/* Iterate over all the compound datatype's fields */
for(u = 0; u < dt->shared->u.compnd.nmembs; u++)
/* Recurse on field's datatype */
- if(H5T__detect_reg_ref(dt->shared->u.compnd.memb[u].type))
+ if(H5T__detect_vlen_ref(dt->shared->u.compnd.memb[u].type))
HGOTO_DONE(TRUE);
break;
case H5T_ARRAY:
case H5T_VLEN:
case H5T_ENUM:
- HGOTO_DONE(H5T__detect_reg_ref(dt->shared->parent));
+ HGOTO_DONE(H5T__detect_vlen_ref(dt->shared->parent));
break;
case H5T_NO_CLASS:
@@ -5586,7 +5848,7 @@ H5T__detect_reg_ref(const H5T_t *dt)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T__detect_reg_ref() */
+} /* end H5T__detect_vlen_ref() */
/*-------------------------------------------------------------------------
@@ -5622,7 +5884,7 @@ H5T_is_vl_storage(const H5T_t *dt)
if(H5T_detect_class(dt, H5T_VLEN, FALSE))
ret_value = TRUE;
else if(H5T_detect_class(dt, H5T_REFERENCE, FALSE))
- ret_value = H5T__detect_reg_ref(dt);
+ ret_value = H5T__detect_vlen_ref(dt);
else
ret_value = FALSE;
@@ -5802,8 +6064,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5T_patch_vlen_file
*
- * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.f)
- * to point to f. This is possible because
+ * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.file)
+ * to point to file. This is possible because
* the top-level file pointer can be closed out from under
* dt while dt is contained in the shared file's cache.
*
@@ -5812,18 +6074,56 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_patch_vlen_file(H5T_t *dt, H5F_t *f)
+H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
HDassert(dt);
HDassert(dt->shared);
- HDassert(f);
+ HDassert(file);
- if((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.f != f)
- dt->shared->u.vlen.f = f;
+ if((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.file != file)
+ dt->shared->u.vlen.file = file;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T_patch_vlen_file() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_own_vol_obj
+ *
+ * Purpose: Transfers ownership of the supplied VOL object to the
+ * datatype, the VOL object will be freed when the datatype
+ * is closed.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_own_vol_obj(H5T_t *dt, H5VL_object_t *vol_obj)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(dt);
+ HDassert(dt->shared);
+ HDassert(vol_obj);
+
+ /* Currently no support for owning multiple VOL objects, free the previous
+ * owned object. Currently this is only used for holding open VOL objects
+ * used in the "loc" for vlens and references, so if this is being
+ * overwritten we don't need the old one anyways. */
+ if(dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
+
+ /* Take ownership */
+ dt->shared->owned_vol_obj = vol_obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_own_vol_obj() */
+
diff --git a/src/H5TS.c b/src/H5TS.c
index 10e14d5..9503e05 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -37,6 +37,31 @@ H5TS_key_t H5TS_funcstk_key_g;
H5TS_key_t H5TS_apictx_key_g;
H5TS_key_t H5TS_cancel_key_g;
+#ifndef H5_HAVE_WIN_THREADS
+
+/* An h5_tid_t is a record of a thread identifier that is
+ * available for reuse.
+ */
+struct _tid;
+typedef struct _tid h5_tid_t;
+
+struct _tid {
+ h5_tid_t *next;
+ uint64_t id;
+};
+
+/* Pointer to first free thread ID record or NULL. */
+static h5_tid_t *tid_next_free = NULL;
+static uint64_t tid_next_id = 0;
+
+/* Mutual exclusion for access to tid_next_free and tid_next_id. */
+static pthread_mutex_t tid_mtx;
+
+/* Key for thread-local storage of the thread ID. */
+static H5TS_key_t tid_key;
+
+#endif /* H5_HAVE_WIN_THREADS */
+
/*--------------------------------------------------------------------------
* NAME
@@ -68,6 +93,89 @@ H5TS_key_destructor(void *key_val)
#ifndef H5_HAVE_WIN_THREADS
+/* When a thread shuts down, put its ID record on the free list. */
+static void
+tid_destructor(void *_v)
+{
+ h5_tid_t *tid = _v;
+
+ if (tid == NULL)
+ return;
+
+ /* XXX I can use mutexes in destructors, right? */
+ /* TBD use an atomic CAS */
+ pthread_mutex_lock(&tid_mtx);
+ tid->next = tid_next_free;
+ tid_next_free = tid;
+ pthread_mutex_unlock(&tid_mtx);
+}
+
+/* Initialize for integer thread identifiers. */
+static void
+tid_init(void)
+{
+ pthread_mutex_init(&tid_mtx, NULL);
+ pthread_key_create(&tid_key, tid_destructor);
+}
+
+/* Return an integer identifier, ID, for the current thread satisfying the
+ * following properties:
+ *
+ * 1 1 <= ID <= UINT64_MAX
+ * 2 ID is constant over the thread's lifetime.
+ * 3 No two threads share an ID during their lifetimes.
+ * 4 A thread's ID is available for reuse as soon as it is joined.
+ *
+ * ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not built
+ * with thread safety or if an error prevents it from assigning an ID.
+ */
+uint64_t
+H5TS_thread_id(void)
+{
+ h5_tid_t *tid = pthread_getspecific(tid_key);
+ h5_tid_t proto_tid;
+
+ /* An ID is already assigned. */
+ if (tid != NULL)
+ return tid->id;
+
+ /* An ID is *not* already assigned: reuse an ID that's on the
+ * free list, or else generate a new ID.
+ *
+ * Allocating memory while holding a mutex is bad form, so
+ * point `tid` at `proto_tid` if we need to allocate some
+ * memory.
+ */
+ pthread_mutex_lock(&tid_mtx);
+ if ((tid = tid_next_free) != NULL)
+ tid_next_free = tid->next;
+ else if (tid_next_id != UINT64_MAX) {
+ tid = &proto_tid;
+ tid->id = ++tid_next_id;
+ }
+ pthread_mutex_unlock(&tid_mtx);
+
+ /* If a prototype ID record was established, copy it to the heap. */
+ if (tid == &proto_tid) {
+ if ((tid = HDmalloc(sizeof(*tid))) != NULL)
+ *tid = proto_tid;
+ }
+
+ if (tid == NULL)
+ return 0;
+
+ /* Finish initializing the ID record and set a thread-local pointer
+ * to it.
+ */
+ tid->next = NULL;
+ if (pthread_setspecific(tid_key, tid) != 0) {
+ tid_destructor(tid);
+ return 0;
+ }
+
+ return tid->id;
+}
+
/*--------------------------------------------------------------------------
* NAME
* H5TS_pthread_first_thread_init
@@ -104,6 +212,9 @@ H5TS_pthread_first_thread_init(void)
pthread_cond_init(&H5_g.init_lock.cond_var, NULL);
H5_g.init_lock.lock_count = 0;
+ /* Initialize integer thread identifiers. */
+ tid_init();
+
/* initialize key for thread-specific error stacks */
pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor);
@@ -529,4 +640,3 @@ 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 9e093a6..887f001 100644
--- a/src/H5TSprivate.h
+++ b/src/H5TSprivate.h
@@ -26,6 +26,7 @@
#ifndef H5TSprivate_H_
#define H5TSprivate_H_
+#ifdef H5_HAVE_THREADSAFE
/* Public headers needed by this file */
#ifdef LATER
#include "H5TSpublic.h" /*Public API prototypes */
@@ -68,7 +69,7 @@ H5_DLL void H5TS_win32_process_exit(void);
H5_DLL herr_t H5TS_win32_thread_enter(void);
H5_DLL herr_t H5TS_win32_thread_exit(void);
-
+#define H5TS_thread_id() ((uint64_t)GetCurrentThreadId())
#else /* H5_HAVE_WIN_THREADS */
@@ -102,6 +103,7 @@ typedef pthread_once_t H5TS_once_t;
#define H5TS_mutex_init(mutex) pthread_mutex_init(mutex, NULL)
#define H5TS_mutex_lock_simple(mutex) pthread_mutex_lock(mutex)
#define H5TS_mutex_unlock_simple(mutex) pthread_mutex_unlock(mutex)
+H5_DLL uint64_t H5TS_thread_id(void);
#endif /* H5_HAVE_WIN_THREADS */
@@ -127,5 +129,11 @@ H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t * att
}
#endif /* c_plusplus || __cplusplus */
+#else /* H5_HAVE_THREADSAFE */
+
+#define H5TS_thread_id() ((uint64_t)0)
+
+#endif /* H5_HAVE_THREADSAFE */
+
#endif /* H5TSprivate_H_ */
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index df6d2c3..c6c1777 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -363,7 +363,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value)
/* The middle bytes */
while (size >= 8) {
- buf[idx++] = value ? 0xff : 0x00;
+ buf[idx++] = (uint8_t)(value ? 0xff : 0x00);
size -= 8;
}
@@ -532,7 +532,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size)
acc = buf[idx];
acc++;
carry = acc & 0x100;
- buf[idx] = acc & 0xff;
+ buf[idx] = (uint8_t)(acc & 0xff);
idx++;
size -= 8;
}
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index c6b85a5..7d26af3 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -106,7 +106,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_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_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -137,6 +137,9 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list")
+ /* Set the LCPL for the API context */
+ H5CX_set_lcpl(lcpl_id);
+
/* Verify access property list and set up collective metadata if appropriate */
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")
@@ -229,7 +232,7 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects")
/* Close the datatype object */
- if(H5O_close(&(dt->oloc), NULL) < 0)
+ if(H5O_close(&(dt->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header")
/* Remove the datatype's object header from the file */
@@ -237,7 +240,7 @@ done:
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header")
/* Mark datatype as being back in memory */
- if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY))
+ if(H5T_set_loc(dt, NULL, 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->shared->state = old_state;
@@ -270,7 +273,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
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_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -303,7 +306,8 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_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)))
+ if(NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_LINK_CREATE_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 */
@@ -414,7 +418,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id)
/* Mark datatype as being on disk now. This step changes the size of
* datatype as stored on disk.
*/
- if(H5T_set_loc(type, file, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
/* Reset datatype location and path */
@@ -442,7 +446,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id)
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)
+ if(H5O_loc_copy_shallow(&(type->oloc), &temp_oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
if(H5G_name_copy(&(type->path), &temp_path, H5_COPY_SHALLOW) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
@@ -564,8 +568,8 @@ done:
hid_t
H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
{
- void *dt = NULL; /* datatype token created by VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
+ void *dt = NULL; /* datatype object created by VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -939,7 +943,7 @@ H5T_open(const H5G_loc_t *loc)
#endif /* H5_USING_MEMCHECKER */
/* Shallow copy (take ownership) of the object location object */
- if(H5O_loc_copy(&dt->oloc, loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&dt->oloc, loc->oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
@@ -1029,7 +1033,7 @@ H5T__open_oid(const H5G_loc_t *loc)
dt->shared->state = H5T_STATE_OPEN;
/* Shallow copy (take ownership) of the object location object */
- if(H5O_loc_copy(&dt->oloc, loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&dt->oloc, loc->oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
@@ -1092,7 +1096,7 @@ 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 *dt = NULL; /* datatype object from VOL connector */
H5T_t *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index d4f1008..f4a9e04 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -51,8 +51,9 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5T_pack(const H5T_t *dt);
-static htri_t H5T_is_packed(const H5T_t *dt);
+static herr_t H5T__pack(const H5T_t *dt);
+static htri_t H5T__is_packed(const H5T_t *dt);
+static H5T_t *H5T__reopen_member_type(const H5T_t *dt, unsigned membno);
/*********************/
@@ -226,7 +227,7 @@ H5Tget_member_type(hid_t type_id, unsigned membno)
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)))
+ if(NULL == (memb_dt = H5T__reopen_member_type(dt, membno)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type")
/* Get an ID for the datatype */
@@ -245,8 +246,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5T_get_member_type
*
- * Purpose: Private function for H5Tget_member_type. Returns the data
- * type of the specified member.
+ * Purpose: Returns a copy of the data type of the specified member.
*
* Return: Success: A copy of the member datatype;
* modifying the returned datatype does not
@@ -260,18 +260,19 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method)
+H5T_get_member_type(const H5T_t *dt, unsigned membno)
{
H5T_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
+ /* Sanity checks */
HDassert(dt);
HDassert(membno < dt->shared->u.compnd.nmembs);
- /* Copy datatype into an atom */
- if(NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, method)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy member datatype")
+ /* Copy datatype */
+ if(NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy member datatype")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -279,6 +280,43 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T__reopen_member_type
+ *
+ * Purpose: Private function for H5Tget_member_type. Returns a re-opened
+ * copy of the data type of the specified member.
+ *
+ * Return: Success: A copy of the member datatype;
+ * modifying the returned datatype does not
+ * modify the member type.
+ *
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5T_t *
+H5T__reopen_member_type(const H5T_t *dt, unsigned membno)
+{
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(dt);
+ HDassert(membno < dt->shared->u.compnd.nmembs);
+
+ /* Copy datatype, possibly re-opening it */
+ if(NULL == (ret_value = H5T_copy_reopen(dt->shared->u.compnd.memb[membno].type)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to reopen member datatype")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__reopen_member_type() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T__get_member_size
*
* Purpose: Returns the size of the specified member.
@@ -387,7 +425,7 @@ H5Tpack(hid_t type_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype")
/* Pack */
- if(H5T_pack(dt) < 0)
+ if(H5T__pack(dt) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype")
done:
@@ -493,7 +531,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_pack
+ * Function: H5T__pack
*
* Purpose: Recursively packs a compound datatype by removing padding
* bytes. This is done in place (that is, destructively).
@@ -506,17 +544,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_pack(const H5T_t *dt)
+H5T__pack(const H5T_t *dt)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(dt);
if(H5T_detect_class(dt, H5T_COMPOUND, FALSE) > 0) {
/* If datatype has been packed, skip packing it and indicate success */
- if(TRUE == H5T_is_packed(dt))
+ if(TRUE == H5T__is_packed(dt))
HGOTO_DONE(SUCCEED)
/* Check for packing unmodifiable datatype */
@@ -524,7 +562,7 @@ H5T_pack(const H5T_t *dt)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only")
if(dt->shared->parent) {
- if (H5T_pack(dt->shared->parent) < 0)
+ if(H5T__pack(dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype")
/* Adjust size of datatype appropriately */
@@ -539,7 +577,7 @@ H5T_pack(const H5T_t *dt)
/* Recursively pack the members */
for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
- if(H5T_pack(dt->shared->u.compnd.memb[i].type) < 0)
+ if(H5T__pack(dt->shared->u.compnd.memb[i].type) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack part of a compound datatype")
/* Update the member size */
@@ -552,7 +590,7 @@ H5T_pack(const H5T_t *dt)
for(i = 0, offset = 0; i < dt->shared->u.compnd.nmembs; i++) {
dt->shared->u.compnd.memb[i].offset = offset;
offset += dt->shared->u.compnd.memb[i].size;
- }
+ } /* end for */
/* Change total size */
dt->shared->size = MAX(1, offset);
@@ -564,11 +602,11 @@ H5T_pack(const H5T_t *dt)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_pack() */
+} /* end H5T__pack() */
/*-------------------------------------------------------------------------
- * Function: H5T_is_packed
+ * Function: H5T__is_packed
*
* Purpose: Checks whether a datatype which is compound (or has compound
* components) is packed.
@@ -583,11 +621,11 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5T_is_packed(const H5T_t *dt)
+H5T__is_packed(const H5T_t *dt)
{
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(dt);
@@ -596,12 +634,11 @@ H5T_is_packed(const H5T_t *dt)
dt = dt->shared->parent;
/* If this is a compound datatype, check if it is packed */
- if(dt->shared->type == H5T_COMPOUND) {
+ if(dt->shared->type == H5T_COMPOUND)
ret_value = (htri_t)(dt->shared->u.compnd.packed);
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_is_packed() */
+} /* end H5T__is_packed() */
/*-------------------------------------------------------------------------
@@ -638,7 +675,7 @@ H5T__update_packed(const H5T_t *dt)
/* Now check if all members are packed */
for(i = 0; i < dt->shared->u.compnd.nmembs; i++)
- if(!H5T_is_packed(dt->shared->u.compnd.memb[i].type)) {
+ if(!H5T__is_packed(dt->shared->u.compnd.memb[i].type)) {
dt->shared->u.compnd.packed = FALSE;
break;
} /* end if */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 48c3282..29fd582 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -30,7 +30,6 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5HGprivate.h" /* Global Heaps */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
@@ -1019,6 +1018,9 @@ H5FL_BLK_DEFINE_STATIC(vlen_seq);
/* Declare a free list to manage pieces of array data */
H5FL_BLK_DEFINE_STATIC(array_seq);
+/* Declare a free list to manage pieces of reference data */
+H5FL_BLK_DEFINE_STATIC(ref_seq);
+
/*-------------------------------------------------------------------------
* Function: H5T__conv_noop
@@ -1846,7 +1848,7 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv)
for(i = 0; i < priv->src_nmembs; i++)
if(src2dst[i] >= 0) {
- int status;
+ int H5_ATTR_NDEBUG_UNUSED status;
status = H5I_dec_ref(src_memb_id[i]);
HDassert(status >= 0);
@@ -3020,17 +3022,16 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
hbool_t noop_conv = FALSE; /* Flag to indicate a noop conversion */
hbool_t write_to_file = FALSE; /* Flag to indicate writing to file */
htri_t parent_is_vlen; /* Flag to indicate parent is vlen datatyp */
+ size_t bg_seq_len = 0; /* The number of elements in the background sequence */
hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */
H5T_t *src = NULL; /*source datatype */
H5T_t *dst = NULL; /*destination datatype */
- H5HG_t bg_hobjid, parent_hobjid;
uint8_t *s = NULL; /*source buffer */
uint8_t *d = NULL; /*destination buffer */
uint8_t *b = NULL; /*background buffer */
ssize_t s_stride, d_stride; /*src and dst strides */
ssize_t b_stride; /*bkg stride */
size_t safe; /*how many elements are safe to process in each pass */
- size_t bg_seq_len = 0;
size_t src_base_size, dst_base_size;/*source & destination base size*/
void *conv_buf = NULL; /*temporary conversion buffer */
size_t conv_buf_size = 0; /*size of conversion buffer in bytes */
@@ -3055,13 +3056,13 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype")
if(H5T_VLEN != src->shared->type)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype")
- if(H5T_VLEN != dst->shared->type)
+ if(H5T_VLEN != dst->shared->type)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype")
if(H5T_VLEN_STRING == src->shared->u.vlen.type && H5T_VLEN_STRING == dst->shared->u.vlen.type) {
if((H5T_CSET_ASCII == src->shared->u.vlen.cset && H5T_CSET_UTF8 == dst->shared->u.vlen.cset)
- || (H5T_CSET_ASCII == dst->shared->u.vlen.cset && H5T_CSET_UTF8 == src->shared->u.vlen.cset))
+ || (H5T_CSET_ASCII == dst->shared->u.vlen.cset && H5T_CSET_UTF8 == src->shared->u.vlen.cset))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "The library doesn't convert between strings of ASCII and UTF")
- }
+ } /* end if */
/* Variable-length types don't need a background buffer */
cdata->need_bkg = H5T_BKG_NO;
@@ -3131,7 +3132,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
/* Set flags to indicate we are writing to or reading from the file */
- if(dst->shared->u.vlen.f != NULL)
+ if(dst->shared->u.vlen.file != NULL)
write_to_file = TRUE;
/* Set the flag for nested VL case */
@@ -3179,25 +3180,27 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end else */
for(elmtno = 0; elmtno < safe; elmtno++) {
+ hbool_t is_nil; /* Whether sequence is "nil" */
+
/* Check for "nil" source sequence */
- if((*(src->shared->u.vlen.isnull))(src->shared->u.vlen.f, s)) {
+ if((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.file, s, &is_nil) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if VL data is 'nil'")
+ else if(is_nil) {
/* Write "nil" sequence to destination location */
- if((*(dst->shared->u.vlen.setnull))(dst->shared->u.vlen.f, d, b) < 0)
+ if((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.file, d, b) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'")
- } /* end if */
+ } /* end else-if */
else {
- ssize_t sseq_len; /* (signed) The number of elements in the current sequence*/
- size_t seq_len; /* The number of elements in the current sequence*/
+ size_t seq_len; /* The number of elements in the current sequence */
/* Get length of element sequences */
- if((sseq_len = (*(src->shared->u.vlen.getlen))(s)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect length")
- seq_len = (size_t)sseq_len;
+ if((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.file, s, &seq_len) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length")
/* If we are reading from memory and there is no conversion, just get the pointer to sequence */
if(write_to_file && noop_conv) {
/* Get direct pointer to sequence */
- if(NULL == (conv_buf = (*(src->shared->u.vlen.getptr))(s)))
+ if(NULL == (conv_buf = (*(src->shared->u.vlen.cls->getptr))(s)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer")
} /* end if */
else {
@@ -3213,17 +3216,17 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
conv_buf_size = ((1 / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
if(NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
- }
+ } /* end if */
else if(conv_buf_size < MAX(src_size, dst_size)) {
/* Only allocate conversion buffer in H5T_VLEN_MIN_CONF_BUF_SIZE increments */
conv_buf_size = ((MAX(src_size, dst_size) / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
if(NULL == (conv_buf = H5FL_BLK_REALLOC(vlen_seq, conv_buf, conv_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
HDmemset(conv_buf, 0, conv_buf_size);
- } /* end if */
+ } /* end else-if */
/* Read in VL sequence */
- if((*(src->shared->u.vlen.read))(src->shared->u.vlen.f, s, conv_buf, src_size) < 0)
+ if((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.file, s, conv_buf, src_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data")
} /* end else */
@@ -3241,9 +3244,14 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* If we are writing and there is a nested VL type, read
* the sequence into the background buffer */
if(nested) {
- const uint8_t *tmp = b;
+ /* Sanity check */
+ HDassert(write_to_file);
+
+ /* Get length of background element sequence */
+ if((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.file, b, &bg_seq_len) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length")
- UINT32DECODE(tmp, bg_seq_len);
+ /* Read sequence if length > 0 */
if(bg_seq_len > 0) {
if(tmp_buf_size < (bg_seq_len * MAX(src_base_size, dst_base_size))) {
tmp_buf_size = (bg_seq_len * MAX(src_base_size, dst_base_size));
@@ -3251,10 +3259,10 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
HDmemset(tmp_buf, 0, tmp_buf_size);
} /* end if */
- H5F_addr_decode(dst->shared->u.vlen.f, &tmp, &(bg_hobjid.addr));
- UINT32DECODE(tmp, bg_hobjid.idx);
- if(NULL == H5HG_read(dst->shared->u.vlen.f, &bg_hobjid, tmp_buf, NULL))
- HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL sequence into background buffer")
+
+ /* Read in background VL sequence */
+ if((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.file, b, tmp_buf, bg_seq_len * dst_base_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data")
} /* end if */
/* If the sequence gets shorter, pad out the original sequence with zeros */
@@ -3268,26 +3276,23 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end if */
/* Write sequence to destination location */
- if((*(dst->shared->u.vlen.write))(dst->shared->u.vlen.f, &vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0)
+ if((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.file, &vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data")
if(!noop_conv) {
/* For nested VL case, free leftover heap objects from the deeper level if the length of new data elements is shorter than the old data elements.*/
if(nested && seq_len < bg_seq_len) {
- size_t parent_seq_len;
const uint8_t *tmp;
size_t u;
- /* TMP_P is reset each time in the loop because DST_BASE_SIZE may include some data in addition to VL info. - SLU */
- for(u = seq_len; u < bg_seq_len; u++) {
- tmp = (uint8_t *)tmp_buf + u * dst_base_size;
- UINT32DECODE(tmp, parent_seq_len);
- if(parent_seq_len > 0) {
- H5F_addr_decode(dst->shared->u.vlen.f, &tmp, &(parent_hobjid.addr));
- UINT32DECODE(tmp, parent_hobjid.idx);
- if(H5HG_remove(dst->shared->u.vlen.f, &parent_hobjid) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
- } /* end if */
+ /* Sanity check */
+ HDassert(write_to_file);
+
+ tmp = (uint8_t *)tmp_buf + seq_len * dst_base_size;
+ for(u = seq_len; u < bg_seq_len; u++, tmp += dst_base_size) {
+ /* Delete sequence in destination location */
+ if((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.file, tmp) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
} /* end for */
} /* end if */
} /* end if */
@@ -3474,6 +3479,207 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__conv_array() */
+/*-------------------------------------------------------------------------
+ * Function: H5T__conv_ref
+ *
+ * Purpose: Converts between reference datatypes in memory and on disk.
+ * This is a soft conversion function.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
+ size_t buf_stride, size_t bkg_stride, void *buf, void *bkg)
+{
+ H5T_t *src = NULL; /* source datatype */
+ H5T_t *dst = NULL; /* destination datatype */
+ uint8_t *s = NULL; /* source buffer */
+ uint8_t *d = NULL; /* destination buffer */
+ uint8_t *b = NULL; /* background buffer */
+ ssize_t s_stride, d_stride; /* src and dst strides */
+ ssize_t b_stride; /* bkg stride */
+ size_t safe; /* how many elements are safe to process in each pass */
+ void *conv_buf = NULL; /* temporary conversion buffer */
+ size_t conv_buf_size = 0; /* size of conversion buffer in bytes */
+ size_t elmtno; /* element number counter */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_PACKAGE
+
+ switch(cdata->command) {
+ case H5T_CONV_INIT:
+ /*
+ * First, determine if this conversion function applies to the
+ * conversion path SRC_ID-->DST_ID. If not, return failure;
+ * otherwise initialize the `priv' field of `cdata' with
+ * information that remains (almost) constant for this
+ * conversion path.
+ */
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype")
+ if(H5T_REFERENCE != src->shared->type)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype")
+ if(H5T_REFERENCE != dst->shared->type)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype")
+ /* Only allow for source reference that is not an opaque type, destination must be opaque */
+ if(!dst->shared->u.atomic.u.r.opaque)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not an H5T_STD_REF datatype")
+
+ /* Reference types don't need a background buffer */
+ cdata->need_bkg = H5T_BKG_NO;
+ break;
+
+ case H5T_CONV_FREE:
+ break;
+
+ case H5T_CONV_CONV:
+ {
+ /*
+ * Conversion.
+ */
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ HDassert(src->shared->u.atomic.u.r.cls);
+
+ /* Initialize source & destination strides */
+ if(buf_stride) {
+ HDassert(buf_stride >= src->shared->size);
+ HDassert(buf_stride >= dst->shared->size);
+ H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
+ s_stride = d_stride = (ssize_t)buf_stride;
+ } /* end if */
+ else {
+ H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t);
+ s_stride = (ssize_t)src->shared->size;
+ d_stride = (ssize_t)dst->shared->size;
+ } /* end else */
+ if(bkg) {
+ if(bkg_stride)
+ b_stride = (ssize_t)bkg_stride;
+ else
+ b_stride = d_stride;
+ } /* end if */
+ else
+ b_stride = 0;
+
+ /* The outer loop of the type conversion macro, controlling which */
+ /* direction the buffer is walked */
+ while(nelmts > 0) {
+ /* Check if we need to go backwards through the buffer */
+ if(d_stride > s_stride) {
+ /* Sanity check */
+ HDassert(s_stride > 0);
+ HDassert(d_stride > 0);
+ HDassert(b_stride >= 0);
+
+ /* Compute the number of "safe" destination elements at */
+ /* the end of the buffer (Those which don't overlap with */
+ /* any source elements at the beginning of the buffer) */
+ safe = nelmts - (((nelmts * (size_t)s_stride) + ((size_t)d_stride - 1)) / (size_t)d_stride);
+
+ /* If we're down to the last few elements, just wrap up */
+ /* with a "real" reverse copy */
+ if(safe < 2) {
+ s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride;
+ d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride;
+ b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride;
+ s_stride = -s_stride;
+ d_stride = -d_stride;
+ b_stride = -b_stride;
+
+ safe = nelmts;
+ } /* end if */
+ else {
+ s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride;
+ d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride;
+ b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride;
+ } /* end else */
+ } /* end if */
+ else {
+ /* Single forward pass over all data */
+ s = d = (uint8_t *)buf;
+ b = (uint8_t *)bkg;
+ safe = nelmts;
+ } /* end else */
+
+ for(elmtno = 0; elmtno < safe; elmtno++) {
+ size_t buf_size;
+ hbool_t dst_copy = FALSE;
+ hbool_t is_nil; /* Whether reference is "nil" */
+
+ /* Check for "nil" source reference */
+ if((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, &is_nil) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'")
+
+ if(is_nil) {
+ /* Write "nil" reference to destination location */
+ if((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, b) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'")
+ } /* end else-if */
+ else {
+ /* Get size of references */
+ if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize(
+ src->shared->u.atomic.u.r.file, s, src->shared->size,
+ dst->shared->u.atomic.u.r.file, &dst_copy)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size")
+
+ /* Check if conversion buffer is large enough, resize if necessary. */
+ if(conv_buf_size < buf_size) {
+ conv_buf_size = buf_size;
+ if(NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HDmemset(conv_buf, 0, conv_buf_size);
+ } /* end if */
+
+ if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK))
+ H5MM_memcpy(conv_buf, s, buf_size);
+ else {
+ /* Read reference */
+ if(src->shared->u.atomic.u.r.cls->read(
+ src->shared->u.atomic.u.r.file, s, src->shared->size,
+ dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data")
+ } /* end else */
+
+ if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK))
+ H5MM_memcpy(d, conv_buf, buf_size);
+ else {
+ /* Write reference to destination location */
+ if(dst->shared->u.atomic.u.r.cls->write(
+ src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype,
+ dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data")
+ } /* end else */
+ } /* end else */
+
+ /* Advance pointers */
+ s += s_stride;
+ d += d_stride;
+ b += b_stride;
+ } /* end for */
+
+ /* Decrement number of elements left to convert */
+ nelmts -= safe;
+ } /* end while */
+ } /* end case */
+ break;
+
+ default: /* Some other command we don't know about yet.*/
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command")
+ } /* end switch */
+
+done:
+ /* Release the conversion buffer (always allocated, except on errors) */
+ if(conv_buf)
+ conv_buf = H5FL_BLK_FREE(ref_seq, conv_buf);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__conv_ref() */
+
/*-------------------------------------------------------------------------
* Function: H5T__conv_i_i
@@ -9305,3 +9511,84 @@ H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order)
FUNC_LEAVE_NOAPI(SUCCEED)
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_reclaim
+ *
+ * Purpose: Frees the buffers allocated for storing variable-length data
+ * in memory. Only frees the VL data in the selection defined in the
+ * dataspace.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_reclaim(hid_t type_id, H5S_t *space, void *buf)
+{
+ H5T_t *type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check args */
+ HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(space);
+ HDassert(buf);
+
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
+
+ /* Get the allocation info */
+ if(H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
+
+ /* Call H5S_select_iterate with args, etc. */
+ dset_op.op_type = H5S_SEL_ITER_OP_LIB;
+ dset_op.u.lib_op = H5T_reclaim_cb;
+
+ ret_value = H5S_select_iterate(buf, type, space, &dset_op, &vl_alloc_info);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_reclaim() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_reclaim_cb
+ *
+ * Purpose: Iteration callback to reclaim conversion allocated memory for a
+ * buffer element.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_reclaim_cb(void *elem, const H5T_t *dt, unsigned H5_ATTR_UNUSED ndim,
+ const hsize_t H5_ATTR_UNUSED *point, void *op_data)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(elem);
+ HDassert(dt);
+
+ if(dt->shared->type == H5T_REFERENCE) {
+ if(H5T_ref_reclaim(elem, dt) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim ref elements")
+ } else {
+ HDassert(op_data);
+
+ /* Allow vlen reclaim to recurse into that routine */
+ if(H5T_vlen_reclaim(elem, dt, (H5T_vlen_alloc_info_t *)op_data) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_reclaim_cb() */
diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c
index 6ee0cd7..2c98dc0 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -110,7 +110,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_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_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -137,7 +137,8 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_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)))
+ 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 */
@@ -174,8 +175,8 @@ done:
hid_t
H5Topen1(hid_t loc_id, const char *name)
{
- void *dt = NULL; /* Datatype token created by VOL connector */
- H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
+ void *dt = NULL; /* Datatype object created by VOL connector */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 6daa544..357bb08 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -126,7 +126,6 @@ static H5T_t *
H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_align,
size_t *offset, size_t *comp_size)
{
- H5T_t *dt; /* Datatype to make native */
H5T_t *super_type; /* Super type of VL, array and enum datatypes */
H5T_t *nat_super_type; /* Native form of VL, array & enum super datatype */
H5T_t *new_type = NULL; /* New native datatype */
@@ -218,26 +217,36 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
case H5T_REFERENCE:
{
+ H5T_t *dt; /* Datatype to make native */
size_t align;
size_t ref_size;
- int not_equal;
if(NULL == (ret_value = H5T_copy(dtype, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy reference type")
- /* Decide if the data type is object or dataset region reference. */
+ /* Decide if the data type is object reference. */
if(NULL == (dt = (H5T_t *)H5I_object(H5T_STD_REF_OBJ_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
- not_equal = H5T_cmp(ret_value, dt, FALSE);
/* Update size, offset and compound alignment for parent. */
- if(!not_equal) {
+ if(0 == H5T_cmp(ret_value, dt, FALSE)) {
align = H5T_HOBJREF_COMP_ALIGN_g;
ref_size = sizeof(hobj_ref_t);
} /* end if */
else {
- align = H5T_HDSETREGREF_COMP_ALIGN_g;
- ref_size = sizeof(hdset_reg_ref_t);
+ /* Decide if the data type is dataset region reference. */
+ if(NULL == (dt = (H5T_t *)H5I_object(H5T_STD_REF_DSETREG_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
+
+ if (0 == H5T_cmp(ret_value, dt, FALSE)) {
+ align = H5T_HDSETREGREF_COMP_ALIGN_g;
+ ref_size = sizeof(hdset_reg_ref_t);
+ } /* end if */
+ else {
+ /* Only pointers to underlying opaque reference types */
+ align = H5T_REF_COMP_ALIGN_g;
+ ref_size = sizeof(H5R_ref_t);
+ } /* end else */
} /* end else */
if(H5T__cmp_offset(comp_size, offset, ref_size, (size_t)1, align, struct_align) < 0)
@@ -263,7 +272,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
/* Construct child compound type and retrieve a list of their IDs, offsets, total size, and alignment for compound type. */
for(u = 0; u < nmemb; u++) {
- if(NULL == (memb_type = H5T_get_member_type(dtype, u, H5T_COPY_TRANSIENT)))
+ if(NULL == (memb_type = H5T_get_member_type(dtype, u)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed")
if(NULL == (comp_mname[u] = H5T__get_member_name(dtype, u)))
@@ -521,8 +530,7 @@ done:
* the code below, but early (4.4.7, at least) gcc only allows
* diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wduplicated-branches"
+H5_GCC_DIAG_OFF(duplicated-branches)
/*-------------------------------------------------------------------------
* Function: H5T__get_native_integer
@@ -663,7 +671,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_integer() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(duplicated-branches)
/* Disable warning for intentional identical branches here -QAK */
/*
@@ -671,8 +679,7 @@ done:
* the code below, but early (4.4.7, at least) gcc only allows
* diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wduplicated-branches"
+H5_GCC_DIAG_OFF(duplicated-branches)
/*-------------------------------------------------------------------------
* Function: H5T__get_native_float
@@ -797,7 +804,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_float() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(duplicated-branches)
/* Disable warning for intentional identical branches here -QAK */
/*
@@ -805,8 +812,7 @@ done:
* the code below, but early (4.4.7, at least) gcc only allows
* diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wduplicated-branches"
+H5_GCC_DIAG_OFF(duplicated-branches)
/*-------------------------------------------------------------------------
* Function: H5T__get_native_bitfield
@@ -892,7 +898,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_bitfield() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(duplicated-branches)
/*-------------------------------------------------------------------------
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 7798e37..39bff15 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -40,6 +40,7 @@
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Oprivate.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Other public headers needed by this file */
#include "H5Spublic.h" /* Dataspace functions */
@@ -95,9 +96,14 @@
/* This version also encodes array types more efficiently */
#define H5O_DTYPE_VERSION_3 3
+/* This is the version that adds support for new reference types and prevents
+ * older versions of the library to attempt reading unknown types.
+ */
+#define H5O_DTYPE_VERSION_4 4
+
/* The latest version of the format. Look through the 'encode helper' routine
* and 'size' callback for places to change when updating this. */
-#define H5O_DTYPE_VERSION_LATEST H5O_DTYPE_VERSION_3
+#define H5O_DTYPE_VERSION_LATEST H5O_DTYPE_VERSION_4
/* Flags for visiting datatype */
@@ -175,37 +181,56 @@ struct H5T_path_t {
H5T_cdata_t cdata; /*data for this function */
};
+/* Reference function pointers */
+typedef herr_t (*H5T_ref_isnullfunc_t)(const H5VL_object_t *file, const void *src_buf, hbool_t *isnull);
+typedef herr_t (*H5T_ref_setnullfunc_t)(H5VL_object_t *file, void *dst_buf, void *bg_buf);
+typedef size_t (*H5T_ref_getsizefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+typedef herr_t (*H5T_ref_readfunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+typedef herr_t (*H5T_ref_writefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
+
+typedef struct H5T_ref_class_t {
+ H5T_ref_isnullfunc_t isnull; /* check if reference value is NIL */
+ H5T_ref_setnullfunc_t setnull; /* set a reference value to NIL */
+ H5T_ref_getsizefunc_t getsize; /* get reference size (bytes) */
+ H5T_ref_readfunc_t read; /* read reference into buffer */
+ H5T_ref_writefunc_t write; /* write reference from buffer */
+} H5T_ref_class_t;
+
typedef struct H5T_atomic_t {
- H5T_order_t order; /*byte order */
- size_t prec; /*precision in bits */
- size_t offset; /*bit position of lsb of value */
- H5T_pad_t lsb_pad;/*type of lsb padding */
- H5T_pad_t msb_pad;/*type of msb padding */
+ H5T_order_t order; /* byte order */
+ size_t prec; /* precision in bits */
+ size_t offset; /* bit position of lsb of value */
+ H5T_pad_t lsb_pad; /* type of lsb padding */
+ H5T_pad_t msb_pad; /* type of msb padding */
union {
- struct {
- H5T_sign_t sign; /*type of integer sign */
- } i; /*integer; integer types */
-
- struct {
- size_t sign; /*bit position of sign bit */
- size_t epos; /*position of lsb of exponent */
- size_t esize; /*size of exponent in bits */
- uint64_t ebias; /*exponent bias */
- size_t mpos; /*position of lsb of mantissa */
- size_t msize; /*size of mantissa */
- H5T_norm_t norm; /*normalization */
- H5T_pad_t pad; /*type of padding for internal bits */
- } f; /*floating-point types */
-
- struct {
- H5T_cset_t cset; /*character set */
- H5T_str_t pad; /*space or null padding of extra bytes */
- } s; /*string types */
-
- struct {
- H5R_type_t rtype; /*type of reference stored */
- H5T_loc_t loc; /* Location of data in buffer */
- } r; /*reference types */
+ struct {
+ H5T_sign_t sign; /* type of integer sign */
+ } i; /* integer; integer types */
+
+ struct {
+ size_t sign; /* bit position of sign bit */
+ size_t epos; /* position of lsb of exponent */
+ size_t esize; /* size of exponent in bits */
+ uint64_t ebias; /* exponent bias */
+ size_t mpos; /* position of lsb of mantissa */
+ size_t msize; /* size of mantissa */
+ H5T_norm_t norm; /* normalization */
+ H5T_pad_t pad; /* type of padding for internal bits */
+ } f; /* floating-point types */
+
+ struct {
+ H5T_cset_t cset; /* character set */
+ H5T_str_t pad; /* space or null padding of extra bytes */
+ } s; /* string types */
+
+ struct {
+ H5R_type_t rtype; /* type of reference stored */
+ unsigned version; /* version of encoded reference */
+ hbool_t opaque; /* opaque reference type */
+ H5T_loc_t loc; /* location of data in buffer */
+ H5VL_object_t *file; /* file VOL pointer (if data is on disk) */
+ const H5T_ref_class_t *cls; /* Pointer to ref class callbacks */
+ } r; /* reference types */
} u;
} H5T_atomic_t;
@@ -243,14 +268,6 @@ typedef struct H5T_enum_t {
char **name; /*array of symbol names */
} H5T_enum_t;
-/* VL function pointers */
-typedef ssize_t (*H5T_vlen_getlenfunc_t)(const void *vl_addr);
-typedef void * (*H5T_vlen_getptrfunc_t)(void *vl_addr);
-typedef htri_t (*H5T_vlen_isnullfunc_t)(const H5F_t *f, void *vl_addr);
-typedef herr_t (*H5T_vlen_readfunc_t)(H5F_t *f, void *_vl, void *buf, size_t len);
-typedef herr_t (*H5T_vlen_writefunc_t)(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size);
-typedef herr_t (*H5T_vlen_setnullfunc_t)(H5F_t *f, void *_vl, void *_bg);
-
/* VL types */
typedef enum {
H5T_VLEN_BADTYPE = -1, /* invalid VL Type */
@@ -259,20 +276,35 @@ typedef enum {
H5T_VLEN_MAXTYPE /* highest type (Invalid as true type) */
} H5T_vlen_type_t;
+/* VL function pointers */
+typedef herr_t (*H5T_vlen_getlen_func_t)(H5VL_object_t *file, const void *vl_addr, size_t *len);
+typedef void * (*H5T_vlen_getptr_func_t)(void *vl_addr);
+typedef herr_t (*H5T_vlen_isnull_func_t)(const H5VL_object_t *file, void *vl_addr, hbool_t *isnull);
+typedef herr_t (*H5T_vlen_setnull_func_t)(H5VL_object_t *file, void *_vl, void *_bg);
+typedef herr_t (*H5T_vlen_read_func_t)(H5VL_object_t *file, void *_vl, void *buf, size_t len);
+typedef herr_t (*H5T_vlen_write_func_t)(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size);
+typedef herr_t (*H5T_vlen_delete_func_t)(H5VL_object_t *file, const void *_vl);
+
+/* VL datatype callbacks */
+typedef struct H5T_vlen_class_t {
+ H5T_vlen_getlen_func_t getlen; /* Function to get VL sequence size (in element units, not bytes) */
+ H5T_vlen_getptr_func_t getptr; /* Function to get VL sequence pointer */
+ H5T_vlen_isnull_func_t isnull; /* Function to check if VL value is NIL */
+ H5T_vlen_setnull_func_t setnull;/* Function to set a VL value to NIL */
+ H5T_vlen_read_func_t read; /* Function to read VL sequence into buffer */
+ H5T_vlen_write_func_t write; /* Function to write VL sequence from buffer */
+ H5T_vlen_delete_func_t del; /* Function to delete VL sequence */
+} H5T_vlen_class_t;
+
/* A VL datatype */
typedef struct H5T_vlen_t {
H5T_vlen_type_t type; /* Type of VL data in buffer */
H5T_loc_t loc; /* Location of VL data in buffer */
- H5T_cset_t cset; /* For VL string. character set */
- H5T_str_t pad; /* For VL string. space or null padding of
+ H5T_cset_t cset; /* For VL string: character set */
+ H5T_str_t pad; /* For VL string: space or null padding of
* extra bytes */
- H5F_t *f; /* File ID (if VL data is on disk) */
- H5T_vlen_getptrfunc_t getptr; /* Function to get VL sequence pointer */
- H5T_vlen_getlenfunc_t getlen; /* Function to get VL sequence size (in element units, not bytes) */
- H5T_vlen_isnullfunc_t isnull; /* Function to check if VL value is NIL */
- H5T_vlen_readfunc_t read; /* Function to read VL sequence into buffer */
- H5T_vlen_writefunc_t write; /* Function to write VL sequence from buffer */
- H5T_vlen_setnullfunc_t setnull; /* Function to set a VL value to NIL */
+ H5VL_object_t *file; /* File object (if VL data is on disk) */
+ const H5T_vlen_class_t *cls; /* Pointer to VL class callbacks */
} H5T_vlen_t;
/* An opaque datatype */
@@ -304,6 +336,7 @@ typedef struct H5T_shared_t {
unsigned version; /* Version of object header message to encode this object with */
hbool_t force_conv;/* Set if this type always needs to be converted and H5T__conv_noop cannot be called */
struct H5T_t *parent;/*parent type for derived datatypes */
+ H5VL_object_t *owned_vol_obj; /* Vol object owned by this type (free on close) */
union {
H5T_atomic_t atomic; /* an atomic datatype */
H5T_compnd_t compnd; /* a compound datatype (struct) */
@@ -371,6 +404,7 @@ H5_DLLVAR size_t H5T_POINTER_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_HVL_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_HOBJREF_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_HDSETREGREF_COMP_ALIGN_g;
+H5_DLLVAR size_t H5T_REF_COMP_ALIGN_g;
/*
* Alignment information for native types. A value of N indicates that the
@@ -483,6 +517,9 @@ H5_DLL herr_t H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5_DLL herr_t H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
+ size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
H5_DLL herr_t H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *bkg);
@@ -1142,13 +1179,16 @@ H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size);
/* VL functions */
H5_DLL H5T_t * H5T__vlen_create(const H5T_t *base);
-H5_DLL htri_t H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc);
+H5_DLL htri_t H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
/* Array functions */
H5_DLL H5T_t *H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]);
H5_DLL int H5T__get_array_ndims(const H5T_t *dt);
H5_DLL int H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]);
+/* Reference functions */
+H5_DLL htri_t H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
+
/* Compound functions */
H5_DLL herr_t H5T__insert(H5T_t *parent, const char *name, size_t offset,
const H5T_t *member);
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 3dcbb2c..e05bb4e 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -52,11 +52,13 @@ typedef struct H5T_t H5T_t;
typedef struct H5T_stats_t H5T_stats_t;
typedef struct H5T_path_t H5T_path_t;
+/* Forward reference of H5S_t */
+struct H5S_t;
+
/* How to copy a datatype */
typedef enum H5T_copy_t {
H5T_COPY_TRANSIENT,
H5T_COPY_ALL,
- H5T_COPY_REOPEN
} H5T_copy_t;
/* Location of datatype information */
@@ -106,7 +108,8 @@ H5_DLLVAR H5T_order_t H5T_native_order_g;
/* Private functions */
H5_DLL herr_t H5T_init(void);
-H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method);
+H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
+H5_DLL H5T_t *H5T_copy_reopen(H5T_t *old_dt);
H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
H5_DLL herr_t H5T_close(H5T_t *dt);
H5_DLL herr_t H5T_close_real(H5T_t *dt);
@@ -130,14 +133,18 @@ H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p);
H5_DLL H5T_subset_info_t *H5T_path_compound_subset(const H5T_path_t *p);
H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id,
size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg);
-H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_op_data);
+H5_DLL herr_t H5T_reclaim(hid_t type_id, struct H5S_t *space, void *buf);
+H5_DLL herr_t H5T_reclaim_cb(void *elem, const H5T_t *dt, unsigned ndim, const hsize_t *point, void *op_data);
+H5_DLL herr_t H5T_ref_reclaim(void *elem, const H5T_t *dt);
+H5_DLL herr_t H5T_vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info);
H5_DLL herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt);
-H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
+H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
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 herr_t H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file);
+H5_DLL herr_t H5T_own_vol_obj(H5T_t *dt, H5VL_object_t *vol_obj);
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);
@@ -157,7 +164,7 @@ H5_DLL herr_t H5T_update_shared(H5T_t *type);
/* Field functions (for both compound & enumerated types) */
H5_DLL int H5T_get_nmembers(const H5T_t *dt);
-H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method);
+H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno);
H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
/* Atomic functions */
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index fc3e4ee..0ec0c73 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -262,8 +262,9 @@ H5_DLLVAR hid_t H5T_IEEE_F64LE_g;
#define H5T_STD_B32LE (H5OPEN H5T_STD_B32LE_g)
#define H5T_STD_B64BE (H5OPEN H5T_STD_B64BE_g)
#define H5T_STD_B64LE (H5OPEN H5T_STD_B64LE_g)
-#define H5T_STD_REF_OBJ (H5OPEN H5T_STD_REF_OBJ_g)
+#define H5T_STD_REF_OBJ (H5OPEN H5T_STD_REF_OBJ_g)
#define H5T_STD_REF_DSETREG (H5OPEN H5T_STD_REF_DSETREG_g)
+#define H5T_STD_REF (H5OPEN H5T_STD_REF_g)
H5_DLLVAR hid_t H5T_STD_I8BE_g;
H5_DLLVAR hid_t H5T_STD_I8LE_g;
H5_DLLVAR hid_t H5T_STD_I16BE_g;
@@ -290,6 +291,7 @@ H5_DLLVAR hid_t H5T_STD_B64BE_g;
H5_DLLVAR hid_t H5T_STD_B64LE_g;
H5_DLLVAR hid_t H5T_STD_REF_OBJ_g;
H5_DLLVAR hid_t H5T_STD_REF_DSETREG_g;
+H5_DLLVAR hid_t H5T_STD_REF_g;
/*
* Types which are particular to Unix.
@@ -591,6 +593,7 @@ H5_DLL H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata);
H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id);
H5_DLL herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts,
void *buf, void *background, hid_t plist_id);
+H5_DLL herr_t H5Treclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5Tref.c b/src/H5Tref.c
new file mode 100644
index 0000000..f97b78a
--- /dev/null
+++ b/src/H5Tref.c
@@ -0,0 +1,1218 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Module Info: This module contains the functionality for reference
+ * datatypes in the H5T interface.
+ */
+
+#include "H5Tmodule.h" /* This source code file is part of the H5T module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5R_FRIEND /*suppress error about including H5Rpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Fpkg.h" /* File */
+#include "H5Rpkg.h" /* References */
+#include "H5Tpkg.h" /* Datatypes */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+/****************/
+/* Local Macros */
+/****************/
+
+#define H5T_REF_MEM_SIZE (H5R_REF_BUF_SIZE)
+#define H5T_REF_OBJ_MEM_SIZE (H5R_OBJ_REF_BUF_SIZE)
+#define H5T_REF_DSETREG_MEM_SIZE (H5R_DSET_REG_REF_BUF_SIZE)
+
+#define H5T_REF_OBJ_DISK_SIZE(f) (H5F_SIZEOF_ADDR(f))
+#define H5T_REF_DSETREG_DISK_SIZE(f) (H5HG_HEAP_ID_SIZE(f))
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* For region compatibility support */
+struct H5Tref_dsetreg {
+ H5O_token_t token; /* Object token */
+ H5S_t *space; /* Dataspace */
+};
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
+static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf);
+static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
+
+static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
+static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf);
+static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
+
+/* For compatibility */
+static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
+static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+
+static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
+static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
+static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Class for reference in memory */
+static const H5T_ref_class_t H5T_ref_mem_g = {
+ H5T__ref_mem_isnull, /* 'isnull' */
+ H5T__ref_mem_setnull, /* 'setnull' */
+ H5T__ref_mem_getsize, /* 'getsize' */
+ H5T__ref_mem_read, /* 'read' */
+ H5T__ref_mem_write /* 'write' */
+};
+
+static const H5T_ref_class_t H5T_ref_disk_g = {
+ H5T__ref_disk_isnull, /* 'isnull' */
+ H5T__ref_disk_setnull, /* 'setnull' */
+ H5T__ref_disk_getsize, /* 'getsize' */
+ H5T__ref_disk_read, /* 'read' */
+ H5T__ref_disk_write /* 'write' */
+};
+
+static const H5T_ref_class_t H5T_ref_obj_disk_g = {
+ H5T__ref_obj_disk_isnull, /* 'isnull' */
+ NULL, /* 'setnull' */
+ H5T__ref_obj_disk_getsize, /* 'getsize' */
+ H5T__ref_obj_disk_read, /* 'read' */
+ NULL /* 'write' */
+};
+
+static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = {
+ H5T__ref_dsetreg_disk_isnull, /* 'isnull' */
+ NULL, /* 'setnull' */
+ H5T__ref_dsetreg_disk_getsize, /* 'getsize' */
+ H5T__ref_dsetreg_disk_read, /* 'read' */
+ NULL /* 'write' */
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_set_loc
+ *
+ * Purpose: Sets the location of a reference datatype to be either on disk
+ * or in memory
+ *
+ * Return:
+ * One of two values on success:
+ * TRUE - If the location of any reference types changed
+ * FALSE - If the location of any reference types is the same
+ * Negative value is returned on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
+{
+ htri_t ret_value = FALSE; /* Indicate success, but no location change */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(dt);
+ /* f is NULL when loc == H5T_LOC_MEMORY */
+ HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC);
+
+ /* Only change the location if it's different */
+ if(loc == dt->shared->u.atomic.u.r.loc && file == dt->shared->u.atomic.u.r.file)
+ HGOTO_DONE(FALSE)
+
+ switch(loc) {
+ case H5T_LOC_MEMORY: /* Memory based reference datatype */
+ HDassert(NULL == file);
+
+ /* Mark this type as being stored in memory */
+ dt->shared->u.atomic.u.r.loc = H5T_LOC_MEMORY;
+
+ /* Reset file ID (since this reference is in memory) */
+ dt->shared->u.atomic.u.r.file = file; /* file is NULL */
+
+ if(dt->shared->u.atomic.u.r.opaque) {
+ /* Size in memory, disk size is different */
+ dt->shared->size = H5T_REF_MEM_SIZE;
+ dt->shared->u.atomic.prec = 8 * dt->shared->size;
+
+ /* Set up the function pointers to access the reference in memory */
+ dt->shared->u.atomic.u.r.cls = &H5T_ref_mem_g;
+ } /* end if */
+ else if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) {
+ /* Size in memory, disk size is different */
+ dt->shared->size = H5T_REF_OBJ_MEM_SIZE;
+ dt->shared->u.atomic.prec = 8 * dt->shared->size;
+
+ /* Unused for now */
+ dt->shared->u.atomic.u.r.cls = NULL;
+ } /* end else-if */
+ else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) {
+ /* Size in memory, disk size is different */
+ dt->shared->size = H5T_REF_DSETREG_MEM_SIZE;
+ dt->shared->u.atomic.prec = 8 * dt->shared->size;
+
+ /* Unused for now */
+ dt->shared->u.atomic.u.r.cls = NULL;
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid location")
+ break;
+
+ case H5T_LOC_DISK: /* Disk based reference datatype */
+ HDassert(file);
+
+ /* Mark this type as being stored on disk */
+ dt->shared->u.atomic.u.r.loc = H5T_LOC_DISK;
+
+ /* Set file pointer (since this reference is on disk) */
+ dt->shared->u.atomic.u.r.file = file;
+
+ if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) {
+ H5F_t *f;
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data(file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Size on disk, memory size is different */
+ dt->shared->size = H5T_REF_OBJ_DISK_SIZE(f);
+ dt->shared->u.atomic.prec = 8 * dt->shared->size;
+
+ /* Set up the function pointers to access the reference in memory */
+ dt->shared->u.atomic.u.r.cls = &H5T_ref_obj_disk_g;
+ } /* end if */
+ else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) {
+ H5F_t *f;
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data(file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Size on disk, memory size is different */
+ dt->shared->size = H5T_REF_DSETREG_DISK_SIZE(f);
+ dt->shared->u.atomic.prec = 8 * dt->shared->size;
+
+ /* Set up the function pointers to access the reference in memory */
+ dt->shared->u.atomic.u.r.cls = &H5T_ref_dsetreg_disk_g;
+ } /* end else-if */
+ else {
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ size_t ref_encode_size;
+ H5R_ref_priv_t fixed_ref;
+
+ /* Get container info */
+ if(H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
+
+ /* Retrieve min encode size (when references have no vlen part) */
+ HDmemset(&fixed_ref, 0, sizeof(fixed_ref));
+ fixed_ref.type = (int8_t)H5R_OBJECT2;
+ fixed_ref.token_size = (uint8_t)cont_info.token_size;
+ if(H5R__encode(NULL, &fixed_ref, NULL, &ref_encode_size, 0) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get encode size")
+
+ /* Size on disk, memory size is different */
+ dt->shared->size = MAX(H5_SIZEOF_UINT32_T +
+ H5R_ENCODE_HEADER_SIZE + cont_info.blob_id_size,
+ ref_encode_size);
+ dt->shared->u.atomic.prec = 8 * dt->shared->size;
+
+ /* Set up the function pointers to access the information on
+ * disk. Region and attribute references are stored identically
+ * on disk, so use the same functions.
+ */
+ dt->shared->u.atomic.u.r.cls = &H5T_ref_disk_g;
+ }
+ break;
+
+ case H5T_LOC_BADLOC:
+ /* Allow undefined location. In H5Odtype.c, H5O_dtype_decode sets undefined
+ * location for reference type and leaves it for the caller to decide.
+ */
+ dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC;
+
+ /* Reset file pointer */
+ dt->shared->u.atomic.u.r.file = NULL;
+
+ /* Reset the function pointers */
+ dt->shared->u.atomic.u.r.cls = NULL;
+
+ break;
+
+ case H5T_LOC_MAXLOC: /* MAXLOC is invalid */
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid reference datatype location")
+ } /* end switch */
+
+ /* Indicate that the location changed */
+ ret_value = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_set_loc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_mem_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file,
+ const void *src_buf, hbool_t *isnull)
+{
+ const unsigned char zeros[H5T_REF_MEM_SIZE] = { 0 };
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check parameters */
+ HDassert(src_buf);
+ HDassert(isnull);
+
+ *isnull = (0 == HDmemcmp(src_buf, zeros, H5T_REF_MEM_SIZE)) ? TRUE : FALSE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_mem_isnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_mem_setnull
+ *
+ * Purpose: Set a reference as NULL / uninitialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf,
+ H5_ATTR_UNUSED void *bg_buf)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_mem_setnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_mem_getsize
+ *
+ * Purpose: Retrieves the size of a memory based reference.
+ *
+ * Return: Non-negative on success/zero on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy)
+{
+ H5VL_object_t *vol_obj; /* VOL object for src ref's location */
+ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
+ hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */
+ char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */
+ unsigned flags = 0; /* References flags */
+ size_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(src_buf);
+ HDassert(src_size == H5T_REF_MEM_SIZE);
+
+ /* Retrieve VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier")
+
+ /* Set external flag if referenced file is not destination file */
+ if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal")
+ flags |= !files_equal ? H5R_IS_EXTERNAL : 0;
+
+ /* Force re-calculating encoding size if any flags are set */
+ if(flags || !src_ref->encode_size) {
+ char file_name_buf_static[256]; /* File name */
+ ssize_t file_name_len; /* Size of file name buffer */
+
+ /* Pass the correct encoding version for the selection depending on the
+ * file libver bounds, this is later retrieved in H5S hyper encode */
+ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) {
+ hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(dst_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector")
+
+ /* Set the file's libver bounds if using the native VOL connector */
+ if(is_native) {
+ H5F_t *dst_f; /* Native file struct */
+
+ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+ H5CX_set_libver_bounds(dst_f);
+ } /* end if */
+ else
+ H5CX_set_libver_bounds(NULL);
+ } /* end if */
+
+ /* Get file name */
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
+ if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ } /* end if */
+
+ /* Determine encoding size */
+ if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, NULL, &ret_value, flags) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size")
+ } /* end if */
+ else {
+ /* Can do a direct copy and skip blob decoding */
+ if(src_ref->type == (int8_t)H5R_OBJECT2)
+ *dst_copy = TRUE;
+
+ /* Get cached encoding size */
+ ret_value = src_ref->encode_size;
+ } /* end else */
+
+done:
+ H5MM_xfree(file_name_buf_dyn);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_mem_getsize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_mem_read
+ *
+ * Purpose: "Reads" the memory based reference into a buffer
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, void *dst_buf,
+ size_t dst_size)
+{
+ H5VL_object_t *vol_obj; /* VOL object for src ref's location */
+ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
+ hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */
+ char file_name_buf_static[256]; /* File name */
+ char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */
+ ssize_t file_name_len; /* Size of file name buffer */
+ unsigned flags = 0; /* References flags */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(src_buf);
+ HDassert(src_size == H5T_REF_MEM_SIZE);
+ HDassert(dst_file);
+ HDassert(dst_buf);
+ HDassert(dst_size);
+
+ /* Retrieve VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier")
+
+ /* Set external flag if referenced file is not destination file */
+ if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal")
+ flags |= !files_equal ? H5R_IS_EXTERNAL : 0;
+
+ /* Pass the correct encoding version for the selection depending on the
+ * file libver bounds, this is later retrieved in H5S hyper encode */
+ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) {
+ hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(dst_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector")
+
+ /* Set the file's libver bounds if using the native VOL connector */
+ if(is_native) {
+ H5F_t *dst_f;
+
+ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+ H5CX_set_libver_bounds(dst_f);
+ } /* end if */
+ else
+ H5CX_set_libver_bounds(NULL);
+ } /* end if */
+
+ /* Get file name */
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
+ if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ } /* end if */
+
+ /* Encode reference */
+ if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference")
+
+done:
+ H5MM_xfree(file_name_buf_dyn);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_mem_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_mem_write
+ *
+ * Purpose: "Writes" the memory reference from a buffer
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size,
+ H5R_type_t src_type, H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf,
+ size_t dst_size, void H5_ATTR_UNUSED *bg_buf)
+{
+ H5F_t *src_f;
+ hid_t file_id = H5I_INVALID_HID;
+ H5R_ref_priv_t *dst_ref = (H5R_ref_priv_t *)dst_buf;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(src_size);
+ HDassert(dst_buf);
+ HDassert(dst_size == H5T_REF_MEM_SIZE);
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(src_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Make sure reference buffer is correctly initialized */
+ HDmemset(dst_buf, 0, dst_size);
+
+ switch(src_type) {
+ case H5R_OBJECT1:
+ {
+ size_t token_size = H5F_SIZEOF_ADDR(src_f);
+
+ if(H5R__create_object((const H5O_token_t *)src_buf, token_size, dst_ref) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference")
+ }
+ break;
+
+ case H5R_DATASET_REGION1:
+ {
+ const struct H5Tref_dsetreg *src_reg = (const struct H5Tref_dsetreg *)src_buf;
+ size_t token_size = H5F_SIZEOF_ADDR(src_f);
+
+ if(H5R__create_region(&src_reg->token, token_size, src_reg->space, dst_ref) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference")
+
+ /* create_region creates its internal copy of the space */
+ if(H5S_close(src_reg->space) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace")
+ }
+ break;
+
+ case H5R_DATASET_REGION2:
+ /* Pass the correct encoding version for the selection depending on the
+ * file libver bounds, this is later retrieved in H5S hyper decode */
+ H5CX_set_libver_bounds(src_f);
+ H5_ATTR_FALLTHROUGH
+ case H5R_OBJECT2:
+ case H5R_ATTR:
+ /* Decode reference */
+ if(H5R__decode((const unsigned char *)src_buf, &src_size, dst_ref) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Cannot decode reference")
+ break;
+
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ HDassert("unknown reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ } /* end switch */
+
+ /* If no filename set, this is not an external reference */
+ if(NULL == H5R_REF_FILENAME(dst_ref)) {
+ /* TODO temporary hack to retrieve file object */
+ if((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+
+ /* Attach loc ID to reference and hold reference to it, this is a
+ * user exposed reference so set app_ref to TRUE. */
+ if(H5R__set_loc_id(dst_ref, file_id, TRUE, TRUE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference")
+ } /* end if */
+
+done:
+ if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0))
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on location id")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_mem_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_disk_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf,
+ hbool_t *isnull)
+{
+ const uint8_t *p = (const uint8_t *)src_buf;
+ H5R_type_t ref_type;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check parameters */
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(isnull);
+
+ /* Try to check encoded reference type */
+ ref_type = (H5R_type_t)*p++;
+ if(ref_type) {
+ /* This is a valid reference */
+ *isnull = FALSE;
+ } else {
+ /* Skip the size / header */
+ p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T;
+
+ /* Check if blob ID is "nil" */
+ if(H5VL_blob_specific(src_file, (void *)p, H5VL_BLOB_ISNULL, isnull) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_disk_isnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_disk_setnull
+ *
+ * Purpose: Set a reference as NULL / uninitialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
+{
+ uint8_t *q = (uint8_t *)dst_buf;
+ uint8_t *p_bg = (uint8_t *)bg_buf;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(dst_file);
+ HDassert(dst_buf);
+
+ /* TODO Should get rid of bg stuff */
+ if(p_bg) {
+ /* Skip the size / header */
+ p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+
+ /* Remove blob for old data */
+ if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
+ } /* end if */
+
+ /* Copy header manually so that it does not get encoded into the blob */
+ HDmemset(q, 0, H5R_ENCODE_HEADER_SIZE);
+ q += H5R_ENCODE_HEADER_SIZE;
+
+ /* Set the size */
+ UINT32ENCODE(q, 0);
+
+ /* Set blob ID to "nil" */
+ if(H5VL_blob_specific(dst_file, q, H5VL_BLOB_SETNULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_disk_setnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_disk_getsize
+ *
+ * Purpose: Retrieves the length of a disk based reference.
+ *
+ * Return: Non-negative value (cannot fail)
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t *dst_copy)
+{
+ const uint8_t *p = (const uint8_t *)src_buf;
+ unsigned flags;
+ H5R_type_t ref_type;
+ size_t ret_value = 0;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(src_buf);
+
+ /* Set reference type */
+ ref_type = (H5R_type_t)*p++;
+ if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid reference type")
+
+ /* Set flags */
+ flags = (unsigned)*p++;
+
+ if(!(flags & H5R_IS_EXTERNAL) && (ref_type == H5R_OBJECT2)) {
+ /* Can do a direct copy and skip blob decoding */
+ *dst_copy = TRUE;
+
+ ret_value = src_size;
+ } /* end if */
+ else {
+ /* Retrieve encoded data size */
+ UINT32DECODE(p, ret_value);
+
+ /* Add size of the header */
+ ret_value += H5R_ENCODE_HEADER_SIZE;
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_disk_getsize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_disk_read
+ *
+ * Purpose: Reads the disk based reference into a buffer
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_NDEBUG_UNUSED src_size,
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size)
+{
+ const uint8_t *p = (const uint8_t *)src_buf;
+ uint8_t *q = (uint8_t *)dst_buf;
+ size_t blob_size = dst_size;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(dst_buf);
+ HDassert(dst_size);
+
+ /* Copy header manually */
+ HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE);
+ p += H5R_ENCODE_HEADER_SIZE;
+ q += H5R_ENCODE_HEADER_SIZE;
+ blob_size -= H5R_ENCODE_HEADER_SIZE;
+
+ /* Skip the size */
+ p += H5_SIZEOF_UINT32_T;
+ HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T));
+
+ /* Retrieve blob */
+ if(H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_disk_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_disk_write
+ *
+ * Purpose: Writes the disk based reference from a buffer
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
+ size_t src_size, H5R_type_t H5_ATTR_UNUSED src_type, H5VL_object_t *dst_file,
+ void *dst_buf, size_t dst_size, void *bg_buf)
+{
+ const uint8_t *p = (const uint8_t *)src_buf;
+ uint8_t *q = (uint8_t *)dst_buf;
+ size_t buf_size_left = dst_size;
+ uint8_t *p_bg = (uint8_t *)bg_buf;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(src_buf);
+ HDassert(src_size);
+ HDassert(dst_file);
+ HDassert(dst_buf);
+
+ /* TODO Should get rid of bg stuff */
+ if(p_bg) {
+ size_t p_buf_size_left = dst_size;
+
+ /* Skip the size / header */
+ p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ HDassert(p_buf_size_left > (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE));
+ p_buf_size_left -= (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+
+ /* Remove blob for old data */
+ if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
+ } /* end if */
+
+ /* Copy header manually so that it does not get encoded into the blob */
+ HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE);
+ p += H5R_ENCODE_HEADER_SIZE;
+ q += H5R_ENCODE_HEADER_SIZE;
+ src_size -= H5R_ENCODE_HEADER_SIZE;
+ buf_size_left -= H5_SIZEOF_UINT32_T;
+
+ /* Set the size */
+ UINT32ENCODE(q, src_size);
+ HDassert(buf_size_left > H5_SIZEOF_UINT32_T);
+ buf_size_left -= H5_SIZEOF_UINT32_T;
+
+ /* Store blob */
+ if(H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_disk_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_obj_disk_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file,
+ const void *src_buf, hbool_t *isnull)
+{
+ H5F_t *src_f;
+ const uint8_t *p = (const uint8_t *)src_buf;
+ haddr_t addr;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check parameters */
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(isnull);
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(src_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Get the object address */
+ H5F_addr_decode(src_f, &p, &addr);
+
+ /* Check if heap address is 'nil' */
+ *isnull = (addr == 0) ? TRUE : FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_obj_disk_isnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_obj_disk_getsize
+ *
+ * Purpose: Retrieves the length of a disk based reference.
+ *
+ * Return: Non-negative value (cannot fail)
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *src_buf,
+ size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file,
+ hbool_t H5_ATTR_UNUSED *dst_copy)
+{
+ H5F_t *src_f;
+ size_t ret_value = 0;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(src_file);
+ HDassert(src_buf);
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(src_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+
+ HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f));
+
+ ret_value = H5T_REF_OBJ_DISK_SIZE(src_f);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_obj_disk_getsize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_obj_disk_read
+ *
+ * Purpose: Reads the disk based reference into a buffer
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size,
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size)
+{
+ H5F_t *src_f;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(dst_buf);
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(src_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f));
+ HDassert(dst_size == H5F_SIZEOF_ADDR(src_f));
+
+ /* Get object address */
+ if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size,
+ (H5O_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_obj_disk_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_dsetreg_disk_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf,
+ hbool_t *isnull)
+{
+ H5F_t *src_f;
+ const uint8_t *p = (const uint8_t *)src_buf;
+ haddr_t addr;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check parameters */
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(isnull);
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(src_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Get the heap address */
+ H5F_addr_decode(src_f, &p, &addr);
+
+ /* Check if heap address is 'nil' */
+ *isnull = (addr == 0) ? TRUE : FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_dsetreg_disk_isnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_dsetreg_disk_getsize
+ *
+ * Purpose: Retrieves the length of a disk based reference.
+ *
+ * Return: Non-negative value (cannot fail)
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file,
+ const void H5_ATTR_UNUSED *src_buf, size_t H5_ATTR_UNUSED src_size,
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t H5_ATTR_UNUSED *dst_copy)
+{
+ size_t ret_value = sizeof(struct H5Tref_dsetreg);
+
+#ifndef NDEBUG
+ FUNC_ENTER_STATIC
+#else
+ FUNC_ENTER_STATIC_NOERR
+#endif
+
+ HDassert(src_buf);
+
+#ifndef NDEBUG
+ {
+ H5F_t *src_f;
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(src_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+
+ HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f));
+ }
+#endif /* NDEBUG */
+
+#ifndef NDEBUG
+done:
+#endif
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_dsetreg_disk_getsize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_dsetreg_disk_read
+ *
+ * Purpose: Reads the disk based reference into a buffer
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size,
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size)
+{
+ H5F_t *src_f;
+ struct H5Tref_dsetreg *dst_reg = (struct H5Tref_dsetreg *)dst_buf;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(dst_buf);
+ HDassert(dst_size == sizeof(struct H5Tref_dsetreg));
+
+#ifndef NDEBUG
+ {
+ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */
+
+ /* Check if using native VOL connector */
+ if(H5VL_object_is_native(src_file, &is_native) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector")
+
+ /* Must use native VOL connector for this operation */
+ HDassert(is_native);
+ }
+#endif /* NDEBUG */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f));
+
+ /* Retrieve object address and space */
+ if(H5R__decode_token_region_compat(src_f, (const unsigned char *)src_buf,
+ &src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_dsetreg_disk_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_ref_reclaim
+ *
+ * Purpose: Internal routine to free reference datatypes
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_ref_reclaim(void *elem, const H5T_t *dt)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity checks */
+ HDassert(elem);
+ HDassert(dt && (dt->shared->type == H5T_REFERENCE));
+
+ if(dt->shared->u.atomic.u.r.opaque && H5R__destroy((H5R_ref_priv_t *)elem) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "cannot free reference")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_ref_reclaim() */
+
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index bafb47f..9d098c6 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -16,41 +16,120 @@
* datatypes in the H5T interface.
*/
-#include "H5Tmodule.h" /* This source code file is part of the H5T module */
-
+/****************/
+/* Module Setup */
+/****************/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5HGprivate.h" /* Global Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tpkg.h" /* Datatypes */
-
-/* Local functions */
-static herr_t H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, void *free_info);
-static ssize_t H5T_vlen_seq_mem_getlen(const void *_vl);
-static void * H5T_vlen_seq_mem_getptr(void *_vl);
-static htri_t H5T_vlen_seq_mem_isnull(const H5F_t *f, void *_vl);
-static herr_t H5T_vlen_seq_mem_read(H5F_t *f, void *_vl, void *_buf, size_t len);
-static herr_t H5T_vlen_seq_mem_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
-static herr_t H5T_vlen_seq_mem_setnull(H5F_t *f, void *_vl, void *_bg);
-static ssize_t H5T_vlen_str_mem_getlen(const void *_vl);
-static void * H5T_vlen_str_mem_getptr(void *_vl);
-static htri_t H5T_vlen_str_mem_isnull(const H5F_t *f, void *_vl);
-static herr_t H5T_vlen_str_mem_read(H5F_t *f, void *_vl, void *_buf, size_t len);
-static herr_t H5T_vlen_str_mem_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
-static herr_t H5T_vlen_str_mem_setnull(H5F_t *f, void *_vl, void *_bg);
-static ssize_t H5T_vlen_disk_getlen(const void *_vl);
-static void * H5T_vlen_disk_getptr(void *_vl);
-static htri_t H5T_vlen_disk_isnull(const H5F_t *f, void *_vl);
-static herr_t H5T_vlen_disk_read(H5F_t *f, void *_vl, void *_buf, size_t len);
-static herr_t H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
-static herr_t H5T_vlen_disk_setnull(H5F_t *f, void *_vl, void *_bg);
-
-/* Local variables */
+#include "H5Tmodule.h" /* This source code file is part of the H5T module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Memory-based VL sequence callbacks */
+static herr_t H5T__vlen_mem_seq_getlen(H5VL_object_t *file, const void *_vl, size_t *len);
+static void * H5T__vlen_mem_seq_getptr(void *_vl);
+static herr_t H5T__vlen_mem_seq_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull);
+static herr_t H5T__vlen_mem_seq_setnull(H5VL_object_t *file, void *_vl, void *_bg);
+static herr_t H5T__vlen_mem_seq_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len);
+static herr_t H5T__vlen_mem_seq_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
+
+/* Memory-based VL string callbacks */
+static herr_t H5T__vlen_mem_str_getlen(H5VL_object_t *file, const void *_vl, size_t *len);
+static void * H5T__vlen_mem_str_getptr(void *_vl);
+static herr_t H5T__vlen_mem_str_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull);
+static herr_t H5T__vlen_mem_str_setnull(H5VL_object_t *file, void *_vl, void *_bg);
+static herr_t H5T__vlen_mem_str_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len);
+static herr_t H5T__vlen_mem_str_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
+
+/* Disk-based VL sequence (and string) callbacks */
+static herr_t H5T__vlen_disk_getlen(H5VL_object_t *file, const void *_vl, size_t *len);
+static herr_t H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull);
+static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *_bg);
+static herr_t H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len);
+static herr_t H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
+static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl);
+
+
+/*********************/
+/* Public Variables */
+/*********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Class for VL sequences in memory */
+static const H5T_vlen_class_t H5T_vlen_mem_seq_g = {
+ H5T__vlen_mem_seq_getlen, /* 'getlen' */
+ H5T__vlen_mem_seq_getptr, /* 'getptr' */
+ H5T__vlen_mem_seq_isnull, /* 'isnull' */
+ H5T__vlen_mem_seq_setnull, /* 'setnull' */
+ H5T__vlen_mem_seq_read, /* 'read' */
+ H5T__vlen_mem_seq_write, /* 'write' */
+ NULL /* 'delete' */
+};
+
+/* Class for VL strings in memory */
+static const H5T_vlen_class_t H5T_vlen_mem_str_g = {
+ H5T__vlen_mem_str_getlen, /* 'getlen' */
+ H5T__vlen_mem_str_getptr, /* 'getptr' */
+ H5T__vlen_mem_str_isnull, /* 'isnull' */
+ H5T__vlen_mem_str_setnull, /* 'setnull' */
+ H5T__vlen_mem_str_read, /* 'read' */
+ H5T__vlen_mem_str_write, /* 'write' */
+ NULL /* 'delete' */
+};
+
+/* Class for both VL strings and sequences in file */
+static const H5T_vlen_class_t H5T_vlen_disk_g = {
+ H5T__vlen_disk_getlen, /* 'getlen' */
+ NULL, /* 'getptr' */
+ H5T__vlen_disk_isnull, /* 'isnull' */
+ H5T__vlen_disk_setnull, /* 'setnull' */
+ H5T__vlen_disk_read, /* 'read' */
+ H5T__vlen_disk_write, /* 'write' */
+ H5T__vlen_disk_delete /* 'delete' */
+};
@@ -174,8 +253,9 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
+H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
htri_t ret_value = FALSE; /* Indicate success, but no location change */
FUNC_ENTER_PACKAGE
@@ -185,76 +265,68 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC);
/* Only change the location if it's different */
- if(loc != dt->shared->u.vlen.loc || f != dt->shared->u.vlen.f) {
+ if(loc != dt->shared->u.vlen.loc || file != dt->shared->u.vlen.file) {
switch(loc) {
case H5T_LOC_MEMORY: /* Memory based VL datatype */
- HDassert(NULL == f);
+ HDassert(NULL == file);
/* Mark this type as being stored in memory */
dt->shared->u.vlen.loc = H5T_LOC_MEMORY;
if(dt->shared->u.vlen.type == H5T_VLEN_SEQUENCE) {
- /* size in memory, disk size is different */
+ /* Size in memory, disk size is different */
dt->shared->size = sizeof(hvl_t);
/* Set up the function pointers to access the VL sequence in memory */
- dt->shared->u.vlen.getlen = H5T_vlen_seq_mem_getlen;
- dt->shared->u.vlen.getptr = H5T_vlen_seq_mem_getptr;
- dt->shared->u.vlen.isnull = H5T_vlen_seq_mem_isnull;
- 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;
- }
+ dt->shared->u.vlen.cls = &H5T_vlen_mem_seq_g;
+ } /* end if */
else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) {
- /* size in memory, disk size is different */
+ /* Size in memory, disk size is different */
dt->shared->size = sizeof(char *);
/* Set up the function pointers to access the VL string in memory */
- dt->shared->u.vlen.getlen = H5T_vlen_str_mem_getlen;
- dt->shared->u.vlen.getptr = H5T_vlen_str_mem_getptr;
- dt->shared->u.vlen.isnull = H5T_vlen_str_mem_isnull;
- 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;
- }
- else {
+ dt->shared->u.vlen.cls = &H5T_vlen_mem_str_g;
+ } /* end else-if */
+ else
HDassert(0 && "Invalid VL type");
- }
- /* Reset file ID (since this VL is in memory) */
- dt->shared->u.vlen.f = NULL;
+ /* Reset file pointer (since this VL is in memory) */
+ dt->shared->u.vlen.file = NULL;
break;
case H5T_LOC_DISK: /* Disk based VL datatype */
- HDassert(f);
+ HDassert(file);
/* Mark this type as being stored on disk */
dt->shared->u.vlen.loc = H5T_LOC_DISK;
- /*
- * Size of element on disk is 4 bytes for the length, plus the size
- * of an address in this file, plus 4 bytes for the size of a heap
- * ID. Memory size is different
- */
- dt->shared->size = 4 + (size_t)H5F_SIZEOF_ADDR(f) + 4;
+ /* Get container info */
+ if(H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
+
+ /* The datatype size is equal to 4 bytes for the sequence length
+ * plus the size of a blob id */
+ dt->shared->size = 4 + cont_info.blob_id_size;
/* Set up the function pointers to access the VL information on disk */
/* VL sequences and VL strings are stored identically on disk, so use the same functions */
- dt->shared->u.vlen.getlen = H5T_vlen_disk_getlen;
- dt->shared->u.vlen.getptr = H5T_vlen_disk_getptr;
- dt->shared->u.vlen.isnull = H5T_vlen_disk_isnull;
- dt->shared->u.vlen.read = H5T_vlen_disk_read;
- dt->shared->u.vlen.write = H5T_vlen_disk_write;
- dt->shared->u.vlen.setnull = H5T_vlen_disk_setnull;
+ dt->shared->u.vlen.cls = &H5T_vlen_disk_g;
/* Set file ID (since this VL is on disk) */
- dt->shared->u.vlen.f = f;
+ dt->shared->u.vlen.file = file;
break;
case H5T_LOC_BADLOC:
/* Allow undefined location. In H5Odtype.c, H5O_dtype_decode sets undefined
* location for VL type and leaves it for the caller to decide.
*/
+ dt->shared->u.vlen.loc = H5T_LOC_BADLOC;
+
+ /* Reset the function pointers to access the VL information */
+ dt->shared->u.vlen.cls = NULL;
+
+ /* Reset file pointer */
+ dt->shared->u.vlen.file = NULL;
break;
case H5T_LOC_MAXLOC:
@@ -269,11 +341,11 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T__vlen_set_loc() */
+} /* end H5T__vlen_set_loc() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_seq_mem_getlen
+ * Function: H5T__vlen_mem_seq_getlen
*
* Purpose: Retrieves the length of a memory based VL element.
*
@@ -284,33 +356,35 @@ done:
*
*-------------------------------------------------------------------------
*/
-static ssize_t
-H5T_vlen_seq_mem_getlen(const void *_vl)
+static herr_t
+H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- const hvl_t *vl=(const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
+ const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
#else
hvl_t vl; /* User's hvl_t information */
#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- /* check parameters, return result */
-#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- HDassert(vl);
+ /* Check parameter */
+ HDassert(_vl);
+ HDassert(len);
- FUNC_LEAVE_NOAPI((ssize_t)vl->len)
+#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
+ *len = vl->len;
#else
- HDassert(_vl);
H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
- FUNC_LEAVE_NOAPI((ssize_t)vl.len)
+ *len = vl.len;
#endif
-} /* end H5T_vlen_seq_mem_getlen() */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5T__vlen_mem_seq_getlen() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_seq_mem_getptr
+ * Function: H5T__vlen_mem_seq_getptr
*
* Purpose: Retrieves the pointer for a memory based VL element.
*
@@ -322,15 +396,15 @@ H5T_vlen_seq_mem_getlen(const void *_vl)
*-------------------------------------------------------------------------
*/
static void *
-H5T_vlen_seq_mem_getptr(void *_vl)
+H5T__vlen_mem_seq_getptr(void *_vl)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- const hvl_t *vl=(const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
+ const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
#else
hvl_t vl; /* User's hvl_t information */
#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check parameters, return result */
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
@@ -343,48 +417,82 @@ H5T_vlen_seq_mem_getptr(void *_vl)
FUNC_LEAVE_NOAPI(vl.p)
#endif
-} /* end H5T_vlen_seq_mem_getptr() */
+} /* end H5T__vlen_mem_seq_getptr() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_seq_mem_isnull
+ * Function: H5T__vlen_mem_seq_isnull
*
* Purpose: Checks if a memory sequence is the "null" sequence
*
- * Return: TRUE/FALSE on success/Negative on failure
+ * Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
*-------------------------------------------------------------------------
*/
-static htri_t
-H5T_vlen_seq_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
+static herr_t
+H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- const hvl_t *vl=(const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
+ const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
#else
hvl_t vl; /* User's hvl_t information */
#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- /* check parameters, return result */
-#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- HDassert(vl);
+ /* Check parameters */
+ HDassert(_vl);
- FUNC_LEAVE_NOAPI((vl->len==0 || vl->p==NULL) ? TRUE : FALSE)
+#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
+ *isnull = ((vl->len == 0 || vl->p == NULL) ? TRUE : FALSE);
#else
- HDassert(_vl);
H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
- FUNC_LEAVE_NOAPI((vl.len==0 || vl.p==NULL) ? TRUE : FALSE)
+ *isnull = ((vl.len == 0 || vl.p == NULL) ? TRUE : FALSE);
#endif
-} /* end H5T_vlen_seq_mem_isnull() */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5T__vlen_mem_seq_isnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__vlen_mem_seq_setnull
+ *
+ * Purpose: Sets a VL info object in memory to the "nil" value
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 8, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg)
+{
+ hvl_t vl; /* Temporary hvl_t to use during operation */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* check parameters */
+ HDassert(_vl);
+
+ /* Set the "nil" hvl_t */
+ vl.len = 0;
+ vl.p = NULL;
+
+ /* Set pointer in user's buffer with memcpy, to avoid alignment issues */
+ H5MM_memcpy(_vl, &vl, sizeof(hvl_t));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5T__vlen_mem_seq_setnull() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_seq_mem_read
+ * Function: H5T__vlen_mem_seq_read
*
* Purpose: "Reads" the memory based VL sequence into a buffer
*
@@ -396,36 +504,36 @@ H5T_vlen_seq_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_vlen_seq_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
+H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- const hvl_t *vl=(const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
+ const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
#else
hvl_t vl; /* User's hvl_t information */
#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check parameters, copy data */
HDassert(buf);
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
HDassert(vl && vl->p);
- H5MM_memcpy(buf,vl->p,len);
+ H5MM_memcpy(buf, vl->p, len);
#else
HDassert(_vl);
H5MM_memcpy(&vl, _vl, sizeof(hvl_t));
HDassert(vl.p);
- H5MM_memcpy(buf,vl.p,len);
+ H5MM_memcpy(buf, vl.p, len);
#endif
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5T_vlen_seq_mem_read() */
+} /* end H5T__vlen_mem_seq_read() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_seq_mem_write
+ * Function: H5T__vlen_mem_seq_write
*
* Purpose: "Writes" the memory based VL sequence from a buffer
*
@@ -437,104 +545,105 @@ H5T_vlen_seq_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_vlen_seq_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)
+H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, 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)
{
hvl_t vl; /* Temporary hvl_t to use during operation */
- size_t len;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check parameters */
HDassert(_vl);
HDassert(buf);
- if(seq_len!=0) {
- len=seq_len*base_size;
+ if(seq_len) {
+ size_t len = seq_len * base_size; /* Sequence size */
/* Use the user's memory allocation routine is one is defined */
- if(vl_alloc_info->alloc_func!=NULL) {
- if(NULL==(vl.p=(vl_alloc_info->alloc_func)(len,vl_alloc_info->alloc_info)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
+ if(vl_alloc_info->alloc_func != NULL) {
+ if(NULL == (vl.p = (vl_alloc_info->alloc_func)(len, vl_alloc_info->alloc_info)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "application memory allocation routine failed for VL data")
} /* end if */
- else { /* Default to system malloc */
+ else /* Default to system malloc */
if(NULL == (vl.p = HDmalloc(len)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
- } /* end else */
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data")
/* Copy the data into the newly allocated buffer */
- H5MM_memcpy(vl.p,buf,len);
-
+ H5MM_memcpy(vl.p, buf, len);
} /* end if */
else
- vl.p=NULL;
+ vl.p = NULL;
/* Set the sequence length */
- vl.len=seq_len;
+ vl.len = seq_len;
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- H5MM_memcpy(_vl,&vl,sizeof(hvl_t));
+ H5MM_memcpy(_vl, &vl, sizeof(hvl_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_vlen_seq_mem_write() */
+} /* end H5T__vlen_mem_seq_write() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_seq_mem_setnull
+ * Function: H5T__vlen_mem_str_getlen
*
- * Purpose: Sets a VL info object in memory to the "nil" value
+ * Purpose: Retrieves the length of a memory based VL string.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * Saturday, November 8, 2003
+ * Wednesday, June 2, 1999
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_vlen_seq_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED *_bg)
+H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len)
{
- hvl_t vl; /* Temporary hvl_t to use during operation */
+#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
+ const char *s = *(const char * const *)_vl; /* Pointer to the user's string information */
+#else
+ const char *s = NULL; /* Pointer to the user's string information */
+#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check parameters */
HDassert(_vl);
- /* Set the "nil" hvl_t */
- vl.len=0;
- vl.p=NULL;
+#ifndef H5_NO_ALIGNMENT_RESTRICTIONS
+ H5MM_memcpy(&s, _vl, sizeof(char *));
+#endif
- /* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- H5MM_memcpy(_vl,&vl,sizeof(hvl_t));
+ *len = HDstrlen(s);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5T_vlen_seq_mem_setnull() */
+} /* end H5T__vlen_mem_str_getlen() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_str_mem_getlen
+ * Function: H5T__vlen_mem_str_getptr
*
- * Purpose: Retrieves the length of a memory based VL string.
+ * Purpose: Retrieves the pointer for a memory based VL string.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-NULL on success/NULL on failure
*
* Programmer: Quincey Koziol
- * Wednesday, June 2, 1999
+ * Saturday, June 12, 2004
*
*-------------------------------------------------------------------------
*/
-static ssize_t
-H5T_vlen_str_mem_getlen(const void *_vl)
+static void *
+H5T__vlen_mem_str_getptr(void *_vl)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */
+ char *s = *(char **)_vl; /* Pointer to the user's string information */
#else
- const char *s = NULL; /* Pointer to the user's string information */
+ char *s = NULL; /* Pointer to the user's string information */
#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check parameters */
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
@@ -544,78 +653,71 @@ H5T_vlen_str_mem_getlen(const void *_vl)
H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
- FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(s))
-} /* end H5T_vlen_str_mem_getlen() */
+ FUNC_LEAVE_NOAPI(s)
+} /* end H5T__vlen_mem_str_getptr() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_str_mem_getptr
+ * Function: H5T__vlen_mem_str_isnull
*
- * Purpose: Retrieves the pointer for a memory based VL string.
+ * Purpose: Checks if a memory string is a NULL pointer
*
- * Return: Non-NULL on success/NULL on failure
+ * Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
- * Saturday, June 12, 2004
+ * Saturday, November 8, 2003
*
*-------------------------------------------------------------------------
*/
-static void *
-H5T_vlen_str_mem_getptr(void *_vl)
+static herr_t
+H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- char *s=*(char **)_vl; /* Pointer to the user's string information */
+ char *s = *(char **)_vl; /* Pointer to the user's string information */
#else
char *s = NULL; /* Pointer to the user's string information */
#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- /* check parameters */
-#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- HDassert(s);
-#else
- HDassert(_vl);
+#ifndef H5_NO_ALIGNMENT_RESTRICTIONS
H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
- FUNC_LEAVE_NOAPI(s)
-} /* end H5T_vlen_str_mem_getptr() */
+ *isnull = (s == NULL ? TRUE : FALSE);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5T__vlen_mem_str_isnull() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_str_mem_isnull
+ * Function: H5T__vlen_mem_str_setnull
*
- * Purpose: Checks if a memory string is a NULL pointer
+ * Purpose: Sets a VL info object in memory to the "null" value
*
- * Return: TRUE/FALSE on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
*-------------------------------------------------------------------------
*/
-static htri_t
-H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
+static herr_t
+H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg)
{
-#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- char *s=*(char **)_vl; /* Pointer to the user's string information */
-#else
- char *s = NULL; /* Pointer to the user's string information */
-#endif
+ char *t = NULL; /* Pointer to temporary buffer allocated */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
-#ifndef H5_NO_ALIGNMENT_RESTRICTIONS
- H5MM_memcpy(&s, _vl, sizeof(char *));
-#endif
+ /* Set pointer in user's buffer with memcpy, to avoid alignment issues */
+ H5MM_memcpy(_vl, &t, sizeof(char *));
- FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE)
-} /* end H5T_vlen_str_mem_isnull() */
+ FUNC_LEAVE_NOAPI(SUCCEED) /*lint !e429 The pointer in 't' has been copied */
+} /* end H5T__vlen_mem_str_setnull() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_str_mem_read
+ * Function: H5T__vlen_mem_str_read
*
* Purpose: "Reads" the memory based VL string into a buffer
*
@@ -627,17 +729,18 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl)
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
+H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf,
+ size_t len)
{
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
- char *s=*(char **)_vl; /* Pointer to the user's string information */
+ char *s = *(char **)_vl; /* Pointer to the user's string information */
#else
char *s; /* Pointer to the user's string information */
#endif
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- if(len>0) {
+ if(len > 0) {
/* check parameters */
HDassert(buf);
#ifdef H5_NO_ALIGNMENT_RESTRICTIONS
@@ -647,15 +750,15 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len)
H5MM_memcpy(&s, _vl, sizeof(char *));
#endif
- H5MM_memcpy(buf,s,len);
+ H5MM_memcpy(buf, s, len);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5T_vlen_str_mem_read() */
+} /* end H5T__vlen_mem_str_read() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_str_mem_write
+ * Function: H5T__vlen_mem_str_write
*
* Purpose: "Writes" the memory based VL string from a buffer
*
@@ -667,68 +770,42 @@ 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,
+H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, 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)
{
char *t; /* Pointer to temporary buffer allocated */
size_t len; /* Maximum length of the string to copy */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check parameters */
HDassert(buf);
/* Use the user's memory allocation routine if one is defined */
- if(vl_alloc_info->alloc_func!=NULL) {
- if(NULL==(t = (char *)(vl_alloc_info->alloc_func)((seq_len+1)*base_size,vl_alloc_info->alloc_info)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
- } /* end if */
- else { /* Default to system malloc */
+ if(vl_alloc_info->alloc_func != NULL) {
+ if(NULL == (t = (char *)(vl_alloc_info->alloc_func)((seq_len + 1) * base_size, vl_alloc_info->alloc_info)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "application memory allocation routine failed for VL data")
+ } /* end if */
+ else /* Default to system malloc */
if(NULL == (t = (char *)HDmalloc((seq_len + 1) * base_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
- } /* end else */
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data")
- len=(seq_len*base_size);
- H5MM_memcpy(t,buf,len);
- t[len]='\0';
+ /* 'write' the string into the buffer, with memcpy() */
+ len = (seq_len * base_size);
+ H5MM_memcpy(t, buf, len);
+ t[len] = '\0';
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- H5MM_memcpy(_vl,&t,sizeof(char *));
+ H5MM_memcpy(_vl, &t, sizeof(char *));
done:
FUNC_LEAVE_NOAPI(ret_value) /*lint !e429 The pointer in 't' has been copied */
-} /* end H5T_vlen_str_mem_write() */
+} /* end H5T__vlen_mem_str_write() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_str_mem_setnull
- *
- * Purpose: Sets a VL info object in memory to the "null" value
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, November 8, 2003
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED *_bg)
-{
- char *t=NULL; /* Pointer to temporary buffer allocated */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Set pointer in user's buffer with memcpy, to avoid alignment issues */
- H5MM_memcpy(_vl,&t,sizeof(char *));
-
- FUNC_LEAVE_NOAPI(SUCCEED) /*lint !e429 The pointer in 't' has been copied */
-} /* end H5T_vlen_str_mem_setnull() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5T_vlen_disk_getlen
+ * Function: H5T__vlen_disk_getlen
*
* Purpose: Retrieves the length of a disk based VL element.
*
@@ -739,82 +816,105 @@ H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED
*
*-------------------------------------------------------------------------
*/
-static ssize_t
-H5T_vlen_disk_getlen(const void *_vl)
+static herr_t
+H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *seq_len)
{
- const uint8_t *vl=(const uint8_t *)_vl; /* Pointer to the disk VL information */
- size_t seq_len = 0; /* Sequence length */
+ const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- /* check parameters */
+ /* Check parameters */
HDassert(vl);
+ HDassert(seq_len);
- UINT32DECODE(vl, seq_len);
+ /* Get length of sequence (different from blob size) */
+ UINT32DECODE(vl, *seq_len);
- FUNC_LEAVE_NOAPI((ssize_t)seq_len)
-} /* end H5T_vlen_disk_getlen() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5T__vlen_disk_getlen() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_disk_getptr
+ * Function: H5T__vlen_disk_isnull
*
- * Purpose: Retrieves the pointer to a disk based VL element.
+ * Purpose: Checks if a disk VL info object is the "nil" object
*
- * Return: Non-NULL on success/NULL on failure
+ * Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
- * Saturday, June 12, 2004
+ * Saturday, November 8, 2003
*
*-------------------------------------------------------------------------
*/
-static void *
-H5T_vlen_disk_getptr(void H5_ATTR_UNUSED *vl)
+static herr_t
+H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* check parameters */
+ FUNC_ENTER_STATIC
+
+ /* Check parameters */
+ HDassert(file);
HDassert(vl);
+ HDassert(isnull);
+
+ /* Skip the sequence's length */
+ vl += 4;
+
+ /* Check if blob ID is "nil" */
+ if(H5VL_blob_specific(file, vl, H5VL_BLOB_ISNULL, isnull) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
- FUNC_LEAVE_NOAPI(NULL)
-} /* end H5T_vlen_disk_getptr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__vlen_disk_isnull() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_disk_isnull
+ * Function: H5T__vlen_disk_setnull
*
- * Purpose: Checks if a disk VL info object is the "nil" object
+ * Purpose: Sets a VL info object on disk to the "nil" value
*
- * Return: TRUE/FALSE on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
*-------------------------------------------------------------------------
*/
-static htri_t
-H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
+static herr_t
+H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg)
{
- uint8_t *vl = (uint8_t *)_vl; /* Pointer to the disk VL information */
- haddr_t addr; /* Sequence's heap address */
+ uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
/* check parameters */
+ HDassert(file);
HDassert(vl);
- /* Skip the sequence's length */
- vl += 4;
+ /* Free heap object for old data */
+ if(bg != NULL)
+ /* Delete sequence in destination location */
+ if(H5T__vlen_disk_delete(file, bg) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object")
- /* Get the heap address */
- H5F_addr_decode(f, (const uint8_t **)&vl, &addr);
+ /* Set the length of the sequence */
+ UINT32ENCODE(vl, 0);
- FUNC_LEAVE_NOAPI(addr == 0 ? TRUE : FALSE)
-} /* end H5T_vlen_disk_isnull() */
+ /* Set blob ID to "nil" */
+ if(H5VL_blob_specific(file, vl, H5VL_BLOB_SETNULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__vlen_disk_setnull() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_disk_read
+ * Function: H5T__vlen_disk_read
*
* Purpose: Reads the disk based VL element into a buffer
*
@@ -826,40 +926,32 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len)
+H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len)
{
- uint8_t *vl=(uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- H5HG_t hobjid;
- herr_t ret_value=SUCCEED; /* Return value */
+ const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- /* check parameters */
+ /* Check parameters */
+ HDassert(file);
HDassert(vl);
HDassert(buf);
- HDassert(f);
/* Skip the length of the sequence */
vl += 4;
- /* Get the heap information */
- H5F_addr_decode(f, (const uint8_t **)&vl, &(hobjid.addr));
- UINT32DECODE(vl, hobjid.idx);
-
- /* Check if this sequence actually has any data */
- 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")
- }
+ /* Retrieve blob */
+ if(H5VL_blob_get(file, vl, buf, len, NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_vlen_disk_read() */
+} /* end H5T__vlen_disk_read() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_disk_write
+ * Function: H5T__vlen_disk_write
*
* Purpose: Writes the disk based VL element from a buffer
*
@@ -871,146 +963,108 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info,
- void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size)
+H5T__vlen_disk_write(H5VL_object_t *file,
+ const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, void *_vl,
+ void *buf, void *_bg, size_t seq_len, size_t base_size)
{
- uint8_t *vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/
- uint8_t *bg = (uint8_t *)_bg; /*Pointer to the old data hvl_t */
- H5HG_t hobjid; /* New VL sequence's heap ID */
- size_t len; /* Size of new sequence on disk (in bytes) */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ const uint8_t *bg = (const uint8_t *)_bg; /* Pointer to the old data hvl_t */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check parameters */
HDassert(vl);
HDassert(seq_len == 0 || buf);
- HDassert(f);
+ HDassert(file);
- /* Free heap object for old data. */
- if(bg!=NULL) {
- H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */
-
- /* Skip the length of the sequence and heap object ID from background data. */
- bg += 4;
-
- /* Get heap information */
- H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr));
- UINT32DECODE(bg, bg_hobjid.idx);
-
- /* Free heap object for old data */
- 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 */
+ /* Free heap object for old data, if non-NULL */
+ if(bg != NULL)
+ if(H5T__vlen_disk_delete(file, bg) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object")
/* Set the length of the sequence */
UINT32ENCODE(vl, seq_len);
- /* Write the VL information to disk (allocates space also) */
- len = (seq_len*base_size);
- if(H5HG_insert(f, len, buf, &hobjid) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to write VL information")
-
- /* Encode the heap information */
- H5F_addr_encode(f, &vl, hobjid.addr);
- UINT32ENCODE(vl, hobjid.idx);
+ /* Store blob */
+ if(H5VL_blob_put(file, buf, (seq_len * base_size), vl, NULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_vlen_disk_write() */
+} /* end H5T__vlen_disk_write() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_disk_setnull
+ * Function: H5T__vlen_disk_delete
*
- * Purpose: Sets a VL info object on disk to the "nil" value
+ * Purpose: Deletes a disk-based VL element
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
- * Saturday, November 8, 2003
+ * Friday, August 15, 2019
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_vlen_disk_setnull(H5F_t *f, void *_vl, void *_bg)
+H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
{
- uint8_t *vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/
- uint8_t *bg = (uint8_t *)_bg; /*Pointer to the old data hvl_t */
- uint32_t seq_len = 0; /* Sequence length */
- herr_t ret_value = SUCCEED; /* Return value */
+ const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- /* check parameters */
- HDassert(f);
- HDassert(vl);
+ /* Check parameters */
+ HDassert(file);
- /* Free heap object for old data. */
- if(bg != NULL) {
- H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */
+ /* Free heap object for old data */
+ if(vl != NULL) {
+ size_t seq_len; /* VL sequence's length */
- /* Skip the length of the sequence and heap object ID from background data. */
- bg += 4;
+ /* Get length of sequence */
+ UINT32DECODE(vl, seq_len);
- /* Get heap information */
- H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr));
- UINT32DECODE(bg, bg_hobjid.idx);
-
- /* Free heap object for old data */
- 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 */
+ /* Delete object, if length > 0 */
+ if(seq_len > 0)
+ if(H5VL_blob_specific(file, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
} /* end if */
- /* Set the length of the sequence */
- UINT32ENCODE(vl, seq_len);
-
- /* Encode the "nil" heap pointer information */
- H5F_addr_encode(f, &vl, (haddr_t)0);
- UINT32ENCODE(vl, 0);
-
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_vlen_disk_setnull() */
+} /* end H5T__vlen_disk_delete() */
-/*--------------------------------------------------------------------------
- NAME
- H5T_vlen_reclaim_recurse
- PURPOSE
- Internal recursive routine to free VL datatypes
- USAGE
- herr_t H5T_vlen_reclaim_recurse(elem,dt)
- void *elem; IN/OUT: Pointer to the dataset element
- H5T_t *dt; IN: Datatype of dataset element
-
- RETURNS
- SUCCEED/FAIL
- DESCRIPTION
- Frees any dynamic memory used by VL datatypes in the current dataset
- element. Performs a recursive depth-first traversal of all compound
- datatypes to free all VL datatype information allocated by any field.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, void *free_info)
+/*-------------------------------------------------------------------------
+ * Function: H5T_vlen_reclaim
+ *
+ * Purpose: Internal recursive routine to free VL datatypes
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 15, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info)
{
unsigned u; /* Local index variable */
+ H5MM_free_t free_func; /* Free function */
+ void *free_info; /* Free info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI(FAIL)
+ /* Sanity checks */
HDassert(elem);
HDassert(dt);
+ HDassert(alloc_info);
+
+ free_func = alloc_info->free_func;
+ free_info = alloc_info->free_info;
/* Check the datatype of this element */
switch(dt->shared->type) {
@@ -1022,8 +1076,8 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
/* Calculate the offset member and recurse on it */
for(u = 0; u < dt->shared->u.array.nelem; u++) {
off = ((uint8_t *)elem) + u * (dt->shared->parent->shared->size);
- if(H5T_vlen_reclaim_recurse(off, dt->shared->parent, free_func, free_info) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free array element")
+ if(H5T_reclaim_cb(off, dt->shared->parent, 0, NULL, alloc_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free array element")
} /* end for */
} /* end if */
break;
@@ -1037,8 +1091,8 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
/* Calculate the offset member and recurse on it */
off = ((uint8_t *)elem) + dt->shared->u.compnd.memb[u].offset;
- if(H5T_vlen_reclaim_recurse(off, dt->shared->u.compnd.memb[u].type, free_func, free_info) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free compound field")
+ if(H5T_reclaim_cb(off, dt->shared->u.compnd.memb[u].type, 0, NULL, alloc_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free compound field")
} /* end if */
} /* end for */
break;
@@ -1057,8 +1111,8 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
/* Calculate the offset of each array element and recurse on it */
while(vl->len > 0) {
off = ((uint8_t *)vl->p) + (vl->len - 1) * dt->shared->parent->shared->size;
- if(H5T_vlen_reclaim_recurse(off, dt->shared->parent, free_func, free_info) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free VL element")
+ if(H5T_reclaim_cb(off, dt->shared->parent, 0, NULL, alloc_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free VL element")
vl->len--;
} /* end while */
} /* end if */
@@ -1087,11 +1141,11 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
case H5T_STRING:
case H5T_BITFIELD:
case H5T_OPAQUE:
- case H5T_REFERENCE:
case H5T_ENUM:
break;
/* Should never have these values */
+ case H5T_REFERENCE:
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
@@ -1102,66 +1156,15 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_vlen_reclaim_recurse() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5T_vlen_reclaim
- PURPOSE
- Default method to reclaim any VL data for a buffer element
- USAGE
- herr_t H5T_vlen_reclaim(elem,type_id,ndim,point,op_data)
- void *elem; IN/OUT: Pointer to the dataset element
- hid_t type_id; IN: Datatype of dataset element
- unsigned ndim; IN: Number of dimensions in dataspace
- hsize_t *point; IN: Coordinate location of element in dataspace
- void *op_data IN: Operator data
-
- RETURNS
- SUCCEED/FAIL
- DESCRIPTION
- Frees any dynamic memory used by VL datatypes in the current dataset
- element. Recursively descends compound datatypes to free all VL datatype
- information allocated by any field.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim,
- const hsize_t H5_ATTR_UNUSED *point, void *op_data)
-{
- H5T_vlen_alloc_info_t *vl_alloc_info = (H5T_vlen_alloc_info_t *)op_data; /* VL allocation info from iterator */
- H5T_t *dt;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(elem);
- HDassert(vl_alloc_info);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
-
- /* Check args */
- if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
-
- /* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */
- if(H5T_vlen_reclaim_recurse(elem, dt, vl_alloc_info->free_func, vl_alloc_info->free_info) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_vlen_reclaim() */
+} /* end H5T_vlen_reclaim() */
/*-------------------------------------------------------------------------
* Function: H5T_vlen_reclaim_elmt
*
* Purpose: Alternative method to reclaim any VL data for a buffer element.
- *
- * Use this function when the datatype is already available, but
+ *
+ * Use this function when the datatype is already available, but
* the allocation info is needed from the context before jumping
* into recursion.
*
@@ -1188,10 +1191,9 @@ H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
/* Recurse on buffer to free dynamic fields */
- if(H5T_vlen_reclaim_recurse(elem, dt, vl_alloc_info.free_func, vl_alloc_info.free_info) < 0)
+ if(H5T_vlen_reclaim(elem, dt, &vl_alloc_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5T_vlen_reclaim_elmt */
-
+} /* H5T_vlen_reclaim_elmt() */
diff --git a/src/H5VL.c b/src/H5VL.c
index 5c62f6f..18fd3d6 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -29,9 +29,11 @@
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5VLpkg.h" /* Virtual Object Layer */
/* VOL connectors */
@@ -105,7 +107,7 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided")
- /* Check VOL initialization property list */
+ /* Check VOL initialization property list */
if(H5P_DEFAULT == vipl_id)
vipl_id = H5P_VOL_INITIALIZE_DEFAULT;
else
@@ -152,7 +154,7 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
if (0 == HDstrlen(name))
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed")
- /* Check VOL initialization property list */
+ /* Check VOL initialization property list */
if(H5P_DEFAULT == vipl_id)
vipl_id = H5P_VOL_INITIALIZE_DEFAULT;
else
@@ -197,7 +199,7 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
if(value < 0)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed")
- /* Check VOL initialization property list */
+ /* Check VOL initialization property list */
if(H5P_DEFAULT == vipl_id)
vipl_id = H5P_VOL_INITIALIZE_DEFAULT;
else
@@ -214,9 +216,10 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VLis_connector_registered
+ * Function: H5VLis_connector_registered_by_name
*
* Purpose: Tests whether a VOL class has been registered or not
+ * according to a supplied connector name.
*
* Return: >0 if a VOL connector with that name has been registered
* 0 if a VOL connector with that name has NOT been registered
@@ -228,7 +231,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5VLis_connector_registered(const char *name)
+H5VLis_connector_registered_by_name(const char *name)
{
htri_t ret_value = FALSE; /* Return value */
@@ -236,17 +239,78 @@ H5VLis_connector_registered(const char *name)
H5TRACE1("t", "*s", name);
/* Check if connector with this name is registered */
- if((ret_value = H5VL__is_connector_registered(name)) < 0)
+ if((ret_value = H5VL__is_connector_registered_by_name(name)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLis_connector_registered() */
+} /* end H5VLis_connector_registered_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLis_connector_registered_by_value
+ *
+ * Purpose: Tests whether a VOL class has been registered or not
+ * according to a supplied connector value (ID).
+ *
+ * Return: >0 if a VOL connector with that value has been registered
+ * 0 if a VOL connector with that value hasn't been registered
+ * <0 on errors
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5VLis_connector_registered_by_value(H5VL_class_value_t connector_value)
+{
+ htri_t ret_value = FALSE;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("t", "VC", connector_value);
+
+ /* Check if connector with this value is registered */
+ if((ret_value = H5VL__is_connector_registered_by_value(connector_value)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLis_connector_registered_by_value() */
/*-------------------------------------------------------------------------
* Function: H5VLget_connector_id
*
+ * Purpose: Retrieves the VOL connector ID for a given object ID.
+ *
+ * Return: A valid VOL connector ID. This ID will need to be closed
+ * using H5VLclose().
+ *
+ * H5I_INVALID_HID on error.
+ *
+ * Programmer: Dana Robinson
+ * June 17, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLget_connector_id(hid_t obj_id)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "i", obj_id);
+
+ /* Get connector ID */
+ if((ret_value = H5VL__get_connector_id(obj_id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLget_connector_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLget_connector_id_by_name
+ *
* Purpose: Retrieves the ID for a registered VOL connector.
*
* Return: A valid VOL connector ID if a connector by that name has
@@ -262,7 +326,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VLget_connector_id(const char *name)
+H5VLget_connector_id_by_name(const char *name)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -270,12 +334,107 @@ H5VLget_connector_id(const char *name)
H5TRACE1("i", "*s", name);
/* Get connector ID with this name */
- if((ret_value = H5VL__get_connector_id(name, TRUE)) < 0)
+ if((ret_value = H5VL__get_connector_id_by_name(name, TRUE)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLget_connector_id() */
+} /* end H5VLget_connector_id_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLget_connector_id_by_value
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector.
+ *
+ * Return: A valid VOL connector ID if a connector with that value has
+ * been registered. This ID will need to be closed using
+ * H5VLclose().
+ *
+ * H5I_INVALID_HID on error or if a VOL connector with that
+ * value has not been registered.
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLget_connector_id_by_value(H5VL_class_value_t connector_value)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "VC", connector_value);
+
+ /* Get connector ID with this value */
+ if((ret_value = H5VL__get_connector_id_by_value(connector_value, TRUE)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLget_connector_id_by_value() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLpeek_connector_id_by_name
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector.
+ *
+ * Return: A valid VOL connector ID if a connector by that name has
+ * been registered. This ID is *not* owned by the caller and
+ * H5VLclose() should not be called. Intended for use by VOL
+ * connectors to find their own ID.
+ *
+ * H5I_INVALID_HID on error or if a VOL connector of that
+ * name has not been registered.
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLpeek_connector_id_by_name(const char *name)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "*s", name);
+
+ /* Get connector ID with this name */
+ if((ret_value = H5VL__peek_connector_id_by_name(name)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLpeek_connector_id_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLpeek_connector_id_by_value
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector.
+ *
+ * Return: A valid VOL connector ID if a connector with that value
+ * has been registered. This ID is *not* owned by the caller
+ * and H5VLclose() should not be called. Intended for use by
+ * VOL connectors to find their own ID.
+ *
+ * H5I_INVALID_HID on error or if a VOL connector with that
+ * value has not been registered.
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLpeek_connector_id_by_value(H5VL_class_value_t value)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "VC", value);
+
+ /* Get connector ID with this value */
+ if((ret_value = H5VL__peek_connector_id_by_value(value)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLpeek_connector_id_by_value() */
/*-------------------------------------------------------------------------
@@ -377,7 +536,7 @@ H5VLunregister_connector(hid_t vol_id)
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* For the time being, we disallow unregistering the native VOL connector */
- if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id(H5VL_NATIVE_NAME, FALSE)))
+ if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id_by_name(H5VL_NATIVE_NAME, FALSE)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to find the native VOL connector ID")
if(vol_id == native_id)
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "unregistering the native VOL connector is not allowed")
@@ -443,6 +602,9 @@ done:
* iteration routine callbacks (i.e. the callbacks from H5Aiterate*,
* H5Literate* / H5Lvisit*, and H5Ovisit* ).
*
+ * type must be a VOL-managed object class (H5I_FILE,
+ * H5I_GROUP, H5I_DATATYPE, H5I_DATASET, H5I_MAP, or H5I_ATTR).
+ *
* Return: Success: Non-negative hid_t for the object.
* Failure: Negative (H5I_INVALID_HID)
*
@@ -458,8 +620,34 @@ H5VLwrap_register(void *obj, H5I_type_t type)
H5TRACE2("i", "*xIt", obj, type);
/* Check args */
- if(type <= H5I_BADID || type >= H5I_NTYPES)
- HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
+ /* Use a switch here for (hopefully) better performance than a series of
+ * equality checks. We could also group these types together in H5I_type_t,
+ * make some assertions here to guarantee that, then just check the range.
+ */
+ switch(type) {
+ case H5I_FILE:
+ case H5I_GROUP:
+ case H5I_DATATYPE:
+ case H5I_DATASET:
+ case H5I_MAP:
+ case H5I_ATTR:
+ /* VOL-managed objects, call is valid */
+ break;
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_DATASPACE:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
+ } /* end switch */
if(NULL == obj)
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL")
@@ -503,6 +691,73 @@ done:
} /* H5VLobject() */
+/*-------------------------------------------------------------------------
+ * Function: H5VLget_file_type
+ *
+ * Purpose: Returns a copy of dtype_id with its location set to be in
+ * the file, with updated size, etc.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id)
+{
+ H5T_t *dtype; /* unatomized type */
+ H5T_t *file_type = NULL; /* copied file type */
+ hid_t file_type_id = -1; /* copied file type id */
+ H5VL_object_t *file_vol_obj = NULL; /* VOL object for file */
+ hid_t ret_value = -1; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("i", "*xii", file_obj, connector_id, dtype_id);
+
+ /* Check args */
+ if(!file_obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "no file object supplied")
+ if(NULL == (dtype = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
+
+ /* Create VOL object for file */
+ if(NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
+
+ /* Copy the datatype */
+ if(NULL == (file_type = H5T_copy(dtype, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy datatype")
+
+ /* Register file type id */
+ if((file_type_id = H5I_register(H5I_DATATYPE, file_type, FALSE)) < 0) {
+ (void)H5T_close_real(file_type);
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ } /* end if */
+
+ /* Set the location of the datatype to be in the file */
+ if(H5T_set_loc(file_type, file_vol_obj, H5T_LOC_DISK) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't set datatype location")
+
+ /* file_type now owns file_vol_obj */
+ if(H5T_own_vol_obj(file_type, file_vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't give ownership of VOL object")
+ file_vol_obj = NULL;
+
+ /* Set return value */
+ ret_value = file_type_id;
+
+done:
+ /* Cleanup on error */
+ if(ret_value < 0) {
+ if(file_vol_obj && H5VL_free_object(file_vol_obj) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ if(file_type_id >= 0 && H5I_dec_ref(file_type_id) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close file datatype")
+ } /* end if */
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLget_file_type() */
+
+
/*---------------------------------------------------------------------------
* Function: H5VLretrieve_lib_state
*
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 0131f0e..5c54b5b 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -66,13 +66,13 @@ static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type
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,
+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_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type,
+ 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,
@@ -82,29 +82,44 @@ 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,
+ hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
void *buf, void **req);
static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls,
- hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id,
+ hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
const void *buf, void **req);
-static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
+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,
+static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type,
hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
void **req);
+static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id,
+ hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+static void *H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls,
+ H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls,
+ H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req,
+ va_list arguments);
+static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls,
+ H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req);
static void * H5VL__file_create(const H5VL_class_t *cls, const char *name,
unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
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_get(void *obj, const H5VL_class_t *cls,
+ H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls,
+ H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__file_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,
@@ -113,12 +128,12 @@ static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params,
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,
+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_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls,
+ H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls,
+ H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__group_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,
@@ -136,8 +151,8 @@ static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params,
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 herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls,
+ H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
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,
@@ -150,23 +165,12 @@ static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params,
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__object_optional(void *obj, const H5VL_class_t *cls,
+ H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls,
+ H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls);
+static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls,
+ H5VL_subclass_t subcls, int opt_type, hbool_t *supported);
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,
@@ -175,9 +179,24 @@ 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);
+ H5VL_request_optional_t opt_type, va_list arguments);
static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls);
-
+static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls,
+ const void *buf, size_t size, void *blob_id, void *ctx);
+static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls,
+ const void *blob_id, void *buf, size_t size, void *ctx);
+static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls,
+ void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
+static herr_t H5VL__blob_optional(void *obj, const H5VL_class_t *cls,
+ void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments);
+static herr_t H5VL__token_cmp(void *obj, const H5VL_class_t *cls,
+ const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value);
+static herr_t H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
+ const H5O_token_t *token, char **token_str);
+static herr_t H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
+ const char *token_str, H5O_token_t *token);
+static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type,
+ hid_t dxpl_id, void **req, va_list arguments);
/*********************/
/* Package Variables */
@@ -506,7 +525,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_free_connector_info(hid_t connector_id, void *info)
+H5VL_free_connector_info(hid_t connector_id, const void *info)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
@@ -524,12 +543,13 @@ H5VL_free_connector_info(hid_t connector_id, void *info)
if(info) {
/* Allow the connector to free info or do it ourselves */
if(cls->info_cls.free) {
- if((cls->info_cls.free)(info) < 0)
+ /* Cast through uintptr_t to de-const memory */
+ if((cls->info_cls.free)((void *)(uintptr_t)info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
- } /* end if */
+ }
else
- H5MM_xfree(info);
- } /* end if */
+ H5MM_xfree_const(info);
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -947,7 +967,7 @@ done:
*
* Purpose: Creates an attribute through the VOL
*
- * Return: Success: Pointer to the new attribute
+ * Return: Success: Pointer to the new attribute
* Failure: NULL
*
*-------------------------------------------------------------------------
@@ -979,13 +999,13 @@ done:
*
* Purpose: Creates an attribute through the VOL
*
- * Return: Success: Pointer to the new attribute
+ * 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,
+H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
hid_t aapl_id, hid_t dxpl_id, void **req)
{
@@ -995,7 +1015,7 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_para
FUNC_ENTER_NOAPI(NULL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -1060,7 +1080,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name,
+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 */
@@ -1100,7 +1120,7 @@ H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params
FUNC_ENTER_NOAPI(NULL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -1164,7 +1184,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf,
+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 */
@@ -1195,7 +1215,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf,
+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 */
@@ -1204,7 +1224,7 @@ H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -1266,7 +1286,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf,
+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 */
@@ -1297,7 +1317,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf,
+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 */
@@ -1306,7 +1326,7 @@ H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -1369,7 +1389,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type,
+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 */
@@ -1400,7 +1420,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type,
+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 */
@@ -1411,7 +1431,7 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -1481,7 +1501,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+H5VL__attr_specific(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)
{
@@ -1524,7 +1544,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -1594,8 +1614,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1606,7 +1626,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
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)
+ if((ret_value = (cls->attr_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
done:
@@ -1625,7 +1645,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
+H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_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 */
@@ -1635,14 +1656,14 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, req);
arg_started = TRUE;
- if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
+ if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
done:
@@ -1669,13 +1690,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE6("e", "*xiVsi**xx", obj, connector_id, opt_type, dxpl_id, req,
+ arguments);
/* Check args and get class pointer */
if(NULL == obj)
@@ -1684,7 +1707,7 @@ H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_l
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)
+ if((ret_value = H5VL__attr_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
done:
@@ -1708,7 +1731,7 @@ 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")
@@ -1738,7 +1761,7 @@ 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);
@@ -1838,7 +1861,7 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_p
FUNC_ENTER_NOAPI(NULL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -1897,13 +1920,13 @@ done:
*
* Purpose: Opens a dataset through the VOL
*
- * Return: Success: Pointer to dataset
+ * 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,
+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 */
@@ -1928,7 +1951,7 @@ done:
*
* Purpose: Opens a dataset through the VOL
*
- * Return: Success: Pointer to dataset
+ * Return: Success: Pointer to dataset
* Failure: NULL
*
*-------------------------------------------------------------------------
@@ -1943,7 +1966,7 @@ H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par
FUNC_ENTER_NOAPI(NULL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -2006,9 +2029,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf,
void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2020,7 +2043,7 @@ H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
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)
+ if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
done:
@@ -2038,9 +2061,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+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,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf,
void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
@@ -2049,12 +2072,12 @@ H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed")
done:
@@ -2078,14 +2101,14 @@ done:
*/
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)
+ hid_t file_space_id, hid_t dxpl_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);
+ file_space_id, dxpl_id, buf, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -2094,7 +2117,7 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa
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)
+ if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset")
done:
@@ -2112,9 +2135,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf,
void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2126,7 +2149,7 @@ H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id,
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)
+ if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
done:
@@ -2144,9 +2167,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+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,
+ hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf,
void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
@@ -2155,12 +2178,12 @@ H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0)
+ if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed")
done:
@@ -2184,14 +2207,14 @@ done:
*/
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)
+ hid_t file_space_id, hid_t dxpl_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);
+ file_space_id, dxpl_id, buf, req);
/* Check args and get class pointer */
if(NULL == obj)
@@ -2200,7 +2223,7 @@ H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_sp
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)
+ if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset")
done:
@@ -2219,7 +2242,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
+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 */
@@ -2250,7 +2273,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type,
+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 */
@@ -2261,7 +2284,7 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -2331,7 +2354,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type,
+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 */
@@ -2362,7 +2385,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type,
+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 */
@@ -2373,7 +2396,7 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -2443,8 +2466,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2455,7 +2478,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
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)
+ if((cls->dataset_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
@@ -2474,8 +2497,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
- void **req, ...)
+H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_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 */
@@ -2484,16 +2507,15 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
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)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, req);
arg_started = TRUE;
- if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
+ if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
@@ -2520,14 +2542,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE6("e", "*xiVti**xx", obj, connector_id, opt_type, dxpl_id, req,
+ arguments);
/* Check args and get class pointer */
if(NULL == obj)
@@ -2536,7 +2559,7 @@ H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
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)
+ if(H5VL__dataset_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
@@ -2603,7 +2626,7 @@ H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
HDassert(vol_obj->connector->cls);
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -2655,6 +2678,658 @@ done:
/*-------------------------------------------------------------------------
+ * 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) < 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) < 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) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ HDva_start(arguments, 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)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_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) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ HDva_start(arguments, 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)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_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, H5VL_datatype_optional_t opt_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.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, opt_type, 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, H5VL_datatype_optional_t opt_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) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ HDva_start(arguments, req);
+ arg_started = TRUE;
+ if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ 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, H5VL_datatype_optional_t opt_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", "*xiVui**xx", obj, connector_id, opt_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_optional(obj, cls, opt_type, 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) < 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__file_create
*
* Purpose: Creates a file through the VOL
@@ -2769,7 +3444,7 @@ done:
*
* Purpose: Opens a file through the VOL.
*
- * Return: Success: Pointer to file.
+ * Return: Success: Pointer to file.
* Failure: NULL
*
*-------------------------------------------------------------------------
@@ -2803,7 +3478,7 @@ done:
* 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.
+ * Return: Success: Pointer to file.
* Failure: NULL
*
*-------------------------------------------------------------------------
@@ -2882,7 +3557,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type,
+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 */
@@ -2913,7 +3588,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type,
+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 */
@@ -2924,7 +3599,7 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -2994,7 +3669,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
+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 */
@@ -3017,7 +3692,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VL_file_specific
*
- * Purpose: Perform File specific operations through the VOL
+ * Purpose: Perform file specific operations through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -3025,7 +3700,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type,
+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 */
@@ -3040,7 +3715,8 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
HDva_start(arguments, req);
arg_started = TRUE;
- /* Special treatment of file access check */
+ /* Special treatment of file access check & delete operations */
+ /* (Retrieve the VOL connector from the FAPL, since the file isn't open) */
if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
H5P_genplist_t *plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
@@ -3067,7 +3743,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
/* Sanity check */
HDassert(vol_obj);
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -3139,8 +3815,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3151,7 +3827,7 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
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)
+ if((cls->file_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
done:
@@ -3170,7 +3846,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
+H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_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 */
@@ -3180,14 +3857,14 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, req);
arg_started = TRUE;
- if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
+ if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
done:
@@ -3214,14 +3891,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE6("e", "*xiVvi**xx", obj, connector_id, opt_type, dxpl_id, req,
+ arguments);
/* Check args and get class pointer */
if(NULL == obj)
@@ -3230,7 +3908,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
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)
+ if(H5VL__file_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback")
done:
@@ -3291,7 +3969,7 @@ H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -3395,7 +4073,7 @@ H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par
FUNC_ENTER_NOAPI(NULL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -3500,7 +4178,7 @@ H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param
FUNC_ENTER_NOAPI(NULL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -3564,7 +4242,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type,
+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 */
@@ -3595,7 +4273,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type,
+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 */
@@ -3606,7 +4284,7 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -3676,7 +4354,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type,
+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 */
@@ -3707,7 +4385,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type,
+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 */
@@ -3718,7 +4396,7 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -3788,8 +4466,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3800,7 +4478,7 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
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)
+ if((ret_value = (cls->group_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
done:
@@ -3819,7 +4497,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
+H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_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 */
@@ -3829,14 +4508,14 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, req);
arg_started = TRUE;
- if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
+ if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
done:
@@ -3863,14 +4542,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE6("e", "*xiVwi**xx", obj, connector_id, opt_type, dxpl_id, req,
+ arguments);
/* Check args and get class pointer */
if(NULL == obj)
@@ -3879,7 +4559,7 @@ H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
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)
+ if((ret_value = H5VL__group_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
done:
@@ -3940,7 +4620,7 @@ H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -4004,7 +4684,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
+H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
va_list arguments)
{
@@ -4040,7 +4720,7 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o
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 */
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
va_list arguments; /* Argument list passed from the API call */
hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
@@ -4067,7 +4747,7 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o
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)
+ if(H5VL_set_vol_wrapper(&tmp_vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -4135,7 +4815,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
@@ -4167,7 +4847,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+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)
@@ -4180,12 +4860,12 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa
/* 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)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__link_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)
+ if(H5VL__link_copy(src_vol_obj->data, 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:
@@ -4244,7 +4924,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
@@ -4276,7 +4956,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+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)
@@ -4288,13 +4968,13 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa
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)
+ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj);
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__link_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)
+ if(H5VL__link_move(src_vol_obj->data, 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:
@@ -4396,7 +5076,7 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -4466,7 +5146,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+H5VL__link_specific(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 */
@@ -4508,7 +5188,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -4578,8 +5258,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4590,7 +5270,7 @@ H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
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)
+ if((cls->link_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -4609,7 +5289,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
+H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_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 */
@@ -4619,14 +5300,14 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, req);
arg_started = TRUE;
- if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
+ if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -4653,13 +5334,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE6("e", "*xiVxi**xx", obj, connector_id, opt_type, dxpl_id, req,
+ arguments);
/* Check args and get class pointer */
if(NULL == obj)
@@ -4668,7 +5351,7 @@ H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_l
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)
+ if(H5VL__link_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -4727,7 +5410,7 @@ H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params,
FUNC_ENTER_NOAPI(NULL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -4790,7 +5473,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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,
@@ -4823,7 +5506,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+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,
@@ -4839,7 +5522,7 @@ H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_
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)
+ if(H5VL_set_vol_wrapper(src_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -4948,7 +5631,7 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -5018,7 +5701,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+H5VL__object_specific(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)
{
@@ -5061,7 +5744,7 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
@@ -5135,8 +5818,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5147,7 +5830,7 @@ H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
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)
+ if((cls->object_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
@@ -5166,7 +5849,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
+H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_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 */
@@ -5176,14 +5860,14 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ..
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, req);
arg_started = TRUE;
- if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0)
+ if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
@@ -5210,13 +5894,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments)
+H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE6("e", "*xiVyi**xx", obj, connector_id, opt_type, dxpl_id, req,
+ arguments);
/* Check args and get class pointer */
if(NULL == obj)
@@ -5225,7 +5911,7 @@ H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va
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)
+ if(H5VL__object_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
@@ -5234,220 +5920,232 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL__datatype_commit
+ * Function: H5VL__introspect_get_conn_cls
*
- * Purpose: Commits a datatype to the file through the VOL
+ * Purpose: Calls the connector-specific callback to query the connector
+ * class.
*
- * Return: Success: Pointer to the new datatype
- * Failure: NULL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
-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 herr_t
+H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls,
+ H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls)
{
- void *ret_value = NULL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+ HDassert(lvl >= H5VL_GET_CONN_LVL_CURR && lvl <= H5VL_GET_CONN_LVL_TERM);
+ HDassert(conn_cls);
+
/* 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")
+ if(NULL == cls->introspect_cls.get_conn_cls)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_conn_cls' 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")
+ if((cls->introspect_cls.get_conn_cls)(obj, lvl, conn_cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__datatype_commit() */
+} /* end H5VL__introspect_get_conn_cls() */
/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_commit
+ * Function: H5VL_introspect_get_conn_cls
*
- * Purpose: Commits a datatype to the file through the VOL
+ * Purpose: Calls the connector-specific callback to query the connector
+ * class.
*
- * Return: Success: Pointer to the new datatype
- * Failure: NULL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
-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)
+herr_t
+H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl,
+ const H5VL_class_t **conn_cls)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- void *ret_value = NULL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(NULL)
+ 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, NULL, "can't set VOL wrapper info")
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(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")
+ if(H5VL__introspect_get_conn_cls(vol_obj->data, vol_obj->connector->cls, lvl, conn_cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class")
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")
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_commit() */
+} /* end H5VL_introspect_get_conn_cls() */
/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_commit
+ * Function: H5VLintrospect_get_conn_cls
*
- * Purpose: Commits a datatype to the file
+ * Purpose: Calls the connector-specific callback to query the connector
+ * class.
*
- * Return: Success: Pointer to the new datatype
- * Failure: NULL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
-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)
+herr_t
+H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t lvl,
+ const H5VL_class_t **conn_cls)
{
H5VL_class_t *cls; /* VOL connector's class struct */
- void *ret_value = NULL; /* Return value */
+ herr_t ret_value = SUCCEED; /* 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);
+ H5TRACE4("e", "*xiVL**x", obj, connector_id, lvl, conn_cls);
- /* Check args and get class pointer */
+ /* Check args */
if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL obj pointer")
+ if(NULL == conn_cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer")
+
+ /* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "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")
+ if(H5VL__introspect_get_conn_cls(obj, cls, lvl, conn_cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* end H5VLdatatype_commit() */
+} /* end H5VLintrospect_get_conn_cls() */
/*-------------------------------------------------------------------------
- * Function: H5VL__datatype_open
+ * Function: H5VL__introspect_opt_query
*
- * Purpose: Opens a named datatype through the VOL
+ * Purpose: Calls the connector-specific callback to query if an optional
+ * operation is supported.
*
- * Return: Success: Pointer to the datatype
- * Failure: NULL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
-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__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls,
+ int opt_type, hbool_t *supported)
{
- void *ret_value = NULL; /* Return value */
+ herr_t ret_value = SUCCEED; /* 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")
+ if(NULL == cls->introspect_cls.opt_query)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'opt_query' method")
/* 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")
+ if((cls->introspect_cls.opt_query)(obj, subcls, opt_type, supported) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__datatype_open() */
+} /* end H5VL__introspect_opt_query() */
/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_open
+ * Function: H5VL_introspect_opt_query
*
- * Purpose: Opens a named datatype through the VOL
+ * Purpose: Calls the connector-specific callback to query if an optional
+ * operation is supported.
*
- * Return: Success: Pointer to the datatype
- * Failure: NULL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
-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)
+herr_t
+H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls,
+ int opt_type, hbool_t *supported)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- void *ret_value = NULL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(NULL)
+ 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, NULL, "can't set VOL wrapper info")
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(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")
+ if(H5VL__introspect_opt_query(vol_obj->data, vol_obj->connector->cls, subcls, opt_type, supported) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support")
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")
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_open() */
+} /* end H5VL_introspect_opt_query() */
/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_open
+ * Function: H5VLintrospect_opt_query
*
- * Purpose: Opens a named datatype
+ * Purpose: Calls the connector-specific callback to query if an optional
+ * operation is supported.
*
- * Return: Success: Pointer to the datatype
- * Failure: NULL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
*-------------------------------------------------------------------------
*/
-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)
+herr_t
+H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls,
+ int opt_type, hbool_t *supported)
{
H5VL_class_t *cls; /* VOL connector's class struct */
- void *ret_value = NULL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, tapl_id,
- dxpl_id, req);
+ H5TRACE5("e", "*xiVSIs*b", obj, connector_id, subcls, opt_type, supported);
- /* Check args and get class pointer */
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
+ /* Get class pointer */
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")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "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")
+ if(H5VL__introspect_opt_query(obj, cls, subcls, opt_type, supported) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* end H5VLdatatype_open() */
+} /* end H5VLintrospect_opt_query() */
/*-------------------------------------------------------------------------
- * Function: H5VL__datatype_get
+ * Function: H5VL__request_wait
*
- * Purpose: Get specific information about the datatype through the VOL
+ * 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
@@ -5455,30 +6153,38 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL__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->datatype_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method")
+ 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->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed")
+ 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__datatype_get() */
+} /* end H5VL__request_wait() */
/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_get
+ * Function: H5VL_request_wait
*
- * Purpose: Get specific information about the datatype through the VOL
+ * 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
@@ -5486,44 +6192,42 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout,
+ H5ES_status_t *status)
{
- 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 checks */
+ HDassert(vol_obj);
+
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, 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")
+ 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:
- /* End access to the va_list, if we started it */
- if(arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_get() */
+} /* end H5VL_request_wait() */
/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_get
+ * Function: H5VLrequest_wait
*
- * Purpose: Gets information about the datatype
+ * 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
@@ -5531,39 +6235,34 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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
- H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req,
- arguments);
+ H5TRACE4("e", "*xiUL*Es", req, connector_id, timeout, status);
- /* Check args and get class pointer */
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ /* 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")
- /* 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")
+ 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 H5VLdatatype_get() */
+} /* end H5VLrequest_wait() */
/*-------------------------------------------------------------------------
- * Function: H5VL__datatype_specific
+ * Function: H5VL__request_notify
*
- * Purpose: Specific operation on datatypes through the VOL
+ * 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
@@ -5571,30 +6270,37 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL__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->datatype_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method")
+ 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->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific 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__datatype_specific() */
+} /* end H5VL__request_notify() */
/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_specific
+ * Function: H5VL_request_notify
*
- * Purpose: Specific operation on datatypes through the VOL
+ * 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
@@ -5602,44 +6308,42 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb,
+ void *ctx)
{
- 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)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, 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")
+ 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:
- /* End access to the va_list, if we started it */
- if(arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_specific() */
+} /* end H5VL_request_notify() */
/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_specific
+ * Function: H5VLrequest_notify
*
- * Purpose: Performs a connector-specific operation on a datatype
+ * 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
@@ -5647,35 +6351,34 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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
- H5TRACE6("e", "*xiVfi**xx", obj, connector_id, specific_type, dxpl_id, req,
- arguments);
+ H5TRACE4("e", "*xix*x", req, connector_id, cb, ctx);
- /* Check args and get class pointer */
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ /* 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__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
+ 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 H5VLdatatype_specific() */
+} /* end H5VLrequest_notify() */
/*-------------------------------------------------------------------------
- * Function: H5VL__datatype_optional
+ * Function: H5VL__request_cancel
*
- * Purpose: Optional operation specific to connectors.
+ * Purpose: Cancels an asynchronous request through the VOL
+ *
+ * Note: Releases the request, if connector callback succeeds
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5683,30 +6386,35 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, va_list arguments)
+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->datatype_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method")
+ 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->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional 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__datatype_optional() */
+} /* end H5VL__request_cancel() */
/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_optional
+ * Function: H5VL_request_cancel
*
- * Purpose: Optional operation specific to connectors.
+ * Purpose: Cancels an asynchronous request through the VOL
+ *
+ * Note: Releases the request, if connector callback succeeds
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5714,44 +6422,40 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
- void **req, ...)
+H5VL_request_cancel(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)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, 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")
+ if(H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
done:
- /* End access to the va_list, if we started it */
- if(arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_optional() */
+} /* end H5VL_request_cancel() */
/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_optional
+ * Function: H5VLrequest_cancel
*
- * Purpose: Performs an optional connector-specific operation on a datatype
+ * Purpose: Cancels a request
+ *
+ * Note: Releases the request, if connector callback succeeds
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5759,34 +6463,31 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
- va_list arguments)
+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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE2("e", "*xi", req, connector_id);
- /* Check args and get class pointer */
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ /* 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__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+ 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 H5VLdatatype_optional() */
+} /* end H5VLrequest_cancel() */
/*-------------------------------------------------------------------------
- * Function: H5VL__datatype_close
+ * Function: H5VL__request_specific
*
- * Purpose: Closes a datatype through the VOL
+ * Purpose: Specific operation on asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5794,30 +6495,34 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req)
+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->datatype_cls.close)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method")
+ 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((cls->datatype_cls.close)(obj, dxpl_id, req) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed")
+ 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__datatype_close() */
+} /* end H5VL__request_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VL_datatype_close
+ * Function: H5VL_request_specific
*
- * Purpose: Closes a datatype through the VOL
+ * Purpose: Specific operation on asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5825,35 +6530,47 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req)
+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)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed")
+ HDva_start(arguments, specific_type);
+ arg_started = TRUE;
+ if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_datatype_close() */
+} /* end H5VL_request_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VLdatatype_close
+ * Function: H5VLrequest_specific
*
- * Purpose: Closes a datatype
+ * Purpose: Performs a connector-specific operation on an asynchronous request
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5861,36 +6578,32 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req)
+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", "*xii**x", obj, connector_id, dxpl_id, req);
+ H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments);
- /* Check args and get class pointer */
- if(NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ /* 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__datatype_close(obj, cls, dxpl_id, req) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype")
+ 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 H5VLdatatype_close() */
+} /* end H5VLrequest_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VL__request_wait
- *
- * Purpose: Waits on an asychronous request through the VOL
+ * Function: H5VL__request_optional
*
- * Note: Releases the request if the operation has completed and the
- * connector callback succeeds
+ * Purpose: Optional operation specific to connectors.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5898,38 +6611,34 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout,
- H5ES_status_t *status)
+H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type,
+ va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
- /* Sanity checks */
+ /* Sanity check */
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")
+ 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((cls->request_cls.wait)(req, timeout, status) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
+ if((ret_value = (cls->request_cls.optional)(req, opt_type, 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_wait() */
+} /* end H5VL__request_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_request_wait
- *
- * Purpose: Waits on an asychronous request through the VOL
+ * Function: H5VL_request_optional
*
- * Note: Releases the request if the operation has completed and the
- * connector callback succeeds
+ * Purpose: Optional operation specific to connectors.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5937,42 +6646,47 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout,
- H5ES_status_t *status)
+H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_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 checks */
+ /* Sanity check */
HDassert(vol_obj);
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
+ HDva_start(arguments, opt_type);
+ arg_started = TRUE;
+ if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, opt_type, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
done:
+ /* End access to the va_list, if we started it */
+ if(arg_started)
+ HDva_end(arguments);
+
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_wait() */
+} /* end H5VL_request_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VLrequest_wait
- *
- * Purpose: Waits on a request
+ * Function: H5VLrequest_optional
*
- * Note: Releases the request if the operation has completed and the
- * connector callback succeeds
+ * Purpose: Performs an optional connector-specific operation on an asynchronous request
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5980,34 +6694,32 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status)
+H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_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", "*xiUL*Es", req, connector_id, timeout, status);
+ H5TRACE4("e", "*xiVzx", req, connector_id, opt_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(H5VL__request_wait(req, cls, timeout, status) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request")
+ if((ret_value = H5VL__request_optional(req, cls, opt_type, 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_wait() */
+} /* end H5VLrequest_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL__request_notify
- *
- * Purpose: Registers a user callback to be invoked when an asynchronous
- * operation completes
+ * Function: H5VL__request_free
*
- * Note: Releases the request, if connector callback succeeds
+ * Purpose: Frees an asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6015,8 +6727,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb,
- void *ctx)
+H5VL__request_free(void *req, const H5VL_class_t *cls)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6027,25 +6738,22 @@ H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t c
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")
+ 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.notify)(req, cb, ctx) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request notify failed")
+ 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_notify() */
+} /* end H5VL__request_free() */
/*-------------------------------------------------------------------------
- * Function: H5VL_request_notify
- *
- * Purpose: Registers a user callback to be invoked when an asynchronous
- * operation completes
+ * Function: H5VL_request_free
*
- * Note: Releases the request, if connector callback succeeds
+ * Purpose: Frees an asynchronous request through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6053,8 +6761,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb,
- void *ctx)
+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 */
@@ -6065,13 +6772,13 @@ H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb,
HDassert(vol_obj);
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
- /* Call the corresponding internal VOL routine */
- if(H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed")
+ /* 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 */
@@ -6079,16 +6786,13 @@ done:
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_notify() */
+} /* end H5VL_request_free() */
/*-------------------------------------------------------------------------
- * Function: H5VLrequest_notify
- *
- * Purpose: Registers a user callback to be invoked when an asynchronous
- * operation completes
+ * Function: H5VLrequest_free
*
- * Note: Releases the request, if connector callback succeeds
+ * Purpose: Frees a request
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6096,78 +6800,78 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb,
- void *ctx)
+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
- H5TRACE4("e", "*xix*x", req, connector_id, cb, ctx);
+ 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_notify(req, cls, cb, ctx) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request")
+ 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_notify() */
+} /* end H5VLrequest_free() */
/*-------------------------------------------------------------------------
- * Function: H5VL__request_cancel
- *
- * Purpose: Cancels an asynchronous request through the VOL
+ * Function: H5VL__blob_put
*
- * Note: Releases the request, if connector callback succeeds
+ * Purpose: Put a blob through the VOL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_cancel(void *req, const H5VL_class_t *cls)
+H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size,
+ void *blob_id, void *ctx)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(req);
+ HDassert(obj);
HDassert(cls);
+ HDassert(size == 0 || buf);
+ HDassert(blob_id);
/* 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")
+ if(NULL == cls->blob_cls.put)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob put' method")
/* Call the corresponding VOL callback */
- if((cls->request_cls.cancel)(req) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
+ if((cls->blob_cls.put)(obj, buf, size, blob_id, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put callback failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__request_cancel() */
+} /* end H5VL__blob_put() */
/*-------------------------------------------------------------------------
- * Function: H5VL_request_cancel
+ * Function: H5VL_blob_put
*
- * Purpose: Cancels an asynchronous request through the VOL
+ * Purpose: Put a blob through the VOL
*
- * Note: Releases the request, if connector callback succeeds
+ * Return: SUCCEED / FAIL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Programmer: Quincey Koziol
+ * Wednesday, August 21, 2019
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_cancel(const H5VL_object_t *vol_obj)
+H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size,
+ void *blob_id, void *ctx)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -6176,98 +6880,212 @@ H5VL_request_cancel(const H5VL_object_t *vol_obj)
/* Sanity check */
HDassert(vol_obj);
+ HDassert(size == 0 || buf);
+ HDassert(blob_id);
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
- /* Call the corresponding internal VOL routine */
- if(H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
+ /* Call the corresponding VOL callback */
+ if(H5VL__blob_put(vol_obj->data, vol_obj->connector->cls, buf, size, blob_id, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed")
done:
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_blob_put() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLblob_put
+ *
+ * Purpose: Put a blob through the VOL
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size,
+ void *blob_id, void *ctx)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE6("e", "*xi*xz*x*x", obj, connector_id, buf, size, blob_id, ctx);
+
+ /* 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 VOL callback */
+ if(H5VL__blob_put(obj, cls, buf, size, blob_id, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLblob_put() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__blob_get
+ *
+ * Purpose: Get a blob through the VOL
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id,
+ void *buf, size_t size, void *ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(obj);
+ HDassert(cls);
+ HDassert(blob_id);
+ HDassert(buf);
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->blob_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->blob_cls.get)(obj, blob_id, buf, size, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get callback failed")
+
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_cancel() */
+} /* end H5VL__blob_get() */
/*-------------------------------------------------------------------------
- * Function: H5VLrequest_cancel
+ * Function: H5VL_blob_get
*
- * Purpose: Cancels a request
+ * Purpose: Get a blob through the VOL
*
- * Note: Releases the request, if connector callback succeeds
+ * Return: SUCCEED / FAIL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf,
+ size_t size, void *ctx)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(blob_id);
+ HDassert(buf);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding VOL callback */
+ if(H5VL__blob_get(vol_obj->data, vol_obj->connector->cls, blob_id, buf, size, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_blob_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLblob_get
+ *
+ * Purpose: Get a blob through the VOL
+ *
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_cancel(void *req, hid_t connector_id)
+H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf,
+ size_t size, void *ctx)
{
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);
+ H5TRACE6("e", "*xi*x*xz*x", obj, connector_id, blob_id, buf, size, ctx);
/* 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__request_cancel(req, cls) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request")
+ /* Call the corresponding VOL callback */
+ if(H5VL__blob_get(obj, cls, blob_id, buf, size, ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* end H5VLrequest_cancel() */
+} /* end H5VLblob_get() */
/*-------------------------------------------------------------------------
- * Function: H5VL__request_specific
+ * Function: H5VL__blob_specific
*
- * Purpose: Specific operation on asynchronous request through the VOL
+ * Purpose: Specific operation on blobs through the VOL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, August 17, 2019
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_specific(void *req, const H5VL_class_t *cls,
- H5VL_request_specific_t specific_type, va_list arguments)
+H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id,
+ H5VL_blob_specific_t specific_type, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(req);
+ HDassert(obj);
HDassert(cls);
+ HDassert(blob_id);
/* 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")
+ if(NULL == cls->blob_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob 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")
+ if((cls->blob_cls.specific)(obj, blob_id, specific_type, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__request_specific() */
+} /* end H5VL__blob_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VL_request_specific
+ * Function: H5VL_blob_specific
*
- * Purpose: Specific operation on asynchronous request through the VOL
+ * Purpose: Specific operation on blobs through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6275,8 +7093,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_specific(const H5VL_object_t *vol_obj,
- H5VL_request_specific_t specific_type, ...)
+H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id,
+ H5VL_blob_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 */
@@ -6287,17 +7105,18 @@ H5VL_request_specific(const H5VL_object_t *vol_obj,
/* Sanity check */
HDassert(vol_obj);
+ HDassert(blob_id);
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, specific_type);
arg_started = TRUE;
- if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
+ if((ret_value = H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, specific_type, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback")
done:
/* End access to the va_list, if we started it */
@@ -6309,80 +7128,85 @@ done:
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_specific() */
+} /* end H5VL_blob_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VLrequest_specific
+ * Function: H5VLblob_specific
*
- * Purpose: Performs a connector-specific operation on an asynchronous request
+ * Purpose: Specific operation on blobs through the VOL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type,
- va_list arguments)
+H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id,
+ H5VL_blob_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);
+ H5TRACE5("e", "*xi*xVBx", obj, connector_id, blob_id, specific_type, arguments);
/* 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__request_specific(req, cls, specific_type, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback")
+ /* Call the corresponding VOL callback */
+ if(H5VL__blob_specific(obj, cls, blob_id, specific_type, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* end H5VLrequest_specific() */
+} /* end H5VLblob_specific() */
/*-------------------------------------------------------------------------
- * Function: H5VL__request_optional
+ * Function: H5VL__blob_optional
*
- * Purpose: Optional operation specific to connectors.
+ * Purpose: Optional operation on blobs through the VOL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 14, 2019
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments)
+H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id,
+ H5VL_blob_optional_t opt_type, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(req);
+ HDassert(obj);
HDassert(cls);
+ HDassert(blob_id);
/* 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")
+ if(NULL == cls->blob_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob 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")
+ if((cls->blob_cls.optional)(obj, blob_id, opt_type, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__request_optional() */
+} /* end H5VL__blob_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_request_optional
+ * Function: H5VL_blob_optional
*
- * Purpose: Optional operation specific to connectors.
+ * Purpose: Optional operation on blobs through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6390,7 +7214,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_optional(const H5VL_object_t *vol_obj, ...)
+H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id,
+ H5VL_blob_optional_t opt_type, ...)
{
va_list arguments; /* Argument list passed from the API call */
hbool_t arg_started = FALSE; /* Whether the va_list has been started */
@@ -6401,17 +7226,18 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, ...)
/* Sanity check */
HDassert(vol_obj);
+ HDassert(blob_id);
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, vol_obj);
+ HDva_start(arguments, opt_type);
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")
+ if((ret_value = H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, opt_type, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback")
done:
/* End access to the va_list, if we started it */
@@ -6423,45 +7249,50 @@ done:
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_optional() */
+} /* end H5VL_blob_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VLrequest_optional
+ * Function: H5VLblob_optional
*
- * Purpose: Performs an optional connector-specific operation on an asynchronous request
+ * Purpose: Optional operation on blobs through the VOL
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED / FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments)
+H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id,
+ H5VL_blob_optional_t opt_type, 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);
+ H5TRACE5("e", "*xi*xVAx", obj, connector_id, blob_id, opt_type, arguments);
/* 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__request_optional(req, cls, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback")
+ /* Call the corresponding VOL callback */
+ if(H5VL__blob_optional(obj, cls, blob_id, opt_type, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* end H5VLrequest_optional() */
+} /* end H5VLblob_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL__request_free
+ * Function: H5VL__token_cmp
*
- * Purpose: Frees an asynchronous request through the VOL
+ * Purpose: Compares two VOL connector object tokens. Sets *cmp_value
+ * to positive if token1 is greater than token2, negative if
+ * token2 is greater than token1 and zero if token1 and
+ * token2 are equal.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6469,33 +7300,172 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_free(void *req, const H5VL_class_t *cls)
+H5VL__token_cmp(void *obj, const H5VL_class_t *cls,
+ const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
- /* Sanity check */
- HDassert(req);
+ /* Sanity checks */
+ HDassert(obj);
HDassert(cls);
+ HDassert(cmp_value);
- /* 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")
+ /* Take care of cases where one or both pointers is NULL */
+ if(token1 == NULL && token2 != NULL)
+ *cmp_value = -1;
+ else if(token1 != NULL && token2 == NULL)
+ *cmp_value = 1;
+ else if(token1 == NULL && token2 == NULL)
+ *cmp_value = 0;
+ else {
+ /* Use the class's token comparison routine to compare the tokens,
+ * if there is a callback, otherwise just compare the tokens as
+ * memory buffers.
+ */
+ if(cls->token_cls.cmp) {
+ if((cls->token_cls.cmp)(obj, token1, token2, cmp_value) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare object tokens")
+ } /* end if */
+ else
+ *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t));
+ } /* end else */
- /* 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__token_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_token_cmp
+ *
+ * Purpose: Compares two VOL connector object tokens. Sets *cmp_value
+ * to positive if token1 is greater than token2, negative if
+ * token2 is greater than token1 and zero if token1 and
+ * token2 are equal.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1,
+ const H5O_token_t *token2, int *cmp_value)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(vol_obj);
+ HDassert(cmp_value);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare failed")
done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__request_free() */
+} /* end H5VL_token_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLtoken_cmp
+ *
+ * Purpose: Compares two VOL connector object tokens
+ *
+ * Note: Both object tokens must be from the same VOL connector class
+ *
+ * Return: Success: Non-negative, with *cmp_value set to positive if
+ * token1 is greater than token2, negative if token2
+ * is greater than token1 and zero if token1 and
+ * token2 are equal.
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1,
+ const H5O_token_t *token2, int *cmp_value)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xi*k*k*Is", obj, connector_id, token1, token2, cmp_value);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ if(NULL == cmp_value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__token_cmp(obj, cls, token1, token2, cmp_value) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLtoken_cmp() */
/*-------------------------------------------------------------------------
- * Function: H5VL_request_free
+ * Function: H5VL__token_to_str
*
- * Purpose: Frees an asynchronous request through the VOL
+ * Purpose: Serialize a connector's object token into a string
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
+ const H5O_token_t *token, char **token_str)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(obj);
+ HDassert(cls);
+ HDassert(token);
+ HDassert(token_str);
+
+ /* Use the class's token serialization routine on the token if there is a
+ * callback, otherwise just set the token_str to NULL.
+ */
+ if(cls->token_cls.to_str) {
+ if((cls->token_cls.to_str)(obj, obj_type, token, token_str) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize object token")
+ } /* end if */
+ else
+ *token_str = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__token_to_str() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_token_to_str
+ *
+ * Purpose: Serialize a connector's object token into a string
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6503,24 +7473,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_free(const H5VL_object_t *vol_obj)
+H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type,
+ const H5O_token_t *token, char **token_str)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Sanity check */
+ /* Sanity checks */
HDassert(vol_obj);
+ HDassert(token);
+ HDassert(token_str);
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
- /* Call the corresponding VOL callback */
- if(H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization failed")
done:
/* Reset object wrapping info in API context */
@@ -6528,13 +7501,91 @@ done:
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_request_free() */
+} /* end H5VL_token_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLtoken_to_str
+ *
+ * Purpose: Serialize a connector's object token into a string
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id,
+ const H5O_token_t *token, char **token_str)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE5("e", "*xIti*k**s", obj, obj_type, connector_id, token, token_str);
+
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ if(NULL == token)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer")
+ if(NULL == token_str)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer")
+
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__token_to_str(obj, obj_type, cls, token, token_str) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token to string failed")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLtoken_to_str() */
/*-------------------------------------------------------------------------
- * Function: H5VLrequest_free
+ * Function: H5VL__token_from_str
*
- * Purpose: Frees a request
+ * Purpose: Deserialize a string into a connector object token
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
+ const char *token_str, H5O_token_t *token)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(obj);
+ HDassert(cls);
+ HDassert(token_str);
+ HDassert(token);
+
+ /* Use the class's token deserialization routine on the token if there is a
+ * callback, otherwise just set the token to H5_TOKEN_UNDEF.
+ */
+ if(cls->token_cls.from_str) {
+ if((cls->token_cls.from_str)(obj, obj_type, token_str, token) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token string")
+ } /* end if */
+ else
+ *token = H5O_TOKEN_UNDEF;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__token_from_str() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_token_from_str
+ *
+ * Purpose: Deserialize a string into a connector object token
*
* Return: Success: Non-negative
* Failure: Negative
@@ -6542,25 +7593,74 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_free(void *req, hid_t connector_id)
+H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type,
+ const char *token_str, H5O_token_t *token)
+{
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(vol_obj);
+ HDassert(token);
+ HDassert(token_str);
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization failed")
+
+done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_token_from_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLtoken_from_str
+ *
+ * Purpose: Deserialize a string into a connector object token
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id,
+ const char *token_str, H5O_token_t *token)
{
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);
+ H5TRACE5("e", "*xIti*s*k", obj, obj_type, connector_id, token_str, token);
- /* Get class pointer */
+ /* Check args and get class pointer */
+ if(NULL == obj)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ if(NULL == token)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer")
+ if(NULL == token_str)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer")
/* Call the corresponding internal VOL routine */
- if(H5VL__request_free(req, cls) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request")
+ if(H5VL__token_from_str(obj, obj_type, cls, token_str, token) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token from string failed")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* end H5VLrequest_free() */
+} /* end H5VLtoken_from_str() */
/*-------------------------------------------------------------------------
@@ -6574,7 +7674,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id,
void **req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6586,7 +7686,7 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method")
/* Call the corresponding VOL callback */
- if((ret_value = (cls->optional)(obj, dxpl_id, req, arguments)) < 0)
+ if((ret_value = (cls->optional)(obj, op_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
done:
@@ -6605,7 +7705,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
+H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id,
void **req, ...)
{
va_list arguments; /* Argument list passed from the API call */
@@ -6616,14 +7716,14 @@ H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
+ if(H5VL_set_vol_wrapper(vol_obj) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
HDva_start(arguments, req);
arg_started = TRUE;
- if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0)
+ if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, op_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback")
done:
@@ -6650,14 +7750,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VLoptional(void *obj, hid_t connector_id, int op_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
- H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments);
+ H5TRACE6("e", "*xiIsi**xx", obj, connector_id, op_type, dxpl_id, req, arguments);
/* Check args and get class pointer */
if(NULL == obj)
@@ -6666,7 +7766,7 @@ H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if((ret_value = H5VL__optional(obj, cls, dxpl_id, req, arguments)) < 0)
+ if((ret_value = H5VL__optional(obj, cls, op_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
done:
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index 98bc521..baa4cca 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -37,11 +37,35 @@
#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+/* Container info version */
+#define H5VL_CONTAINER_INFO_VERSION 0x01 /* Container info struct version */
+
+/* The maximum size allowed for blobs */
+#define H5VL_MAX_BLOB_ID_SIZE (16) /* Allow for 128-bits blob IDs */
+
/*******************/
/* Public Typedefs */
/*******************/
+/* Enum type for each VOL subclass */
+/* (Used for various queries, etc) */
+typedef enum H5VL_subclass_t {
+ H5VL_SUBCLS_NONE, /* Operations outside of a subclass */
+ H5VL_SUBCLS_INFO, /* 'Info' subclass */
+ H5VL_SUBCLS_WRAP, /* 'Wrap' subclass */
+ H5VL_SUBCLS_ATTR, /* 'Attribute' subclass */
+ H5VL_SUBCLS_DATASET, /* 'Dataset' subclass */
+ H5VL_SUBCLS_DATATYPE, /* 'Named datatype' subclass */
+ H5VL_SUBCLS_FILE, /* 'File' subclass */
+ H5VL_SUBCLS_GROUP, /* 'Group' subclass */
+ H5VL_SUBCLS_LINK, /* 'Link' subclass */
+ H5VL_SUBCLS_OBJECT, /* 'Object' subclass */
+ H5VL_SUBCLS_REQUEST, /* 'Request' subclass */
+ H5VL_SUBCLS_BLOB, /* 'Blob' subclass */
+ H5VL_SUBCLS_TOKEN /* 'Token' subclass */
+} H5VL_subclass_t;
+
/* types for attribute GET callback */
typedef enum H5VL_attr_get_t {
H5VL_ATTR_GET_ACPL, /* creation property list */
@@ -60,13 +84,16 @@ typedef enum H5VL_attr_specific_t {
H5VL_ATTR_RENAME /* H5Arename(_by_name) */
} H5VL_attr_specific_t;
+/* Typedef for VOL connector attribute optional VOL operations */
+typedef int H5VL_attr_optional_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_SPACE_STATUS, /* space status */
H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */
H5VL_DATASET_GET_TYPE /* datatype */
} H5VL_dataset_get_t;
@@ -78,6 +105,9 @@ typedef enum H5VL_dataset_specific_t {
H5VL_DATASET_REFRESH /* H5Drefresh */
} H5VL_dataset_specific_t;
+/* Typedef for VOL connector dataset optional VOL operations */
+typedef int H5VL_dataset_optional_t;
+
/* types for datatype GET callback */
typedef enum H5VL_datatype_get_t {
H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */
@@ -90,12 +120,17 @@ typedef enum H5VL_datatype_specific_t {
H5VL_DATATYPE_REFRESH
} H5VL_datatype_specific_t;
+/* Typedef and values for native VOL connector named datatype optional VOL operations */
+typedef int H5VL_datatype_optional_t;
+/* (No optional named datatype VOL operations currently) */
+
/* types for file GET callback */
typedef enum H5VL_file_get_t {
+ H5VL_FILE_GET_CONT_INFO, /* file get container info */
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_FILENO, /* file number */
+ 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 */
@@ -108,9 +143,13 @@ typedef enum H5VL_file_specific_t {
H5VL_FILE_MOUNT, /* Mount a file */
H5VL_FILE_UNMOUNT, /* Unmount a file */
H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
- H5VL_FILE_DELETE /* Delete a file */
+ H5VL_FILE_DELETE, /* Delete a file */
+ H5VL_FILE_IS_EQUAL /* Check if two files are the same */
} H5VL_file_specific_t;
+/* Typedef for VOL connector file optional VOL operations */
+typedef int H5VL_file_optional_t;
+
/* types for group GET callback */
typedef enum H5VL_group_get_t {
H5VL_GROUP_GET_GCPL, /* group creation property list */
@@ -123,6 +162,9 @@ typedef enum H5VL_group_specific_t {
H5VL_GROUP_REFRESH
} H5VL_group_specific_t;
+/* Typedef for VOL connector group optional VOL operations */
+typedef int H5VL_group_optional_t;
+
/* link create types for VOL */
typedef enum H5VL_link_create_type_t {
H5VL_LINK_CREATE_HARD,
@@ -144,24 +186,31 @@ typedef enum H5VL_link_specific_t {
H5VL_LINK_ITER /* H5Literate/visit(_by_name) */
} H5VL_link_specific_t;
+/* Typedef and values for native VOL connector link optional VOL operations */
+typedef int H5VL_link_optional_t;
+/* (No optional link VOL operations currently) */
+
/* types for object GET callback */
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_OBJECT_GET_NAME /* object name */
+ H5VL_OBJECT_GET_FILE, /* object file */
+ H5VL_OBJECT_GET_NAME, /* object name */
+ H5VL_OBJECT_GET_TYPE, /* object type */
+ H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name)3 */
} H5VL_object_get_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_LOOKUP, /* Lookup object */
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;
+/* Typedef for VOL connector object optional VOL operations */
+typedef int H5VL_object_optional_t;
+
/* types for async request SPECIFIC callback */
typedef enum H5VL_request_specific_t {
H5VL_REQUEST_WAITANY, /* Wait until any request completes */
@@ -169,56 +218,75 @@ typedef enum H5VL_request_specific_t {
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 and values for native VOL connector request optional VOL operations */
+typedef int H5VL_request_optional_t;
+/* (No optional request VOL operations currently) */
+
+/* types for 'blob' SPECIFIC callback */
+typedef enum H5VL_blob_specific_t {
+ H5VL_BLOB_DELETE, /* Delete a blob (by ID) */
+ H5VL_BLOB_GETSIZE, /* Get size of blob */
+ H5VL_BLOB_ISNULL, /* Check if a blob ID is "null" */
+ H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */
+} H5VL_blob_specific_t;
+
+/* Typedef and values for native VOL connector blob optional VOL operations */
+typedef int H5VL_blob_optional_t;
+/* (No optional blob VOL operations currently) */
+
+/* Types for different ways that objects are located in an HDF5 container */
typedef enum H5VL_loc_type_t {
H5VL_OBJECT_BY_SELF,
H5VL_OBJECT_BY_NAME,
H5VL_OBJECT_BY_IDX,
- H5VL_OBJECT_BY_ADDR,
- H5VL_OBJECT_BY_REF
+ H5VL_OBJECT_BY_TOKEN
} H5VL_loc_type_t;
-struct H5VL_loc_by_name {
+typedef struct H5VL_loc_by_name {
const char *name;
hid_t lapl_id;
-};
+} H5VL_loc_by_name_t;
-struct H5VL_loc_by_idx {
+typedef struct H5VL_loc_by_idx {
const char *name;
H5_index_t idx_type;
H5_iter_order_t order;
hsize_t n;
hid_t lapl_id;
-};
+} H5VL_loc_by_idx_t;
-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;
-};
+typedef struct H5VL_loc_by_token {
+ H5O_token_t *token;
+} H5VL_loc_by_token_t;
-/* Structure to hold parameters for object locations.
- * either: BY_ADDR, BY_ID, BY_NAME, BY_IDX, BY_REF
+/* Structure to hold parameters for object locations.
+ * Either: BY_SELF, BY_NAME, BY_IDX, BY_TOKEN
*
- * Note: Leave loc_by_addr as the first union member so we
+ * Note: Leave loc_by_token as the first union member so we
* can perform the simplest initialization of the struct
* without raising warnings.
+ *
+ * Note: BY_SELF requires no union members.
*/
typedef struct H5VL_loc_params_t {
H5I_type_t obj_type;
H5VL_loc_type_t type;
- union{
- 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;
+ union {
+ H5VL_loc_by_token_t loc_by_token;
+ H5VL_loc_by_name_t loc_by_name;
+ H5VL_loc_by_idx_t loc_by_idx;
} loc_data;
} H5VL_loc_params_t;
+/* Info for H5VL_FILE_GET_CONT_INFO */
+typedef struct H5VL_file_cont_info_t {
+ unsigned version; /* version information (keep first) */
+ uint64_t feature_flags; /* Container feature flags */
+ /* (none currently defined) */
+ size_t token_size; /* Size of tokens */
+ size_t blob_id_size; /* Size of blob IDs */
+} H5VL_file_cont_info_t;
+
/* VOL connector info fields & callbacks */
typedef struct H5VL_info_class_t {
size_t size; /* Size of the VOL info */
@@ -251,7 +319,8 @@ typedef struct H5VL_attr_class_t {
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 (*optional)(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
+ void **req, va_list arguments);
herr_t (*close) (void *attr, hid_t dxpl_id, void **req);
} H5VL_attr_class_t;
@@ -263,13 +332,14 @@ typedef struct H5VL_dataset_class_t {
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);
+ hid_t dxpl_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);
+ hid_t dxpl_id, const void * buf, void **req);
herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
+ void **req, va_list arguments);
herr_t (*close) (void *dset, hid_t dxpl_id, void **req);
} H5VL_dataset_class_t;
@@ -282,7 +352,7 @@ typedef struct H5VL_datatype_class_t {
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 (*optional)(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*close) (void *dt, hid_t dxpl_id, void **req);
} H5VL_datatype_class_t;
@@ -294,7 +364,8 @@ typedef struct H5VL_file_class_t {
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 (*optional)(void *obj, H5VL_file_optional_t opt_type, hid_t dxpl_id,
+ void **req, va_list arguments);
herr_t (*close) (void *file, hid_t dxpl_id, void **req);
} H5VL_file_class_t;
@@ -307,7 +378,7 @@ typedef struct H5VL_group_class_t {
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 (*optional)(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
herr_t (*close) (void *grp, hid_t dxpl_id, void **req);
} H5VL_group_class_t;
@@ -317,15 +388,16 @@ typedef struct H5VL_link_class_t {
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
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);
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2,
- hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
hid_t dxpl_id, void **req, va_list arguments);
herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*optional)(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id,
+ void **req, va_list arguments);
} H5VL_link_class_t;
/* H5O routines */
@@ -339,29 +411,54 @@ typedef struct H5VL_object_class_t {
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);
+ herr_t (*optional)(void *obj, H5VL_object_optional_t opt_type,
+ 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);
+/* "Levels" for 'get connector class' introspection callback */
+typedef enum H5VL_get_conn_lvl_t {
+ H5VL_GET_CONN_LVL_CURR, /* Get "current" connector (for this object) */
+ H5VL_GET_CONN_LVL_TERM /* Get "terminal" connector (for this object) */
+ /* (Recursively called, for pass-through connectors) */
+ /* (Connectors that "split" must choose which connector to return) */
+} H5VL_get_conn_lvl_t;
+
+/* Forward declaration of H5VL_class_t, defined later in this file */
+struct H5VL_class_t;
+
+/* Container/connector introspection routines */
+typedef struct H5VL_introspect_class_t {
+ herr_t (*get_conn_cls)(void *obj, H5VL_get_conn_lvl_t lvl, const struct H5VL_class_t **conn_cls);
+ herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported);
+} H5VL_introspect_class_t;
+
/* 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 (*optional)(void *req, H5VL_request_optional_t opt_type, 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;
+/* 'blob' routines */
+typedef struct H5VL_blob_class_t {
+ herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
+ herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
+ herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
+ herr_t (*optional)(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments);
+} H5VL_blob_class_t;
+
+/* Object token routines */
+typedef struct H5VL_token_class_t {
+ herr_t (*cmp)(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value);
+ herr_t (*to_str)(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str);
+ herr_t (*from_str)(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token);
+} H5VL_token_class_t;
/* Class information for each VOL connector */
typedef struct H5VL_class_t {
@@ -386,11 +483,14 @@ typedef struct H5VL_class_t {
H5VL_link_class_t link_cls; /* Link (H5L*) class callbacks */
H5VL_object_class_t object_cls; /* Object (H5O*) class callbacks */
- /* Services */
+ /* Infrastructure / Services */
+ H5VL_introspect_class_t introspect_cls; /* Container/connector introspection class callbacks */
H5VL_request_class_t request_cls; /* Asynchronous request class callbacks */
+ H5VL_blob_class_t blob_cls; /* 'Blob' class callbacks */
+ H5VL_token_class_t token_cls; /* VOL connector object token class callbacks */
/* Catch-all */
- herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */
+ herr_t (*optional)(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */
} H5VL_class_t;
@@ -398,6 +498,7 @@ typedef struct H5VL_class_t {
/* Public Variables */
/********************/
+
/*********************/
/* Public Prototypes */
/*********************/
@@ -407,7 +508,12 @@ extern "C" {
#endif
/* Helper routines for VOL connector authors */
+H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
H5_DLL void *H5VLobject(hid_t obj_id);
+H5_DLL hid_t H5VLget_file_type(void *file_obj, hid_t connector_id,
+ hid_t dtype_id);
+H5_DLL hid_t H5VLpeek_connector_id_by_name(const char *name);
+H5_DLL hid_t H5VLpeek_connector_id_by_value(H5VL_class_value_t value);
#ifdef __cplusplus
}
diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h
index 9a2bd52..b04f5eb 100644
--- a/src/H5VLconnector_passthru.h
+++ b/src/H5VLconnector_passthru.h
@@ -13,7 +13,7 @@
/*
* This file contains public declarations for authoring VOL connectors
* which act as "passthrough" connectors that forward their API calls to
- * an underlying connector.
+ * an underlying connector.
*
* An example of this might be a logging connector, which creates log messages
* and then passes the call on to an underlying VOL connector.
@@ -92,7 +92,7 @@ H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void
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_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, 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 */
@@ -102,15 +102,23 @@ H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id
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_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req);
+/* 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, H5VL_datatype_optional_t opt_type, 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 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_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for group callbacks */
@@ -118,7 +126,7 @@ H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hi
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_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for link callbacks */
@@ -131,7 +139,7 @@ H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
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);
+H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
/* 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);
@@ -140,24 +148,37 @@ H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params
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);
+H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
-/* 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 connector/container introspection callbacks */
+H5_DLL herr_t H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id,
+ H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VLintrospect_opt_query(void *obj, hid_t connector_id,
+ H5VL_subclass_t subcls, int opt_type, hbool_t *supported);
/* 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_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, va_list arguments);
H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
+/* Public wrappers for blob callbacks */
+H5_DLL herr_t H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void *blob_id, void *ctx);
+H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t size, void *ctx);
+H5_DLL herr_t H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
+H5_DLL herr_t H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments);
+
+/* Public wrappers for token callbacks */
+H5_DLL herr_t H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value);
+H5_DLL herr_t H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_token_t *token, char **token_str);
+H5_DLL herr_t H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const char *token_str, H5O_token_t *token);
+
+/* Public wrappers for generic 'optional' callback */
+H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5VLint.c b/src/H5VLint.c
index f9262f4..6572faa 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -30,10 +30,15 @@
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free lists */
+#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
+#include "H5Mprivate.h" /* Maps */
#include "H5MMprivate.h" /* Memory management */
#include "H5PLprivate.h" /* Plugins */
#include "H5Tprivate.h" /* Datatypes */
@@ -189,6 +194,20 @@ H5VL_init_phase2(void)
FUNC_ENTER_NOAPI(FAIL)
+ /* Initialize all packages for VOL-managed objects */
+ if(H5T_init() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize datatype interface")
+ if(H5D_init() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize dataset interface")
+ if(H5F_init() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize file interface")
+ if(H5G_init() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize group interface")
+ if(H5A_init() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize attribute interface")
+ if(H5M_init() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize map interface")
+
/* Set up the default VOL connector in the default FAPL */
if(H5VL__set_def_conn() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector")
@@ -299,7 +318,7 @@ H5VL__free_cls(H5VL_class_t *cls)
HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly")
/* Release the class */
- H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */
+ H5MM_xfree_const(cls->name);
H5FL_FREE(H5VL_class_t, cls);
done:
@@ -402,11 +421,11 @@ H5VL__set_def_conn(void)
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "VOL connector environment variable set empty?")
/* First, check to see if the connector is already registered */
- if((connector_is_registered = H5VL__is_connector_registered(tok)) < 0)
+ if((connector_is_registered = H5VL__is_connector_registered_by_name(tok)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check if VOL connector already registered")
else if(connector_is_registered) {
/* Retrieve the ID of the already-registered VOL connector */
- if((connector_id = H5VL__get_connector_id(tok, FALSE)) < 0)
+ if((connector_id = H5VL__get_connector_id_by_name(tok, FALSE)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector ID")
} /* end else-if */
else {
@@ -424,7 +443,7 @@ H5VL__set_def_conn(void)
else {
/* Register the VOL connector */
/* (NOTE: No provisions for vipl_id currently) */
- if((connector_id = H5VL__register_connector_by_name(tok, FALSE, H5P_DEFAULT)) < 0)
+ if((connector_id = H5VL__register_connector_by_name(tok, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector")
} /* end else */
} /* end else */
@@ -543,6 +562,7 @@ 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 */
+ hbool_t conn_rc_incr = FALSE; /* Whether the VOL connector refcount has been incremented */
H5VL_object_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -569,6 +589,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t
/* Bump the reference count on the VOL connector */
H5VL__conn_inc_rc(vol_connector);
+ conn_rc_incr = TRUE;
/* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
if(H5I_DATATYPE == type) {
@@ -579,6 +600,12 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t
ret_value = (H5VL_object_t *)new_vol_obj;
done:
+ /* Cleanup on error */
+ if(NULL == ret_value) {
+ if(conn_rc_incr && H5VL__conn_dec_rc(vol_connector) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector")
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__new_vol_obj() */
@@ -655,14 +682,14 @@ H5VL_conn_free(const H5VL_connector_prop_t *connector_prop)
if(connector_prop->connector_id > 0) {
if(connector_prop->connector_info)
/* Free the connector info */
- if(H5VL_free_connector_info(connector_prop->connector_id, (void *)connector_prop->connector_info) < 0) /* Casting away const OK - QAK */
+ if(H5VL_free_connector_info(connector_prop->connector_id, connector_prop->connector_info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
/* Decrement reference count for connector ID */
if(H5I_dec_ref(connector_prop->connector_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID")
- } /* end if */
- } /* end if */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -697,7 +724,7 @@ H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_
/* (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")
@@ -712,7 +739,7 @@ done:
*
* 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,
+ * 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).
@@ -759,16 +786,17 @@ done:
* get the connector information instead of it being passed in.
*
* Return: Success: A valid HDF5 ID
- * Failure: H5I_INVALID_HID
+ * 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;
+ H5VL_class_t *cls = NULL; /* VOL connector class */
+ H5VL_t *connector = NULL; /* VOL connector struct */
+ hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
+ hid_t ret_value = H5I_INVALID_HID;/* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -783,17 +811,85 @@ H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool
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")
+ conn_id_incr = TRUE;
/* Get an ID for the VOL object */
if((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
done:
+ /* Clean up on error */
+ if(ret_value < 0) {
+ /* Decrement VOL connector ID ref count on error */
+ if(conn_id_incr && H5I_dec_ref(connector_id) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement ref count on VOL connector")
+
+ /* Free VOL connector struct */
+ if(NULL != connector)
+ connector = H5FL_FREE(H5VL_t, connector);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_register_using_vol_id() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_create_object_using_vol_id
+ *
+ * Purpose: Similar to H5VL_register_using_vol_id but does not create
+ * an id. Intended for use by internal library routines,
+ * therefore it wraps the object.
+ *
+ * Return: Success: VOL object pointer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5VL_object_t *
+H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id)
+{
+ H5VL_class_t *cls = NULL; /* VOL connector class */
+ H5VL_t *connector = NULL; /* VOL connector struct */
+ hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
+ H5VL_object_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the VOL class object from the connector's ID */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID")
+
+ /* Setup VOL info struct */
+ if(NULL == (connector = H5FL_CALLOC(H5VL_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "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, NULL, "unable to increment ref count on VOL connector")
+ conn_id_incr = TRUE;
+
+ /* Set up VOL object for the passed-in data */
+ /* (Wraps object, since it's a library object) */
+ if(NULL == (ret_value = H5VL__new_vol_obj(type, obj, connector, TRUE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't create VOL object")
+
+done:
+ /* Clean up on error */
+ if(!ret_value) {
+ /* Decrement VOL connector ID ref count on error */
+ if(conn_id_incr && H5I_dec_ref(connector_id) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector")
+
+ /* Free VOL connector struct */
+ if(NULL != connector)
+ connector = H5FL_FREE(H5VL_t, connector);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_create_object_using_vol_id() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__conn_inc_rc
*
* Purpose: Wrapper to increment the ref. count on a connector.
@@ -895,6 +991,114 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL_object_is_native
+ *
+ * Purpose: Query if an object is (if it's a file object) / is in (if its
+ * an object) a native connector's file.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * December 14, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native)
+{
+ const H5VL_class_t *cls; /* VOL connector class structs for object */
+ const H5VL_class_t *native_cls; /* Native VOL connector class structs */
+ int cmp_value; /* Comparison result */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ HDassert(obj);
+ HDassert(is_native);
+
+ /* Retrieve the terminal connector class for the object */
+ cls = NULL;
+ if(H5VL_introspect_get_conn_cls(obj, H5VL_GET_CONN_LVL_TERM, &cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class")
+
+ /* Retrieve the native connector class */
+ if(NULL == (native_cls = (H5VL_class_t *)H5I_object_verify(H5VL_NATIVE, H5I_VOL)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve native VOL connector class")
+
+ /* Compare connector classes */
+ if(H5VL_cmp_connector_cls(&cmp_value, cls, native_cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+
+ /* If classes compare equal, then the object is / is in a native connector's file */
+ *is_native = (cmp_value == 0);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_object_is_native() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_is_same
+ *
+ * Purpose: Query if two files are the same.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * December 14, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2,
+ hbool_t *same_file)
+{
+ const H5VL_class_t *cls1; /* VOL connector class struct for first object */
+ const H5VL_class_t *cls2; /* VOL connector class struct for second object */
+ int cmp_value; /* Comparison result */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ HDassert(vol_obj1);
+ HDassert(vol_obj2);
+ HDassert(same_file);
+
+ /* Retrieve the terminal connectors for each object */
+ cls1 = NULL;
+ if(H5VL_introspect_get_conn_cls(vol_obj1, H5VL_GET_CONN_LVL_TERM, &cls1) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class")
+ cls2 = NULL;
+ if(H5VL_introspect_get_conn_cls(vol_obj2, H5VL_GET_CONN_LVL_TERM, &cls2) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class")
+
+ /* Compare connector classes */
+ if(H5VL_cmp_connector_cls(&cmp_value, cls1, cls2) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+
+ /* If the connector classes are different, the files are different */
+ if(cmp_value)
+ *same_file = FALSE;
+ else {
+ void *obj2; /* Terminal object for second file */
+
+ /* Get unwrapped (terminal) object for vol_obj2 */
+ if(NULL == (obj2 = H5VL_object_data(vol_obj2)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object")
+
+ /* Make callback */
+ if(H5VL_file_specific(vol_obj1, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, obj2, same_file) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_is_same() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_register_connector
*
* Purpose: Registers a new VOL connector as a member of the virtual object
@@ -903,7 +1107,7 @@ done:
* Return: Success: A VOL connector ID which is good until the
* library is closed or the connector is unregistered.
*
- * Failure: H5I_INVALID_HID
+ * Failure: H5I_INVALID_HID
*
* Programmer: Dana Robinson
* June 22, 2017
@@ -940,7 +1144,7 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
done:
if(ret_value < 0 && saved) {
if(saved->name)
- H5MM_xfree((void *)(saved->name)); /* Casting away const OK -QAK */
+ H5MM_xfree_const(saved->name);
H5FL_FREE(H5VL_class_t, saved);
} /* end if */
@@ -1031,7 +1235,7 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i
op_data.found_id = H5I_INVALID_HID;
/* Check if connector is already registered */
- if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
/* If connector alread registered, increment ref count on ID and return ID */
@@ -1121,7 +1325,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL__is_connector_registered
+ * Function: H5VL__is_connector_registered_by_name
*
* Purpose: Checks if a connector with a particular name is registered.
*
@@ -1134,7 +1338,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5VL__is_connector_registered(const char *name)
+H5VL__is_connector_registered_by_name(const char *name)
{
H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
htri_t ret_value = FALSE; /* Return value */
@@ -1156,12 +1360,84 @@ H5VL__is_connector_registered(const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__is_connector_registered() */
+} /* end H5VL__is_connector_registered_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__is_connector_registered_by_value
+ *
+ * Purpose: Checks if a connector with a particular value (ID) is
+ * registered.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5VL__is_connector_registered_by_value(H5VL_class_value_t value)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find connector with value */
+ 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 connectors")
+
+ /* Found a connector with that name */
+ if(op_data.found_id != H5I_INVALID_HID)
+ ret_value = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__is_connector_registered_by_value() */
/*-------------------------------------------------------------------------
* Function: H5VL__get_connector_id
*
+ * Purpose: Retrieves the VOL connector ID for a given object ID.
+ *
+ * Return: Positive if the VOL class has been registered
+ * Negative on error (if the class is not a valid class or not registered)
+ *
+ * Programmer: Dana Robinson
+ * June 17, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL__get_connector_id(hid_t obj_id, hbool_t is_api)
+{
+ H5VL_object_t *vol_obj = NULL;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Get the underlying VOL object for the object ID */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Return the VOL object's VOL class ID */
+ ret_value = vol_obj->connector->id;
+ if(H5I_inc_ref(ret_value, is_api) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__get_connector_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__get_connector_id_by_name
+ *
* Purpose: Retrieves the ID for a registered VOL connector.
*
* Return: Positive if the VOL class has been registered
@@ -1173,7 +1449,70 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VL__get_connector_id(const char *name, hbool_t is_api)
+H5VL__get_connector_id_by_name(const char *name, hbool_t is_api)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Find connector with name */
+ if((ret_value = H5VL__peek_connector_id_by_name(name)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't find VOL connector")
+
+ /* Found a connector with that name */
+ if(H5I_inc_ref(ret_value, is_api) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__get_connector_id_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__get_connector_id_by_value
+ *
+ * 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
+H5VL__get_connector_id_by_value(H5VL_class_value_t value, hbool_t is_api)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Find connector with value */
+ if((ret_value = H5VL__peek_connector_id_by_value(value)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't find VOL connector")
+
+ /* Found a connector with that value */
+ if(H5I_inc_ref(ret_value, is_api) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__get_connector_id_by_value() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__peek_connector_id_by_name
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector. Does not
+ * increment the ref count
+ *
+ * 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
+H5VL__peek_connector_id_by_name(const char *name)
{
H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@@ -1189,16 +1528,49 @@ H5VL__get_connector_id(const char *name, hbool_t is_api)
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 connectors")
- /* Found a connector with that name */
- if(op_data.found_id != H5I_INVALID_HID) {
- if(H5I_inc_ref(op_data.found_id, is_api) < 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 */
+ /* Set return value */
+ ret_value = op_data.found_id;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__get_connector_id() */
+} /* end H5VL__peek_connector_id_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__peek_connector_id_by_value
+ *
+ * Purpose: Retrieves the ID for a registered VOL connector. Does not
+ * increment the ref count
+ *
+ * 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
+H5VL__peek_connector_id_by_value(H5VL_class_value_t value)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Set up op data for iteration */
+ op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find connector with value */
+ 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 connectors")
+
+ /* Set return value */
+ ret_value = op_data.found_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__peek_connector_id_by_value() */
/*-------------------------------------------------------------------------
@@ -1291,7 +1663,7 @@ done:
*
* 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
+ * except for named datatypes, where the vol_obj is returned that
* is attached to the H5T_t struct.
*
* Return: Success: object pointer
@@ -1309,15 +1681,15 @@ H5VL_vol_object(hid_t id)
FUNC_ENTER_NOAPI(NULL)
obj_type = H5I_get_type(id);
- if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type ||
+ 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)))
+ 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)))
+ /* 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
@@ -1398,7 +1770,7 @@ done:
static void *
H5VL__object(hid_t id, H5I_type_t obj_type)
{
- H5VL_object_t *vol_obj = NULL;
+ H5VL_object_t *vol_obj = NULL;
void *ret_value = NULL;
FUNC_ENTER_STATIC
@@ -1407,7 +1779,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type)
switch(obj_type) {
case H5I_GROUP:
case H5I_DATASET:
- case H5I_FILE:
+ case H5I_FILE:
case H5I_ATTR:
case H5I_MAP:
/* get the object */
@@ -1535,6 +1907,12 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas
HDassert(cls1);
HDassert(cls2);
+ /* If the pointers are the same the classes are the same */
+ if(cls1 == cls2) {
+ *cmp_value = 0;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+
/* Compare connector "values" */
if(cls1->value < cls2->value) {
*cmp_value = -1;
@@ -1781,17 +2159,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_set_vol_wrapper(void *obj, H5VL_t *connector)
+H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj)
{
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);
+ /* Sanity check */
+ HDassert(vol_obj);
/* Retrieve the VOL object wrap context */
if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
@@ -1799,13 +2175,19 @@ H5VL_set_vol_wrapper(void *obj, H5VL_t *connector)
/* Check for existing wrapping context */
if(NULL == vol_wrap_ctx) {
+ void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */
+
+ /* Sanity checks */
+ HDassert(vol_obj->data);
+ HDassert(vol_obj->connector);
+
/* Check if the connector can create a wrap context */
- if(connector->cls->wrap_cls.get_wrap_ctx) {
+ if(vol_obj->connector->cls->wrap_cls.get_wrap_ctx) {
/* Sanity check */
- HDassert(connector->cls->wrap_cls.free_wrap_ctx);
+ HDassert(vol_obj->connector->cls->wrap_cls.free_wrap_ctx);
/* Get the wrap context from the connector */
- if((connector->cls->wrap_cls.get_wrap_ctx)(obj, &obj_wrap_ctx) < 0)
+ if((vol_obj->connector->cls->wrap_cls.get_wrap_ctx)(vol_obj->data, &obj_wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context")
} /* end if */
@@ -1814,11 +2196,11 @@ H5VL_set_vol_wrapper(void *obj, H5VL_t *connector)
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context")
/* Increment the outstanding objects that are using the connector */
- H5VL__conn_inc_rc(connector);
+ H5VL__conn_inc_rc(vol_obj->connector);
/* Set up VOL object wrapper context */
vol_wrap_ctx->rc = 1;
- vol_wrap_ctx->connector = connector;
+ vol_wrap_ctx->connector = vol_obj->connector;
vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx;
} /* end if */
else
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 7848c5d..616ca60 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -11,14 +11,20 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: The native VOL connector where access is to a single HDF5 file
- * using HDF5 VFDs.
+ * Purpose: The native VOL connector where access is to a single HDF5 file
+ * using HDF5 VFDs.
*/
#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
@@ -31,7 +37,7 @@ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID;
static herr_t H5VL__native_term(void);
/* Native VOL connector class struct */
-static H5VL_class_t H5VL_native_cls_g = {
+static const H5VL_class_t H5VL_native_cls_g = {
H5VL_NATIVE_VERSION, /* version */
H5VL_NATIVE_VALUE, /* value */
H5VL_NATIVE_NAME, /* name */
@@ -112,6 +118,10 @@ static H5VL_class_t H5VL_native_cls_g = {
H5VL__native_object_specific, /* specific */
H5VL__native_object_optional /* optional */
},
+ { /* introspect_cls */
+ H5VL__native_introspect_get_conn_cls, /* get_conn_cls */
+ H5VL__native_introspect_opt_query, /* opt_query */
+ },
{ /* request_cls */
NULL, /* wait */
NULL, /* notify */
@@ -120,6 +130,17 @@ static H5VL_class_t H5VL_native_cls_g = {
NULL, /* optional */
NULL /* free */
},
+ { /* blob_cls */
+ H5VL__native_blob_put, /* put */
+ H5VL__native_blob_get, /* get */
+ H5VL__native_blob_specific, /* specific */
+ NULL /* optional */
+ },
+ { /* token_cls */
+ H5VL__native_token_cmp, /* cmp */
+ H5VL__native_token_to_str, /* to_str */
+ H5VL__native_str_to_token /* from_str */
+ },
NULL /* optional */
};
@@ -142,8 +163,8 @@ H5VL_native_register(void)
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)
+ if(H5I_INVALID_HID == H5VL_NATIVE_ID_g)
+ if((H5VL_NATIVE_ID_g = H5VL_register_connector(&H5VL_native_cls_g, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector")
/* Set return value */
@@ -174,3 +195,365 @@ H5VL__native_term(void)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5VL__native_term() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_introspect_get_conn_cls
+ *
+ * Purpose: Query the connector class.
+ *
+ * Note: This routine is in this file so that it can return the address
+ * of the staticly declared class struct.
+ *
+ * Returns: SUCCEED (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj,
+ H5VL_get_conn_lvl_t H5_ATTR_UNUSED lvl, const H5VL_class_t **conn_cls)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity check */
+ HDassert(conn_cls);
+
+ /* Retrieve the native VOL connector class */
+ *conn_cls = &H5VL_native_cls_g;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5VL__native_introspect_get_conn_cls() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_native_get_file_addr_len
+ *
+ * Purpose: Convenience function to get a file's address length from a
+ * location ID. Useful when you have to encode/decode addresses
+ * to/from tokens.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_native_get_file_addr_len(hid_t loc_id, size_t *addr_len)
+{
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ void *vol_obj = NULL; /* VOL Object of loc_id */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check arguments */
+ HDassert(addr_len);
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Retrieve underlying VOL object */
+ if(NULL == (vol_obj = H5VL_object(loc_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Retrieve file address length */
+ if(H5VL__native_get_file_addr_len(vol_obj, vol_obj_type, addr_len) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get file address length")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_get_file_addr_len() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_get_file_addr_len
+ *
+ * Purpose: Convenience function to get a file's address length from a
+ * VOL object. Useful when you have to encode/decode addresses
+ * to/from tokens.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_get_file_addr_len(void *obj, H5I_type_t obj_type, size_t *addr_len)
+{
+ H5F_t *file = NULL; /* File stuct pointer */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check arguments */
+ HDassert(obj);
+ HDassert(addr_len);
+
+ /* Retrieve file from the VOL object */
+ if(H5VL_native_get_file_struct(obj, obj_type, &file) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get file from VOL object")
+
+ /* Get the length of an address in this file */
+ *addr_len = H5F_SIZEOF_ADDR(file);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_get_file_addr_len() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLnative_addr_to_token
+ *
+ * Purpose: Converts a native VOL haddr_t address to an abstract VOL token.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token)
+{
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ void *vol_obj = NULL; /* VOL Object of loc_id */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ia*k", loc_id, addr, token);
+
+ /* Check args */
+ if(NULL == token)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "token pointer can't be NULL")
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Retrieve underlying VOL object */
+ if(NULL == (vol_obj = H5VL_object(loc_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object")
+
+#ifndef NDEBUG
+ {
+ H5VL_object_t *vol_obj_container;
+ hbool_t is_native_vol_obj;
+
+ /* Get the location object */
+ if(NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Make sure that the VOL object is a native connector object */
+ if(H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+
+ HDassert(is_native_vol_obj && "not a native VOL connector object");
+ }
+#endif
+
+ /* Convert the haddr_t to an object token */
+ if(H5VL_native_addr_to_token(vol_obj, vol_obj_type, addr, token) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "couldn't serialize haddr_t into object token")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLnative_addr_to_token() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_native_addr_to_token
+ *
+ * Purpose: Converts a native VOL haddr_t address to an abstract VOL token.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_native_addr_to_token(void *obj, H5I_type_t obj_type, haddr_t addr, H5O_token_t *token)
+{
+ uint8_t *p;
+ size_t addr_len = 0; /* Size of haddr_t */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(obj);
+ HDassert(token);
+
+ /* Get the length of an haddr_t in the file */
+ if(H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object")
+
+ /* Ensure that token is initialized */
+ HDmemset(token, 0, sizeof(H5O_token_t));
+
+ /* Encode token */
+ p = (uint8_t *)token;
+ H5F_addr_encode_len(addr_len, &p, addr);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_addr_to_token() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLnative_token_to_addr
+ *
+ * Purpose: Converts an abstract VOL token to a native VOL haddr_t address.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr)
+{
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ void *vol_obj = NULL; /* VOL Object of loc_id */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ik*a", loc_id, token, addr);
+
+ /* Check args */
+ if(NULL == addr)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr pointer can't be NULL")
+
+ /* Get object type */
+ if((vol_obj_type = H5I_get_type(loc_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Retrieve underlying VOL object */
+ if(NULL == (vol_obj = H5VL_object(loc_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object")
+
+#ifndef NDEBUG
+ {
+ H5VL_object_t *vol_obj_container;
+ hbool_t is_native_vol_obj;
+
+ /* Get the location object */
+ if(NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Make sure that the VOL object is a native connector object */
+ if(H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object")
+
+ HDassert(is_native_vol_obj && "not a native VOL connector object");
+ }
+#endif
+
+ /* Convert the object token to an haddr_t */
+ if(H5VL_native_token_to_addr(vol_obj, vol_obj_type, token, addr) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "couldn't deserialize object token into haddr_t")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLnative_token_to_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_native_token_to_addr
+ *
+ * Purpose: Converts an abstract VOL token to a native VOL haddr_t address.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_native_token_to_addr(void *obj, H5I_type_t obj_type, H5O_token_t token, haddr_t *addr)
+{
+ const uint8_t *p;
+ size_t addr_len = 0; /* Size of haddr_t */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(obj);
+ HDassert(addr);
+
+ /* Get the length of an haddr_t in the file */
+ if(H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object")
+
+ /* Decode token */
+ p = (const uint8_t *)&token;
+ H5F_addr_decode_len(addr_len, &p, addr);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_token_to_addr() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_native_get_file_struct
+ *
+ * Purpose: Utility routine to get file struct for an object
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file)
+{
+ H5O_loc_t *oloc = NULL; /* Object location for ID */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL);
+
+ *file = NULL;
+
+ switch(type) {
+ case H5I_FILE:
+ *file = (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_MAP:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector")
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_DATASPACE:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ } /* end switch */
+
+ /* Set return value for objects (not files) */
+ if(oloc)
+ *file = oloc->file;
+
+ /* Couldn't find a file struct */
+ if(!*file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL_native_get_file_struct */
+
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index b2dd13d..e1f3f93 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -17,6 +17,14 @@
#ifndef _H5VLnative_H
#define _H5VLnative_H
+/* Public headers needed by this file */
+#include "H5VLpublic.h" /* Virtual Object Layer */
+
+
+/*****************/
+/* Public Macros */
+/*****************/
+
/* Identifier for the native VOL connector */
#define H5VL_NATIVE (H5VL_native_register())
@@ -25,14 +33,12 @@
#define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */
#define H5VL_NATIVE_VERSION 0
-/* Typedef and values for native VOL connector attribute optional VOL operations */
-typedef int H5VL_native_attr_optional_t;
+/* Values for VOL connector attribute optional VOL operations */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */
+#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-/* Typedef and values for native VOL connector dataset optional VOL operations */
-typedef int H5VL_native_dataset_optional_t;
+/* Values for native VOL connector dataset optional VOL operations */
#define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */
#define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */
#define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */
@@ -41,60 +47,86 @@ typedef int H5VL_native_dataset_optional_t;
#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */
#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */
#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */
+#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */
-/* Typedef and values for native VOL connector file optional VOL operations */
-typedef int H5VL_native_file_optional_t;
-#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */
-#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */
-#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */
-#define H5VL_NATIVE_FILE_GET_FREE_SPACE 3 /* H5Fget_freespace */
-#define H5VL_NATIVE_FILE_GET_INFO 4 /* H5Fget_info1/2 */
-#define H5VL_NATIVE_FILE_GET_MDC_CONF 5 /* H5Fget_mdc_config */
-#define H5VL_NATIVE_FILE_GET_MDC_HR 6 /* H5Fget_mdc_hit_rate */
-#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */
-#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */
-#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */
-#define H5VL_NATIVE_FILE_GET_FILE_ID 10 /* H5Fget_file_id */
-#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 11 /* H5Freset_mdc_hit_rate_stats */
-#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 12 /* H5Fset_mdc_config */
-#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 13 /* H5Fget_metadata_read_retry_info */
-#define H5VL_NATIVE_FILE_START_SWMR_WRITE 14 /* H5Fstart_swmr_write */
-#define H5VL_NATIVE_FILE_START_MDC_LOGGING 15 /* H5Fstart_mdc_logging */
-#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 16 /* H5Fstop_mdc_logging */
-#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 17 /* H5Fget_mdc_logging_status */
-#define H5VL_NATIVE_FILE_FORMAT_CONVERT 18 /* H5Fformat_convert */
-#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 19 /* H5Freset_page_buffering_stats */
-#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 20 /* H5Fget_page_buffering_stats */
-#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 21 /* H5Fget_mdc_image_info */
-#define H5VL_NATIVE_FILE_GET_EOA 22 /* H5Fget_eoa */
-#define H5VL_NATIVE_FILE_INCR_FILESIZE 23 /* H5Fincrement_filesize */
-#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 24 /* H5Fset_latest_format/libver_bounds */
-#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 25 /* H5Fget_dset_no_attrs_hint */
-#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 26 /* H5Fset_dset_no_attrs_hint */
-#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 27 /* H5Fget_mpi_atomicity */
-#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 28 /* H5Fset_mpi_atomicity */
-
-/* Typedef and values for native VOL connector group optional VOL operations */
-typedef int H5VL_native_group_optional_t;
+/* Values for native VOL connector file optional VOL operations */
+#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */
+#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */
+#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */
+#define H5VL_NATIVE_FILE_GET_FREE_SPACE 3 /* H5Fget_freespace */
+#define H5VL_NATIVE_FILE_GET_INFO 4 /* H5Fget_info1/2 */
+#define H5VL_NATIVE_FILE_GET_MDC_CONF 5 /* H5Fget_mdc_config */
+#define H5VL_NATIVE_FILE_GET_MDC_HR 6 /* H5Fget_mdc_hit_rate */
+#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */
+#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */
+#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */
+#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */
+#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */
+#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */
+#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */
+#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */
+#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */
+#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */
+#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */
+#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */
+#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */
+#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */
+#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */
+#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */
+#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */
+#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */
+#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */
+#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */
+#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */
+#define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */
+
+/* Values for native VOL connector group optional VOL operations */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */
-#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */
+#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */
+#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-/* Typedef and values for native VOL connector object optional VOL operations */
-typedef int H5VL_native_object_optional_t;
-#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */
-#define H5VL_NATIVE_OBJECT_GET_INFO 1 /* H5Oget_info(_by_idx, _by_name)(2) */
-#define H5VL_NATIVE_OBJECT_SET_COMMENT 2 /* H5G|H5Oset_comment, H5Oset_comment_by_name */
-#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 3 /* H5Odisable_mdc_flushes */
-#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 4 /* H5Oenable_mdc_flushes */
-#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 5 /* H5Oare_mdc_flushes_disabled */
+/* Values for native VOL connector object optional VOL operations */
+#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */
+#define H5VL_NATIVE_OBJECT_SET_COMMENT 1 /* H5G|H5Oset_comment, H5Oset_comment_by_name */
+#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 2 /* H5Odisable_mdc_flushes */
+#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 3 /* H5Oenable_mdc_flushes */
+#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 4 /* H5Oare_mdc_flushes_disabled */
+#define H5VL_NATIVE_OBJECT_GET_NATIVE_INFO 5 /* H5Oget_native_info(_by_idx, _by_name) */
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
#ifdef __cplusplus
extern "C" {
#endif
-/* Private functions */
+/* Token <--> address converters */
+H5_DLL herr_t H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token);
+H5_DLL herr_t H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr);
+
+/* Not really public but must be included here */
H5_DLL hid_t H5VL_native_register(void);
#ifdef __cplusplus
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
index 85af320..8072cd5 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -524,16 +524,15 @@ done:
*-------------------------------------------------------------------------
*/
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__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_attr_optional_t opt_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
+ va_list H5_ATTR_DEPRECATED_USED arguments)
{
- H5VL_native_attr_optional_t optional_type;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- optional_type = HDva_arg(arguments, H5VL_native_attr_optional_t);
- switch(optional_type) {
+ switch(opt_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
case H5VL_NATIVE_ATTR_ITERATE_OLD:
{
diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c
new file mode 100644
index 0000000..8e34859
--- /dev/null
+++ b/src/H5VLnative_blob.c
@@ -0,0 +1,242 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Blob callbacks for the native VOL connector
+ */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5HGprivate.h" /* Global Heaps */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_blob_put
+ *
+ * Purpose: Handles the blob 'put' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 15, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id,
+ void H5_ATTR_UNUSED *ctx)
+{
+ H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
+ uint8_t *id = (uint8_t *)blob_id; /* Pointer to blob ID */
+ H5HG_t hobjid; /* New VL sequence's heap ID */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check parameters */
+ HDassert(f);
+ HDassert(size == 0 || buf);
+ HDassert(id);
+
+ /* Write the VL information to disk (allocates space also) */
+ if(H5HG_insert(f, size, buf, &hobjid) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write blob information")
+
+ /* Encode the heap information */
+ H5F_addr_encode(f, &id, hobjid.addr);
+ UINT32ENCODE(id, hobjid.idx);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_blob_put() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_blob_get
+ *
+ * Purpose: Handles the blob 'get' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 15, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size,
+ void H5_ATTR_UNUSED *ctx)
+{
+ H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the disk blob ID */
+ H5HG_t hobjid; /* Global heap ID for sequence */
+ size_t hobj_size; /* Global heap object size returned from H5HG_read() */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(id);
+ HDassert(buf);
+
+ /* Get the heap information */
+ H5F_addr_decode(f, &id, &hobjid.addr);
+ UINT32DECODE(id, hobjid.idx);
+
+ /* Check if this sequence actually has any data */
+ if(hobjid.addr > 0)
+ /* Read the VL information from disk */
+ if(NULL == H5HG_read(f, &hobjid, buf, &hobj_size))
+ HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read VL information")
+
+ /* Verify the size is correct */
+ if(hobj_size != size)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "Expected global heap object size does not match")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_blob_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_blob_specific
+ *
+ * Purpose: Handles the blob 'specific' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 15, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_blob_specific(void *obj, void *blob_id,
+ H5VL_blob_specific_t specific_type, va_list arguments)
+{
+ H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(blob_id);
+
+ switch(specific_type) {
+ case H5VL_BLOB_GETSIZE:
+ {
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ size_t *size = HDva_arg(arguments, size_t *);
+ H5HG_t hobjid; /* blob's heap ID */
+
+ /* Get heap information */
+ H5F_addr_decode(f, &id, &(hobjid.addr));
+ UINT32DECODE(id, hobjid.idx);
+
+ /* Get heap object's size */
+ if(hobjid.addr > 0) {
+ if(H5HG_get_obj_size(f, &hobjid, size) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
+ } /* end if */
+ else
+ *size = 0; /* Return '0' size for 'nil' blob ID */
+
+ break;
+ }
+
+ case H5VL_BLOB_ISNULL:
+ {
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ hbool_t *isnull = HDva_arg(arguments, hbool_t *);
+ haddr_t addr; /* Sequence's heap address */
+
+ /* Get the heap address */
+ H5F_addr_decode(f, &id, &addr);
+
+ /* Check if heap address is 'nil' */
+ *isnull = (addr == 0 ? TRUE : FALSE);
+
+ break;
+ }
+
+ case H5VL_BLOB_SETNULL:
+ {
+ uint8_t *id = (uint8_t *)blob_id; /* Pointer to the blob ID */
+ /* Encode the "nil" heap pointer information */
+ H5F_addr_encode(f, &id, (haddr_t)0);
+ UINT32ENCODE(id, 0);
+
+ break;
+ }
+
+ case H5VL_BLOB_DELETE:
+ {
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ H5HG_t hobjid; /* VL sequence's heap ID */
+
+ /* Get heap information */
+ H5F_addr_decode(f, &id, &hobjid.addr);
+ UINT32DECODE(id, hobjid.idx);
+
+ /* Free heap object */
+ if(hobjid.addr > 0)
+ if(H5HG_remove(f, &hobjid) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
+
+ break;
+ }
+
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_blob_specific() */
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index 676d859..bea2c50 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -203,7 +203,7 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id,
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)
+ 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:
@@ -241,7 +241,7 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type,
break;
}
- /* H5Dget_space_statuc */
+ /* H5Dget_space_status */
case H5VL_DATASET_GET_SPACE_STATUS:
{
H5D_space_status_t *allocation = HDva_arg(arguments, H5D_space_status_t *);
@@ -388,11 +388,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
H5D_t *dset = NULL; /* Dataset */
- H5VL_native_dataset_optional_t optional_type = HDva_arg(arguments, H5VL_native_dataset_optional_t);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -426,7 +425,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
case H5D_NLAYOUTS:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
- default:
+ default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
} /* end switch */
@@ -607,6 +606,20 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
break;
}
+ case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE:
+ { /* H5Dvlen_get_buf_size */
+ hid_t type_id = HDva_arg(arguments, hid_t);
+ hid_t space_id = HDva_arg(arguments, hid_t);
+ hsize_t *size = HDva_arg(arguments, hsize_t *);
+
+ dset = (H5D_t *)obj;
+
+ if(H5D__vlen_get_buf_size(dset, type_id, space_id, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed")
+ break;
+ }
+
+
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
} /* end switch */
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index 1cb7533..1f213dd 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -129,6 +129,18 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
FUNC_ENTER_PACKAGE
switch(get_type) {
+ /* "get container info" */
+ case H5VL_FILE_GET_CONT_INFO:
+ {
+ H5VL_file_cont_info_t *info = HDva_arg(arguments, H5VL_file_cont_info_t *);
+
+ /* Retrieve the file's container info */
+ if(H5F__get_cont_info((H5F_t *)obj, info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file container info")
+
+ break;
+ }
+
/* H5Fget_access_plist */
case H5VL_FILE_GET_FAPL:
{
@@ -139,7 +151,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
/* 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")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
@@ -163,42 +175,6 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
break;
}
- /* H5Fget_obj_count */
- case H5VL_FILE_GET_OBJ_COUNT:
- {
- unsigned types = HDva_arg(arguments, unsigned);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
-
- f = (H5F_t *)obj;
- /* Perform the query */
- if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
-
- /* Set the return value */
- *ret = (ssize_t)obj_count;
- break;
- }
-
- /* H5Fget_obj_ids */
- case H5VL_FILE_GET_OBJ_IDS:
- {
- unsigned types = HDva_arg(arguments, unsigned);
- size_t max_objs = HDva_arg(arguments, size_t);
- hid_t *oid_list = HDva_arg(arguments, hid_t *);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
-
- 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:
{
@@ -231,12 +207,12 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
/* H5Fget_fileno */
case H5VL_FILE_GET_FILENO:
{
- unsigned long *fileno = HDva_arg(arguments, unsigned long *);
+ unsigned long *fno = HDva_arg(arguments, unsigned long *);
unsigned long my_fileno = 0;
f = (H5F_t *)obj;
H5F_GET_FILENO(f, my_fileno);
- *fileno = my_fileno; /* sigh */
+ *fno = my_fileno; /* sigh */
break;
}
@@ -250,7 +226,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
ssize_t *ret = HDva_arg(arguments, ssize_t *);
size_t len;
- if(NULL == (f = H5F__get_file(obj, type)))
+ if(H5VL_native_get_file_struct(obj, type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
len = HDstrlen(H5F_OPEN_NAME(f));
@@ -266,6 +242,42 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
break;
}
+ /* H5Fget_obj_count */
+ case H5VL_FILE_GET_OBJ_COUNT:
+ {
+ unsigned types = HDva_arg(arguments, unsigned);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ f = (H5F_t *)obj;
+ /* Perform the query */
+ if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+
+ /* Set the return value */
+ *ret = (ssize_t)obj_count;
+ break;
+ }
+
+ /* H5Fget_obj_ids */
+ case H5VL_FILE_GET_OBJ_IDS:
+ {
+ unsigned types = HDva_arg(arguments, unsigned);
+ size_t max_objs = HDva_arg(arguments, size_t);
+ hid_t *oid_list = HDva_arg(arguments, hid_t *);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ 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;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information")
} /* end switch */
@@ -301,7 +313,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
H5F_t *f = NULL; /* File to flush */
/* Get the file for the object */
- if(NULL == (f = H5F__get_file(obj, type)))
+ if(H5VL_native_get_file_struct(obj, type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Nothing to do if the file is read only. This determination is
@@ -347,14 +359,14 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
const char *name = HDva_arg(arguments, const char *);
H5F_t *child = HDva_arg(arguments, H5F_t *);
- hid_t plist_id = HDva_arg(arguments, hid_t);
+ hid_t fmpl_id = HDva_arg(arguments, hid_t);
H5G_loc_t loc;
if(H5G_loc_real(obj, type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Do the mount */
- if(H5F__mount(&loc, name, child, plist_id) < 0)
+ if(H5F__mount(&loc, name, child, fmpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
break;
@@ -382,10 +394,10 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
{
hid_t fapl_id = HDva_arg(arguments, hid_t);
const char *name = HDva_arg(arguments, const char *);
- htri_t *ret = HDva_arg(arguments, htri_t *);
+ htri_t *result = HDva_arg(arguments, htri_t *);
/* Call private routine */
- if((*ret = H5F__is_hdf5(name, fapl_id)) < 0)
+ if((*result = H5F__is_hdf5(name, fapl_id)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "error in HDF5 file check")
break;
}
@@ -397,6 +409,18 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
break;
}
+ /* Check if two files are the same */
+ case H5VL_FILE_IS_EQUAL:
+ {
+ H5F_t *file2 = (H5F_t *)HDva_arg(arguments, void *);
+ hbool_t *is_equal = HDva_arg(arguments, hbool_t *);
+
+ if(!obj || !file2)
+ *is_equal = FALSE;
+ else
+ *is_equal = (((H5F_t *)obj)->shared == file2->shared);
+ break;
+ }
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
@@ -417,10 +441,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
H5F_t *f = NULL; /* File */
- H5VL_native_file_optional_t optional_type = HDva_arg(arguments, H5VL_native_file_optional_t);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -495,7 +519,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
/* 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)))
+ if(H5VL_native_get_file_struct(obj, type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct")
/* Get the file info */
@@ -532,8 +556,8 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
{
size_t *max_size_ptr = HDva_arg(arguments, size_t *);
size_t *min_clean_size_ptr = HDva_arg(arguments, size_t *);
- size_t *cur_size_ptr = HDva_arg(arguments, size_t *);
- int *cur_num_entries_ptr = HDva_arg(arguments, int *);
+ size_t *cur_size_ptr = HDva_arg(arguments, size_t *);
+ int *cur_num_entries_ptr = HDva_arg(arguments, int *);
uint32_t cur_num_entries;
/* Go get the size data */
@@ -558,20 +582,6 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
break;
}
- /* H5Iget_file_id */
- case H5VL_NATIVE_FILE_GET_FILE_ID:
- {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- hbool_t app_ref = (hbool_t)HDva_arg(arguments, int);
- hid_t *file_id = HDva_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, app_ref)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID")
- break;
- }
-
/* H5Fclear_elink_file_cache */
case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE:
{
@@ -687,7 +697,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
unsigned *misses = HDva_arg(arguments, unsigned *);
unsigned *evictions = HDva_arg(arguments, unsigned *);
unsigned *bypasses = HDva_arg(arguments, unsigned *);
-
+
/* Sanity check */
if(NULL == f->shared->page_buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
@@ -809,6 +819,15 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
}
#endif /* H5_HAVE_PARALLEL */
+ /* Finalize H5Fopen */
+ case H5VL_NATIVE_FILE_POST_OPEN:
+ {
+ /* Call package routine */
+ if(H5F__post_open((H5F_t *)obj) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file")
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
} /* end switch */
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c
index b6bef7f..236ee9d 100644
--- a/src/H5VLnative_group.c
+++ b/src/H5VLnative_group.c
@@ -266,15 +266,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_group_optional(void H5_ATTR_UNUSED *obj,
+ H5VL_group_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list H5_ATTR_DEPRECATED_USED arguments)
{
- H5VL_native_group_optional_t optional_type;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- optional_type = HDva_arg(arguments, H5VL_native_group_optional_t);
switch(optional_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* H5Giterate (deprecated) */
diff --git a/src/H5VLnative_introspect.c b/src/H5VLnative_introspect.c
new file mode 100644
index 0000000..45b8d8c
--- /dev/null
+++ b/src/H5VLnative_introspect.c
@@ -0,0 +1,52 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Connector/container introspection callbacks for the native VOL connector
+ *
+ */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+/* Note: H5VL__native_introspect_get_conn_cls is in src/H5VLnative.c so that
+ * it can return the address of the staticly declared class struct.
+ */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_introspect_opt_query
+ *
+ * Purpose: Query if an optional operation is supported by this connector
+ *
+ * Returns: SUCCEED (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t H5_ATTR_UNUSED cls,
+ int H5_ATTR_UNUSED opt_type, hbool_t *supported)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity check */
+ HDassert(supported);
+
+ /* The native VOL connector supports all optional operations */
+ *supported = TRUE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5VL__native_introspect_opt_query() */
+
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
index 5d5935d..051de19 100644
--- a/src/H5VLnative_link.c
+++ b/src/H5VLnative_link.c
@@ -43,15 +43,10 @@ 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, va_list arguments)
{
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- /* 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:
{
@@ -246,20 +241,21 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
/* H5Lget_info/H5Lget_info_by_idx */
case H5VL_LINK_GET_INFO:
{
- H5L_info_t *linfo = HDva_arg(arguments, H5L_info_t *);
+ H5L_info2_t *linfo2 = HDva_arg(arguments, H5L_info2_t *);
/* Get the link information */
if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */
- if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo) < 0)
+ if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo2) < 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)
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo2) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
} /* end else-if */
else
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
+
break;
}
@@ -345,12 +341,12 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
case H5VL_LINK_ITER:
{
H5G_loc_t loc;
- hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned);
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- hsize_t *idx_p = HDva_arg(arguments, hsize_t *);
- H5L_iterate_t op = HDva_arg(arguments, H5L_iterate_t);
- void *op_data = HDva_arg(arguments, void *);
+ hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned);
+ H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
+ H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
+ hsize_t *idx_p = HDva_arg(arguments, hsize_t *);
+ H5L_iterate2_t op = HDva_arg(arguments, H5L_iterate2_t);
+ void *op_data = HDva_arg(arguments, void *);
/* Get the location */
if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 49d4b2c..3a29b6c 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -16,16 +16,15 @@
*/
#define H5O_FRIEND /* Suppress error about including H5Opkg */
-#define H5R_FRIEND /* Suppress error about including H5Rpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
+#include "H5Fpkg.h" /* Files (pkg needed for id_exists) */
#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
-#include "H5Rpkg.h" /* References */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
@@ -71,31 +70,18 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ
break;
}
- case H5VL_OBJECT_BY_ADDR:
+ case H5VL_OBJECT_BY_TOKEN:
{
- /* 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;
+ H5O_token_t token = *loc_params->loc_data.loc_by_token.token;
+ haddr_t addr;
- /* Get the file pointer from the entry */
- file = loc.oloc->file;
+ /* Decode token */
+ if(H5VL_native_token_to_addr(loc.oloc->file, H5I_FILE, token, &addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, NULL, "can't deserialize object token into address")
- /* 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")
+ /* Open the object */
+ if(NULL == (ret_value = H5O_open_by_addr(&loc, addr, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address")
break;
}
@@ -166,50 +152,22 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
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 = HDva_arg(arguments, hid_t *);
- H5R_type_t H5_ATTR_UNUSED ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
- void *ref = HDva_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_type1/2 */
- case H5VL_REF_GET_TYPE:
+ /* Object file */
+ case H5VL_OBJECT_GET_FILE:
{
- H5O_type_t *obj_type = HDva_arg(arguments, H5O_type_t *);
- H5R_type_t ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
- void *ref = HDva_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;
- }
+ void **ret = HDva_arg(arguments, void **);
- /* H5Rget_name */
- case H5VL_REF_GET_NAME:
- {
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- char *name = HDva_arg(arguments, char *);
- size_t size = HDva_arg(arguments, size_t);
- H5R_type_t ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
- void *ref = HDva_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")
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ *ret = (void *)loc.oloc->file;
+
+ /* TODO we currently need to set id_exists to TRUE because
+ * the upper layer will create an ID from the returned
+ * object. In theory this should not be needed and id_exists
+ * should be removed once the H5Fmount code gets fixed. */
+ loc.oloc->file->id_exists = TRUE;
+ } else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters")
break;
}
@@ -225,13 +183,17 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve object name")
} /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_ADDR) {
+ else if(loc_params->type == H5VL_OBJECT_BY_TOKEN) {
H5O_loc_t obj_oloc; /* Object location */
+ H5O_token_t token = *loc_params->loc_data.loc_by_token.token;
/* Initialize the object location */
H5O_loc_reset(&obj_oloc);
obj_oloc.file = loc.oloc->file;
- obj_oloc.addr = loc_params->loc_data.loc_by_addr.addr;
+
+ /* Decode token */
+ if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
/* Retrieve object's name */
if((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0)
@@ -242,6 +204,83 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
break;
}
+ /* Object type */
+ case H5VL_OBJECT_GET_TYPE:
+ {
+ H5O_type_t *obj_type = HDva_arg(arguments, H5O_type_t *);
+
+ if(loc_params->type == H5VL_OBJECT_BY_TOKEN) {
+ H5O_loc_t obj_oloc; /* Object location */
+ unsigned rc; /* Reference count of object */
+ H5O_token_t token = *loc_params->loc_data.loc_by_token.token;
+
+ /* Initialize the object location */
+ H5O_loc_reset(&obj_oloc);
+ obj_oloc.file = loc.oloc->file;
+
+ /* Decode token */
+ if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+
+ /* Get the # of links for object, and its type */
+ /* (To check to make certain that this object hasn't been deleted) */
+ if(H5O_get_rc_and_type(&obj_oloc, &rc, obj_type) < 0 || 0 == rc)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
+ } else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_type parameters")
+ break;
+ }
+
+ /* H5Oget_info(_name|_by_idx)3 */
+ case H5VL_OBJECT_GET_INFO:
+ {
+ H5O_info2_t *oinfo = HDva_arg(arguments, H5O_info2_t *);
+ unsigned fields = HDva_arg(arguments, unsigned);
+
+ /* Use the original H5Oget_info code to get the data */
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, ".", oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, oinfo, fields) < 0)
+ 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, oinfo, 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;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object")
} /* end switch */
@@ -300,11 +339,45 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V
break;
}
+ /* Lookup object */
+ case H5VL_OBJECT_LOOKUP:
+ {
+ H5O_token_t *token = va_arg(arguments, H5O_token_t *);
+
+ HDassert(token);
+
+ if(loc_params->type == H5VL_OBJECT_BY_NAME) {
+ H5G_loc_t obj_loc; /* Group hier. location of object */
+ H5G_name_t obj_path; /* Object group hier. path */
+ H5O_loc_t obj_oloc; /* 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 */
+ if(H5G_loc_find(&loc, loc_params->loc_data.loc_by_name.name, &obj_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+
+ /* Encode token */
+ if(H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr, token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
+
+ /* Release the object location */
+ if(H5G_loc_free(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters")
+ break;
+ }
+
case H5VL_OBJECT_VISIT:
{
H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- H5O_iterate_t op = HDva_arg(arguments, H5O_iterate_t);
+ H5O_iterate2_t op = HDva_arg(arguments, H5O_iterate2_t);
void *op_data = HDva_arg(arguments, void *);
unsigned fields = HDva_arg(arguments, unsigned);
@@ -347,24 +420,6 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V
break;
}
- case H5VL_REF_CREATE:
- {
- void *ref = HDva_arg(arguments, void *);
- const char *name = HDva_arg(arguments, char *);
- H5R_type_t ref_type = (H5R_type_t)HDva_arg(arguments, int); /* enum work-around */
- hid_t space_id = HDva_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 */
@@ -384,10 +439,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
- H5VL_native_object_optional_t optional_type = HDva_arg(arguments, H5VL_native_object_optional_t);
H5VL_loc_params_t *loc_params = HDva_arg(arguments, H5VL_loc_params_t *);
H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
@@ -398,54 +452,6 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
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_NATIVE_OBJECT_GET_INFO:
- {
- H5O_info_t *obj_info = HDva_arg(arguments, H5O_info_t *);
- unsigned fields = HDva_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_NATIVE_OBJECT_GET_COMMENT:
{
@@ -521,6 +527,57 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
break;
}
+ /* H5Oget_native_info(_name|_by_idx) */
+ case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO:
+ {
+ H5O_native_info_t *native_info = HDva_arg(arguments, H5O_native_info_t *);
+ unsigned fields = HDva_arg(arguments, unsigned);
+
+ /* Use the original H5Oget_info code to get the data */
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
+ /* Retrieve the object's information */
+ if(H5G_loc_native_info(&loc, ".", native_info, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
+ /* Retrieve the object's information */
+ if(H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, native_info, fields) < 0)
+ 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_native_info(obj_loc.oloc, native_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;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object");
} /* end switch */
diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h
index 714b73c..30bddb6 100644
--- a/src/H5VLnative_private.h
+++ b/src/H5VLnative_private.h
@@ -17,20 +17,42 @@
#ifndef _H5VLnative_private_H
#define _H5VLnative_private_H
-#include "H5VLnative.h" /* Native VOL connector */
+/* Private headers needed by this file */
+#include "H5Fprivate.h" /* Files */
+#include "H5VLnative.h" /* Native VOL connector */
+
+
+/**************************/
+/* Library Private Macros */
+/**************************/
+
+
+/****************************/
+/* Library Private Typedefs */
+/****************************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Library Private Prototypes */
+/******************************/
#ifdef __cplusplus
extern "C" {
#endif
-/* Atrribute callbacks */
+/* Attribute callbacks */
H5_DLL void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
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);
H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
@@ -40,15 +62,22 @@ H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem
H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_dataset_optional(void *dset, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req);
+/* Datatype callbacks */
+H5_DLL 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);
+H5_DLL void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
+
/* File callbacks */
H5_DLL void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
@@ -56,7 +85,7 @@ H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_p
H5_DLL void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
@@ -71,14 +100,28 @@ H5_DLL void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_pa
H5_DLL 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);
H5_DLL herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
-/* Datatype callbacks */
-H5_DLL 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);
-H5_DLL void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
+/* Connector/container introspection functions */
+H5_DLL herr_t H5VL__native_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VL__native_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported);
+
+/* Blob callbacks */
+H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
+H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
+H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
+
+/* Token callbacks */
+H5_DLL herr_t H5VL__native_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value);
+H5_DLL herr_t H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str);
+H5_DLL herr_t H5VL__native_str_to_token(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token);
+
+/* Helper functions */
+H5_DLL herr_t H5VL_native_get_file_addr_len(hid_t loc_id, size_t *addr_len);
+H5_DLL herr_t H5VL__native_get_file_addr_len(void *obj, H5I_type_t obj_type, size_t *addr_len);
+H5_DLL herr_t H5VL_native_addr_to_token(void *obj, H5I_type_t obj_type, haddr_t addr, H5O_token_t *token);
+H5_DLL herr_t H5VL_native_token_to_addr(void *obj, H5I_type_t obj_type, H5O_token_t token, haddr_t *addr);
+H5_DLL herr_t H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file);
#ifdef __cplusplus
}
diff --git a/src/H5VLnative_token.c b/src/H5VLnative_token.c
new file mode 100644
index 0000000..2b5429e
--- /dev/null
+++ b/src/H5VLnative_token.c
@@ -0,0 +1,157 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Object token callbacks for the native VOL connector
+ */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory handling */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_token_cmp
+ *
+ * Purpose: Compare two of the connector's object tokens, setting
+ * *cmp_value, following the same rules as strcmp().
+ *
+ * Return: Success: 0
+ * Failure: (can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_token_cmp(void H5_ATTR_UNUSED *obj,
+ const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Check parameters */
+ HDassert(token1);
+ HDassert(token2);
+
+ *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t));
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_token_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_token_to_str
+ *
+ * Purpose: Serialize an object token into a string
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token,
+ char **token_str)
+{
+ haddr_t addr;
+ size_t addr_ndigits;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check parameters */
+ HDassert(obj);
+ HDassert(token);
+
+ if(H5VL_native_token_to_addr(obj, obj_type, *token, &addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert object token to address")
+
+ if(addr == 0)
+ addr_ndigits = 1;
+ else
+ addr_ndigits = (size_t)(HDfloor(HDlog10((double)addr)) + 1);
+
+ if(NULL == (*token_str = H5MM_malloc(addr_ndigits + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for token string")
+
+ HDsnprintf(*token_str, addr_ndigits + 1, H5_PRINTF_HADDR_FMT, addr);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_token_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_str_to_token
+ *
+ * Purpose: Deserialize a string into an object token
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_str_to_token(void *obj, H5I_type_t obj_type,
+ const char *token_str, H5O_token_t *token)
+{
+ haddr_t addr;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check parameters */
+ HDassert(token_str);
+
+ HDsscanf(token_str, H5_PRINTF_HADDR_FMT, &addr);
+
+ if(H5VL_native_addr_to_token(obj, obj_type, addr, token) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert address to object token")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_str_to_token() */
+
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 24070fa..8b3dc62 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -117,8 +117,8 @@ static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *b
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);
+static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+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 lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
@@ -128,7 +128,7 @@ static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_
static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req);
/* Datatype callbacks */
@@ -136,7 +136,7 @@ static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_
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_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* File callbacks */
@@ -144,7 +144,7 @@ static void *H5VL_pass_through_file_create(const char *name, unsigned flags, hid
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_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
@@ -152,7 +152,7 @@ static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *
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_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
@@ -161,23 +161,42 @@ static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t
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);
+static herr_t H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
/* 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);
+static herr_t H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Container/connector introspection callbacks */
+static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls);
+static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported);
/* 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_optional(void *req, H5VL_request_optional_t opt_type, va_list arguments);
static herr_t H5VL_pass_through_request_free(void *req);
+/* Blob callbacks */
+static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
+static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
+static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
+static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments);
+
+/* Token callbacks */
+static herr_t H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value);
+static herr_t H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str);
+static herr_t H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token);
+
+/* Generic optional callback */
+static herr_t H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments);
+
+
/*******************/
/* Local variables */
/*******************/
@@ -196,14 +215,14 @@ static const H5VL_class_t H5VL_pass_through_g = {
H5VL_pass_through_info_cmp, /* compare */
H5VL_pass_through_info_free, /* free */
H5VL_pass_through_info_to_str, /* to_str */
- H5VL_pass_through_str_to_info, /* from_str */
+ H5VL_pass_through_str_to_info /* from_str */
},
{ /* wrap_cls */
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_unwrap_object, /* unwrap_object */
- H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
+ H5VL_pass_through_free_wrap_ctx /* free_wrap_ctx */
},
{ /* attribute_cls */
H5VL_pass_through_attr_create, /* create */
@@ -255,14 +274,18 @@ static const H5VL_class_t H5VL_pass_through_g = {
H5VL_pass_through_link_move, /* move */
H5VL_pass_through_link_get, /* get */
H5VL_pass_through_link_specific, /* specific */
- H5VL_pass_through_link_optional, /* optional */
+ 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 */
+ H5VL_pass_through_object_optional /* optional */
+ },
+ { /* introspect_cls */
+ H5VL_pass_through_introspect_get_conn_cls, /* get_conn_cls */
+ H5VL_pass_through_introspect_opt_query, /* opt_query */
},
{ /* request_cls */
H5VL_pass_through_request_wait, /* wait */
@@ -272,7 +295,18 @@ static const H5VL_class_t H5VL_pass_through_g = {
H5VL_pass_through_request_optional, /* optional */
H5VL_pass_through_request_free /* free */
},
- NULL /* optional */
+ { /* blob_cls */
+ H5VL_pass_through_blob_put, /* put */
+ H5VL_pass_through_blob_get, /* get */
+ H5VL_pass_through_blob_specific, /* specific */
+ H5VL_pass_through_blob_optional /* optional */
+ },
+ { /* token_cls */
+ H5VL_pass_through_token_cmp, /* cmp */
+ H5VL_pass_through_token_to_str, /* to_str */
+ H5VL_pass_through_token_from_str /* from_str */
+ },
+ H5VL_pass_through_optional /* optional */
};
/* The connector identification number, initialized at runtime */
@@ -477,7 +511,7 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info
/* 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)
@@ -594,7 +628,7 @@ H5VL_pass_through_str_to_info(const char *str, void **_info)
const char *under_vol_info_start, *under_vol_info_end;
hid_t under_vol_id;
void *under_vol_info = NULL;
-
+
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO String To Info\n");
#endif
@@ -808,7 +842,7 @@ H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Create\n");
#endif
@@ -845,7 +879,7 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Open\n");
#endif
@@ -874,14 +908,14 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Read\n");
#endif
@@ -905,14 +939,14 @@ H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Write\n");
#endif
@@ -936,14 +970,14 @@ H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Get\n");
#endif
@@ -967,14 +1001,14 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n");
#endif
@@ -998,18 +1032,18 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
*
*-------------------------------------------------------------------------
*/
-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_optional(void *obj, H5VL_attr_optional_t opt_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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n");
#endif
- ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+ ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -1029,13 +1063,13 @@ H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL ATTRIBUTE Close\n");
#endif
@@ -1066,13 +1100,13 @@ H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req)
static void *
H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
- hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
+ 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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Create\n");
#endif
@@ -1109,7 +1143,7 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Open\n");
#endif
@@ -1138,14 +1172,14 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Read\n");
#endif
@@ -1169,14 +1203,14 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Write\n");
#endif
@@ -1200,14 +1234,14 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Get\n");
#endif
@@ -1231,7 +1265,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
{
@@ -1239,7 +1273,7 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
hid_t under_vol_id;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL H5Dspecific\n");
#endif
@@ -1267,18 +1301,18 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
*
*-------------------------------------------------------------------------
*/
-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_optional(void *obj, H5VL_dataset_optional_t opt_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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Optional\n");
#endif
- ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+ ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -1298,13 +1332,13 @@ H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATASET Close\n");
#endif
@@ -1341,7 +1375,7 @@ H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Commit\n");
#endif
@@ -1375,10 +1409,10 @@ 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;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Open\n");
#endif
@@ -1407,14 +1441,14 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Get\n");
#endif
@@ -1438,7 +1472,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
{
@@ -1446,7 +1480,7 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
hid_t under_vol_id;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Specific\n");
#endif
@@ -1474,18 +1508,18 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
*
*-------------------------------------------------------------------------
*/
-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_optional(void *obj, H5VL_datatype_optional_t opt_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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Optional\n");
#endif
- ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+ ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -1505,13 +1539,13 @@ H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Close\n");
#endif
@@ -1550,7 +1584,7 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id,
hid_t under_fapl_id;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Create\n");
#endif
@@ -1604,7 +1638,7 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id,
hid_t under_fapl_id;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Open\n");
#endif
@@ -1649,14 +1683,14 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Get\n");
#endif
@@ -1681,7 +1715,7 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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, ...)
{
@@ -1706,7 +1740,7 @@ H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
{
@@ -1714,7 +1748,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Specific\n");
#endif
@@ -1813,18 +1847,18 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
*
*-------------------------------------------------------------------------
*/
-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_optional(void *file, H5VL_file_optional_t opt_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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL File Optional\n");
#endif
- ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+ ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -1844,13 +1878,13 @@ H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Close\n");
#endif
@@ -1887,7 +1921,7 @@ H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Create\n");
#endif
@@ -1924,7 +1958,7 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Open\n");
#endif
@@ -1953,14 +1987,14 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Get\n");
#endif
@@ -1984,7 +2018,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
{
@@ -1992,7 +2026,7 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
hid_t under_vol_id;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Specific\n");
#endif
@@ -2020,18 +2054,18 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
*
*-------------------------------------------------------------------------
*/
-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_optional(void *obj, H5VL_group_optional_t opt_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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Optional\n");
#endif
- ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+ ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -2051,13 +2085,13 @@ H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL H5Gclose\n");
#endif
@@ -2086,7 +2120,7 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static herr_t
H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type,
void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...)
@@ -2111,7 +2145,7 @@ H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static herr_t
H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req, va_list arguments)
@@ -2120,7 +2154,7 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Create\n");
#endif
@@ -2176,7 +2210,7 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
@@ -2186,7 +2220,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Copy\n");
#endif
@@ -2202,7 +2236,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
/* 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() */
@@ -2222,7 +2256,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
@@ -2232,7 +2266,7 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
hid_t under_vol_id = -1;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Move\n");
#endif
@@ -2263,14 +2297,14 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Get\n");
#endif
@@ -2279,7 +2313,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params,
/* 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() */
@@ -2294,14 +2328,14 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params,
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Specific\n");
#endif
@@ -2326,17 +2360,17 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL LINK Optional\n");
#endif
- ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+ ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -2364,7 +2398,7 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Open\n");
#endif
@@ -2393,7 +2427,7 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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,
@@ -2403,7 +2437,7 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa
H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Copy\n");
#endif
@@ -2427,13 +2461,13 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Get\n");
#endif
@@ -2457,7 +2491,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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)
@@ -2466,7 +2500,7 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
hid_t under_vol_id;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Specific\n");
#endif
@@ -2494,18 +2528,18 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req,
- va_list arguments)
+static herr_t
+H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Optional\n");
#endif
- ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments);
+ ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@@ -2516,6 +2550,66 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req,
/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_introspect_get_conn_clss
+ *
+ * Purpose: Query the connector class.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl,
+ const H5VL_class_t **conn_cls)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INTROSPECT GetConnCls\n");
+#endif
+
+ /* Check for querying this connector's class */
+ if(H5VL_GET_CONN_LVL_CURR == lvl) {
+ *conn_cls = &H5VL_pass_through_g;
+ ret_value = 0;
+ } /* end if */
+ else
+ ret_value = H5VLintrospect_get_conn_cls(o->under_object, o->under_vol_id,
+ lvl, conn_cls);
+
+ return ret_value;
+} /* end H5VL_pass_through_introspect_get_conn_cls() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_introspect_opt_query
+ *
+ * Purpose: Query if an optional operation is supported by this connector
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls,
+ int opt_type, hbool_t *supported)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INTROSPECT OptQuery\n");
+#endif
+
+ ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls,
+ opt_type, supported);
+
+ return ret_value;
+} /* end H5VL_pass_through_introspect_opt_query() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_request_wait
*
* Purpose: Wait (with a timeout) for an async operation to complete
@@ -2528,14 +2622,14 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Wait\n");
#endif
@@ -2561,14 +2655,14 @@ H5VL_pass_through_request_wait(void *obj, uint64_t timeout,
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
- printf("------- PASS THROUGH VOL REQUEST Wait\n");
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL REQUEST Notify\n");
#endif
ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx);
@@ -2592,13 +2686,13 @@ H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx)
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Cancel\n");
#endif
@@ -2622,7 +2716,7 @@ H5VL_pass_through_request_cancel(void *obj)
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static herr_t
H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
H5VL_request_specific_t specific_type, ...)
{
@@ -2647,13 +2741,13 @@ H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type,
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Specific\n");
#endif
@@ -2694,22 +2788,24 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t
/* Release requests that have completed */
if(H5VL_REQUEST_WAITANY == specific_type) {
- size_t *index; /* Pointer to the index of completed request */
+ size_t *idx; /* 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);
+ idx = va_arg(tmp_arguments, size_t *);
+ assert(*idx <= req_count);
status = va_arg(tmp_arguments, H5ES_status_t *);
/* Reissue the WAITANY 'request specific' call */
- ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, index, status);
+ ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout,
+ idx,
+ status);
/* Release the completed request, if it completed */
if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) {
H5VL_pass_through_t *tmp_o;
- tmp_o = (H5VL_pass_through_t *)req_array[*index];
+ tmp_o = (H5VL_pass_through_t *)req_array[*idx];
H5VL_pass_through_free_obj(tmp_o);
} /* end if */
} /* end if */
@@ -2789,17 +2885,18 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5VL_pass_through_request_optional(void *obj, va_list arguments)
+static herr_t
+H5VL_pass_through_request_optional(void *obj, H5VL_request_optional_t opt_type,
+ va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
-#ifdef ENABLE_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Optional\n");
#endif
- ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, arguments);
+ ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, opt_type, arguments);
return ret_value;
} /* end H5VL_pass_through_request_optional() */
@@ -2816,13 +2913,13 @@ H5VL_pass_through_request_optional(void *obj, va_list arguments)
*
*-------------------------------------------------------------------------
*/
-static herr_t
+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_PASSTHRU_LOGGING
+#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Free\n");
#endif
@@ -2834,3 +2931,236 @@ H5VL_pass_through_request_free(void *obj)
return ret_value;
} /* end H5VL_pass_through_request_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_blob_put
+ *
+ * Purpose: Handles the blob 'put' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size,
+ void *blob_id, void *ctx)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL BLOB Put\n");
+#endif
+
+ ret_value = H5VLblob_put(o->under_object, o->under_vol_id, buf, size,
+ blob_id, ctx);
+
+ return ret_value;
+} /* end H5VL_pass_through_blob_put() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_blob_get
+ *
+ * Purpose: Handles the blob 'get' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf,
+ size_t size, void *ctx)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL BLOB Get\n");
+#endif
+
+ ret_value = H5VLblob_get(o->under_object, o->under_vol_id, blob_id, buf,
+ size, ctx);
+
+ return ret_value;
+} /* end H5VL_pass_through_blob_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_blob_specific
+ *
+ * Purpose: Handles the blob 'specific' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_blob_specific(void *obj, void *blob_id,
+ H5VL_blob_specific_t specific_type, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL BLOB Specific\n");
+#endif
+
+ ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id,
+ specific_type, arguments);
+
+ return ret_value;
+} /* end H5VL_pass_through_blob_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_blob_optional
+ *
+ * Purpose: Handles the blob 'optional' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_blob_optional(void *obj, void *blob_id,
+ H5VL_blob_optional_t opt_type, va_list arguments)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL BLOB Optional\n");
+#endif
+
+ ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id,
+ opt_type, arguments);
+
+ return ret_value;
+} /* end H5VL_pass_through_blob_optional() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_token_cmp
+ *
+ * Purpose: Compare two of the connector's object tokens, setting
+ * *cmp_value, following the same rules as strcmp().
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1,
+ const H5O_token_t *token2, int *cmp_value)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL TOKEN Compare\n");
+#endif
+
+ /* Sanity checks */
+ assert(obj);
+ assert(token1);
+ assert(token2);
+ assert(cmp_value);
+
+ ret_value = H5VLtoken_cmp(o->under_object, o->under_vol_id, token1, token2, cmp_value);
+
+ return ret_value;
+} /* end H5VL_pass_through_token_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_token_to_str
+ *
+ * Purpose: Serialize the connector's object token into a string.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type,
+ const H5O_token_t *token, char **token_str)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL TOKEN To string\n");
+#endif
+
+ /* Sanity checks */
+ assert(obj);
+ assert(token);
+ assert(token_str);
+
+ ret_value = H5VLtoken_to_str(o->under_object, obj_type, o->under_vol_id, token, token_str);
+
+ return ret_value;
+} /* end H5VL_pass_through_token_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_pass_through_token_from_str
+ *
+ * Purpose: Deserialize the connector's object token from a string.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type,
+ const char *token_str, H5O_token_t *token)
+{
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL TOKEN From string\n");
+#endif
+
+ /* Sanity checks */
+ assert(obj);
+ assert(token);
+ assert(token_str);
+
+ ret_value = H5VLtoken_from_str(o->under_object, obj_type, o->under_vol_id, token_str, token);
+
+ return ret_value;
+} /* end H5VL_pass_through_token_from_str() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_optional
+ *
+ * Purpose: Handles the generic 'optional' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_optional(void *obj, int op_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_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL generic Optional\n");
+#endif
+
+ ret_value = H5VLoptional(o->under_object, o->under_vol_id, op_type,
+ dxpl_id, req, arguments);
+
+ return ret_value;
+} /* end H5VL_pass_through_optional() */
+
diff --git a/src/H5VLpassthru.h b/src/H5VLpassthru.h
index e640636..d145bcd 100644
--- a/src/H5VLpassthru.h
+++ b/src/H5VLpassthru.h
@@ -17,6 +17,9 @@
#ifndef _H5VLpassthru_H
#define _H5VLpassthru_H
+/* Public headers needed by this file */
+#include "H5VLpublic.h" /* Virtual Object Layer */
+
/* Identifier for the pass-through VOL connector */
#define H5VL_PASSTHRU (H5VL_pass_through_register())
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index 69e51c2..4174732 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -53,8 +53,13 @@ H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref,
hid_t vipl_id);
H5_DLL hid_t H5VL__register_connector_by_value(H5VL_class_value_t value,
hbool_t app_ref, hid_t vipl_id);
-H5_DLL htri_t H5VL__is_connector_registered(const char *name);
-H5_DLL hid_t H5VL__get_connector_id(const char *name, hbool_t is_api);
+H5_DLL htri_t H5VL__is_connector_registered_by_name(const char *name);
+H5_DLL htri_t H5VL__is_connector_registered_by_value(H5VL_class_value_t value);
+H5_DLL hid_t H5VL__get_connector_id(hid_t obj_id, hbool_t is_api);
+H5_DLL hid_t H5VL__get_connector_id_by_name(const char *name, hbool_t is_api);
+H5_DLL hid_t H5VL__get_connector_id_by_value(H5VL_class_value_t value, hbool_t is_api);
+H5_DLL hid_t H5VL__peek_connector_id_by_name(const char *name);
+H5_DLL hid_t H5VL__peek_connector_id_by_value(H5VL_class_value_t value);
H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id,
void **info);
H5_DLL ssize_t H5VL__get_connector_name(hid_t id, char *name/*out*/, size_t size);
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 1752b0c..3235357 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -44,7 +44,7 @@ typedef 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 */
- void *connector_info; /* VOL connector info, for open callbacks */
+ const void *connector_info; /* VOL connector info, for open callbacks */
} H5VL_connector_prop_t;
/* Which kind of VOL connector field to use for searching */
@@ -89,7 +89,11 @@ H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_unwrap(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type);
H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id);
+H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id);
H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
+H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native);
+H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2,
+ hbool_t *same_file);
/* Functions that wrap / unwrap VOL objects */
H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj,
@@ -98,7 +102,7 @@ H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx,
void *obj, H5I_type_t obj_type);
H5_DLL void * H5VL_unwrap_object(const H5VL_class_t *connector, void *obj);
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, H5VL_t *vol_connector);
+H5_DLL herr_t H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj);
H5_DLL herr_t H5VL_inc_vol_wrapper(void *vol_wrap_ctx);
H5_DLL herr_t H5VL_dec_vol_wrapper(void *vol_wrap_ctx);
H5_DLL herr_t H5VL_reset_vol_wrapper(void);
@@ -124,7 +128,7 @@ H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_in
const void *src_info);
H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
const void *info1, const void *info2);
-H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, void *info);
+H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, const void *info);
/* Attribute functions */
H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
@@ -133,25 +137,33 @@ H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void
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_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, 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 lcpl_id, hid_t type_id, hid_t space_id, 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_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void **req);
+H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req);
H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_dataset_close(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, H5VL_datatype_optional_t opt_type, 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);
+
/* 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_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Group functions */
@@ -159,7 +171,7 @@ H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_para
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_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Link functions */
@@ -168,33 +180,45 @@ H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_pa
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, ...);
+H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, ...);
/* 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, ...);
+H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, ...);
-/* 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);
+/* Connector/container introspection functions */
+H5_DLL herr_t H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl,
+ const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls,
+ int opt_type, hbool_t *supported);
/* 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_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...);
H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
+/* Blob functions */
+H5_DLL herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx);
+H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx);
+H5_DLL herr_t H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...);
+H5_DLL herr_t H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type, ...);
+
+/* Token functions */
+H5_DLL herr_t H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1,
+ const H5O_token_t *token2, int *cmp_value);
+H5_DLL herr_t H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type,
+ const H5O_token_t *token, char **token_str);
+H5_DLL herr_t H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type,
+ const char *token_str, H5O_token_t *token);
+
/* Generic functions */
-H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,void **req, ...);
+H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...);
#endif /* _H5VLprivate_H */
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 12448b6..006c3ea 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -21,11 +21,6 @@
#include "H5public.h" /* Generic Functions */
#include "H5Ipublic.h" /* IDs */
-/* Semi-public headers mainly for VOL connector authors */
-#include "H5VLconnector.h"
-#include "H5VLconnector_passthru.h"
-
-
/*****************/
/* Public Macros */
/*****************/
@@ -33,7 +28,7 @@
/* VOL connector identifier values
* These are H5VL_class_value_t values, NOT hid_t values!
*/
-#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */
+#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector ID */
#define H5_VOL_NATIVE 0 /* Native HDF5 file format VOL connector */
#define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */
#define H5_VOL_MAX 65535 /* Maximum VOL connector ID */
@@ -43,6 +38,16 @@
/* Public Typedefs */
/*******************/
+
+/*
+ * VOL connector identifiers. Values 0 through 255 are for connectors defined
+ * by the HDF5 library. Values 256 through 511 are available for testing new
+ * connectors. Subsequent values should be obtained from the HDF5 development
+ * team at help@hdfgroup.org.
+ */
+typedef int H5VL_class_value_t;
+
+
/********************/
/* Public Variables */
/********************/
@@ -55,15 +60,13 @@
extern "C" {
#endif
-/* The H5VL types uses in the API calls are not opaque - they are defined in
- * H5VLconnector.h, which is included at the top of this file.
- */
-
-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 htri_t H5VLis_connector_registered_by_name(const char *name);
+H5_DLL htri_t H5VLis_connector_registered_by_value(H5VL_class_value_t connector_value);
+H5_DLL hid_t H5VLget_connector_id(hid_t obj_id);
+H5_DLL hid_t H5VLget_connector_id_by_name(const char *name);
+H5_DLL hid_t H5VLget_connector_id_by_value(H5VL_class_value_t connector_value);
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);
@@ -73,5 +76,10 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
}
#endif
+/* Semi-public headers mainly for VOL connector authors */
+#include "H5VLconnector.h" /* VOL connector author routines */
+#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
+#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
+
#endif /* _H5VLpublic_H */
diff --git a/src/H5Z.c b/src/H5Z.c
index b703958..2f477a3 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -215,8 +215,10 @@ herr_t
H5Zregister(const void *cls)
{
const H5Z_class2_t *cls_real = (const H5Z_class2_t *) cls; /* "Real" class pointer */
- H5Z_class2_t cls_new; /* Translated class struct */
herr_t ret_value = SUCCEED; /* Return value */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5Z_class2_t cls_new; /* Translated class struct */
+#endif
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "*x", cls);
@@ -583,7 +585,8 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
+H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id,
+ void *key H5_ATTR_PARALLEL_USED)
{
H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index fe0041c..2f79725 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -338,7 +338,7 @@ H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms)
H5T_class_t dtype_member_class; /* Compound datatype's member datatype's class */
/* Get member datatype */
- if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT)))
+ if(NULL == (dtype_member = H5T_get_member_type(type, u)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */
@@ -695,7 +695,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index,
/* For each member, set parameters */
for(u = 0; u < nmembers; u++) {
/* Get member datatype */
- if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT)))
+ if(NULL == (dtype_member = H5T_get_member_type(type, u)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */
diff --git a/src/H5detect.c b/src/H5detect.c
index 32b7d34..655b05c 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -49,7 +49,7 @@ static const char *FileHeader = "\n\
/* Disable warning about cast increasing the alignment of the target type,
* that's _exactly_ what this code is probing. -QAK
*/
-#pragma GCC diagnostic ignored "-Wcast-align"
+H5_GCC_DIAG_OFF(cast-align)
#if defined(__has_attribute)
# if __has_attribute(no_sanitize_address)
@@ -107,8 +107,8 @@ typedef struct detected_t {
unsigned int comp_align; /* alignment for structure */
} detected_t;
-/* This structure holds structure alignment for pointers, hvl_t, hobj_ref_t,
- * hdset_reg_ref_t */
+/* This structure holds structure alignment for pointers, vlen and reference
+ * types. */
typedef struct malign_t {
const char *name;
unsigned int comp_align; /* alignment for structure */
@@ -383,9 +383,8 @@ precision (detected_t *d)
/*-------------------------------------------------------------------------
* Function: DETECT_M
*
- * 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.
+ * Purpose: This macro takes only miscellaneous structures or pointer.
+ * It constructs the names and decides the alignment in structure.
*
* Return: void
*-------------------------------------------------------------------------
@@ -761,8 +760,8 @@ H5T__init_native(void)\n\
H5T_native_order_g = H5T_ORDER_%s;\n", "BE");
}
- /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */
- fprintf(rawoutstream, "\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n");
+ /* Structure alignment for pointers, vlen and reference types */
+ fprintf(rawoutstream, "\n /* Structure alignment for pointers, vlen and reference types */\n");
for(j=0; j<na; j++)
fprintf(rawoutstream, " H5T_%s_COMP_ALIGN_g = %lu;\n", misc_align[j].name, (unsigned long)(misc_align[j].comp_align));
@@ -1544,11 +1543,12 @@ detect_C99_floats(void)
static void HDF_NO_UBSAN
detect_alignments(void)
{
- /* Detect structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */
+ /* Detect structure alignment for pointers, vlen and reference types */
DETECT_M(void *, POINTER, m_g[na_g]); na_g++;
DETECT_M(hvl_t, HVL, m_g[na_g]); na_g++;
DETECT_M(hobj_ref_t, HOBJREF, m_g[na_g]); na_g++;
DETECT_M(hdset_reg_ref_t, HDSETREGREF, m_g[na_g]); na_g++;
+ DETECT_M(H5R_ref_t, REF, m_g[na_g]); na_g++;
}
@@ -1707,3 +1707,4 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
+H5_GCC_DIAG_ON(cast-align)
diff --git a/src/H5mpi.c b/src/H5mpi.c
index d48790b..4e1bc95 100644
--- a/src/H5mpi.c
+++ b/src/H5mpi.c
@@ -22,6 +22,64 @@
#ifdef H5_HAVE_PARALLEL
+
+/****************/
+/* Local Macros */
+/****************/
+#define TWO_GIG_LIMIT (1 << 31)
+#ifndef H5_MAX_MPI_COUNT
+#define H5_MAX_MPI_COUNT (1 << 30)
+#endif
+
+/*******************/
+/* Local Variables */
+/*******************/
+static hsize_t bigio_count = H5_MAX_MPI_COUNT;
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_set_bigio_count
+ *
+ * Purpose: Allow us to programatically change the switch point
+ * when we utilize derived datatypes. This is of
+ * particular interest for allowing nightly testing
+ *
+ * Return: The current/previous value of bigio_count.
+ *
+ * Programmer: Richard Warren, March 10, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+H5_mpi_set_bigio_count(hsize_t new_count)
+{
+ hsize_t orig_count = bigio_count;
+
+ if((new_count > 0) && (new_count < (hsize_t)TWO_GIG_LIMIT)) {
+ bigio_count = new_count;
+ }
+ return orig_count;
+} /* end H5_mpi_set_bigio_count() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_get_bigio_count
+ *
+ * Purpose: Allow other HDF5 library functions to access
+ * the current value for bigio_count.
+ *
+ * Return: The current/previous value of bigio_count.
+ *
+ * Programmer: Richard Warren, October 7, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+H5_mpi_get_bigio_count(void)
+{
+ return bigio_count;
+}
+
/*-------------------------------------------------------------------------
* Function: H5_mpi_comm_dup
@@ -392,5 +450,114 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5_mpi_info_cmp() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpio_create_large_type
+ *
+ * Purpose: Create a large datatype of size larger than what a 32 bit integer
+ * can hold.
+ *
+ * Return: Non-negative on success, negative on failure.
+ *
+ * *new_type the new datatype created
+ *
+ * Programmer: Mohamad Chaarawi
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
+ MPI_Datatype old_type, MPI_Datatype *new_type)
+{
+ int num_big_types; /* num times the 2G datatype will be repeated */
+ int remaining_bytes; /* the number of bytes left that can be held in an int value */
+ hsize_t leftover;
+ int block_len[2];
+ int mpi_code; /* MPI return code */
+ MPI_Datatype inner_type, outer_type, leftover_type, type[2];
+ MPI_Aint disp[2], old_extent;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Calculate how many Big MPI datatypes are needed to represent the buffer */
+ num_big_types = (int)(num_elements/bigio_count);
+ leftover = (hsize_t)num_elements - (hsize_t)num_big_types * bigio_count;
+ H5_CHECKED_ASSIGN(remaining_bytes, int, leftover, hsize_t);
+
+ /* Create a contiguous datatype of size equal to the largest
+ * number that a 32 bit integer can hold x size of old type.
+ * If the displacement is 0, then the type is contiguous, otherwise
+ * use type_hvector to create the type with the displacement provided
+ */
+ if (0 == stride_bytes) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)bigio_count, old_type, &inner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)bigio_count, 1, stride_bytes, old_type, &inner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
+
+ /* Create a contiguous datatype of the buffer (minus the remaining < 2GB part)
+ * If a stride is present, use hvector type
+ */
+ if(0 == stride_bytes) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types, inner_type, &outer_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(num_big_types, 1, stride_bytes, inner_type, &outer_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
+
+ MPI_Type_free(&inner_type);
+
+ /* If there is a remaining part create a contiguous/vector datatype and then
+ * use a struct datatype to encapsulate everything.
+ */
+ if(remaining_bytes) {
+ if(stride_bytes == 0) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(remaining_bytes, old_type, &leftover_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)(num_elements - (hsize_t)num_big_types * bigio_count), 1, stride_bytes, old_type, &leftover_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
+
+ /* 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;
+ type[1] = leftover_type;
+ block_len[0] = 1;
+ block_len[1] = 1;
+ disp[0] = 0;
+ disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count;
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
+
+ MPI_Type_free(&outer_type);
+ MPI_Type_free(&leftover_type);
+ } /* end if */
+ else
+ /* There are no remaining bytes so just set the new type to
+ * the outer type created */
+ *new_type = outer_type;
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpio_create_large_type() */
+
+
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5overflow.txt b/src/H5overflow.txt
index a9e5099..9fb3b89 100644
--- a/src/H5overflow.txt
+++ b/src/H5overflow.txt
@@ -29,7 +29,9 @@
# Creation Date: 2009/04/09
unsigned, UNSIGNED;
+int8_t, SIGNED;
int, SIGNED;
+long, SIGNED;
int64_t, SIGNED;
uint8_t, UNSIGNED;
uint16_t, UNSIGNED;
diff --git a/src/H5private.h b/src/H5private.h
index bb2a2eb..3759446 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -304,16 +304,43 @@
* file). Be sure to update that file if the #ifdefs change here.
*/
#ifdef __cplusplus
-# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
-# define H5_ATTR_UNUSED /*void*/
-# define H5_ATTR_NORETURN /*void*/
-# define H5_ATTR_CONST /*void*/
-# define H5_ATTR_PURE /*void*/
-# define H5_ATTR_FALLTHROUGH /*void*/
+# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
+# define H5_ATTR_UNUSED /*void*/
+# define H5_ATTR_DEPRECATED_USED /*void*/
+# define H5_ATTR_NDEBUG_UNUSED /*void*/
+# define H5_ATTR_DEBUG_API_USED /*void*/
+# define H5_ATTR_PARALLEL_UNUSED /*void*/
+# define H5_ATTR_PARALLEL_USED /*void*/
+# define H5_ATTR_NORETURN /*void*/
+# define H5_ATTR_CONST /*void*/
+# define H5_ATTR_PURE /*void*/
+# define H5_ATTR_FALLTHROUGH /*void*/
#else /* __cplusplus */
#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C)
# define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z)))
# define H5_ATTR_UNUSED __attribute__((unused))
+#ifdef H5_HAVE_PARALLEL
+# define H5_ATTR_PARALLEL_UNUSED __attribute__((unused))
+# define H5_ATTR_PARALLEL_USED /*void*/
+#else
+# define H5_ATTR_PARALLEL_UNUSED /*void*/
+# define H5_ATTR_PARALLEL_USED __attribute__((unused))
+#endif
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+#define H5_ATTR_DEPRECATED_USED H5_ATTR_UNUSED
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+#define H5_ATTR_DEPRECATED_USED /*void*/
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+#ifdef H5_DEBUG_API
+#define H5_ATTR_DEBUG_API_USED /*void*/
+#else /* H5_DEBUG_API */
+#define H5_ATTR_DEBUG_API_USED H5_ATTR_UNUSED
+#endif /* H5_DEBUG_API */
+#ifndef NDEBUG
+#define H5_ATTR_NDEBUG_UNUSED /*void*/
+#else /* NDEBUG */
+#define H5_ATTR_NDEBUG_UNUSED H5_ATTR_UNUSED
+#endif /* NDEBUG */
# define H5_ATTR_NORETURN __attribute__((noreturn))
# define H5_ATTR_CONST __attribute__((const))
# define H5_ATTR_PURE __attribute__((pure))
@@ -323,12 +350,17 @@
# define H5_ATTR_FALLTHROUGH /*void*/
#endif
#else
-# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
-# define H5_ATTR_UNUSED /*void*/
-# define H5_ATTR_NORETURN /*void*/
-# define H5_ATTR_CONST /*void*/
-# define H5_ATTR_PURE /*void*/
-# define H5_ATTR_FALLTHROUGH /*void*/
+# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
+# define H5_ATTR_UNUSED /*void*/
+# define H5_ATTR_NDEBUG_UNUSED /*void*/
+# define H5_ATTR_DEBUG_API_USED /*void*/
+# define H5_ATTR_DEPRECATED_USED /*void*/
+# define H5_ATTR_PARALLEL_UNUSED /*void*/
+# define H5_ATTR_PARALLEL_USED /*void*/
+# define H5_ATTR_NORETURN /*void*/
+# define H5_ATTR_CONST /*void*/
+# define H5_ATTR_PURE /*void*/
+# define H5_ATTR_FALLTHROUGH /*void*/
#endif
#endif /* __cplusplus */
@@ -345,6 +377,14 @@
#define FAIL (-1)
#define UFAIL (unsigned)(-1)
+/* The HDF5 library uses the symbol `ERR` frequently. So do
+ * header files for libraries such as curses(3), terminfo(3), etc.
+ * Remove its definition here to avoid clashes with HDF5.
+ */
+#ifdef ERR
+#undef ERR
+#endif
+
/* number of members in an array */
#ifndef NELMTS
# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
@@ -513,41 +553,12 @@
# define H5_POSIX_CREATE_MODE_RW 0666
#endif
-/*
- * A macro to portably increment enumerated types.
- */
-#ifndef H5_INC_ENUM
-# 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.
- */
-#ifndef H5_DEC_ENUM
-# define H5_DEC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)-1))
-#endif
-
-/* Double constant wrapper
- *
- * Quiets gcc warnings from -Wunsuffixed-float-constants.
- *
- * This is a really annoying warning since the standard specifies that
- * constants of type double do NOT get a suffix so there's no way
- * to specify a constant of type double. To quiet gcc, we specify floating
- * point constants as type long double and cast to double.
- *
- * Note that this macro only needs to be used where using a double
- * is important. For most code, suffixing constants with F will quiet the
- * compiler and not produce erroneous code.
- */
-#define H5_DOUBLE(S) ((double) S ## L)
-
-/*
* Methods to compare the equality of floating-point values:
*
* 1. H5_XXX_ABS_EQUAL - check if the difference is smaller than the
@@ -1024,6 +1035,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDislower
#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
#endif /* HDislower */
+#ifndef HDisnan
+ #define HDisnan(X) isnan(X)
+#endif /* HDisnan */
#ifndef HDisprint
#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
#endif /* HDisprint */
@@ -1189,13 +1203,23 @@ typedef off_t h5_stat_size_t;
#define HDrandom() HDrand()
#endif /* HDrandom */
H5_DLL int HDrand(void);
-#elif H5_HAVE_RANDOM
+ #ifndef HDsrandom
+ #define HDsrandom(S) HDsrand(S)
+ #endif /* HDsrandom */
+ H5_DLL void HDsrand(unsigned int seed);
+#elif defined(H5_HAVE_RANDOM)
#ifndef HDrand
#define HDrand() random()
#endif /* HDrand */
#ifndef HDrandom
#define HDrandom() random()
#endif /* HDrandom */
+ #ifndef HDsrand
+ #define HDsrand(S) srandom(S)
+ #endif /* HDsrand */
+ #ifndef HDsrandom
+ #define HDsrandom(S) srandom(S)
+ #endif /* HDsrandom */
#else /* H5_HAVE_RANDOM */
#ifndef HDrand
#define HDrand() rand()
@@ -1203,6 +1227,12 @@ typedef off_t h5_stat_size_t;
#ifndef HDrandom
#define HDrandom() rand()
#endif /* HDrandom */
+ #ifndef HDsrand
+ #define HDsrand(S) srand(S)
+ #endif /* HDsrand */
+ #ifndef HDsrandom
+ #define HDsrandom(S) srand(S)
+ #endif /* HDsrandom */
#endif /* H5_HAVE_RANDOM */
#ifndef HDread
@@ -1323,26 +1353,6 @@ typedef off_t h5_stat_size_t;
#ifndef HDsqrt
#define HDsqrt(X) sqrt(X)
#endif /* HDsqrt */
-#ifdef H5_HAVE_RAND_R
- H5_DLL void HDsrand(unsigned int seed);
- #ifndef HDsrandom
- #define HDsrandom(S) HDsrand(S)
- #endif /* HDsrandom */
-#elif H5_HAVE_RANDOM
- #ifndef HDsrand
- #define HDsrand(S) srandom(S)
- #endif /* HDsrand */
- #ifndef HDsrandom
- #define HDsrandom(S) srandom(S)
- #endif /* HDsrandom */
-#else /* H5_HAVE_RAND_R */
- #ifndef HDsrand
- #define HDsrand(S) srand(S)
- #endif /* HDsrand */
- #ifndef HDsrandom
- #define HDsrandom(S) srand(S)
- #endif /* HDsrandom */
-#endif /* H5_HAVE_RAND_R */
#ifndef HDsscanf
#define HDsscanf(S,FMT,...) sscanf(S,FMT,__VA_ARGS__)
#endif /* HDsscanf */
@@ -1564,11 +1574,6 @@ extern char *strdup(const char *s);
#define HDpthread_self() pthread_self()
#endif /* HDpthread_self */
-/* Use this version of pthread_self for printing the thread ID */
-#ifndef HDpthread_self_ulong
- #define HDpthread_self_ulong() ((unsigned long)pthread_self())
-#endif /* HDpthread_self_ulong */
-
/* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */
/* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */
#define H5_STRINGIZE(x) #x
@@ -1612,7 +1617,7 @@ extern char *strdup(const char *s);
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
HDassert(_tmp_src >= 0); \
- HDassert(_tmp_src == _tmp_dst); \
+ HDassert(_tmp_src == (srctype)_tmp_dst); \
(dst) = _tmp_dst; \
}
@@ -1645,9 +1650,18 @@ extern char *strdup(const char *s);
/* Assign a variable to one of a different size (think safer dst = (dsttype)src").
* The code generated by the macro checks for overflows.
+ *
+ * Use w##x##y##z instead of H5_GLUE4(w, x, y, z) because srctype
+ * or dsttype on some systems (e.g., NetBSD 8 and earlier) may
+ * supply some standard types using a macro---e.g.,
+ * #define uint8_t __uint8_t. The preprocessor will expand the
+ * macros before it evaluates H5_GLUE4(), and that will generate
+ * an unexpected name such as ASSIGN___uint8_t_TO___uint16_t.
+ * The preprocessor does not expand macros in w##x##y##z, so
+ * that will always generate the expected name.
*/
#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \
- H5_GLUE4(ASSIGN_,srctype,_TO_,dsttype)(dst,dsttype,src,srctype)\
+ ASSIGN_##srctype##_TO_##dsttype(dst,dsttype,src,srctype)\
#else /* NDEBUG */
#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \
@@ -1908,12 +1922,11 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ
/* global library version information string */
extern char H5_lib_vers_info_g[];
+#include "H5TSprivate.h"
+
/* Lock headers */
#ifdef H5_HAVE_THREADSAFE
-/* Include required thread-safety header */
-#include "H5TSprivate.h"
-
/* replacement structure for original global variable */
typedef struct H5_api_struct {
H5TS_mutex_t init_lock; /* API entrance mutex */
@@ -2670,12 +2683,16 @@ H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **ful
#ifdef H5_HAVE_PARALLEL
/* Generic MPI functions */
+H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count);
+H5_DLL hsize_t H5_mpi_get_bigio_count(void);
H5_DLL herr_t H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new);
H5_DLL herr_t H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new);
H5_DLL herr_t H5_mpi_comm_free(MPI_Comm *comm);
H5_DLL herr_t H5_mpi_info_free(MPI_Info *info);
H5_DLL herr_t H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result);
H5_DLL herr_t H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result);
+H5_DLL herr_t H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
+ MPI_Datatype old_type, MPI_Datatype *new_type);
#endif /* H5_HAVE_PARALLEL */
/* Functions for debugging */
diff --git a/src/H5public.h b/src/H5public.h
index 8021027..3312cf4 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -51,7 +51,45 @@
# endif
#endif
#ifdef H5_HAVE_INTTYPES_H
-# include <inttypes.h> /* For uint64_t on some platforms */
+# include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
+#else /* H5_HAVE_INTTYPES_H */
+/* The following definitions should be suitable for 64-bit Windows, which is
+ * LLP64, and for 32-bit Windows, which is ILP32. Those are the only
+ * platforms where <inttypes.h> is likely to be missing. VS2015 and later
+ * *may* provide these definitions.
+ */
+#ifdef _WIN64
+# define PRIdPTR "lld"
+# define PRIoPTR "llo"
+# define PRIuPTR "llu"
+# define PRIxPTR "llx"
+#else /* _WIN64 */
+# define PRIdPTR "ld"
+# define PRIoPTR "lo"
+# define PRIuPTR "lu"
+# define PRIxPTR "lx"
+#endif /* _WIN64 */
+
+# define PRId8 "d"
+# define PRIo8 "o"
+# define PRIu8 "u"
+# define PRIx8 "x"
+# define PRId16 "d"
+# define PRIo16 "o"
+# define PRIu16 "u"
+# define PRIx16 "x"
+# define PRId32 "d"
+# define PRIo32 "o"
+# define PRIu32 "u"
+# define PRIx32 "x"
+# define PRId64 "lld"
+# define PRIo64 "llo"
+# define PRIu64 "llu"
+# define PRIx64 "llx"
+# define PRIdMAX "lld"
+# define PRIoMAX "llo"
+# define PRIuMAX "llu"
+# define PRIxMAX "llx"
#endif
#ifdef H5_HAVE_STDDEF_H
# include <stddef.h>
@@ -328,6 +366,18 @@ typedef struct H5_ih_info_t {
hsize_t heap_size;
} H5_ih_info_t;
+/* Tokens are unique and permanent identifiers that are
+ * used to reference HDF5 objects in a container. */
+
+/* The maximum size allowed for tokens */
+#define H5O_MAX_TOKEN_SIZE (16) /* Allows for 128-bit tokens */
+
+/* Type for object tokens */
+/* (Hoisted here, since it's used by both the H5Lpublic.h and H5Opublic.h headers) */
+typedef struct H5O_token_t {
+ uint8_t __data[H5O_MAX_TOKEN_SIZE];
+} H5O_token_t;
+
/* Functions in H5.c */
H5_DLL herr_t H5open(void);
H5_DLL herr_t H5close(void);
diff --git a/src/H5system.c b/src/H5system.c
index 384360d..dd1f10d 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -86,7 +86,11 @@ static hbool_t H5_ntzset = FALSE;
* prints an `hsize_t' value as a hex number right justified and
* zero filled in an 18-character field.
*
- * The conversion `a' refers to an `haddr_t' type.
+ * The conversion 'a' refers to an haddr_t type.
+ *
+ * The conversion 't' refers to an htri_t type.
+ *
+ * The conversion 'k' refers to an H5O_token_t type.
*
* Return: Success: Number of characters printed
*
@@ -103,8 +107,7 @@ static hbool_t H5_ntzset = FALSE;
* format_templ in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
int
HDfprintf(FILE *stream, const char *fmt, ...)
{
@@ -414,6 +417,32 @@ HDfprintf(FILE *stream, const char *fmt, ...)
}
break;
+ case 'k':
+ {
+ H5O_token_t token = HDva_arg(ap, H5O_token_t);
+
+ /* Print the raw token. */
+ n = fprintf(stream, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+ (unsigned char)token.__data[15],
+ (unsigned char)token.__data[14],
+ (unsigned char)token.__data[13],
+ (unsigned char)token.__data[12],
+ (unsigned char)token.__data[11],
+ (unsigned char)token.__data[10],
+ (unsigned char)token.__data[9],
+ (unsigned char)token.__data[8],
+ (unsigned char)token.__data[7],
+ (unsigned char)token.__data[6],
+ (unsigned char)token.__data[5],
+ (unsigned char)token.__data[4],
+ (unsigned char)token.__data[3],
+ (unsigned char)token.__data[2],
+ (unsigned char)token.__data[1],
+ (unsigned char)token.__data[0]
+ );
+ }
+ break;
+
default:
HDfputs(format_templ, stream);
n = (int)HDstrlen(format_templ);
@@ -430,7 +459,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
HDva_end(ap);
return nout;
} /* end HDfprintf() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
diff --git a/src/H5trace.c b/src/H5trace.c
index b1301dd..ec5c6a2 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -34,6 +34,7 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FDprivate.h" /* File drivers */
+#include "H5Rprivate.h" /* References */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5VLprivate.h" /* Virtual Object Layer */
@@ -154,7 +155,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end if */
/* Get time for event */
- if(H5_DBL_ABS_EQUAL(first_time.etime, H5_DOUBLE(0.0)))
+ if(H5_DBL_ABS_EQUAL(first_time.etime, 0.0))
H5_timer_begin(&first_time);
if(H5_debug_g.ttimes)
H5_timer_begin(&event_time);
@@ -1629,6 +1630,22 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
break;
+ case 'k':
+ if(ptr) {
+ if(vp)
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5O_token_t token = HDva_arg(ap, H5O_token_t);
+ int j;
+
+ for (j = 0; j < H5O_MAX_TOKEN_SIZE; j++)
+ HDfprintf(out, "%02x", token.__data[j]);
+ } /* end else */
+ break;
+
case 'L':
switch(type[1]) {
case 'l':
@@ -1856,22 +1873,51 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end else */
break;
- case 'r':
- if(ptr) {
- if(vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
- else
- HDfprintf(out, "NULL");
- } /* end if */
- else {
- hobj_ref_t ref = HDva_arg(ap, hobj_ref_t);
-
- HDfprintf(out, "Reference Object=%a", ref);
- } /* end else */
- break;
-
case 'R':
switch(type[1]) {
+
+ case 'o':
+ if(ptr) {
+ if(vp)
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ hobj_ref_t ref = HDva_arg(ap, hobj_ref_t);
+
+ HDfprintf(out, "Reference Object=%a", ref);
+ } /* end else */
+ break;
+
+ case 'd':
+ if(ptr) {
+ if(vp)
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ /* Note! region references are array types */
+ HDfprintf(out, "Reference Region");
+ goto error;
+ } /* end else */
+ break;
+
+ case 'r':
+ if(ptr) {
+ if(vp)
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ /* Note! reference types are opaque types */
+ HDfprintf(out, "Reference Opaque");
+ goto error;
+ } /* end else */
+ break;
+
case 't':
if(ptr) {
if(vp)
@@ -1887,12 +1933,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "H5R_BADTYPE");
break;
- case H5R_OBJECT:
- HDfprintf(out, "H5R_OBJECT");
+ case H5R_OBJECT1:
+ HDfprintf(out, "H5R_OBJECT1");
break;
- case H5R_DATASET_REGION:
- HDfprintf(out, "H5R_DATASET_REGION");
+ case H5R_DATASET_REGION1:
+ HDfprintf(out, "H5R_DATASET_REGION1");
+ break;
+
+ case H5R_OBJECT2:
+ HDfprintf(out, "H5R_OBJECT2");
+ break;
+
+ case H5R_DATASET_REGION2:
+ HDfprintf(out, "H5R_DATASET_REGION2");
+ break;
+
+ case H5R_ATTR:
+ HDfprintf(out, "H5R_ATTR");
break;
case H5R_MAXTYPE:
@@ -2563,6 +2621,25 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
+ case 'A':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_blob_optional_t optional = (H5VL_blob_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
case 'b':
if(ptr) {
if(vp)
@@ -2592,6 +2669,37 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* 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_blob_specific_t specific = (H5VL_blob_specific_t)HDva_arg(ap, int);
+
+ switch(specific) {
+ case H5VL_BLOB_DELETE:
+ HDfprintf(out, "H5VL_BLOB_DELETE");
+ break;
+ case H5VL_BLOB_GETSIZE:
+ HDfprintf(out, "H5VL_BLOB_GETSIZE");
+ break;
+ case H5VL_BLOB_ISNULL:
+ HDfprintf(out, "H5VL_BLOB_ISNULL");
+ break;
+ case H5VL_BLOB_SETNULL:
+ HDfprintf(out, "H5VL_BLOB_SETNULL");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
case 'C':
if(ptr) {
if(vp)
@@ -2608,6 +2716,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
HDfprintf(out, "%ld", (long)class_val);
} /* end else */
break;
+
case 'c':
if(ptr) {
if(vp)
@@ -2646,6 +2755,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'd':
if(ptr) {
if(vp)
@@ -2672,6 +2782,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'e':
if(ptr) {
if(vp)
@@ -2695,6 +2806,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'f':
if(ptr) {
if(vp)
@@ -2718,6 +2830,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'g':
if(ptr) {
if(vp)
@@ -2729,18 +2842,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
H5VL_file_get_t get = (H5VL_file_get_t)HDva_arg(ap, int);
switch(get) {
+ case H5VL_FILE_GET_CONT_INFO:
+ HDfprintf(out, "H5VL_FILE_GET_CONT_INFO");
+ break;
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_FILENO:
HDfprintf(out, "H5VL_FILE_GET_FILENO");
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;
@@ -2756,6 +2872,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'h':
if(ptr) {
if(vp)
@@ -2785,12 +2902,16 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_FILE_DELETE:
HDfprintf(out, "H5VL_FILE_DELETE");
break;
+ case H5VL_FILE_IS_EQUAL:
+ HDfprintf(out, "H5VL_FILE_IS_EQUAL");
+ break;
default:
HDfprintf(out, "%ld", (long)specific);
break;
} /* end switch */
} /* end else */
break;
+
case 'i':
if(ptr) {
if(vp)
@@ -2814,6 +2935,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'j':
if(ptr) {
if(vp)
@@ -2837,6 +2959,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'k':
if(ptr) {
if(vp)
@@ -2863,6 +2986,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'l':
if(ptr) {
if(vp)
@@ -2889,6 +3013,31 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* 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_get_conn_lvl_t get = (H5VL_get_conn_lvl_t)HDva_arg(ap, int);
+
+ switch(get) {
+ case H5VL_GET_CONN_LVL_CURR:
+ HDfprintf(out, "H5VL_GET_CONN_LVL_CURR");
+ break;
+ case H5VL_GET_CONN_LVL_TERM:
+ HDfprintf(out, "H5VL_GET_CONN_LVL_TERM");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)get);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
case 'm':
if(ptr) {
if(vp)
@@ -2915,6 +3064,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'n':
if(ptr) {
if(vp)
@@ -2926,24 +3076,25 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
H5VL_object_get_t get = (H5VL_object_get_t)HDva_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");
+ case H5VL_OBJECT_GET_FILE:
+ HDfprintf(out, "H5VL_OBJECT_GET_FILE");
break;
case H5VL_OBJECT_GET_NAME:
HDfprintf(out, "H5VL_OBJECT_GET_NAME");
break;
+ case H5VL_OBJECT_GET_TYPE:
+ HDfprintf(out, "H5VL_OBJECT_GET_TYPE");
+ break;
+ case H5VL_OBJECT_GET_INFO:
+ HDfprintf(out, "H5VL_OBJECT_GET_INFO");
+ break;
default:
HDfprintf(out, "%ld", (long)get);
break;
} /* end switch */
} /* end else */
break;
+
case 'o':
if(ptr) {
if(vp)
@@ -2961,12 +3112,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_OBJECT_EXISTS:
HDfprintf(out, "H5VL_OBJECT_EXISTS");
break;
+ case H5VL_OBJECT_LOOKUP:
+ HDfprintf(out, "H5VL_OBJECT_LOOKUP");
+ 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;
@@ -2979,6 +3130,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
case 'r':
if(ptr) {
if(vp)
@@ -3005,6 +3157,353 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end switch */
} /* end else */
break;
+
+ case 's':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_attr_optional_t optional = (H5VL_attr_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ case H5VL_NATIVE_ATTR_ITERATE_OLD:
+ HDfprintf(out, "H5VL_NATIVE_ATTR_ITERATE_OLD");
+ break;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'S':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_subclass_t subclass = (H5VL_subclass_t)HDva_arg(ap, int);
+
+ switch(subclass) {
+ case H5VL_SUBCLS_NONE:
+ HDfprintf(out, "H5VL_SUBCLS_NONE");
+ break;
+ case H5VL_SUBCLS_INFO:
+ HDfprintf(out, "H5VL_SUBCLS_INFO");
+ break;
+ case H5VL_SUBCLS_WRAP:
+ HDfprintf(out, "H5VL_SUBCLS_WRAP");
+ break;
+ case H5VL_SUBCLS_ATTR:
+ HDfprintf(out, "H5VL_SUBCLS_ATTR");
+ break;
+ case H5VL_SUBCLS_DATASET:
+ HDfprintf(out, "H5VL_SUBCLS_DATASET");
+ break;
+ case H5VL_SUBCLS_DATATYPE:
+ HDfprintf(out, "H5VL_SUBCLS_DATATYPE");
+ break;
+ case H5VL_SUBCLS_FILE:
+ HDfprintf(out, "H5VL_SUBCLS_FILE");
+ break;
+ case H5VL_SUBCLS_GROUP:
+ HDfprintf(out, "H5VL_SUBCLS_GROUP");
+ break;
+ case H5VL_SUBCLS_LINK:
+ HDfprintf(out, "H5VL_SUBCLS_LINK");
+ break;
+ case H5VL_SUBCLS_OBJECT:
+ HDfprintf(out, "H5VL_SUBCLS_OBJECT");
+ break;
+ case H5VL_SUBCLS_REQUEST:
+ HDfprintf(out, "H5VL_SUBCLS_REQUEST");
+ break;
+ case H5VL_SUBCLS_BLOB:
+ HDfprintf(out, "H5VL_SUBCLS_BLOB");
+ break;
+ case H5VL_SUBCLS_TOKEN:
+ HDfprintf(out, "H5VL_SUBCLS_TOKEN");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)subclass);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 't':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_dataset_optional_t optional = (H5VL_dataset_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+ case H5VL_NATIVE_DATASET_FORMAT_CONVERT:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_FORMAT_CONVERT");
+ break;
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE");
+ break;
+ case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE");
+ break;
+ case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_NUM_CHUNKS");
+ break;
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX");
+ break;
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD");
+ break;
+ case H5VL_NATIVE_DATASET_CHUNK_READ:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_CHUNK_READ");
+ break;
+ case H5VL_NATIVE_DATASET_CHUNK_WRITE:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_CHUNK_WRITE");
+ break;
+ case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'u':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_datatype_optional_t optional = (H5VL_datatype_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'v':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_file_optional_t optional = (H5VL_file_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+ case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE");
+ break;
+ case H5VL_NATIVE_FILE_GET_FILE_IMAGE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_FILE_IMAGE");
+ break;
+ case H5VL_NATIVE_FILE_GET_FREE_SECTIONS:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_FREE_SECTIONS");
+ break;
+ case H5VL_NATIVE_FILE_GET_FREE_SPACE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_FREE_SPACE");
+ break;
+ case H5VL_NATIVE_FILE_GET_INFO:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_INFO");
+ break;
+ case H5VL_NATIVE_FILE_GET_MDC_CONF:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_CONF");
+ break;
+ case H5VL_NATIVE_FILE_GET_MDC_HR:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_HR");
+ break;
+ case H5VL_NATIVE_FILE_GET_MDC_SIZE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_SIZE");
+ break;
+ case H5VL_NATIVE_FILE_GET_SIZE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_SIZE");
+ break;
+ case H5VL_NATIVE_FILE_GET_VFD_HANDLE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_VFD_HANDLE");
+ break;
+ case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE");
+ break;
+ case H5VL_NATIVE_FILE_SET_MDC_CONFIG:
+ HDfprintf(out, "H5VL_NATIVE_FILE_SET_MDC_CONFIG");
+ break;
+ case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO");
+ break;
+ case H5VL_NATIVE_FILE_START_SWMR_WRITE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_START_SWMR_WRITE");
+ break;
+ case H5VL_NATIVE_FILE_START_MDC_LOGGING:
+ HDfprintf(out, "H5VL_NATIVE_FILE_START_MDC_LOGGING");
+ break;
+ case H5VL_NATIVE_FILE_STOP_MDC_LOGGING:
+ HDfprintf(out, "H5VL_NATIVE_FILE_STOP_MDC_LOGGING");
+ break;
+ case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS");
+ break;
+ case H5VL_NATIVE_FILE_FORMAT_CONVERT:
+ HDfprintf(out, "H5VL_NATIVE_FILE_FORMAT_CONVERT");
+ break;
+ case H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS:
+ HDfprintf(out, "H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS");
+ break;
+ case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS");
+ break;
+ case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO");
+ break;
+ case H5VL_NATIVE_FILE_GET_EOA:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_EOA");
+ break;
+ case H5VL_NATIVE_FILE_INCR_FILESIZE:
+ HDfprintf(out, "H5VL_NATIVE_FILE_INCR_FILESIZE");
+ break;
+ case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS:
+ HDfprintf(out, "H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS");
+ break;
+ case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG");
+ break;
+ case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG:
+ HDfprintf(out, "H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG");
+ break;
+ case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY:
+ HDfprintf(out, "H5VL_NATIVE_FILE_GET_MPI_ATOMICITY");
+ break;
+ case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY:
+ HDfprintf(out, "H5VL_NATIVE_FILE_SET_MPI_ATOMICITY");
+ break;
+ case H5VL_NATIVE_FILE_POST_OPEN:
+ HDfprintf(out, "H5VL_NATIVE_FILE_POST_OPEN");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'w':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_group_optional_t optional = (H5VL_group_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ case H5VL_NATIVE_GROUP_ITERATE_OLD:
+ HDfprintf(out, "H5VL_NATIVE_GROUP_ITERATE_OLD");
+ break;
+ case H5VL_NATIVE_GROUP_GET_OBJINFO:
+ HDfprintf(out, "H5VL_NATIVE_GROUP_GET_OBJINFO");
+ break;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'x':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_link_optional_t optional = (H5VL_link_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'y':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_object_optional_t optional = (H5VL_object_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+ case H5VL_NATIVE_OBJECT_GET_COMMENT:
+ HDfprintf(out, "H5VL_NATIVE_OBJECT_GET_COMMENT");
+ break;
+ case H5VL_NATIVE_OBJECT_SET_COMMENT:
+ HDfprintf(out, "H5VL_NATIVE_OBJECT_SET_COMMENT");
+ break;
+ case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES:
+ HDfprintf(out, "H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES");
+ break;
+ case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES:
+ HDfprintf(out, "H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES");
+ break;
+ case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED:
+ HDfprintf(out, "H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED");
+ break;
+ case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO:
+ HDfprintf(out, "H5VL_NATIVE_OBJECT_GET_NATIVE_INFO");
+ break;
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'z':
+ if(ptr) {
+ if(vp)
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ HDfprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5VL_request_optional_t optional = (H5VL_request_optional_t)HDva_arg(ap, int);
+
+ switch(optional) {
+ default:
+ HDfprintf(out, "%ld", (long)optional);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
default:
HDfprintf(out, "BADTYPE(Z%c)", type[1]);
goto error;
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 22117c3..ae1d600 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -20,7 +20,7 @@
# Blank lines and lines beginning with '#' are ignored
#
# The format of this file is as follows:
-# <type>: <base routine name>; <list of parameter types for function>; <version introduced>, <list of revised versions>
+# <type>: <base routine name>; <list of versioned parameter types for function>; <version introduced>, <list of revised versions>
#
# Where <type> is either 'FUNCTION' or 'TYPEDEF'
#
@@ -56,11 +56,26 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
FUNCTION: H5Fget_info; H5F_info; v18, v110
FUNCTION: H5Gcreate; ; v10, v18
FUNCTION: H5Gopen; ; v10, v18
-FUNCTION: H5Oget_info; ; v18, v112
-FUNCTION: H5Oget_info_by_name; ; v18, v112
-FUNCTION: H5Oget_info_by_idx; ; v18, v112
-FUNCTION: H5Ovisit; ; v18, v112
-FUNCTION: H5Ovisit_by_name; ; v18, v112
+FUNCTION: H5Lget_info; H5L_info; v18, v112
+FUNCTION: H5Lget_info_by_idx; H5L_info; v18, v112
+FUNCTION: H5Literate; H5L_iterate; v18, v112
+FUNCTION: H5Literate_by_name; H5L_iterate; v18, v112
+FUNCTION: H5Lvisit; H5L_iterate; v18, v112
+FUNCTION: H5Lvisit_by_name; H5L_iterate; v18, v112
+# Note: v111 is allowed in make_vers because H5O functions were prematurely
+# versioned in HDF5 1.10. Because users were affected by this, the
+# versioning was rescinded but the H5O version 2 functions were kept
+# to be called directly. Now that the version macros are added in 1.12,
+# along with a 3rd version of the H5O functions, the H5O function
+# version for default api=v110 should be version 1 to work correctly
+# with 1.10 applications that were using unversioned H5O functions,
+# and the H5O function version should be version 3 for default api=v112
+# (the default api version for 1.12).
+FUNCTION: H5Oget_info; ; v18, v111, v112
+FUNCTION: H5Oget_info_by_name; ; v18, v111, v112
+FUNCTION: H5Oget_info_by_idx; ; v18, v111, v112
+FUNCTION: H5Ovisit; ; v18, v111, v112
+FUNCTION: H5Ovisit_by_name; ; v18, v111, v112
FUNCTION: H5Pencode; ; v110, v112
FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pget_filter_by_id; ; v16, v18
@@ -78,5 +93,7 @@ FUNCTION: H5Topen; ; v10, v18
# (although not required, it's easier to compare this file with the headers
# generated if the list below is in alphanumeric sort order - QAK)
TYPEDEF: H5E_auto; v10, v18
+TYPEDEF: H5O_info; v18, v112
+TYPEDEF: H5O_iterate; v18, v112
TYPEDEF: H5Z_class; v16, v18
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 29533dd..00df56d 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -40,6 +40,12 @@ typedef __int64 h5_stat_size_t;
#define HDfileno(F) _fileno(F)
#define HDfstat(F,B) _fstati64(F,B)
#define HDisatty(F) _isatty(F)
+
+/* The isnan function needs underscore in VS2012 and earlier */
+#if (_MSC_VER <= 1700)
+ #define HDisnan(X) _isnan(X)
+#endif /* MSC_VER < 1700 */
+
#define HDgetcwd(S,Z) _getcwd(S,Z)
#define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z)
#define HDgetdrive() _getdrive()
@@ -157,10 +163,6 @@ extern "C" {
/* Non-POSIX functions */
-/* Don't use actual pthread_self on Windows because the return
- * type cannot be cast as a ulong like other systems. */
-#define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId())
-
#ifndef H5_HAVE_MINGW
#define HDftruncate(F,L) _chsize_s(F,L)
#define HDfseek(F,O,W) _fseeki64(F,O,W)
diff --git a/src/Makefile.am b/src/Makefile.am
index ccee69b..0c07c1b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,7 +38,8 @@ MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c
DISTCLEANFILES=H5pubconf.h
# library sources
-libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
+libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
+ H5timer.c H5trace.c \
H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \
H5AC.c H5ACdbg.c H5ACproxy_entry.c \
H5B.c H5Bcache.c H5Bdbg.c \
@@ -48,59 +49,49 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \
H5CS.c \
H5CX.c \
- H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
- H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \
- H5Dio.c H5Dlayout.c H5Dnone.c \
- H5Doh.c H5Dscatgath.c H5Dselect.c \
- H5Dsingle.c H5Dtest.c H5Dvirtual.c \
+ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c \
+ H5Ddbg.c H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c \
+ H5Dint.c H5Dio.c H5Dlayout.c H5Dnone.c H5Doh.c H5Dscatgath.c \
+ H5Dselect.c H5Dsingle.c H5Dtest.c H5Dvirtual.c \
H5E.c H5Edeprec.c H5Eint.c \
H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \
H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \
- H5F.c H5Faccum.c H5Fcwfs.c \
- H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fint.c H5Fio.c \
- H5Fmount.c H5Fquery.c \
- H5Fsfile.c H5Fspace.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
+ H5F.c H5Faccum.c H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c \
+ H5Fint.c H5Fio.c H5Fmount.c H5Fquery.c H5Fsfile.c H5Fspace.c \
+ H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
H5FAint.c H5FAstat.c H5FAtest.c \
H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c \
H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \
H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \
H5FSstat.c H5FStest.c \
- H5G.c H5Gbtree2.c H5Gcache.c \
- H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \
- H5Gint.c H5Glink.c \
- H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c \
- H5Gtraverse.c \
+ H5G.c H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \
+ H5Gent.c H5Gint.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c \
+ H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \
- H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c\
- H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \
+ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \
+ H5HP.c \
+ H5I.c H5Itest.c \
+ H5L.c H5Ldeprec.c H5Lexternal.c \
H5M.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
- H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
- H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c \
- H5Ochunk.c \
- H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
- H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c \
- H5Oint.c H5Olayout.c \
- H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
- H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \
- H5Osdspace.c H5Oshared.c \
- H5Oshmesg.c \
- H5Ostab.c \
- H5Otest.c H5Ounknown.c \
- H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \
- H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
- H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
- H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \
- H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \
- H5Ptest.c \
+ H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c H5Oattribute.c \
+ H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c H5Ochunk.c \
+ H5Ocont.c H5Ocopy.c H5Ocopy_ref.c H5Odbg.c H5Odrvinfo.c H5Odtype.c \
+ H5Oefl.c H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c H5Oint.c \
+ H5Olayout.c H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c H5Oname.c \
+ H5Onull.c H5Opline.c H5Orefcount.c H5Osdspace.c H5Oshared.c \
+ H5Oshmesg.c H5Ostab.c H5Otest.c H5Ounknown.c \
+ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
+ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \
+ H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
H5PB.c \
H5PL.c H5PLint.c H5PLpath.c H5PLplugin_cache.c \
- H5R.c H5Rint.c H5Rdeprec.c \
+ H5R.c H5Rdeprec.c H5Rint.c \
H5UC.c \
H5RS.c \
H5S.c H5Sall.c H5Sdbg.c H5Sdeprec.c H5Shyper.c H5Snone.c H5Spoint.c \
@@ -109,19 +100,20 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \
H5ST.c \
H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \
- H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c \
- H5Tfixed.c \
- H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \
- H5Topaque.c \
- H5Torder.c \
- H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \
+ H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \
+ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
+ H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c \
+ H5Tvlen.c \
+ H5TS.c \
H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \
- H5VLnative_attr.c H5VLnative_dataset.c H5VLnative_datatype.c \
- H5VLnative_file.c H5VLnative_group.c H5VLnative_link.c H5VLnative_object.c \
+ H5VLnative_attr.c H5VLnative_blob.c H5VLnative_dataset.c \
+ H5VLnative_datatype.c H5VLnative_file.c H5VLnative_group.c \
+ H5VLnative_link.c H5VLnative_introspect.c H5VLnative_object.c \
+ H5VLnative_token.c \
H5VLpassthru.c \
H5VM.c H5WB.c H5Z.c \
- H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \
- H5Zscaleoffset.c H5Zszip.c H5Ztrans.c
+ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zscaleoffset.c \
+ H5Zszip.c H5Ztrans.c
# Only compile parallel sources if necessary
if BUILD_PARALLEL_CONDITIONAL
diff --git a/src/hdf5-lin.lnt b/src/hdf5-lin.lnt
index da20937..23ceed2 100644
--- a/src/hdf5-lin.lnt
+++ b/src/hdf5-lin.lnt
@@ -13,9 +13,6 @@
// Turn off warnings about not using the return value from these functions:
-emacro(534,HDfflush,HDgetrusage,HDgettimeofday,HDputc)
-// Turn off warnings about converting an enum to an int
--emacro(641,H5_INC_ENUM,H5_DEC_ENUM)
-
// Suppress message about "Expression with side effects passed to repeated parameter 1 in macro 'assert'"
-esym(666,assert)
diff --git a/src/hdf5.lnt b/src/hdf5.lnt
index 642698a..995e3f6 100644
--- a/src/hdf5.lnt
+++ b/src/hdf5.lnt
@@ -30,11 +30,6 @@
-esym(534, H5UC_decr)
-esym(534, H5VM_array_fill)
-
-// Turn off warnings about "Expression-like macro not parenthesized" for
-// enumerated type increment & decrement macros:
--esym(773, H5_INC_ENUM, H5_DEC_ENUM)
-
/* So far, the following files have been linted with these options:
H5.c
H5A.c
@@ -60,7 +55,7 @@
H5FO.c
H5Tcommit.c
- H5Tcompound.c
+ H5Tcompound.c
H5Tcset.c
H5Tenum.c