summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraylu-hdf <60487644+raylu-hdf@users.noreply.github.com>2022-04-15 15:47:31 (GMT)
committerGitHub <noreply@github.com>2022-04-15 15:47:31 (GMT)
commit374f49946f814e1d1cdd871d50ae6fd3fbf443f0 (patch)
tree4e6edf72ae0725bd3d589cd40ea3042a18832804
parent30dfa364ea33806786a67dc0f243d0e7f262159a (diff)
downloadhdf5-374f49946f814e1d1cdd871d50ae6fd3fbf443f0.zip
hdf5-374f49946f814e1d1cdd871d50ae6fd3fbf443f0.tar.gz
hdf5-374f49946f814e1d1cdd871d50ae6fd3fbf443f0.tar.bz2
Changed the options for the Onion VFD to use the generic VFD options in h5diff and h5dump (#1643)
* Changed the options for the Onion VFD to use the generic VFD options in h5diff and h5dump. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
-rw-r--r--tools/lib/h5diff.c17
-rw-r--r--tools/src/h5diff/h5diff_common.c57
-rw-r--r--tools/src/h5diff/h5diff_main.c4
-rw-r--r--tools/src/h5dump/h5dump.c32
-rw-r--r--tools/test/h5diff/testh5diff.sh.in6
-rw-r--r--tools/test/h5dump/testh5dump.sh.in6
6 files changed, 99 insertions, 23 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index debd54a..3de0683 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -648,8 +648,15 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
*-------------------------------------------------------------------------
*/
/* open file 1 */
+ if (opts->vfd_info[0].u.name) {
+ if ((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &(opts->vfd_info[0]))) < 0) {
+ parallel_print("h5diff: unable to create fapl for input file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
+ }
+ }
+
if (opts->custom_vol[0] || opts->custom_vfd[0]) {
- if ((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, opts->custom_vol[0] ? &(opts->vol_info[0]) : NULL,
+ if ((fapl1_id = h5tools_get_fapl(fapl1_id, opts->custom_vol[0] ? &(opts->vol_info[0]) : NULL,
opts->custom_vfd[0] ? &(opts->vfd_info[0]) : NULL)) < 0) {
parallel_print("h5diff: unable to create fapl for input file\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
@@ -664,9 +671,15 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_DEBUG("file1_id = %s", fname1);
/* open file 2 */
+ if (opts->vfd_info[1].u.name) {
+ if ((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &(opts->vfd_info[1]))) < 0) {
+ parallel_print("h5diff: unable to create fapl for output file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
+ }
+ }
if (opts->custom_vol[1] || opts->custom_vfd[1]) {
- if ((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, opts->custom_vol[1] ? &(opts->vol_info[1]) : NULL,
+ if ((fapl2_id = h5tools_get_fapl(fapl2_id, opts->custom_vol[1] ? &(opts->vol_info[1]) : NULL,
opts->custom_vfd[1] ? &(opts->vfd_info[1]) : NULL)) < 0) {
parallel_print("h5diff: unable to create fapl for output file\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 2619a9d..6bfdac7 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -56,6 +56,28 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
{"vfd-info-2", require_arg, 'Z'},
{NULL, 0, '\0'}};
+static H5FD_onion_fapl_info_t onion_fa_g_1 = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5P_DEFAULT, /* backing_fapl_id */
+ 32, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation_flags */
+ "first input file", /* comment */
+};
+
+static H5FD_onion_fapl_info_t onion_fa_g_2 = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5P_DEFAULT, /* backing_fapl_id */
+ 32, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation_flags */
+ "second input file", /* comment */
+};
+
/*-------------------------------------------------------------------------
* Function: check_options
*
@@ -445,37 +467,60 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
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;
+ opts->vfd_info[0].info = 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;
+ opts->vfd_info[1].info = H5_optarg;
break;
}
}
+ /* Copy the VFD driver info for both the files if it's the onion file */
+ if (opts->vfd_info[0].u.name) {
+ if (!HDstrcmp(opts->vfd_info[0].u.name, "onion")) {
+ if (opts->vfd_info[0].info)
+ onion_fa_g_1.revision_id = HDatoi((char *)(opts->vfd_info[0].info));
+ else
+ onion_fa_g_1.revision_id = 0;
+
+ /* Need to free this memory */
+ opts->vfd_info[0].info = HDmalloc(sizeof(H5FD_onion_fapl_info_t));
+ HDmemcpy(opts->vfd_info[0].info, &onion_fa_g_1, sizeof(H5FD_onion_fapl_info_t));
+ }
+ } /* driver name defined */
+
+ if (opts->vfd_info[1].u.name) {
+ if (!HDstrcmp(opts->vfd_info[1].u.name, "onion")) {
+ if (opts->vfd_info[1].info)
+ onion_fa_g_2.revision_id = HDatoi((char *)(opts->vfd_info[1].info));
+ else
+ onion_fa_g_2.revision_id = 0;
+
+ /* Need to free this memory */
+ opts->vfd_info[1].info = HDmalloc(sizeof(H5FD_onion_fapl_info_t));
+ HDmemcpy(opts->vfd_info[1].info, &onion_fa_g_2, sizeof(H5FD_onion_fapl_info_t));
+ }
+ } /* driver name defined */
+
/* check options */
check_options(opts);
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index 2a43b56..7b39104 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -127,6 +127,10 @@ main(int argc, char *argv[])
HDfree(opts.sset[i]->count.data);
if (opts.sset[i]->block.data)
HDfree(opts.sset[i]->block.data);
+ if (opts.vfd_info[0].info)
+ HDfree(opts.vfd_info[1].info);
+ if (opts.vfd_info[1].info)
+ HDfree(opts.vfd_info[1].info);
HDfree(opts.sset[i]);
opts.sset[i] = NULL;
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 8bbd271..bb0863a 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -57,11 +57,10 @@ static H5FD_onion_fapl_info_t onion_fa_g = {
32, /* page_size */
H5FD_ONION_STORE_TARGET_ONION, /* store_target */
H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
- 0, /* force_write_open */
- 0, /* creation_flags */
- "indoor speaking voices", /* comment */
+ 0, /* force_write_open */
+ 0, /* creation_flags */
+ "input file", /* comment */
};
-static uint64_t onion_revision_g = UINT64_MAX;
/* module-scoped variables for XML option */
#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
@@ -1230,11 +1229,6 @@ end_collect:
else
enable_error_stack = 1;
break;
- case 'F':
- /* TODO: Convert to strtoumax */
- onion_revision_g = (uint64_t)HDatol(H5_optarg);
- HDprintf("Using revision %" PRIu64 "\n", onion_revision_g);
- break;
case 'C':
dump_opts.disable_compact_subset = TRUE;
break;
@@ -1318,6 +1312,22 @@ end_collect:
}
}
+ /* Copy the VFD driver info for the input file if it's the onion file */
+ if (vfd_info_g.u.name) {
+ if (!HDstrcmp(vfd_info_g.u.name, "onion")) {
+ if (vfd_info_g.info)
+ onion_fa_g.revision_id = HDatoi((char *)(vfd_info_g.info));
+ else
+ onion_fa_g.revision_id = 0;
+
+ HDprintf("Using revision %" PRIu64 "\n", onion_fa_g.revision_id);
+
+ /* Need to free this memory */
+ vfd_info_g.info = HDmalloc(sizeof(H5FD_onion_fapl_info_t));
+ HDmemcpy(vfd_info_g.info, &onion_fa_g, sizeof(H5FD_onion_fapl_info_t));
+ }
+ } /* driver name defined */
+
parse_end:
/* check for file name to be processed */
if (argc <= H5_optind) {
@@ -1625,6 +1635,10 @@ done:
/* Free tables for objects */
table_list_free();
+ /* Free the VFD info */
+ if (vfd_info_g.info)
+ HDfree(vfd_info_g.info);
+
if (fapl_id != H5P_DEFAULT && 0 < H5Pclose(fapl_id)) {
error_msg("Can't close fapl entry\n");
h5tools_setstatus(EXIT_FAILURE);
diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in
index 093d5b9..5234e45 100644
--- a/tools/test/h5diff/testh5diff.sh.in
+++ b/tools/test/h5diff/testh5diff.sh.in
@@ -1226,9 +1226,9 @@ TOOLTEST h5diff_v3.txt -c 1_vds.h5 2_vds.h5
# ##############################################################################
# Onion VFD tests
# ##############################################################################
-TOOLTEST h5diff_900.txt -r -v --vfd-name-1 onion --vfd-value-1 0 --vfd-name-2 onion --vfd-value-2 1 h5diff_onion_objs.h5 h5diff_onion_objs.h5
-TOOLTEST h5diff_901.txt -r -v --vfd-name-1 onion --vfd-value-1 0 --vfd-name-2 onion --vfd-value-2 1 h5diff_onion_dset_ext.h5 h5diff_onion_dset_ext.h5
-TOOLTEST h5diff_902.txt -r -v --vfd-name-1 onion --vfd-value-1 0 --vfd-name-2 onion --vfd-value-2 1 h5diff_onion_dset_1d.h5 h5diff_onion_dset_1d.h5
+TOOLTEST h5diff_900.txt -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_objs.h5 h5diff_onion_objs.h5
+TOOLTEST h5diff_901.txt -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_dset_ext.h5 h5diff_onion_dset_ext.h5
+TOOLTEST h5diff_902.txt -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_dset_1d.h5 h5diff_onion_dset_1d.h5
# ##############################################################################
# # END
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index 7389951..a9d7b6a 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -1496,9 +1496,9 @@ TOOLTEST_FAIL tCVE_2018_11206_fill_old.h5
TOOLTEST_FAIL tCVE_2018_11206_fill_new.h5
# test Onion VFD
-TOOLTEST tst_onion_objs.ddl --enable-error-stack -f onion -F 3 tst_onion_objs.h5
-TOOLTEST tst_onion_dset_ext.ddl --enable-error-stack -f onion -F 1 tst_onion_dset_ext.h5
-TOOLTEST tst_onion_dset_1d.ddl --enable-error-stack -f onion -F 1 tst_onion_dset_1d.h5
+TOOLTEST tst_onion_objs.ddl --enable-error-stack --vfd-name onion --vfd-info 3 tst_onion_objs.h5
+TOOLTEST tst_onion_dset_ext.ddl --enable-error-stack --vfd-name onion --vfd-info 1 tst_onion_dset_ext.h5
+TOOLTEST tst_onion_dset_1d.ddl --enable-error-stack --vfd-name onion --vfd-info 1 tst_onion_dset_1d.h5
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR