summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <qkoziol@amazon.com>2023-01-09 21:49:29 (GMT)
committerGitHub <noreply@github.com>2023-01-09 21:49:29 (GMT)
commit90d20764f417a1eb717293256634570fdc6f803d (patch)
tree0235a4a552abb7dea4f5dad54fd80c42481771db /tools
parent54590f3ebd0a14083281b7b8b880a246e1389b43 (diff)
downloadhdf5-90d20764f417a1eb717293256634570fdc6f803d.zip
hdf5-90d20764f417a1eb717293256634570fdc6f803d.tar.gz
hdf5-90d20764f417a1eb717293256634570fdc6f803d.tar.bz2
Determine if native connector is terminal (#2397)
* Correct concurrency bugs when running tests, along with a bugfix & small warning cleanup. * Committing clang-format changes * Allow spaces (and tabs) in VOL connector info string from environment variable. * Parse connector name from HDF5_PLUGIN_PATH environment variable better * Correct H5VLquery_optional to use H5VL routine instead of H5I. Also add an error message to the failure return value from not finding a plugin. * Play nice with existing plugin paths * Use API routine to determine if native connector is terminal. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: AWS ParallelCluster user <ec2-user@ip-10-0-0-65.us-east-2.compute.internal> Co-authored-by: Koziol <qkoziol@88665a374c70.ant.amazon.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5tools.c18
-rw-r--r--tools/lib/h5tools.h2
2 files changed, 12 insertions, 8 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 078ae5a..189aafd 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -817,10 +817,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-h5tools_get_vfd_name(hid_t fapl_id, char *drivername, size_t drivername_size)
+h5tools_get_vfd_name(hid_t fid, hid_t fapl_id, char *drivername, size_t drivername_size)
{
- hid_t fapl_vol_id = H5I_INVALID_HID;
- herr_t ret_value = SUCCEED;
+ hid_t fapl_vol_id = H5I_INVALID_HID;
+ hbool_t is_native = FALSE;
+ herr_t ret_value = SUCCEED;
if (fapl_id < 0)
H5TOOLS_GOTO_ERROR(FAIL, "invalid FAPL");
@@ -839,9 +840,11 @@ h5tools_get_vfd_name(hid_t fapl_id, char *drivername, size_t drivername_size)
if (H5Pget_vol_id(fapl_id, &fapl_vol_id) < 0)
H5TOOLS_ERROR(FAIL, "failed to retrieve VOL ID from FAPL");
- /* TODO: For now, we have no way of determining if an arbitrary
- * VOL connector is native-terminal. */
- if (fapl_vol_id == H5VL_NATIVE || fapl_vol_id == H5VL_PASSTHRU) {
+ /* Query if the file ID is native-terminal */
+ if (H5VLobject_is_native(fid, &is_native) < 0)
+ H5TOOLS_ERROR(FAIL, "failed to determine if file ID is native-terminal");
+
+ if (is_native) {
const char *driver_name;
hid_t driver_id;
@@ -1072,7 +1075,8 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_spec
done:
/* Save the driver name if using a native-terminal VOL connector */
if (drivername && drivername_size && ret_value >= 0)
- if (used_fapl_id >= 0 && h5tools_get_vfd_name(used_fapl_id, drivername, drivername_size) < 0)
+ if (used_fapl_id >= 0 &&
+ h5tools_get_vfd_name(ret_value, used_fapl_id, drivername, drivername_size) < 0)
H5TOOLS_ERROR(H5I_INVALID_HID, "failed to retrieve name of VFD used to open file");
if (tmp_fapl_id >= 0)
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 2082f2d..753a83b 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -667,7 +667,7 @@ H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
H5TOOLS_DLL hid_t h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info,
h5tools_vfd_info_t *vfd_info);
-H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fapl_id, char *drivername, size_t drivername_size);
+H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fid, hid_t fapl_id, char *drivername, size_t drivername_size);
H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, hbool_t use_specific_driver,
char *drivername, size_t drivername_size);
H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type);