diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-26 22:09:17 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-26 22:09:17 (GMT) |
commit | e271be083c2b7a542d282c52df41cd307c8e136f (patch) | |
tree | 66cb747bb72160e843ac93cbeea9300a8967a2b7 /src/H5VLnative.c | |
parent | 39af44b6f2501df56998a2458db3551fc232a422 (diff) | |
download | hdf5-e271be083c2b7a542d282c52df41cd307c8e136f.zip hdf5-e271be083c2b7a542d282c52df41cd307c8e136f.tar.gz hdf5-e271be083c2b7a542d282c52df41cd307c8e136f.tar.bz2 |
[svn-r25555] - rework the public H5VL wrappers to not use H5VL_t* and use a plugin hid_t instead
- rework the private VL layer to use the class structure directly
- some bug fixes
Diffstat (limited to 'src/H5VLnative.c')
-rw-r--r-- | src/H5VLnative.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 295f146..7277a92 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -244,7 +244,7 @@ H5VL_native_init(void) /* Register the Native VOL, if it isn't already */ if(NULL == H5I_object_verify(H5VL_NATIVE_g, H5I_VOL)) { if((H5VL_NATIVE_g = H5VL_register((const H5VL_class_t *)&H5VL_native_g, - sizeof(H5VL_class_t), FALSE)) < 0) + sizeof(H5VL_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't create ID for native plugin") } @@ -255,29 +255,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_init() */ -#if 0 - -/*--------------------------------------------------------------------------- - * Function: H5VL_native_term - * - * Purpose: Shut down the VOL plugin - * - * Returns: SUCCEED (Can't fail) - * - *--------------------------------------------------------------------------- - */ -static herr_t -H5VL_native_term(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Reset VFL ID */ - H5VL_NATIVE_g = 0; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5VL_native_term() */ -#endif - /*--------------------------------------------------------------------------- * Function: H5VL_native_get_file @@ -388,10 +365,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") vol_plugin->cls = &H5VL_native_g; - vol_plugin->nrefs = 1; vol_plugin->id = H5VL_NATIVE_g; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") /* Get an atom for the object */ if(type == H5I_DATATYPE && ((H5T_t *)obj)->vol_obj == NULL) { @@ -399,7 +373,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") } else { - if((ret_value = H5I_register2(type, obj, vol_plugin, app_ref)) < 0) + if((ret_value = H5VL_register_id(type, obj, vol_plugin, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") } @@ -439,11 +413,9 @@ H5VL_native_unregister(hid_t obj_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - vol_plugin->nrefs--; - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - if(0 == vol_plugin->nrefs) - H5MM_free(vol_plugin); + /* decrement ref count on VOL ID */ + if(H5VL_free_id(vol_plugin) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) |