diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-25 23:32:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-25 23:32:13 (GMT) |
commit | 4a328957243ca7502a4c4966d6598498be43e3cd (patch) | |
tree | b46c66d7532db54cdf010b577b9bdfcd9b2dbc8c /src/H5I.c | |
parent | 0df6e44a6e68da1614cf80b50ed7b208edaa5df7 (diff) | |
parent | 47f30b474bdc498c20bd6d2a0ba7e8947ab389f0 (diff) | |
download | hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.zip hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.tar.gz hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into stackable_vol
Diffstat (limited to 'src/H5I.c')
-rw-r--r-- | src/H5I.c | 38 |
1 files changed, 11 insertions, 27 deletions
@@ -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() */ /*------------------------------------------------------------------------- |