summaryrefslogtreecommitdiffstats
path: root/src/H5Fdeprec.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-10-10 15:10:15 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2018-10-10 15:10:15 (GMT)
commite962df1591bc6eaee5b9e318de83b9c6698bc7b6 (patch)
treede3cb2001c62b76a89837ff1e90044574d71f19d /src/H5Fdeprec.c
parent471150151d29eeb806333a8db41fefc9dfb452bb (diff)
downloadhdf5-e962df1591bc6eaee5b9e318de83b9c6698bc7b6.zip
hdf5-e962df1591bc6eaee5b9e318de83b9c6698bc7b6.tar.gz
hdf5-e962df1591bc6eaee5b9e318de83b9c6698bc7b6.tar.bz2
VOL FEATURE
Diffstat (limited to 'src/H5Fdeprec.c')
-rw-r--r--src/H5Fdeprec.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index c91d0ea..6fee596 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -113,7 +113,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
* the top file in a mount hierarchy)
*/
if(H5I_get_type(obj_id) == H5I_FILE ) {
- if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
+ if(NULL == (f = (H5F_t *)H5VL_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
}
else {
@@ -141,6 +141,41 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Fis_hdf5
+ *
+ * Purpose: Check the file signature to detect an HDF5 file.
+ *
+ * Bugs: This function is not robust: it only uses the default file
+ * driver when attempting to open the file when in fact it
+ * should use all known file drivers.
+ *
+ * Return: TRUE/FALSE/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5Fis_hdf5(const char *name)
+{
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_API((-1))
+ H5TRACE1("t", "*s", name);
+
+ /* Check args and all the boring stuff. */
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified")
+
+ /* call the private is_HDF5 function */
+ if((ret_value = H5F__is_hdf5(name, H5P_FILE_ACCESS_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable open file")
+
+done:
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fis_hdf5() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Fset_latest_format
*
* Purpose: Enable switching between latest or non-latest format while
@@ -174,20 +209,24 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'.
+ */
herr_t
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
{
- H5F_t *f; /* File */
- H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
- H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* File as VOL object */
+ H5F_t *f; /* File */
+ H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
+ H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, latest_format);
/* Check args */
- if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
+ f = (H5F_t *)(vol_obj->data);
/* 'low' and 'high' are both initialized to LATEST.
* If latest format is not expected, set 'low' to EARLIEST