summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-07-27 16:52:14 (GMT)
committerGitHub <noreply@github.com>2023-07-27 16:52:14 (GMT)
commitd4299d02012fc007ef049abb231bd69eadc9f4dd (patch)
tree06307ea906229224e9f1e09352e52093cf25f810 /src
parent44ff23956a286c1e9714aabedcdba4950b5df3ac (diff)
downloadhdf5-d4299d02012fc007ef049abb231bd69eadc9f4dd.zip
hdf5-d4299d02012fc007ef049abb231bd69eadc9f4dd.tar.gz
hdf5-d4299d02012fc007ef049abb231bd69eadc9f4dd.tar.bz2
Brings over some H5F changes (#3278)
Diffstat (limited to 'src')
-rw-r--r--src/H5Fefc.c8
-rw-r--r--src/H5Fint.c33
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fprivate.h26
4 files changed, 21 insertions, 48 deletions
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index ea48054..e7de395 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -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. */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index ee35bdd..27a9075 100644
--- a/src/H5Fint.c
+++ b/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);
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 9f7002f..ead3872 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -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);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 40c6cff..1728f8a 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -445,32 +445,6 @@ typedef struct H5F_t H5F_t;
#endif /* H5F_MODULE */
/* Macros to encode/decode offset/length's for storing in the file */
-#define H5F_ENCODE_OFFSET(f, p, o) \
- switch (H5F_SIZEOF_ADDR(f)) { \
- case 4: \
- UINT32ENCODE(p, o); \
- break; \
- case 8: \
- UINT64ENCODE(p, o); \
- break; \
- case 2: \
- UINT16ENCODE(p, o); \
- break; \
- }
-
-#define H5F_DECODE_OFFSET(f, p, o) \
- switch (H5F_SIZEOF_ADDR(f)) { \
- case 4: \
- UINT32DECODE(p, o); \
- break; \
- case 8: \
- UINT64DECODE(p, o); \
- break; \
- case 2: \
- UINT16DECODE(p, o); \
- break; \
- }
-
#define H5F_ENCODE_LENGTH_LEN(p, l, s) \
switch (s) { \
case 4: \