summaryrefslogtreecommitdiffstats
path: root/src/H5Pfapl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Pfapl.c')
-rw-r--r--src/H5Pfapl.c498
1 files changed, 152 insertions, 346 deletions
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 23eb924..452ea3f 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -39,17 +39,17 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory Management */
#include "H5Ppkg.h" /* Property lists */
-#include "H5VLprivate.h" /* VOL drivers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
-/* Includes needed to set as default file driver */
-#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
+/* Includes needed to set default file driver */
+#include "H5FDsec2.h" /* POSIX unbuffered I/O */
#include "H5FDstdio.h" /* Standard C buffered I/O */
#ifdef H5_HAVE_WINDOWS
#include "H5FDwindows.h" /* Win32 I/O */
#endif
-/* Includes needed to set the default VOL driver */
-#include "H5VLnative_private.h" /* Native VOL driver */
+/* Includes needed to set default VOL connector */
+#include "H5VLnative_private.h" /* Native VOL connector */
/****************/
@@ -177,16 +177,6 @@
#define H5F_ACS_FILE_IMAGE_INFO_COPY H5P__facc_file_image_info_copy
#define H5F_ACS_FILE_IMAGE_INFO_CMP H5P__facc_file_image_info_cmp
#define H5F_ACS_FILE_IMAGE_INFO_CLOSE H5P__facc_file_image_info_close
-/* Definition of core VFD write tracking flag */
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE sizeof(hbool_t)
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF FALSE
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC H5P__encode_hbool_t
-#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC H5P__decode_hbool_t
-/* Definition of core VFD write tracking page size */
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE sizeof(size_t)
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF 524288
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t
-#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t
/* Definition for # of metadata read attempts */
#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned)
#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0
@@ -263,16 +253,16 @@
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned
-/* Definition for file VOL driver properties (ID, etc.) */
-#define H5F_ACS_VOL_SIZE sizeof(H5VL_driver_prop_t)
-#define H5F_ACS_VOL_DEF {H5_DEFAULT_VOL, NULL}
-#define H5F_ACS_VOL_CRT H5P__facc_vol_create
-#define H5F_ACS_VOL_SET H5P__facc_vol_set
-#define H5F_ACS_VOL_GET H5P__facc_vol_get
-#define H5F_ACS_VOL_DEL H5P__facc_vol_del
-#define H5F_ACS_VOL_COPY H5P__facc_vol_copy
-#define H5F_ACS_VOL_CMP H5P__facc_vol_cmp
-#define H5F_ACS_VOL_CLOSE H5P__facc_vol_close
+/* Definition for file VOL connector properties (ID, etc.) */
+#define H5F_ACS_VOL_CONN_SIZE sizeof(H5VL_connector_prop_t)
+#define H5F_ACS_VOL_CONN_DEF {H5_DEFAULT_VOL, NULL}
+#define H5F_ACS_VOL_CONN_CRT H5P__facc_vol_create
+#define H5F_ACS_VOL_CONN_SET H5P__facc_vol_set
+#define H5F_ACS_VOL_CONN_GET H5P__facc_vol_get
+#define H5F_ACS_VOL_CONN_DEL H5P__facc_vol_del
+#define H5F_ACS_VOL_CONN_COPY H5P__facc_vol_copy
+#define H5F_ACS_VOL_CONN_CMP H5P__facc_vol_cmp
+#define H5F_ACS_VOL_CONN_CLOSE H5P__facc_vol_close
/******************/
@@ -335,7 +325,7 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c
static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size);
static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value);
-/* VOL driver callbacks */
+/* VOL connector callbacks */
static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value);
static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value);
static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value);
@@ -401,8 +391,6 @@ static const H5F_libver_t H5F_def_libver_high_bound_g = H5F_ACS_LIBVER_HIGH_BOUN
static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */
static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */
static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
-static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */
-static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */
static const unsigned H5F_def_metadata_read_attempts_g = H5F_ACS_METADATA_READ_ATTEMPTS_DEF; /* Default setting for the # of metadata read attempts */
static const H5F_object_flush_t H5F_def_object_flush_cb_g = H5F_ACS_OBJECT_FLUSH_CB_DEF; /* Default setting for object flush callback */
static const hbool_t H5F_def_clear_status_flags_g = H5F_ACS_CLEAR_STATUS_FLAGS_DEF; /* Default to clear the superblock status_flags */
@@ -438,7 +426,7 @@ static herr_t
H5P__facc_reg_prop(H5P_genclass_t *pclass)
{
const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */
- const H5VL_driver_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL driver ID & info (initialized from a variable) */
+ const H5VL_connector_prop_t def_vol_prop = H5F_ACS_VOL_CONN_DEF; /* Default VOL connector ID & info (initialized from a variable) */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -572,18 +560,6 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the core VFD backing store write tracking flag */
- if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g,
- NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC,
- NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the size of the core VFD backing store page size */
- if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g,
- NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC,
- NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
/* Register the # of read attempts */
if(H5P__register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g,
NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC,
@@ -669,11 +645,11 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the file VOL driver ID & info */
+ /* Register the file VOL connector ID & info */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P__register_real(pclass, H5F_ACS_VOL_DRV_NAME, H5F_ACS_VOL_SIZE, &def_vol_prop,
- H5F_ACS_VOL_CRT, H5F_ACS_VOL_SET, H5F_ACS_VOL_GET, NULL, NULL,
- H5F_ACS_VOL_DEL, H5F_ACS_VOL_COPY, H5F_ACS_VOL_CMP, H5F_ACS_VOL_CLOSE) < 0)
+ if(H5P__register_real(pclass, H5F_ACS_VOL_CONN_NAME, H5F_ACS_VOL_CONN_SIZE, &def_vol_prop,
+ H5F_ACS_VOL_CONN_CRT, H5F_ACS_VOL_CONN_SET, H5F_ACS_VOL_CONN_GET, NULL, NULL,
+ H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -3957,89 +3933,6 @@ H5P__facc_libver_type_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_libver_type_dec() */
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_core_write_tracking
- *
- * Purpose: Enables/disables core VFD write tracking and page
- * aggregation size.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Dana Robinson
- * Tuesday, April 8, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "ibz", plist_id, is_enabled, page_size);
-
- /* The page size cannot be zero */
- if(page_size == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page_size cannot be zero")
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, &is_enabled) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD write tracking flag")
- if(H5P_set(plist, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, &page_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD write tracking page size")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pset_core_write_tracking() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_core_write_tracking
- *
- * Purpose: Gets information about core VFD write tracking and page
- * aggregation size.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Dana Robinson
- * Tuesday, April 8, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*b*z", plist_id, is_enabled, page_size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get values */
- if(is_enabled) {
- if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, is_enabled) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core VFD write tracking flag")
- } /* end if */
-
- if(page_size) {
- if(H5P_get(plist, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, page_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core VFD write tracking page size")
- } /* end if */
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_core_write_tracking() */
-
/*-------------------------------------------------------------------------
* Function: H5Pset_metadata_read_attempts
@@ -4975,10 +4868,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P_set_vol
*
- * Purpose: Set the VOL driver for a file access property list
- * (PLIST_ID). The vol properties will
+ * Purpose: Set the VOL connector for a file access property list
+ * (PLIST_ID). The VOL properties will
* be copied into the property list and the reference count on
- * the vol will be incremented.
+ * the VOL will be incremented.
*
* Return: SUCCEED/FAIL
*
@@ -4992,19 +4885,19 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info)
FUNC_ENTER_NOAPI(FAIL)
if(NULL == H5I_object_verify(vol_id, H5I_VOL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
- H5VL_driver_prop_t vol_prop; /* Property for VOL ID & info */
+ H5VL_connector_prop_t vol_prop; /* Property for VOL ID & info */
- /* Prepare the VOL driver property */
- vol_prop.driver_id = vol_id;
- vol_prop.driver_info = vol_info;
+ /* Prepare the VOL connector property */
+ vol_prop.connector_id = vol_id;
+ vol_prop.connector_info = vol_info;
- /* Set the driver ID & info property */
- if(H5P_set(plist, H5F_ACS_VOL_DRV_NAME, &vol_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL driver ID & info")
- }
+ /* Set the connector ID & info property */
+ if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info")
+ } /* end if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
@@ -5016,7 +4909,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pset_vol
*
- * Purpose: Set the file VOL driver (VOL_ID) for a file access
+ * Purpose: Set the file VOL connector (VOL_ID) for a file access
* property list (PLIST_ID)
*
* Return: Success: Non-negative
@@ -5037,11 +4930,11 @@ H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info)
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 == H5I_object_verify(new_vol_id, H5I_VOL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file vol ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID")
- /* Set the vol */
+ /* Set the VOL */
if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL")
done:
FUNC_LEAVE_API(ret_value)
@@ -5049,197 +4942,113 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5P_get_vol_info
- *
- * Purpose: Returns a pointer directly to the file vol-specific
- * information of a file access property list.
- *
- * Return: Success: Ptr to *uncopied* vol specific data
- * structure if any.
- *
- * Failure: NULL. Null is also returned if the vol has
- * not registered any vol-specific properties
- * although no error is pushed on the stack in
- * this case.
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5P_get_vol_info(H5P_genplist_t *plist)
-{
- void *ret_value = NULL;
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Get the current vol info */
- if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
- H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */
-
- if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info")
- ret_value = (void *)driver_prop.driver_info;
- } else
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_get_vol_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_vol_info
- *
- * Purpose: Returns a pointer directly to the file vol-specific
- * information of a file access property list.
- *
- * XXX (VOL MERGE): This API call seems like a REALLY bad idea - DER
- *
- * Return: Success: Ptr to *uncopied* vol specific data
- * structure if any.
+ * Function: H5Pget_vol_id
*
- * Failure: NULL. Null is also returned if the vol has
- * not registered any vol-specific properties
- * although no error is pushed on the stack in
- * this case.
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5Pget_vol_info(hid_t plist_id)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_API(NULL)
- H5TRACE1("*x", "i", plist_id);
-
- if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
-
- if(NULL == (ret_value = H5P_get_vol_info(plist)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol info")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_vol_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P__vol_copy
- *
- * Purpose: Copy VOL driver ID & info.
- *
- * Note: This is an "in-place" copy, since this routine gets called
- * after the top-level copy has been performed and this routine
- * finishes the "deep" part of the copy.
+ * Purpose: Returns the ID of the current VOL connector.
+ * This ID should be closed with H5VLclose().
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5P__vol_copy(void *value)
+herr_t
+H5Pget_vol_id(hid_t plist_id, hid_t *vol_id)
{
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
-
- if(value) {
- H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*i", plist_id, vol_id);
- /* Copy the driver ID & info, if there is one */
- if(info->driver_id > 0) {
- /* Increment the reference count on driver ID and copy driver info */
- if(H5I_inc_ref(info->driver_id, FALSE) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL driver ID")
+ /* Get property list for ID */
+ 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")
- /* Copy driver info, if it exists */
- if(info->driver_info) {
- H5VL_class_t *driver; /* Pointer to driver */
- void *new_driver; /* Copy of driver info */
+ /* Get the current VOL ID */
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- /* Retrieve the driver for the ID */
- if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ /* Get the connector property */
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info")
- /* Allow the driver to copy or do it ourselves */
- if(driver->fapl_copy) {
- if(NULL == (new_driver = (driver->fapl_copy)(info->driver_info)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed")
- }
- else if(driver->fapl_size > 0) {
- if(NULL == (new_driver = H5MM_malloc(driver->fapl_size)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed")
- HDmemcpy(new_driver, info->driver_info, driver->fapl_size);
- }
- else
- HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info")
+ /* Increment the VOL ID's ref count */
+ if(H5I_inc_ref(connector_prop.connector_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID")
- /* Set the driver info for the copy */
- info->driver_info = new_driver;
- }
- }
- }
+ /* Set the connector ID to return */
+ *vol_id = connector_prop.connector_id;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P__vol_copy() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_id() */
/*-------------------------------------------------------------------------
- * Function: H5P__vol_free
+ * Function: H5Pget_vol_info
*
- * Purpose: Free VOL driver ID & info.
+ * Purpose: Returns a copy of the VOL info for a connector.
+ * This information should be freed with H5VLfree_connector_info.
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5P__vol_free(void *value)
+herr_t
+H5Pget_vol_info(hid_t plist_id, void **vol_info)
{
+ H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i**x", plist_id, vol_info);
- if(value) {
- H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */
+ /* Get property list for ID */
+ 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")
- /* Free the driver info (if it exists) and decrement the ID */
- if(info->driver_id > 0) {
- if(info->driver_info) {
- H5VL_class_t *driver; /* Pointer to driver */
+ /* Get the current VOL info */
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ void *new_connector_info = NULL; /* Copy of connector info */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- /* Retrieve the driver for the ID */
- if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID")
+ /* Get the connector property */
+ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property")
- /* Allow the driver to free info or do it ourselves */
- if(driver->fapl_free) {
- if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
- }
- else
- H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */
- }
+ /* Copy connector info, if it exists */
+ if(connector_prop.connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
- /* Decrement reference count for driver ID */
- if(H5I_dec_ref(info->driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID")
- }
- }
+ /* Retrieve the connector for the ID */
+ if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allocate and copy connector info */
+ if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed")
+ } /* end if */
+
+ /* Set the connector info */
+ *vol_info = new_connector_info;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P__vol_free() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_info() */
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_create
*
- * Purpose: Create callback for the VOL driver ID & info property.
+ connectorose: Create callback for the VOL connector ID & info property.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5253,9 +5062,9 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size
FUNC_ENTER_STATIC
- /* Make copy of the VOL driver */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of the VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5265,7 +5074,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_set
*
- * Purpose: Copies a VOL driver property when it's set for a property list
+ * Purpose: Copies a VOL connector property when it's set for a property list
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5283,9 +5092,9 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
/* Sanity check */
HDassert(value);
- /* Make copy of VOL driver ID & info */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of VOL connector ID & info */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5295,7 +5104,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_get
*
- * Purpose: Copies a VOL driver property when it's retrieved from a property list
+ * Purpose: Copies a VOL connector property when it's retrieved from a property list
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5313,9 +5122,9 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
/* Sanity check */
HDassert(value);
- /* Make copy of VOL driver */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5325,7 +5134,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_del
*
- * Purpose: Frees memory used to store the VOL driver ID & info property
+ * Purpose: Frees memory used to store the VOL connector ID & info property
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5339,9 +5148,9 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
FUNC_ENTER_STATIC
- /* Free the VOL driver ID & info */
- if(H5P__vol_free(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver")
+ /* Free the VOL connector ID & info */
+ if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5351,7 +5160,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_copy
*
- * Purpose: Copy callback for the VOL driver ID & info property.
+ * Purpose: Copy callback for the VOL connector ID & info property.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5365,9 +5174,9 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size,
FUNC_ENTER_STATIC
- /* Make copy of VOL driver */
- if(H5P__vol_copy(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver")
+ /* Make copy of VOL connector */
+ if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5377,7 +5186,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_cmp
*
- * Purpose: Callback routine which is called whenever the VOL driver
+ * Purpose: Callback routine which is called whenever the VOL connector
* ID & info property in the file access property list
* is compared.
*
@@ -5390,48 +5199,45 @@ done:
static int
H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size)
{
- const H5VL_driver_prop_t *info1 = (const H5VL_driver_prop_t *)_info1; /* Create local aliases for values */
- const H5VL_driver_prop_t *info2 = (const H5VL_driver_prop_t *)_info2;
- H5VL_class_t *cls1, *cls2; /* Driver class for each property */
- int cmp_value; /* Value from comparison */
- herr_t ret_value = 0; /* Return value */
+ const H5VL_connector_prop_t *info1 = (const H5VL_connector_prop_t *)_info1; /* Create local aliases for values */
+ const H5VL_connector_prop_t *info2 = (const H5VL_connector_prop_t *)_info2;
+ H5VL_class_t *cls1, *cls2; /* connector class for each property */
+ int cmp_value = 0; /* Value from comparison */
+ herr_t status; /* Status from info comparison */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(info1);
HDassert(info2);
- HDassert(size == sizeof(H5VL_driver_prop_t));
+ HDassert(size == sizeof(H5VL_connector_prop_t));
- /* Compare drivers */
- if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->driver_id)))
+ /* Compare connectors */
+ if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->connector_id)))
HGOTO_DONE(-1)
- if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->driver_id)))
+ if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id)))
HGOTO_DONE(1)
- if(cls1->name == NULL && cls2->name != NULL)
- HGOTO_DONE(-1);
- if(cls1->name != NULL && cls2->name == NULL)
- HGOTO_DONE(1);
- if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name)))
+ status = H5VL_cmp_connector_cls(&cmp_value, cls1, cls2);
+ HDassert(status >= 0);
+ if(cmp_value != 0)
HGOTO_DONE(cmp_value);
- /* Compare driver info */
- if(cls1->fapl_size < cls2->fapl_size)
- HGOTO_DONE(-1)
- if(cls1->fapl_size > cls2->fapl_size)
- HGOTO_DONE(1)
- HDassert(cls1->fapl_size == cls2->fapl_size);
+ /* At this point, we should be able to assume that we are dealing with
+ * the same connector class struct (or a copies of the same class struct)
+ */
- if(info1->driver_info == NULL && info2->driver_info != NULL)
- HGOTO_DONE(-1);
- if(info1->driver_info != NULL && info2->driver_info == NULL)
- HGOTO_DONE(1);
- if(info1->driver_info) {
- HDassert(cls1->fapl_size > 0);
- if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size)))
- HGOTO_DONE(cmp_value);
- }
+ /* Use one of the classes (cls1) info comparison routines to compare the
+ * info objects
+ */
+ HDassert(cls1->info_cmp == cls2->info_cmp);
+ status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info);
+ HDassert(status >= 0);
+
+ /* Set return value */
+ ret_value = cmp_value;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_vol_cmp() */
@@ -5440,7 +5246,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_close
*
- * Purpose: Close callback for the VOL driver ID & info property.
+ * Purpose: Close callback for the VOL connector ID & info property.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -5454,9 +5260,9 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size,
FUNC_ENTER_STATIC
- /* Free the VOL driver */
- if(H5P__vol_free(value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver")
+ /* Free the VOL connector */
+ if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector")
done:
FUNC_LEAVE_NOAPI(ret_value)