diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-26 22:27:10 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-26 22:27:10 (GMT) |
commit | ce3d1ec9ea5a7a0627d948687d64dc7e5e76f6cd (patch) | |
tree | ddf31eb610bea93dbd800e10b30cc7e17bd71b6f | |
parent | 171deaa588183b5a3a9d27a5f3f407d398ba53db (diff) | |
download | hdf5-ce3d1ec9ea5a7a0627d948687d64dc7e5e76f6cd.zip hdf5-ce3d1ec9ea5a7a0627d948687d64dc7e5e76f6cd.tar.gz hdf5-ce3d1ec9ea5a7a0627d948687d64dc7e5e76f6cd.tar.bz2 |
Eliminate last call to H5VL_native_register, shifting everything over to
the VOL plugin wrapping code.
-rw-r--r-- | src/H5Fint.c | 10 | ||||
-rw-r--r-- | src/H5Olink.c | 15 | ||||
-rw-r--r-- | src/H5VLnative.c | 37 | ||||
-rw-r--r-- | src/H5VLnative_private.h | 1 |
4 files changed, 15 insertions, 48 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 18b804b..0e35bea 100644 --- a/src/H5Fint.c +++ b/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 */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 961c619..55e1aee 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -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() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 22723a0..69b010b 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -376,43 +376,6 @@ done: } /* 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 * diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 114ce8c..84df828 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -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 } |