diff options
author | raylu-hdf <60487644+raylu-hdf@users.noreply.github.com> | 2022-06-29 22:25:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 22:25:27 (GMT) |
commit | 07ea411e8a5eac35f2d798820569235490a527aa (patch) | |
tree | 97b12dfbbf9c8b28c2d6b7b711d2232947c59df8 /tools/src | |
parent | 29eb6f4df5b65948463bb67ab97e6d78cffa0066 (diff) | |
download | hdf5-07ea411e8a5eac35f2d798820569235490a527aa.zip hdf5-07ea411e8a5eac35f2d798820569235490a527aa.tar.gz hdf5-07ea411e8a5eac35f2d798820569235490a527aa.tar.bz2 |
Enabling h5repack to support onion VFD (#1788)
* Enable h5repack to support onion VFD. The input file can take options for onion VFD. But output file doesn't.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index a805b3d..0d3bc9a 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -76,6 +76,17 @@ static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'}, {"dst-vfd-info", require_arg, 'Z'}, {NULL, 0, '\0'}}; +static H5FD_onion_fapl_info_t onion_fa_in_g = { + 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 */ + "input file", /* comment */ +}; + /*------------------------------------------------------------------------- * Function: usage * @@ -875,6 +886,23 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) ret_value = -1; } + /* If the input file uses the onion VFD, get the revision number */ + if (in_vfd_info.u.name && !HDstrcmp(in_vfd_info.u.name, "onion")) { + if (in_vfd_info.info) { + errno = 0; + onion_fa_in_g.revision_num = HDstrtoull(in_vfd_info.info, NULL, 10); + if (errno == ERANGE) { + HDprintf("Invalid onion revision specified for the input file\n"); + usage(h5tools_getprogname()); + exit(EXIT_FAILURE); + } + } + else + onion_fa_in_g.revision_num = 0; + + in_vfd_info.info = &onion_fa_in_g; + } + /* Setup FAPL for input and output file accesses */ if (custom_in_vol || custom_in_vfd) { if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, custom_in_vol ? &in_vol_info : NULL, |