summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-24 19:40:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-24 19:40:23 (GMT)
commita510f4e8a24efcbdef7b93e5934bc0e2c965a3fe (patch)
tree2802f085a4e5ffd8bebd78f01d35b64bd13f6c00 /src/H5F.c
parent8624dff4d9f84dd22bb8f05e01dbb46a1497de3d (diff)
downloadhdf5-a510f4e8a24efcbdef7b93e5934bc0e2c965a3fe.zip
hdf5-a510f4e8a24efcbdef7b93e5934bc0e2c965a3fe.tar.gz
hdf5-a510f4e8a24efcbdef7b93e5934bc0e2c965a3fe.tar.bz2
[svn-r7726] 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/H5F.c')
-rw-r--r--src/H5F.c123
1 files changed, 54 insertions, 69 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 279ff19..63d6408 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -531,15 +531,9 @@ H5F_acs_create(hid_t fapl_id, void UNUSED *copy_data)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info");
if(driver_id > 0) {
- /* Increment the reference count on driver and copy driver info */
- H5I_inc_ref(driver_id);
- driver_info = H5FD_fapl_copy(driver_id, driver_info);
-
- /* Set the driver properties for the list */
- if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver ID");
- if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver info");
+ /* Set the driver for the property list */
+ if(H5FD_fapl_open(plist, driver_id, driver_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
done:
@@ -548,60 +542,6 @@ done:
/*--------------------------------------------------------------------------
- * Function: H5F_acs_close
- *
- * Purpose: Callback routine which is called whenever a file access
- * property list is closed. This routine performs any generic
- * cleanup needed on the properties.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Raymond Lu
- * Tuesday, Oct 23, 2001
- *
- * Modifications:
- *
- *---------------------------------------------------------------------------
- */
-herr_t
-H5F_acs_close(hid_t fapl_id, void UNUSED *close_data)
-{
- hid_t driver_id;
- void *driver_info;
- H5P_genplist_t *plist; /* Property list */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(H5F_acs_close, FAIL);
-
- /* Check argument */
- if(NULL == (plist = H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
-
- if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
- if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
- HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
-
- if(driver_id > 0) {
- /* Free memory for driver info and decrement reference count for driver */
- H5FD_fapl_free(driver_id, driver_info);
- H5I_dec_ref(driver_id);
- driver_info = NULL;
- driver_id = -1;
- if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
- if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
- HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
-
-
-/*--------------------------------------------------------------------------
* Function: H5F_acs_copy
*
* Purpose: Callback routine which is called whenever a file access
@@ -640,18 +580,63 @@ H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, void UNUSED *copy_data)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info");
if(driver_id > 0) {
- H5I_inc_ref(driver_id);
- driver_info = H5FD_fapl_copy(driver_id, driver_info);
- if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver ID");
- if(H5P_set(new_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver info");
+ /* Set the driver for the property list */
+ if(H5FD_fapl_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);
}
+
+/*--------------------------------------------------------------------------
+ * Function: H5F_acs_close
+ *
+ * Purpose: Callback routine which is called whenever a file access
+ * property list is closed. This routine performs any generic
+ * cleanup needed on the properties.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * Tuesday, Oct 23, 2001
+ *
+ * Modifications:
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5F_acs_close(hid_t fapl_id, void UNUSED *close_data)
+{
+ hid_t driver_id;
+ void *driver_info;
+ H5P_genplist_t *plist; /* Property list */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5F_acs_close, FAIL);
+
+ /* Check argument */
+ if(NULL == (plist = H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
+ if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
+
+ if(driver_id > 0) {
+ /* Close the driver for the property list */
+ if(H5FD_fapl_close(driver_id, driver_info)<0)
+ HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
#ifdef NOT_YET
/*-------------------------------------------------------------------------