summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump
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/h5dump
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/h5dump')
-rw-r--r--tools/src/h5dump/h5dump.c74
1 files changed, 37 insertions, 37 deletions
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);