Eliminate last call to H5VL_native_register, shifting everything over to
the VOL plugin wrapping code.
This commit is contained in:
10
src/H5Fint.c
10
src/H5Fint.c
@@ -2176,7 +2176,15 @@ H5F_get_id(H5F_t *file)
|
||||
|
||||
if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) {
|
||||
/* resurrect the ID - Register an ID with the native driver */
|
||||
if((ret_value = H5VL_native_register(H5I_FILE, file, FALSE)) < 0)
|
||||
{
|
||||
void *vol_wrap_ctx = NULL; /* Object wrapping context */
|
||||
|
||||
/* Retrieve the VOL object wrap 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")
|
||||
HDassert(vol_wrap_ctx);
|
||||
}
|
||||
if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
|
||||
file->id_exists = TRUE;
|
||||
} /* end if */
|
||||
|
||||
@@ -612,6 +612,7 @@ herr_t
|
||||
H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
|
||||
{
|
||||
H5O_link_t *lnk = (H5O_link_t *)_mesg;
|
||||
hid_t file_id = -1; /* ID for the file the link is located in (passed to user callback) */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
@@ -645,25 +646,21 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
|
||||
|
||||
/* Check for delete callback */
|
||||
if(link_class->del_func) {
|
||||
hid_t file_id; /* ID for the file the link is located in (passed to user callback) */
|
||||
|
||||
/* Get a file ID for the file the link is in */
|
||||
if((file_id = H5F_get_id(f)) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID")
|
||||
|
||||
/* Call user-defined link's 'delete' callback */
|
||||
if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) {
|
||||
H5I_dec_ref(file_id);
|
||||
if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
|
||||
} /* end if */
|
||||
|
||||
/* Release the file ID */
|
||||
if(H5I_dec_ref(file_id) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
/* Release the file ID */
|
||||
if(file_id > 0 && H5I_dec_ref(file_id) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_link_delete() */
|
||||
|
||||
|
||||
@@ -375,43 +375,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5VL__native_get_file */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: H5VL_native_register
|
||||
*
|
||||
* Purpose: Utility routine to register an ID with the native VOL plugin
|
||||
* as an auxilary object.
|
||||
*
|
||||
* Returns: Success: An ID for the object
|
||||
* Failure: H5I_INVALID_HID
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
hid_t
|
||||
H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref)
|
||||
{
|
||||
hid_t ret_value = H5I_INVALID_HID;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
|
||||
|
||||
HDassert(obj);
|
||||
|
||||
/* If the datatype is already VOL-managed, the datatype's vol_obj
|
||||
* field will get clobbered later, so disallow this.
|
||||
*/
|
||||
if(type == H5I_DATATYPE)
|
||||
if(((const H5T_t *)obj)->vol_obj != NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype")
|
||||
|
||||
HDassert(0 && "H5VL_native_register");
|
||||
/* Get an ID for the object */
|
||||
if((ret_value = H5VL_register_using_vol_id(type, obj, H5VL_NATIVE_ID_g, app_ref)) < 0)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5VL_native_register() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5VL__native_attr_create
|
||||
|
||||
@@ -30,7 +30,6 @@ extern "C" {
|
||||
|
||||
H5_DLL hid_t H5VL_native_get_driver_id(void);
|
||||
H5_DLL hid_t H5VL_native_init(hid_t vipl_id);
|
||||
H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user