diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-06-14 13:29:30 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-06-14 13:29:30 (GMT) |
commit | 87a81eb5afd4d24b2ba42ef78d8aee433c8e8639 (patch) | |
tree | 07cedd27e147e1ee6dfd2aa28ff96970614e2d41 /src/H5F.c | |
parent | ff91dd8c3b3d376f005790d5105daf0ee23a73a9 (diff) | |
download | hdf5-87a81eb5afd4d24b2ba42ef78d8aee433c8e8639.zip hdf5-87a81eb5afd4d24b2ba42ef78d8aee433c8e8639.tar.gz hdf5-87a81eb5afd4d24b2ba42ef78d8aee433c8e8639.tar.bz2 |
[svn-r22461] add a prototype for a new API routine, H5Fis_accessable
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 51 |
1 files changed, 17 insertions, 34 deletions
@@ -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() */ /*------------------------------------------------------------------------- |