From b7c8061505ce3971c16bcaf0e96e6964b3ae9dc4 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Tue, 25 Apr 2023 12:04:17 -0500 Subject: Allow H5P_DEFAULT in H5Pget_vol_cap_flags and H5Pget_vol_id (#2807) --- release_docs/RELEASE.txt | 6 ++++++ src/H5Pfapl.c | 6 ++++++ test/vol.c | 26 +++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8bc90b8..34ca003 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -151,6 +151,12 @@ Bug Fixes since HDF5-1.14.0 release =================================== Library ------- + - Fixed H5Pget_vol_cap_flags and H5Pget_vol_id to accept H5P_DEFAULT + + H5Pget_vol_cap_flags and H5Pget_vol_id were updated to correctly + accept H5P_DEFAULT for the 'plist_id' FAPL parameter. Previously, + they would fail if provided with H5P_DEFAULT as the FAPL. + - Fixed ROS3 VFD anonymous credential usage with h5dump and h5ls ROS3 VFD anonymous credential functionality became broken in h5dump diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 8e9b680..84d2522 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -6147,6 +6147,9 @@ H5Pget_vol_id(hid_t plist_id, hid_t *vol_id /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", plist_id, vol_id); + if (H5P_DEFAULT == plist_id) + plist_id = H5P_FILE_ACCESS_DEFAULT; + /* Get property list for ID */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -6263,6 +6266,9 @@ H5Pget_vol_cap_flags(hid_t plist_id, uint64_t *cap_flags) /* Get the 'cap_flags' from the connector */ if (cap_flags) { + if (H5P_DEFAULT == plist_id) + plist_id = H5P_FILE_ACCESS_DEFAULT; + if (TRUE == H5P_isa_class(plist_id, H5P_FILE_ACCESS)) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ diff --git a/test/vol.c b/test/vol.c index 27ffdcd..29bbb06 100644 --- a/test/vol.c +++ b/test/vol.c @@ -2227,9 +2227,10 @@ test_vol_cap_flags(void) hid_t fapl_id = H5I_INVALID_HID; hid_t vol_id = H5I_INVALID_HID; uint64_t vol_cap_flags = H5VL_CAP_FLAG_NONE; + char *vol_env = NULL; H5VL_pass_through_info_t passthru_info; - TESTING("VOL capacity flags"); + TESTING("VOL capability flags"); /* Register a fake VOL */ if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) @@ -2251,6 +2252,29 @@ test_vol_cap_flags(void) if (vol_cap_flags & H5VL_CAP_FLAG_ATTR_BASIC) TEST_ERROR; + /* If using the native VOL by default, check flags again with H5P_DEFAULT */ + vol_env = HDgetenv(HDF5_VOL_CONNECTOR); + if (!vol_env || (0 == HDstrcmp(vol_env, "native"))) { + H5VL_class_t *cls; + hid_t connector_id; + + if (H5Pget_vol_id(H5P_DEFAULT, &connector_id) < 0) + TEST_ERROR; + if (NULL == (cls = H5I_object(connector_id))) + TEST_ERROR; + + vol_cap_flags = H5VL_CAP_FLAG_NONE; + + if (H5Pget_vol_cap_flags(H5P_DEFAULT, &vol_cap_flags) < 0) + TEST_ERROR; + + if (vol_cap_flags != cls->cap_flags) + TEST_ERROR; + + if (H5VLclose(connector_id) < 0) + TEST_ERROR; + } + /* Stack the [internal] passthrough VOL connector on top of the fake connector */ passthru_info.under_vol_id = vol_id; passthru_info.under_vol_info = NULL; -- cgit v0.12