summaryrefslogtreecommitdiffstats
path: root/src/H5Fint.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-10-19 22:30:57 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-10-19 22:30:57 (GMT)
commit1d3b4f6ac9075a2f6ee0c7055e7b5763c346eb78 (patch)
tree9587bc673aead454d70ae026e32a0a970a015ef5 /src/H5Fint.c
parent8a391887be263e0ba7f1ba659dcf6559b5a5e01a (diff)
downloadhdf5-1d3b4f6ac9075a2f6ee0c7055e7b5763c346eb78.zip
hdf5-1d3b4f6ac9075a2f6ee0c7055e7b5763c346eb78.tar.gz
hdf5-1d3b4f6ac9075a2f6ee0c7055e7b5763c346eb78.tar.bz2
Moved the 'cache image + SWMR' check from H5Fcreate/open to H5F_open.
Prep for the VOL merge.
Diffstat (limited to 'src/H5Fint.c')
-rw-r--r--src/H5Fint.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 4c5e00e..4333e93 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1186,6 +1186,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
H5F_t *ret_value = NULL; /*actual return value */
char *lock_env_var = NULL;/*env var pointer */
hbool_t use_file_locking; /*read from env var */
+ hbool_t ci_load = FALSE; /* whether MDC ci load requested */
+ hbool_t ci_write = FALSE; /* whether MDC CI write requested */
+ hbool_t ci_swmr_fail = FALSE; /* set w/ SWMR + cache image */
FUNC_ENTER_NOAPI(NULL)
@@ -1490,13 +1493,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
} /* end else */
} /* end if set_flag */
+ /* Check to see if both SWMR and cache image are requested. Fail if so */
+ if(H5C_cache_image_status(file, &ci_load, &ci_write) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status")
+ if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) {
+ ci_swmr_fail = TRUE;
+ HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't have both SWMR and cache image")
+ }
+
/* Success */
ret_value = file;
done:
- if((NULL == ret_value) && file)
+ if(ci_swmr_fail) {
+ if(H5F_try_close(file, NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
+ }
+ else if((NULL == ret_value) && file) {
if(H5F__dest(file, meta_dxpl_id, raw_dxpl_id, FALSE) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_open() */