summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2021-09-29 18:28:12 (GMT)
committerGitHub <noreply@github.com>2021-09-29 18:28:12 (GMT)
commit3da0802c40d58759995916bf9d0880e19f0af44d (patch)
tree809ada78cec1cbaaf6ec2ace5b4429a56d0f6574 /tools/src
parent0fa5836cc5f037dd9f2cdd7f9a1051ddcc1c9ad0 (diff)
downloadhdf5-3da0802c40d58759995916bf9d0880e19f0af44d.zip
hdf5-3da0802c40d58759995916bf9d0880e19f0af44d.tar.gz
hdf5-3da0802c40d58759995916bf9d0880e19f0af44d.tar.bz2
VFD plugins (#602)
* Implement support for loading of Virtual File Drivers as plugins Fix plugin caching for VOL connector and VFD plugins Fix plugin iteration to skip paths that can't be opened * Enable dynamic loading of VFDs with HDF5_DRIVER environment variable * Temporarily disable error reporting during H5F_open double file open * Default to using HDstat in h5_get_file_size for unknown VFDs * Use macros for some environment variables that HDF5 interprets * Update "null" and "ctl testing" VFDs
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5diff/h5diff_common.c56
-rw-r--r--tools/src/h5dump/h5dump.c74
-rw-r--r--tools/src/h5ls/h5ls.c78
-rw-r--r--tools/src/h5perf/perf.c2
-rw-r--r--tools/src/h5perf/pio_engine.c2
-rw-r--r--tools/src/h5perf/sio_engine.c2
-rw-r--r--tools/src/h5repack/h5repack.c4
-rw-r--r--tools/src/h5repack/h5repack_copy.c4
-rw-r--r--tools/src/h5repack/h5repack_main.c88
-rw-r--r--tools/src/h5repack/h5repack_verify.c8
-rw-r--r--tools/src/h5stat/h5stat.c24
-rw-r--r--tools/src/misc/h5mkgrp.c46
12 files changed, 259 insertions, 129 deletions
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index b669087..3d89936 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -48,6 +48,12 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
{"vol-value-2", require_arg, '4'},
{"vol-name-2", require_arg, '5'},
{"vol-info-2", require_arg, '6'},
+ {"vfd-value-1", require_arg, '7'},
+ {"vfd-name-1", require_arg, '8'},
+ {"vfd-info-1", require_arg, '9'},
+ {"vfd-value-2", require_arg, '0'},
+ {"vfd-name-2", require_arg, 'Y'},
+ {"vfd-info-2", require_arg, 'Z'},
{NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
@@ -432,6 +438,38 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char
case '6':
opts->vol_info[1].info_string = H5_optarg;
break;
+
+ case '7':
+ opts->vfd_info[0].type = VFD_BY_VALUE;
+ opts->vfd_info[0].u.value = (H5FD_class_value_t)HDatoi(H5_optarg);
+ opts->custom_vfd[0] = TRUE;
+ break;
+
+ case '8':
+ opts->vfd_info[0].type = VFD_BY_NAME;
+ opts->vfd_info[0].u.name = H5_optarg;
+ opts->custom_vol[0] = TRUE;
+ break;
+
+ case '9':
+ opts->vfd_info[0].info = (const void *)H5_optarg;
+ break;
+
+ case '0':
+ opts->vfd_info[1].type = VFD_BY_VALUE;
+ opts->vfd_info[1].u.value = (H5FD_class_value_t)HDatoi(H5_optarg);
+ opts->custom_vfd[1] = TRUE;
+ break;
+
+ case 'Y':
+ opts->vfd_info[1].type = VFD_BY_NAME;
+ opts->vfd_info[1].u.name = H5_optarg;
+ opts->custom_vfd[1] = TRUE;
+ break;
+
+ case 'Z':
+ opts->vfd_info[1].info = (const void *)H5_optarg;
+ break;
}
}
@@ -657,6 +695,24 @@ usage(void)
PRINTVALSTREAM(rawoutstream,
" --vol-info-2 VOL-specific info to pass to the VOL connector used for\n");
PRINTVALSTREAM(rawoutstream, " opening the second HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-value-1 Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " first HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-name-1 Name of the VFL driver to use for opening the first\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-info-1 VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the first HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-value-2 Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " second HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-name-2 Name of the VFL driver to use for opening the second\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-info-2 VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the second HDF5 file specified\n");
PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
PRINTVALSTREAM(rawoutstream,
" Follow symbolic links (soft links and external links and compare the)\n");
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 36114ba..e6d1de3 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -18,14 +18,15 @@
/* Name of tool */
#define PROGRAMNAME "h5dump"
-static const char *driver_name_g = NULL; /* The driver to open the file with. */
const char * outfname_g = NULL;
static hbool_t doxml_g = FALSE;
static hbool_t useschema_g = TRUE;
static const char *xml_dtd_uri_g = NULL;
static hbool_t use_custom_vol_g = FALSE;
+static hbool_t use_custom_vfd_g = FALSE;
static h5tools_vol_info_t vol_info_g;
+static h5tools_vfd_info_t vfd_info_g;
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -127,6 +128,9 @@ static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'},
{"vol-value", require_arg, '1'},
{"vol-name", require_arg, '2'},
{"vol-info", require_arg, '3'},
+ {"vfd-value", require_arg, '4'},
+ {"vfd-name", require_arg, '5'},
+ {"vfd-info", require_arg, '6'},
{NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
@@ -196,6 +200,14 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream,
" --vol-info VOL-specific info to pass to the VOL connector used for\n");
PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-value Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd-name Name of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-info VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n");
PRINTVALSTREAM(rawoutstream,
@@ -943,7 +955,10 @@ parse_start:
last_was_dset = TRUE;
break;
case 'f':
- driver_name_g = H5_optarg;
+ vfd_info_g.type = VFD_BY_NAME;
+ vfd_info_g.u.name = H5_optarg;
+ vfd_info_g.info = NULL;
+ use_custom_vfd_g = TRUE;
break;
case 'g':
dump_opts.display_all = 0;
@@ -1264,6 +1279,22 @@ end_collect:
vol_info_g.info_string = H5_optarg;
break;
+ case '4':
+ vfd_info_g.type = VFD_BY_VALUE;
+ vfd_info_g.u.value = (H5FD_class_value_t)HDatoi(H5_optarg);
+ use_custom_vfd_g = TRUE;
+ break;
+
+ case '5':
+ vfd_info_g.type = VFD_BY_NAME;
+ vfd_info_g.u.name = H5_optarg;
+ use_custom_vfd_g = TRUE;
+ break;
+
+ case '6':
+ vfd_info_g.info = (const void *)H5_optarg;
+ break;
+
case '?':
default:
usage(h5tools_getprogname());
@@ -1378,40 +1409,9 @@ main(int argc, const char *argv[])
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
- if (driver_name_g != NULL) {
- h5tools_vfd_info_t vfd_info;
-
- vfd_info.info = NULL;
- vfd_info.name = driver_name_g;
-
- if (!HDstrcmp(driver_name_g, drivernames[ROS3_VFD_IDX])) {
-#ifdef H5_HAVE_ROS3_VFD
- vfd_info.info = (void *)&ros3_fa_g;
-#else
- error_msg("Read-Only S3 VFD not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
-#endif
- }
- else if (!HDstrcmp(driver_name_g, drivernames[HDFS_VFD_IDX])) {
-#ifdef H5_HAVE_LIBHDFS
- vfd_info.info = (void *)&hdfs_fa_g;
-#else
- error_msg("The HDFS VFD is not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
-#endif
- }
-
- if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) {
- error_msg("unable to create FAPL for file access\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
- }
- } /* driver name defined */
-
- if (use_custom_vol_g) {
- if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, &vol_info_g, NULL)) < 0) {
+ if (use_custom_vol_g || use_custom_vfd_g) {
+ if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, use_custom_vol_g ? &vol_info_g : NULL,
+ use_custom_vfd_g ? &vfd_info_g : NULL)) < 0) {
error_msg("unable to create FAPL for file access\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -1421,7 +1421,7 @@ main(int argc, const char *argv[])
while (H5_optind < argc) {
fname = HDstrdup(argv[H5_optind++]);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 4392d85..2ec8da2 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -240,6 +240,12 @@ usage(void)
PRINTVALSTREAM(rawoutstream,
" --vol-info VOL-specific info to pass to the VOL connector used for\n");
PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd-value Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd-name Name of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd-info VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n");
@@ -2649,11 +2655,12 @@ main(int argc, const char *argv[])
int argno;
static char root_name[] = "/";
char drivername[50];
- const char * preferred_driver = NULL;
- int err_exit = 0;
- hid_t fapl_id = H5P_DEFAULT;
- hbool_t custom_vol_fapl = FALSE;
+ int err_exit = 0;
+ hid_t fapl_id = H5P_DEFAULT;
+ hbool_t custom_vol_fapl = FALSE;
+ hbool_t custom_vfd_fapl = FALSE;
h5tools_vol_info_t vol_info;
+ h5tools_vfd_info_t vfd_info;
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -2684,8 +2691,9 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- /* Initialize fapl info struct */
+ /* Initialize fapl info structs */
HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t));
+ HDmemset(&vfd_info, 0, sizeof(h5tools_vfd_info_t));
/* Build object display table */
DISPATCH(H5O_TYPE_GROUP, "Group", NULL, NULL);
@@ -2747,9 +2755,6 @@ main(int argc, const char *argv[])
else if (!HDstrcmp(argv[argno], "--string")) {
string_g = TRUE;
}
- else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) {
- preferred_driver = argv[argno] + 6;
- }
else if (!HDstrncmp(argv[argno], "--vol-value=", (size_t)12)) {
vol_info.type = VOL_BY_VALUE;
vol_info.u.value = (H5VL_class_value_t)HDatoi(argv[argno] + 12);
@@ -2763,6 +2768,25 @@ main(int argc, const char *argv[])
else if (!HDstrncmp(argv[argno], "--vol-info=", (size_t)11)) {
vol_info.info_string = argv[argno] + 11;
}
+ else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) {
+ vfd_info.type = VFD_BY_NAME;
+ vfd_info.u.name = argv[argno] + 6;
+ vfd_info.info = NULL;
+ custom_vfd_fapl = TRUE;
+ }
+ else if (!HDstrncmp(argv[argno], "--vfd-value=", (size_t)12)) {
+ vfd_info.type = VFD_BY_VALUE;
+ vfd_info.u.value = (H5FD_class_value_t)HDatoi(argv[argno] + 12);
+ custom_vfd_fapl = TRUE;
+ }
+ else if (!HDstrncmp(argv[argno], "--vfd-name=", (size_t)11)) {
+ vfd_info.type = VFD_BY_NAME;
+ vfd_info.u.name = argv[argno] + 11;
+ custom_vfd_fapl = TRUE;
+ }
+ else if (!HDstrncmp(argv[argno], "--vfd-info=", (size_t)11)) {
+ vfd_info.info = (const void *)(argv[argno] + 11);
+ }
else if (!HDstrncmp(argv[argno], "--width=", (size_t)8)) {
width_g = (int)HDstrtol(argv[argno] + 8, &rest, 0);
@@ -2959,42 +2983,14 @@ main(int argc, const char *argv[])
}
/* Setup a custom fapl for file accesses */
- if (custom_vol_fapl) {
- if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, &vol_info, NULL)) < 0) {
+ if (custom_vol_fapl || custom_vfd_fapl) {
+ if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, custom_vol_fapl ? &vol_info : NULL,
+ custom_vfd_fapl ? &vfd_info : NULL)) < 0) {
error_msg("failed to setup file access property list (fapl) for file\n");
leave(EXIT_FAILURE);
}
}
- if (preferred_driver) {
- h5tools_vfd_info_t vfd_info;
-
- vfd_info.info = NULL;
- vfd_info.name = preferred_driver;
-
- if (!HDstrcmp(preferred_driver, drivernames[ROS3_VFD_IDX])) {
-#ifdef H5_HAVE_ROS3_VFD
- vfd_info.info = (void *)&ros3_fa;
-#else
- HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n");
- leave(EXIT_FAILURE);
-#endif
- }
- else if (!HDstrcmp(preferred_driver, drivernames[HDFS_VFD_IDX])) {
-#ifdef H5_HAVE_LIBHDFS
- vfd_info.info = (void *)&hdfs_fa;
-#else
- HDfprintf(rawerrorstream, "Error: The HDFS VFD is not enabled\n\n");
- leave(EXIT_FAILURE);
-#endif
- }
-
- if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) {
- HDfprintf(rawerrorstream, "Error: Unable to create FAPL for file access\n\n");
- leave(EXIT_FAILURE);
- }
- }
-
/* Each remaining argument is an hdf5 file followed by an optional slash
* and object name.
*
@@ -3019,8 +3015,8 @@ main(int argc, const char *argv[])
file_id = H5I_INVALID_HID;
while (fname && *fname) {
- file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE,
- drivername, sizeof drivername);
+ file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), drivername,
+ sizeof drivername);
if (file_id >= 0) {
if (verbose_g)
diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c
index 83d4ab0..50b18bc 100644
--- a/tools/src/h5perf/perf.c
+++ b/tools/src/h5perf/perf.c
@@ -605,7 +605,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu
* we are using the split driver since both of those
* use the multi VFD under the hood.
*/
- env = HDgetenv("HDF5_DRIVER");
+ env = HDgetenv(HDF5_DRIVER);
#ifdef HDF5_DRIVER
/* Use the environment variable, then the compile-time constant */
if (!env)
diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c
index cac36d7..f890c7d 100644
--- a/tools/src/h5perf/pio_engine.c
+++ b/tools/src/h5perf/pio_engine.c
@@ -2676,7 +2676,7 @@ do_cleanupfile(iotype iot, char *fname)
return;
if (clean_file_g == -1)
- clean_file_g = (getenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0;
+ clean_file_g = (getenv(HDF5_NOCLEANUP) == NULL) ? 1 : 0;
if (clean_file_g) {
switch (iot) {
diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c
index e69a7cd..3ebacc0 100644
--- a/tools/src/h5perf/sio_engine.c
+++ b/tools/src/h5perf/sio_engine.c
@@ -1272,7 +1272,7 @@ do_cleanupfile(iotype iot, char *filename)
hid_t driver;
if (clean_file_g == -1)
- clean_file_g = (HDgetenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0;
+ clean_file_g = (HDgetenv(HDF5_NOCLEANUP) == NULL) ? 1 : 0;
if (clean_file_g) {
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 7cad36b..d75b1cf 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -758,8 +758,8 @@ check_objects(const char *fname, pack_opt_t *options)
* open the file
*-------------------------------------------------------------------------
*/
- if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT),
+ NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 934b4d1..3806a4e 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -81,8 +81,8 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
* open input file
*-------------------------------------------------------------------------
*/
- if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, (size_t)0)) < 0)
+ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT),
+ NULL, (size_t)0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR);
/* get user block size and file space strategy/persist/threshold */
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 3526268..08568cd 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -31,7 +31,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW1:2:3:4:5:6:";
+static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXWY:Z:1:2:3:4:5:6:7:8:9:0:";
static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"block", require_arg, 'b'},
{"compact", require_arg, 'c'},
@@ -68,6 +68,12 @@ static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"dst-vol-value", require_arg, '4'},
{"dst-vol-name", require_arg, '5'},
{"dst-vol-info", require_arg, '6'},
+ {"src-vfd-value", require_arg, '7'},
+ {"src-vfd-name", require_arg, '8'},
+ {"src-vfd-info", require_arg, '9'},
+ {"dst-vfd-value", require_arg, '0'},
+ {"dst-vfd-name", require_arg, 'Y'},
+ {"dst-vfd-info", require_arg, 'Z'},
{NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
@@ -112,6 +118,24 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream,
" --dst-vol-info VOL-specific info to pass to the VOL connector used for\n");
PRINTVALSTREAM(rawoutstream, " opening the output HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --src-vfd-value Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " input HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --src-vfd-name Name of the VFL driver to use for opening the input\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --src-vfd-info VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the input HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --dst-vfd-value Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " output HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --dst-vfd-name Name of the VFL driver to use for opening the output\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --dst-vfd-info VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the output HDF5 file specified\n");
PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n");
PRINTVALSTREAM(rawoutstream,
" This option will take precedence over the options\n");
@@ -486,15 +510,21 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
{
h5tools_vol_info_t in_vol_info;
h5tools_vol_info_t out_vol_info;
- hbool_t custom_in_fapl = FALSE;
- hbool_t custom_out_fapl = FALSE;
- hid_t tmp_fapl = H5I_INVALID_HID;
+ h5tools_vfd_info_t in_vfd_info;
+ h5tools_vfd_info_t out_vfd_info;
+ hbool_t custom_in_vol = FALSE;
+ hbool_t custom_in_vfd = FALSE;
+ hbool_t custom_out_vol = FALSE;
+ hbool_t custom_out_vfd = FALSE;
+ hid_t tmp_fapl = H5I_INVALID_HID;
int bound, opt;
int ret_value = 0;
/* Initialize fapl info structs */
HDmemset(&in_vol_info, 0, sizeof(h5tools_vol_info_t));
HDmemset(&out_vol_info, 0, sizeof(h5tools_vol_info_t));
+ HDmemset(&in_vfd_info, 0, sizeof(h5tools_vfd_info_t));
+ HDmemset(&out_vfd_info, 0, sizeof(h5tools_vfd_info_t));
/* parse command line options */
while (EOF != (opt = H5_get_option(argc, argv, s_opts, l_opts))) {
@@ -741,13 +771,13 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
case '1':
in_vol_info.type = VOL_BY_VALUE;
in_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg);
- custom_in_fapl = TRUE;
+ custom_in_vol = TRUE;
break;
case '2':
in_vol_info.type = VOL_BY_NAME;
in_vol_info.u.name = H5_optarg;
- custom_in_fapl = TRUE;
+ custom_in_vol = TRUE;
break;
case '3':
@@ -757,19 +787,51 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
case '4':
out_vol_info.type = VOL_BY_VALUE;
out_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg);
- custom_out_fapl = TRUE;
+ custom_out_vol = TRUE;
break;
case '5':
out_vol_info.type = VOL_BY_NAME;
out_vol_info.u.name = H5_optarg;
- custom_out_fapl = TRUE;
+ custom_out_vol = TRUE;
break;
case '6':
out_vol_info.info_string = H5_optarg;
break;
+ case '7':
+ in_vfd_info.type = VFD_BY_VALUE;
+ in_vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg);
+ custom_in_vfd = TRUE;
+ break;
+
+ case '8':
+ in_vfd_info.type = VFD_BY_NAME;
+ in_vfd_info.u.name = H5_optarg;
+ custom_in_vfd = TRUE;
+ break;
+
+ case '9':
+ in_vfd_info.info = (const void *)H5_optarg;
+ break;
+
+ case '0':
+ out_vfd_info.type = VFD_BY_VALUE;
+ out_vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg);
+ custom_out_vfd = TRUE;
+ break;
+
+ case 'Y':
+ out_vfd_info.type = VFD_BY_NAME;
+ out_vfd_info.u.name = H5_optarg;
+ custom_out_vfd = TRUE;
+ break;
+
+ case 'Z':
+ out_vfd_info.info = (const void *)H5_optarg;
+ break;
+
default:
break;
} /* end switch */
@@ -803,8 +865,9 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
}
/* Setup FAPL for input and output file accesses */
- if (custom_in_fapl) {
- if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, &in_vol_info, NULL)) < 0) {
+ if (custom_in_vol || custom_in_vfd) {
+ if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, custom_in_vol ? &in_vol_info : NULL,
+ custom_in_vfd ? &in_vfd_info : NULL)) < 0) {
error_msg("failed to setup FAPL for input file\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
@@ -823,8 +886,9 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
options->fin_fapl = tmp_fapl;
}
- if (custom_out_fapl) {
- if ((tmp_fapl = h5tools_get_fapl(options->fout_fapl, &out_vol_info, NULL)) < 0) {
+ if (custom_out_vol || custom_out_vfd) {
+ if ((tmp_fapl = h5tools_get_fapl(options->fout_fapl, custom_out_vol ? &out_vol_info : NULL,
+ custom_out_vfd ? &out_vfd_info : NULL)) < 0) {
error_msg("failed to setup FAPL for output file\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 0542d03..8c54dde 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -378,11 +378,11 @@ h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t
*-------------------------------------------------------------------------
*/
/* Open the files */
- if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl,
- (fname1_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, (fname1_fapl != H5P_DEFAULT), NULL, 0)) <
+ 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
- if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl,
- (fname2_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, (fname2_fapl != H5P_DEFAULT), NULL, 0)) <
+ 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index efc80b6..d745c0f 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -1702,25 +1702,9 @@ main(int argc, const char *argv[])
if (drivername) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = drivername;
-
- if (!HDstrcmp(drivername, drivernames[ROS3_VFD_IDX])) {
-#ifdef H5_HAVE_ROS3_VFD
- vfd_info.info = (void *)&ros3_fa;
-#else
- error_msg("Read-Only S3 VFD not enabled.\n");
- goto done;
-#endif
- }
- else if (!HDstrcmp(drivername, drivernames[HDFS_VFD_IDX])) {
-#ifdef H5_HAVE_LIBHDFS
- vfd_info.info = (void *)&hdfs_fa;
-#else
- error_msg("HDFS VFD not enabled.\n");
- goto done;
-#endif
- }
+ vfd_info.type = VFD_BY_NAME;
+ vfd_info.info = NULL;
+ vfd_info.u.name = drivername;
if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) {
error_msg("Unable to create FAPL for file access\n");
@@ -1737,7 +1721,7 @@ main(int argc, const char *argv[])
HDprintf("Filename: %s\n", fname);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index a85ee4d..1e66fce 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -26,7 +26,8 @@ static const char * s_opts = "hlpvV";
static struct h5_long_options l_opts[] = {
{"help", no_arg, 'h'}, {"latest", no_arg, 'l'}, {"parents", no_arg, 'p'},
{"verbose", no_arg, 'v'}, {"version", no_arg, 'V'}, {"vol-value", require_arg, '1'},
- {"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, {NULL, 0, '\0'}};
+ {"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, {"vfd-value", require_arg, '4'},
+ {"vfd-name", require_arg, '5'}, {"vfd-info", require_arg, '6'}, {NULL, 0, '\0'}};
/* Command line parameter settings */
typedef struct mkgrp_opt_t {
@@ -105,6 +106,14 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream,
" --vol-info VOL-specific info to pass to the VOL connector used for\n");
PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-value Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd-name Name of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-info VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n");
PRINTVALSTREAM(rawoutstream, "\n");
} /* end usage() */
@@ -126,8 +135,10 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
{
int opt; /* Option from command line */
size_t curr_group; /* Current group name to copy */
- hbool_t custom_fapl = FALSE;
+ hbool_t custom_vol = FALSE;
+ hbool_t custom_vfd = FALSE;
h5tools_vol_info_t vol_info;
+ h5tools_vfd_info_t vfd_info;
hid_t tmp_fapl_id = H5I_INVALID_HID;
/* Check for empty command line */
@@ -136,8 +147,9 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
leave(EXIT_SUCCESS);
}
- /* Initialize fapl info struct */
+ /* Initialize fapl info structs */
HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t));
+ HDmemset(&vfd_info, 0, sizeof(h5tools_vfd_info_t));
/* Parse command line options */
while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
@@ -172,19 +184,35 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
case '1':
vol_info.type = VOL_BY_VALUE;
vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg);
- custom_fapl = TRUE;
+ custom_vol = TRUE;
break;
case '2':
vol_info.type = VOL_BY_NAME;
vol_info.u.name = H5_optarg;
- custom_fapl = TRUE;
+ custom_vol = TRUE;
break;
case '3':
vol_info.info_string = H5_optarg;
break;
+ case '4':
+ vfd_info.type = VFD_BY_VALUE;
+ vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg);
+ custom_vfd = TRUE;
+ break;
+
+ case '5':
+ vfd_info.type = VFD_BY_NAME;
+ vfd_info.u.name = H5_optarg;
+ custom_vfd = TRUE;
+ break;
+
+ case '6':
+ vfd_info.info = (const void *)H5_optarg;
+ break;
+
/* Bad command line argument */
default:
usage(h5tools_getprogname());
@@ -223,8 +251,9 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
}
/* Setup a custom fapl for file accesses */
- if (custom_fapl) {
- if ((tmp_fapl_id = h5tools_get_fapl(options->fapl_id, &vol_info, NULL)) < 0) {
+ if (custom_vol || custom_vfd) {
+ if ((tmp_fapl_id = h5tools_get_fapl(options->fapl_id, custom_vol ? &vol_info : NULL,
+ custom_vfd ? &vfd_info : NULL)) < 0) {
error_msg("failed to setup file access property list (fapl) for file\n");
leave(EXIT_FAILURE);
}
@@ -296,7 +325,8 @@ main(int argc, const char *argv[])
}
/* Attempt to open an existing HDF5 file first */
- fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id, FALSE, NULL, 0);
+ fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id, (params_g.fapl_id != H5P_DEFAULT),
+ NULL, 0);
/* If we couldn't open an existing file, try creating file */
/* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */