diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2021-02-08 23:35:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 23:35:01 (GMT) |
commit | f61576a67d190104b01accc7b6485e5f3773ee66 (patch) | |
tree | 1fd3c2f3f7c6aca1b58d902d8a5919941a7d914f /src | |
parent | 21e1a4e592dd0294a8707694b1806b0d052a6f06 (diff) | |
download | hdf5-f61576a67d190104b01accc7b6485e5f3773ee66.zip hdf5-f61576a67d190104b01accc7b6485e5f3773ee66.tar.gz hdf5-f61576a67d190104b01accc7b6485e5f3773ee66.tar.bz2 |
Port PR 291 to 1.12 branch: Allow using virtual datasets in files opened with H5F_CLOSE_SEMI and H5F_CLOSE_STRONG (#322)
* 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
* Run formatter on test/vds.c
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dvirtual.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 2588d1c..229834e 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) |