diff options
author | raylu-hdf <60487644+raylu-hdf@users.noreply.github.com> | 2022-04-15 15:47:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-15 15:47:31 (GMT) |
commit | 374f49946f814e1d1cdd871d50ae6fd3fbf443f0 (patch) | |
tree | 4e6edf72ae0725bd3d589cd40ea3042a18832804 /tools/src/h5diff | |
parent | 30dfa364ea33806786a67dc0f243d0e7f262159a (diff) | |
download | hdf5-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>
Diffstat (limited to 'tools/src/h5diff')
-rw-r--r-- | tools/src/h5diff/h5diff_common.c | 57 | ||||
-rw-r--r-- | tools/src/h5diff/h5diff_main.c | 4 |
2 files changed, 55 insertions, 6 deletions
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; |