summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5I.c')
-rw-r--r--src/H5I.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/src/H5I.c b/src/H5I.c
index ec58ce2..263f51d 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -810,7 +810,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I_register_with_id
+ * Function: H5I_register_using_existing_id
*
* Purpose: Registers an OBJECT in a TYPE with the supplied ID for it.
* This routine will check to ensure the supplied ID is not already
@@ -819,14 +819,17 @@ done:
* registered (thus, it is possible to register one object under
* multiple IDs).
*
+ * NOTE: Intended for use in refresh calls, where we have to close
+ * and re-open the underlying data, then hook the object back
+ * up to the original ID.
+ *
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref, hid_t id)
+H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id)
{
- H5VL_object_t *new_vol_obj = NULL; /* pointer to new VOL object */
H5I_id_type_t *type_ptr; /* ptr to the type */
H5I_id_info_t *id_ptr; /* ptr to the new ID information */
herr_t ret_value = SUCCEED; /* return value */
@@ -835,10 +838,9 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t
/* Check arguments */
HDassert(object);
- HDassert(vol_plugin);
/* Make sure ID is not already in use */
- if(NULL != (id_ptr = H5I__find_id(id)))
+ if(NULL != (id_ptr = H5I__find_id(existing_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use")
/* Make sure type number is valid */
@@ -852,36 +854,18 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* Make sure requested ID belongs to object's type */
- if(H5I_TYPE(id) != type)
+ if(H5I_TYPE(existing_id) != type)
HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID")
/* Allocate new structure to house this ID */
if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t)))
HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed")
- /* Set up the new VOL object */
- if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_ATOM, 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++;
-
/* Create the struct & insert requested ID */
- id_ptr->id = id;
+ id_ptr->id = existing_id;
id_ptr->count = 1; /* initial reference count*/
id_ptr->app_count = !!app_ref;
- if(H5I_DATATYPE == type) {
- void *dt = NULL;
-
- if(NULL == (dt = (void *)H5T_construct_datatype(new_vol_obj)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "can't construct datatype object");
-
- id_ptr->obj_ptr = dt;
- }
- else
- id_ptr->obj_ptr = new_vol_obj;
+ id_ptr->obj_ptr = object;
/* Insert into the type */
if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
@@ -890,7 +874,7 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_register_with_id() */
+} /* end H5I_register_using_existing_id() */
/*-------------------------------------------------------------------------