diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-08 17:05:20 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-08 17:05:20 (GMT) |
commit | e3e4c3710976810ed7a9109d9b4f9d842eca2954 (patch) | |
tree | c85f2d5dcb00b7ccb8f80774818cce25a89e3d0f /src/H5Pfapl.c | |
parent | 68067443e04f352aeca5b41243e77e4aacc4cd98 (diff) | |
download | hdf5-e3e4c3710976810ed7a9109d9b4f9d842eca2954.zip hdf5-e3e4c3710976810ed7a9109d9b4f9d842eca2954.tar.gz hdf5-e3e4c3710976810ed7a9109d9b4f9d842eca2954.tar.bz2 |
[svn-r25521] major rework of the internal setup of VOL plugins to make it more
symmetrical to VFDs and allow new functionality to be implemented
later.
+ some Bug fixes
Diffstat (limited to 'src/H5Pfapl.c')
-rw-r--r-- | src/H5Pfapl.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 8b71836..e2f728b 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -161,11 +161,11 @@ #define H5F_ACS_EFC_SIZE_DEC H5P__decode_unsigned /* Definition for VOL plugin */ -#define H5F_ACS_VOL_SIZE sizeof(void *) -#define H5F_ACS_VOL_DEF H5VL_NATIVE +#define H5F_ACS_VOL_ID_SIZE sizeof(hid_t) +#define H5F_ACS_VOL_ID_DEF H5VL_NATIVE /* Definition for vol info */ -#define H5F_ACS_VOL_INFO_SIZE sizeof(void*) -#define H5F_ACS_VOL_INFO_DEF NULL +#define H5F_ACS_VOL_INFO_SIZE sizeof(void*) +#define H5F_ACS_VOL_INFO_DEF NULL /* Definition of pointer to initial file image info */ #define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t) @@ -290,7 +290,7 @@ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE static herr_t H5P_facc_reg_prop(H5P_genclass_t *pclass) { - H5VL_class_t *vol_cls = H5F_ACS_VOL_DEF; /* Default VOL plugin */ + const hid_t def_vol_id = H5F_ACS_VOL_ID_DEF; /* Default VOL plugin */ void *vol_info = H5F_ACS_VOL_INFO_DEF; /* Default VOL plugin information*/ const hid_t def_driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ @@ -419,7 +419,7 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file VOL ID */ - if(H5P_register_real(pclass, H5F_ACS_VOL_NAME, H5F_ACS_VOL_SIZE, &vol_cls, + if(H5P_register_real(pclass, H5F_ACS_VOL_ID_NAME, H5F_ACS_VOL_ID_SIZE, &def_vol_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -473,7 +473,7 @@ static herr_t H5P_facc_create(hid_t fapl_id, void UNUSED *copy_data) { hid_t driver_id; - H5VL_class_t *vol_cls; + hid_t vol_id; H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; @@ -484,17 +484,17 @@ H5P_facc_create(hid_t fapl_id, void UNUSED *copy_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Retrieve VOL plugin property */ - if(H5P_get(plist, H5F_ACS_VOL_NAME, &vol_cls) < 0) + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &vol_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol plugin") - if(NULL != vol_cls) { + if(vol_id > 0) { void *vol_info; /* Retrieve VOL plugin info property */ if(H5P_get(plist, H5F_ACS_VOL_INFO_NAME, &vol_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol info") /* Set the vol for the property list */ - if(H5VL_fapl_open(plist, vol_cls, vol_info) < 0) + if(H5VL_fapl_open(plist, vol_id, vol_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") } @@ -539,23 +539,23 @@ static herr_t H5P_facc_copy(hid_t dst_fapl_id, hid_t src_fapl_id, void UNUSED *copy_data) { hid_t driver_id; - H5VL_class_t *vol_cls; + hid_t vol_id; H5P_genplist_t *src_plist; /* Source property list */ H5P_genplist_t *dst_plist; /* Destination property list */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* get VOL plugin from source property list */ - if(H5P_get(src_plist, H5F_ACS_VOL_NAME, &vol_cls) < 0) + if(H5P_get(src_plist, H5F_ACS_VOL_ID_NAME, &vol_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol ID") - if(NULL != vol_cls) { + + if(vol_id > 0) { void *vol_info; /* Retrieve VOL plugin property */ @@ -563,7 +563,7 @@ H5P_facc_copy(hid_t dst_fapl_id, hid_t src_fapl_id, void UNUSED *copy_data) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol info") /* Set the vp; for the destination property list */ - if(H5VL_fapl_open(dst_plist, vol_cls, vol_info) < 0) + if(H5VL_fapl_open(dst_plist, vol_id, vol_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") } /* end if */ @@ -607,7 +607,7 @@ herr_t H5P_facc_close(hid_t fapl_id, void UNUSED *close_data) { hid_t driver_id; - H5VL_class_t *vol_cls; + hid_t vol_id; H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; @@ -618,15 +618,18 @@ H5P_facc_close(hid_t fapl_id, void UNUSED *close_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get vol plugin */ - if(H5P_get(plist, H5F_ACS_VOL_NAME, &vol_cls) < 0) + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &vol_id) < 0) HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - if(NULL != vol_cls) { + + if(vol_id > 0) { void *vol_info; + /* Retrieve VOL plugin info property */ if(H5P_get(plist, H5F_ACS_VOL_INFO_NAME, &vol_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol info") + /* Close the driver for the property list */ - if(H5VL_fapl_close(vol_cls, vol_info) < 0) + if(H5VL_fapl_close(vol_id, vol_info) < 0) HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ } /* end if */ @@ -2063,27 +2066,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5P_set_vol(H5P_genplist_t *plist, H5VL_class_t *vol_cls, const void *vol_info) +H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) { - H5VL_class_t *old_vol_cls; + hid_t old_vol_id; void *old_vol_info; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { /* Get the current vol information */ - if(H5P_get(plist, H5F_ACS_VOL_NAME, &old_vol_cls) < 0) + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &old_vol_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol class") if(H5P_get(plist, H5F_ACS_VOL_INFO_NAME, &old_vol_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol info") /* Close the vol for the property list */ - if(H5VL_fapl_close(old_vol_cls, old_vol_info)<0) + if(H5VL_fapl_close(old_vol_id, old_vol_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset vol") /* Set the vol for the property list */ - if(H5VL_fapl_open(plist, vol_cls, vol_info)<0) + if(H5VL_fapl_open(plist, vol_id, vol_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") } else @@ -2113,7 +2116,6 @@ herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_class_t *vol_cls; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -2122,11 +2124,11 @@ H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) /* Check arguments */ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(new_vol_id, H5I_VOL))) + if(NULL == H5I_object_verify(new_vol_id, H5I_VOL)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file vol ID") /* Set the vol */ - if(H5P_set_vol(plist, vol_cls, new_vol_info) < 0) + if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") done: |