summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-24 19:39:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-24 19:39:23 (GMT)
commitd0be7024289ccd82eb6545f61dd38861ec5d79ec (patch)
tree7317eb1eb65763f702f255fbb689c799d555f4d7 /src/H5D.c
parent9d22c9e61aaeb70fa03b0c3cea521edd79c95867 (diff)
downloadhdf5-d0be7024289ccd82eb6545f61dd38861ec5d79ec.zip
hdf5-d0be7024289ccd82eb6545f61dd38861ec5d79ec.tar.gz
hdf5-d0be7024289ccd82eb6545f61dd38861ec5d79ec.tar.bz2
[svn-r7725] Purpose:
Code cleanup Description: Refactored handlier of VFL drivers in file access and data transfer property lists in order to simplify and unify the code dealing with them. Platforms tested: FreeBSD 4.9 (sleipnir) too minor to require h5committest
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 4e5efc5..a384a99 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -589,23 +589,15 @@ H5D_xfer_create(hid_t dxpl_id, void UNUSED *create_data)
/* Get the driver information */
if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID")
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info")
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info")
/* Check if we have a valid driver ID */
if(driver_id>0) {
- /* Increment the reference count on the driver and copy the driver info */
- if(H5I_inc_ref(driver_id)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment VFL driver ID")
- if(H5FD_dxpl_copy(driver_id, driver_info, &driver_info)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "Can't copy VFL driver")
-
- /* Set the driver information for the new property list */
- if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver ID")
- if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver info")
+ /* Set the driver for the property list */
+ if(H5FD_dxpl_open(plist, driver_id, driver_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
done:
@@ -633,15 +625,32 @@ done:
*/
/* ARGSUSED */
herr_t
-H5D_xfer_copy(hid_t new_plist_id, hid_t UNUSED old_plist_id,
- void *copy_data)
+H5D_xfer_copy(hid_t new_dxpl_id, hid_t old_dxpl_id, void UNUSED *copy_data)
{
+ hid_t driver_id;
+ void* driver_info;
+ H5P_genplist_t *new_plist; /* New property list */
+ H5P_genplist_t *old_plist; /* Old property list */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_xfer_copy, FAIL)
- if(H5D_xfer_create(new_plist_id, copy_data) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy property list")
+ if(NULL == (new_plist = H5I_object(new_dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+ if(NULL == (old_plist = H5I_object(old_dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
+ /* Get values from old property list */
+ if(H5P_get(old_plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
+ if(H5P_get(old_plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info")
+
+ if(driver_id > 0) {
+ /* Set the driver for the property list */
+ if(H5FD_dxpl_open(new_plist, driver_id, driver_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -688,10 +697,9 @@ H5D_xfer_close(hid_t dxpl_id, void UNUSED *close_data)
if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info")
if(driver_id>0) {
- if(H5FD_dxpl_free(driver_id, driver_info)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't free VFL driver")
- if(H5I_dec_ref(driver_id)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement VFL driver ID")
+ /* Close the driver for the property list */
+ if(H5FD_dxpl_close(driver_id, driver_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver")
} /* end if */
done: