summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2021-02-08 23:40:52 (GMT)
committerGitHub <noreply@github.com>2021-02-08 23:40:52 (GMT)
commit62025dcac64243d50da295b5651c6ea94552299e (patch)
tree8f7fae9d1f187d173810f08f2d9ce710a5347e5c /src
parentcb7b7257e94c8283c94d8cc8f9f685fca43f2a08 (diff)
downloadhdf5-62025dcac64243d50da295b5651c6ea94552299e.zip
hdf5-62025dcac64243d50da295b5651c6ea94552299e.tar.gz
hdf5-62025dcac64243d50da295b5651c6ea94552299e.tar.bz2
Port PR #291 to 1.10 branch: Allow using virtual datasets in files opened with H5F_CLOSE_SEMI and H5F_CLOSE_STRONG (#323)
* Modify VDS code to always open source files with H5F_CLOSE_WEAK close (#291) degree. Add test cases to VDS test for this, and reduce the amount of output from that test. * Run formatter on H5Dvirtual.c and test/vds.c
Diffstat (limited to 'src')
-rw-r--r--src/H5Dvirtual.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index ac840c2..fc33e67 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -2236,10 +2236,38 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
storage->printf_gap = (hsize_t)0;
/* Retrieve VDS file FAPL to layout */
- if (storage->source_fapl <= 0)
+ if (storage->source_fapl <= 0) {
+ H5P_genplist_t * source_fapl = NULL; /* Source file FAPL */
+ H5F_close_degree_t close_degree = H5F_CLOSE_WEAK; /* Close degree for source files */
+
if ((storage->source_fapl = H5F_get_access_plist(f, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl")
+ /* Get property list pointer */
+ if (NULL == (source_fapl = (H5P_genplist_t *)H5I_object(storage->source_fapl)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+
+ /* Source files must always be opened with H5F_CLOSE_WEAK close degree */
+ if (H5P_set(source_fapl, H5F_ACS_CLOSE_DEGREE_NAME, &close_degree) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ } /* end if */
+#ifndef NDEBUG
+ else {
+ H5P_genplist_t * source_fapl = NULL; /* Source file FAPL */
+ H5F_close_degree_t close_degree; /* Close degree for source files */
+
+ /* Get property list pointer */
+ if (NULL == (source_fapl = (H5P_genplist_t *)H5I_object(storage->source_fapl)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+
+ /* Verify H5F_CLOSE_WEAK close degree is set */
+ if (H5P_get(source_fapl, H5F_ACS_CLOSE_DEGREE_NAME, &close_degree) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree")
+
+ HDassert(close_degree == H5F_CLOSE_WEAK);
+ } /* end else */
+#endif /* NDEBUG */
+
/* Copy DAPL to layout */
if (storage->source_dapl <= 0)
if ((storage->source_dapl = H5P_copy_plist(dapl, FALSE)) < 0)