summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-05-24 13:41:26 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-05-24 13:41:26 (GMT)
commit479f326a267ca5ffacc2012f33674c66cf2907d8 (patch)
tree19d03323c3ceb6e6b9e4da5e3529aeec74992974 /src
parente5a57c97aa43d6c76d1bb1fe64d24aaa0bbbb7d3 (diff)
downloadhdf5-479f326a267ca5ffacc2012f33674c66cf2907d8.zip
hdf5-479f326a267ca5ffacc2012f33674c66cf2907d8.tar.gz
hdf5-479f326a267ca5ffacc2012f33674c66cf2907d8.tar.bz2
* Added new public H5FDdriver_query() API call.
* Changed return type of H5FD_driver_query() to herr_t. * Updated swmr.c to use H5FDdriver_query() instead of the private call. * Added some flags tests to vfd.c.
Diffstat (limited to 'src')
-rw-r--r--src/H5FD.c42
-rw-r--r--src/H5FDint.c8
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDpublic.h3
4 files changed, 48 insertions, 7 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index d3cb77c..67cf963 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -789,7 +789,8 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method")
/* Query driver flag */
- H5FD_driver_query(driver, &driver_flags);
+ if(H5FD_driver_query(driver, &driver_flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't query VFD flags")
/* Get initial file image info */
if(H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0)
@@ -2039,3 +2040,42 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD_set_paged_aggr() */
+
+
+/*-------------------------------------------------------------------------
+* Function: H5FDdriver_query
+*
+* Purpose: Similar to H5FD_query(), but intended for cases when we don't
+* have a file available (e.g. before one is opened). Since we
+* can't use the file to get the driver, the driver ID is passed
+* in as a parameter.
+*
+* Return: SUCCEED/FAIL
+*
+* Programmer: Jacob Gruber
+* Wednesday, August 17, 2011
+*
+*-------------------------------------------------------------------------
+*/
+herr_t
+H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/)
+{
+ H5FD_class_t *driver = NULL; /* Pointer to VFD class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ix", driver_id, flags);
+
+ if(NULL == flags)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL")
+
+ /* Check for the driver to query and then query it */
+ if (NULL == (driver = (H5FD_class_t *)H5I_object_verify(driver_id, H5I_VFL)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a VFL ID")
+ if (H5FD_driver_query(driver, flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "driver flag query failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5FDdriver_query() */
+
diff --git a/src/H5FDint.c b/src/H5FDint.c
index ccf0f2e..52fbc23 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -442,18 +442,17 @@ done:
* can't use the file to get the driver, the driver is passed in
* as a parameter.
*
-* Return: Success: non-negative
-* Failure: negative
+* Return: SUCCEED/FAIL
*
* Programmer: Jacob Gruber
* Wednesday, August 17, 2011
*
*-------------------------------------------------------------------------
*/
-int
+herr_t
H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/)
{
- int ret_value = 0; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -469,4 +468,3 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_driver_query() */
-
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 589e391..e758951 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -153,7 +153,7 @@ H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
H5_DLL herr_t H5FD_close(H5FD_t *file);
H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2);
-H5_DLL int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/);
+H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/);
H5_DLL haddr_t H5FD_alloc(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type,
struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size);
H5_DLL herr_t H5FD_free(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, struct H5F_t *f,
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 45b1237..514d1bf 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -384,6 +384,9 @@ H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw);
H5_DLL herr_t H5FDunlock(H5FD_t *file);
+/* Allows querying a VFD ID for features before the file is opened */
+H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/);
+
#ifdef __cplusplus
}
#endif