summaryrefslogtreecommitdiffstats
path: root/src/H5Dvirtual.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2021-01-30 22:47:23 (GMT)
committerGitHub <noreply@github.com>2021-01-30 22:47:23 (GMT)
commitddd799282f5a921c8d507838e48744ad2c377269 (patch)
tree0ee2fac7ab4a0135407fda2ae3d215a3e6ceedc9 /src/H5Dvirtual.c
parent4869307bd67092ff67fd9de2a66980495434f26e (diff)
downloadhdf5-ddd799282f5a921c8d507838e48744ad2c377269.zip
hdf5-ddd799282f5a921c8d507838e48744ad2c377269.tar.gz
hdf5-ddd799282f5a921c8d507838e48744ad2c377269.tar.bz2
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.
Diffstat (limited to 'src/H5Dvirtual.c')
-rw-r--r--src/H5Dvirtual.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index f8b5a53..fb27b89 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -2237,10 +2237,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)