summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-06-14 13:29:30 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-06-14 13:29:30 (GMT)
commit87a81eb5afd4d24b2ba42ef78d8aee433c8e8639 (patch)
tree07cedd27e147e1ee6dfd2aa28ff96970614e2d41
parentff91dd8c3b3d376f005790d5105daf0ee23a73a9 (diff)
downloadhdf5-87a81eb5afd4d24b2ba42ef78d8aee433c8e8639.zip
hdf5-87a81eb5afd4d24b2ba42ef78d8aee433c8e8639.tar.gz
hdf5-87a81eb5afd4d24b2ba42ef78d8aee433c8e8639.tar.bz2
[svn-r22461] add a prototype for a new API routine, H5Fis_accessable
-rw-r--r--src/H5F.c51
-rw-r--r--src/H5Fprivate.h1
-rw-r--r--src/H5Fpublic.h1
-rw-r--r--src/H5VLnative.c10
-rw-r--r--src/H5VLpublic.h5
5 files changed, 20 insertions, 48 deletions
diff --git a/src/H5F.c b/src/H5F.c
index af71d09..9c3ff8f 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -883,60 +883,43 @@ done:
HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
FUNC_LEAVE_API(ret_value)
-#if 0
- htri_t ret_value; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("t", "*s", name);
-
- /* Check args and all the boring stuff. */
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
-
- if((ret_value = H5VL_file_optional(H5VL_FILE_IS_HDF5, &ret_value, name)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle")
-
- FUNC_LEAVE_API(ret_value)
-#endif
} /* end H5Fis_hdf5() */
/*-------------------------------------------------------------------------
- * Function: H5F_is_hdf5
+ * Function: H5Fis_accessable
*
- * Purpose: private version of H5Fis_hdf5.
+ * Purpose: Check if the file can be opened with the given fapl.
*
* Return: Success: TRUE/FALSE
- *
* Failure: Negative
*
- * Programmer: Unknown
+ * Programmer: Mohamad Chaarawi
+ * June 2012
*
*-------------------------------------------------------------------------
*/
htri_t
-H5F_is_hdf5(const char *name)
+H5Fis_accessable(const char *name, hid_t fapl_id)
{
- H5FD_t *file = NULL; /* Low-level file struct */
- htri_t ret_value; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("t", "*si", name, fapl_id);
- /* Open the file at the virtual file layer */
- if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF)))
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
+ /* Check args and all the boring stuff. */
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
- /* The file is an hdf5 file if the hdf5 file signature can be found */
- ret_value = (HADDR_UNDEF != H5F_locate_signature(file, H5AC_ind_dxpl_id));
+#if 0
+ if(H5VL_file_optional(H5VL_FILE_IS_HDF5, &ret_value, name) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle")
+#endif
done:
- /* Close the file */
- if(file)
- if(H5FD_close(file) < 0 && ret_value >= 0)
- HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fis_accessable() */
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5Fis_hdf5() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 20aff87..26ef19e 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -535,7 +535,6 @@ H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL struct H5VL_class_t *H5F_get_vol_cls(const H5F_t *f);
-H5_DLL htri_t H5F_is_hdf5(const char *name);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index f32b3e0..6611455 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -175,6 +175,7 @@ extern "C" {
/* Functions in H5F.c */
H5_DLL htri_t H5Fis_hdf5(const char *filename);
+H5_DLL htri_t H5Fis_accessable(const char *filename, hid_t fapl_id);
H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags,
hid_t create_plist, hid_t access_plist);
H5_DLL hid_t H5Fopen(const char *filename, unsigned flags,
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index e96132b..bd003bc 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -1712,16 +1712,6 @@ H5VL_native_file_misc(hid_t loc_id, H5VL_file_misc_t misc_type, hid_t UNUSED req
FUNC_ENTER_NOAPI_NOINIT
switch (misc_type) {
- /* H5Fis_hdf5 */
- case H5VL_FILE_IS_HDF5:
- {
- htri_t *ret = va_arg (arguments, htri_t *);
- const char *name = va_arg (arguments, const char *);
-
- if((*ret = H5F_is_hdf5(name)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't determine if file is an HDF5 file")
- break;
- }
/* H5Fmount */
case H5VL_FILE_MOUNT:
{
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index f1d3046..ba15f67 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -82,9 +82,8 @@ typedef enum H5VL_file_get_t {
/* types for all file misc operations */
typedef enum H5VL_file_misc_t {
- H5VL_FILE_IS_HDF5 = 0, /* is HDF5? */
- H5VL_FILE_MOUNT = 1,
- H5VL_FILE_UNMOUNT = 2
+ H5VL_FILE_MOUNT = 0,
+ H5VL_FILE_UNMOUNT = 1
} H5VL_file_misc_t;
/* types for all file optional operations */