diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-04-11 21:15:15 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-04-11 21:15:15 (GMT) |
commit | f70f5b17403c20bef94e4c43bdf86e7fd4b88ec8 (patch) | |
tree | c1fcd41db93340195e18a941660cb93782c36f97 /src/H5F.c | |
parent | 45f6d4c1eed29c45476970a9703304378a5a1073 (diff) | |
download | hdf5-f70f5b17403c20bef94e4c43bdf86e7fd4b88ec8.zip hdf5-f70f5b17403c20bef94e4c43bdf86e7fd4b88ec8.tar.gz hdf5-f70f5b17403c20bef94e4c43bdf86e7fd4b88ec8.tar.bz2 |
[svn-r22278] make get_vfd go through a generic file callback
rearrange routines alphabetically
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 55 |
1 files changed, 54 insertions, 1 deletions
@@ -750,7 +750,7 @@ H5Fget_vfd_handle(hid_t uid, hid_t fapl, void **file_handle) if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") - if((ret_value = H5VL_file_get(uid, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl)) < 0) + if((ret_value = H5VL_file_generic(uid, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle") done: @@ -805,6 +805,59 @@ 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_generic(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 + * + * Purpose: private version of H5Fis_hdf5. + * + * Return: Success: TRUE/FALSE + * + * Failure: Negative + * + * Programmer: Unknown + * + *------------------------------------------------------------------------- + */ +htri_t +H5F_is_hdf5(const char *name) +{ + H5FD_t *file = NULL; /* Low-level file struct */ + htri_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* 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") + + /* 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)); + +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_NOAPI(ret_value) } /* end H5Fis_hdf5() */ |