mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
Only pass efc pointer to H5F__efc_open (#3026)
The H5F__efc_open() API call only needs the efc pointer, so there is no need to pass the entire file struct in.
This commit is contained in:
parent
962593fb0a
commit
81bc34ac4c
@ -137,9 +137,8 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5F_t *
|
||||
H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
|
||||
H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
|
||||
{
|
||||
H5F_efc_t *efc = NULL; /* External file cache for parent file */
|
||||
H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */
|
||||
hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */
|
||||
H5P_genplist_t *plist; /* Property list pointer for FAPL */
|
||||
@ -149,8 +148,6 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
/* Sanity checks */
|
||||
HDassert(parent);
|
||||
HDassert(parent->shared);
|
||||
HDassert(name);
|
||||
|
||||
/* Get the VOL info from the fapl */
|
||||
@ -165,9 +162,6 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi
|
||||
if (H5CX_set_vol_connector_prop(&connector_prop) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context")
|
||||
|
||||
/* Get external file cache */
|
||||
efc = parent->shared->efc;
|
||||
|
||||
/* Check if the EFC exists. If it does not, just call H5F_open(). We
|
||||
* support this so clients do not have to make 2 different calls depending
|
||||
* on the state of the efc. */
|
||||
|
33
src/H5Fint.c
33
src/H5Fint.c
@ -806,15 +806,21 @@ H5F_t *
|
||||
H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const char *prop_prefix,
|
||||
const char *file_name, unsigned file_intent, hid_t fapl_id)
|
||||
{
|
||||
H5F_t *src_file = NULL; /* Source file */
|
||||
char *full_name = NULL; /* File name with prefix */
|
||||
char *actual_file_name = NULL; /* File's actual name */
|
||||
char *temp_file_name = NULL; /* Temporary pointer to file name */
|
||||
size_t temp_file_name_len; /* Length of temporary file name */
|
||||
H5F_t *ret_value = NULL; /* Return value */
|
||||
H5F_t *src_file = NULL; /* Source file */
|
||||
H5F_efc_t *efc = NULL; /* External file cache */
|
||||
char *full_name = NULL; /* File name with prefix */
|
||||
char *actual_file_name = NULL; /* File's actual name */
|
||||
char *temp_file_name = NULL; /* Temporary pointer to file name */
|
||||
size_t temp_file_name_len; /* Length of temporary file name */
|
||||
H5F_t *ret_value = NULL; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
HDassert(primary_file);
|
||||
HDassert(primary_file->shared);
|
||||
|
||||
efc = primary_file->shared->efc;
|
||||
|
||||
/* Simplify intent flags for open calls */
|
||||
file_intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ);
|
||||
|
||||
@ -826,7 +832,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
/* Target file_name is an absolute pathname: see RM for detailed description */
|
||||
if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) {
|
||||
/* Try opening file */
|
||||
src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
|
||||
/* Adjust temporary file name if file not opened */
|
||||
if (NULL == src_file) {
|
||||
@ -849,7 +855,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
} /* end if */
|
||||
else if (H5_CHECK_ABS_DRIVE(file_name)) {
|
||||
/* Try opening file */
|
||||
src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
|
||||
/* Adjust temporary file name if file not opened */
|
||||
if (NULL == src_file) {
|
||||
@ -894,8 +900,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
} /* end if */
|
||||
|
||||
/* Try opening file */
|
||||
src_file =
|
||||
H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
|
||||
/* Release copy of file name */
|
||||
full_name = (char *)H5MM_xfree(full_name);
|
||||
@ -922,7 +927,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename")
|
||||
|
||||
/* Try opening file */
|
||||
src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
|
||||
/* Release name */
|
||||
full_name = (char *)H5MM_xfree(full_name);
|
||||
@ -943,7 +948,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename")
|
||||
|
||||
/* Try opening file */
|
||||
src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
|
||||
/* Release name */
|
||||
full_name = (char *)H5MM_xfree(full_name);
|
||||
@ -958,7 +963,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
/* Try the relative file_name stored in temp_file_name */
|
||||
if (src_file == NULL) {
|
||||
/* Try opening file */
|
||||
src_file = H5F__efc_open(primary_file, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
src_file = H5F__efc_open(efc, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
|
||||
/* Check for file not opened */
|
||||
if (NULL == src_file)
|
||||
@ -986,7 +991,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
actual_file_name = (char *)H5MM_xfree(actual_file_name);
|
||||
|
||||
/* Try opening with the resolved name */
|
||||
src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id);
|
||||
|
||||
/* Release name */
|
||||
full_name = (char *)H5MM_xfree(full_name);
|
||||
|
@ -452,7 +452,7 @@ H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag);
|
||||
|
||||
/* External file cache routines */
|
||||
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);
|
||||
H5_DLL H5F_t *H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
|
||||
H5_DLL H5F_t *H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
|
||||
H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc);
|
||||
H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc);
|
||||
H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc);
|
||||
|
650
test/efc.c
650
test/efc.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user