summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-10-26 21:09:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-10-26 21:09:06 (GMT)
commit171deaa588183b5a3a9d27a5f3f407d398ba53db (patch)
treef71439692ecc5f6a20fa65ce3c1ad94f77450ac5
parent305997501dd4c44cb46adfc0159489ae84c5fad4 (diff)
downloadhdf5-171deaa588183b5a3a9d27a5f3f407d398ba53db.zip
hdf5-171deaa588183b5a3a9d27a5f3f407d398ba53db.tar.gz
hdf5-171deaa588183b5a3a9d27a5f3f407d398ba53db.tar.bz2
Checkpoint progress on stacking VOL plugins - all standalone regression tests
in the 'test' directory appear to be working.
-rw-r--r--src/H5D.c10
-rw-r--r--src/H5Fint.c61
-rw-r--r--src/H5I.c15
-rw-r--r--src/H5VLint.c183
-rw-r--r--test/swmr.c6
5 files changed, 181 insertions, 94 deletions
diff --git a/src/H5D.c b/src/H5D.c
index be3c1e0..2755993 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1013,6 +1013,7 @@ herr_t
H5Drefresh(hid_t dset_id)
{
H5VL_object_t *vol_obj; /* Dataset for this operation */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1026,12 +1027,21 @@ H5Drefresh(hid_t dset_id)
if(H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
/* Refresh the dataset object */
if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_REFRESH,
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info")
+
FUNC_LEAVE_API(ret_value)
} /* end H5Drefresh() */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index b53a83c..18b804b 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -307,11 +307,11 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
if(types & H5F_OBJ_LOCAL) {
olist.file_info.local = TRUE;
olist.file_info.ptr.file = f;
- }
+ } /* end if */
else {
olist.file_info.local = FALSE;
olist.file_info.ptr.shared = f ? f->shared : NULL;
- }
+ } /* end else */
/* Iterate through file IDs to count the number, and put their
* IDs on the object list. */
@@ -319,7 +319,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_FILE;
if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)")
- }
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -330,8 +330,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_DATASET;
if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)")
- }
- }
+ } /* end if */
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -342,8 +342,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_GROUP;
if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)")
- }
- }
+ } /* end if */
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -354,8 +354,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_DATATYPE;
if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)")
- }
- }
+ } /* end if */
+ } /* end if */
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -366,8 +366,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_ATTR;
if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)")
- }
- }
+ } /* end if */
+ } /* end if */
/* Set the number of objects currently open */
*obj_id_count_ptr = obj_id_count;
@@ -409,8 +409,8 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared ||
(olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- }
- }
+ } /* end if */
+ } /* end if */
else { /* Either count opened object IDs or put the IDs on the list */
H5O_loc_t *oloc; /* Group entry info for object */
@@ -460,7 +460,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
(!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) ||
(oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- }
+ } /* end if */
} /* end else */
if(add_obj) {
@@ -468,7 +468,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
if(olist->obj_id_list) {
olist->obj_id_list[olist->list_index] = obj_id;
olist->list_index++;
- }
+ } /* end if */
/* Increment the number of open objects */
if(olist->obj_id_count)
@@ -481,7 +481,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
*/
if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs)
HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3236,6 +3236,7 @@ H5F__start_swmr_write(H5F_t *f)
size_t u; /* Local index variable */
hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */
H5VL_t *vol_plugin = NULL; /* VOL plugin for the file */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3275,16 +3276,16 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Get the # of opened named datatypes and attributes */
- if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
+ if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
- if(nt_attr_count)
+ if(nt_attr_count > 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file")
/* Get the # of opened datasets and groups */
- if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
+ if(H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
- if(grp_dset_count) {
+ if(grp_dset_count > 0) {
/* Allocate space for group and object locations */
if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL)
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t")
@@ -3299,17 +3300,25 @@ H5F__start_swmr_write(H5F_t *f)
if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed")
- /* Save the VOL plugin for the refresh step */
+ /* Save the VOL plugin and the object wrapping context for the refresh step */
if(grp_dset_count > 0) {
- H5VL_object_t *vol_obj = NULL;
+ H5VL_object_t *vol_obj;
+ /* Get the VOL object for one of the IDs */
if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0])))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Get the (top) plugin for the ID */
vol_plugin = vol_obj->plugin;
} /* end if */
- /* Refresh opened objects (groups, datasets) in the file */
+ /* Gather information about opened objects (groups, datasets) in the file */
+ /* (For refresh later on) */
for(u = 0; u < grp_dset_count; u++) {
H5O_loc_t *oloc; /* object location */
H5G_loc_t tmp_loc;
@@ -3379,6 +3388,10 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to unlock the file")
done:
+ /* Reset object wrapping info in API context */
+ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset VOL wrapper info")
+
if(ret_value < 0 && setup) {
/* Re-enable accumulator */
diff --git a/src/H5I.c b/src/H5I.c
index aef5cc5..f8bb8c4 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2034,7 +2034,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
ret_value = H5_ITER_STOP; /* terminate iteration early */
else if(cb_ret_val < 0)
ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I__iterate_cb() */
@@ -2092,7 +2092,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re
/* Iterate over IDs */
if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2352,9 +2352,8 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
obj_ptr = H5VL_object_data(vol_obj);
-
if(H5_VOL_NATIVE == vol_obj->plugin->cls->value)
- path = H5G_nameof(obj_ptr);
+ path = H5G_nameof((const H5G_t *)obj_ptr);
break;
}
@@ -2363,9 +2362,8 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
obj_ptr = H5VL_object_data(vol_obj);
-
if(H5_VOL_NATIVE == vol_obj->plugin->cls->value)
- path = H5D_nameof(obj_ptr);
+ path = H5D_nameof((const H5D_t *)obj_ptr);
break;
}
@@ -2373,9 +2371,8 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
const H5T_t *dt = (const H5T_t *)item->obj_ptr;
- obj_ptr = (void *)H5T_get_actual_type(dt);
-
- path = H5T_nameof(obj_ptr);
+ obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
+ path = H5T_nameof((const H5T_t *)obj_ptr);
break;
}
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 11deed9..f0a5253 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -43,6 +43,7 @@
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
@@ -58,12 +59,17 @@ typedef struct H5VL_wrap_ctx_t {
/* Package Typedefs */
/********************/
+
/********************/
/* Local Prototypes */
/********************/
static herr_t H5VL__free_cls(H5VL_class_t *cls);
+static void *H5VL__wrap_obj(void *obj);
+static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object,
+ H5VL_t *vol_plugin, hbool_t wrap_obj);
static void *H5VL__object(hid_t id, H5I_type_t obj_type);
+
/*********************/
/* Package Variables */
/*********************/
@@ -71,6 +77,7 @@ static void *H5VL__object(hid_t id, H5I_type_t obj_type);
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -225,6 +232,105 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__wrap_obj
+ *
+ * Purpose: Wraps a library object with possible VOL plugin wrappers, to
+ * match the VOL plugin stack for the file.
+ *
+ * Return: Success: Wrapped object pointer
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 7, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL__wrap_obj(void *obj)
+{
+ H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(obj);
+
+ /* Retrieve the VOL object wrapping context */
+ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context")
+
+ /* If there is a VOL object wrapping context, wrap the object */
+ if(vol_wrap_ctx) {
+ /* Wrap object, using the VOL callback */
+ if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->plugin->cls, vol_wrap_ctx->obj_wrap_ctx, obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
+ } /* end if */
+ else
+ ret_value = obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__wrap_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__new_vol_obj
+ *
+ * Purpose: Creates a new VOL object, to use when registering an ID.
+ *
+ * Return: Success: VOL object pointer
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 7, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5VL_object_t *
+H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t wrap_obj)
+{
+ H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */
+ H5VL_object_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
+ HDassert(object);
+ HDassert(vol_plugin);
+
+ /* Make sure type number is valid */
+ if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number")
+
+ /* Create the new VOL object */
+ if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object")
+ new_vol_obj->plugin = vol_plugin;
+ if(wrap_obj) {
+ if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object")
+ } /* end if */
+ else
+ new_vol_obj->data = object;
+
+ /* Bump the reference count on the VOL plugin */
+ vol_plugin->nrefs++;
+
+ /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
+ if(H5I_DATATYPE == type) {
+ if(NULL == (ret_value = (H5VL_object_t *)H5T_construct_datatype(new_vol_obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object")
+ } /* end if */
+ else
+ ret_value = (H5VL_object_t *)new_vol_obj;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__new_vol_obj() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_register
*
* Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t
@@ -239,8 +345,8 @@ done:
hid_t
H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref)
{
- H5VL_object_t *vol_obj = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5VL_object_t *vol_obj = NULL; /* VOL object wrapper for library object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -248,30 +354,13 @@ H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref
HDassert(object);
HDassert(vol_plugin);
- /* Set up VOL object to wrap the passed-in data */
- if (NULL == (vol_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure")
- vol_obj->plugin = vol_plugin;
- vol_obj->data = object;
-
- /* Increment ref count, for new object */
- vol_plugin->nrefs++;
-
- /* Datatypes need special handling under the VOL, since they have a non-VOL aspect */
- if (H5I_DATATYPE == type) {
- H5T_t *dt;
-
- /* Wrap "real" (non-named) datatype around VOL object, so it's compatible with H5T interface */
- if (NULL == (dt = H5T_construct_datatype(vol_obj)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object")
-
- /* New object is _actually_ the datatype */
- vol_obj = (H5VL_object_t *)dt;
- } /* end if */
+ /* Set up VOL object for the passed-in data */
+ /* (Does not wrap object, since it's from a VOL callback) */
+ if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_plugin, FALSE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
/* Register VOL object as _object_ type, for future object API calls */
- /* (Except for named datatypes, as above) */
- if ((ret_value = H5I_register(type, vol_obj, app_ref)) < 0)
+ if((ret_value = H5I_register(type, vol_obj, app_ref)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle")
done:
@@ -301,7 +390,6 @@ herr_t
H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref, hid_t existing_id)
{
H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */
- void *stored_obj = NULL; /* Pointer to the object that will be stored */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -310,29 +398,13 @@ H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_plugi
HDassert(object);
HDassert(vol_plugin);
- /* Make sure type number is valid */
- if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
-
- /* Set up the new VOL object */
- if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object");
- new_vol_obj->plugin = vol_plugin;
- new_vol_obj->data = object;
-
- /* Bump the reference count on the VOL plugin */
- vol_plugin->nrefs++;
-
- /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
- if(H5I_DATATYPE == type) {
- if(NULL == (stored_obj = (void *)H5T_construct_datatype(new_vol_obj)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't construct datatype object");
- }
- else
- stored_obj = (void *)new_vol_obj;
+ /* Set up VOL object for the passed-in data */
+ /* (Wraps object, since it's a library object) */
+ if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_plugin, TRUE)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
/* Call the underlying H5I function to complete the registration */
- if(H5I_register_using_existing_id(type, stored_obj, app_ref, existing_id) < 0)
+ if(H5I_register_using_existing_id(type, new_vol_obj, app_ref, existing_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID")
done:
@@ -875,20 +947,17 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref)
*/
if(type == H5I_DATATYPE)
if(TRUE == H5T_already_vol_managed((const H5T_t *)obj))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype")
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype")
- /* Retrieve the VOL object wrap context */
+ /* Wrap the object with VOL plugin info */
+ if(NULL == (new_obj = H5VL__wrap_obj(obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object")
+
+ /* Retrieve the VOL object wrapping context */
if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context")
-
- /* If there is a VOL object wrapping context, wrap the object */
- if(vol_wrap_ctx) {
- /* Wrap object */
- if(NULL == (new_obj = H5VL_wrap_object(vol_wrap_ctx->plugin->cls, vol_wrap_ctx->obj_wrap_ctx, obj)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't wrap object")
- } /* end if */
- else
- new_obj = obj;
+ if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->plugin)
+ HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its plugin is NULL???")
/* Get an ID for the object */
if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->plugin->id, app_ref)) < 0)
diff --git a/test/swmr.c b/test/swmr.c
index 3b2af4e..bab91bd 100644
--- a/test/swmr.c
+++ b/test/swmr.c
@@ -6500,10 +6500,9 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
+ while(child_notify != 1)
if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
- }
/* Open the file 2 times */
if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
@@ -6540,10 +6539,9 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 3) {
+ while(child_notify != 3)
if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
- }
/* Refresh dataset via did1 */
if(H5Drefresh(child_did1) < 0)