summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src/h5repack')
-rw-r--r--tools/src/h5repack/h5repack.c5
-rw-r--r--tools/src/h5repack/h5repack.h4
-rw-r--r--tools/src/h5repack/h5repack_copy.c82
-rw-r--r--tools/src/h5repack/h5repack_main.c208
-rw-r--r--tools/src/h5repack/h5repack_verify.c22
5 files changed, 250 insertions, 71 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 8eeaa0e..081bdcd 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -79,6 +79,8 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
options->layout_g = H5D_LAYOUT_ERROR;
options->low_bound = H5F_LIBVER_EARLIEST;
options->high_bound = H5F_LIBVER_LATEST;
+ options->fin_fapl = H5P_DEFAULT;
+ options->fout_fapl = H5P_DEFAULT;
for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
options->filter_g[n].filtn = -1;
@@ -751,7 +753,8 @@ check_objects(const char* fname, pack_opt_t *options)
* open the file
*-------------------------------------------------------------------------
*/
- if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0)
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl,
+ (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index 52ecb0e..caa1166 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -114,6 +114,8 @@ typedef struct {
hbool_t latest; /*pack file with the latest file format */
H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
+ hid_t fin_fapl; /* FAPL to use for opening the input file */
+ hid_t fout_fapl; /* FAPL to use for opening/creating the output file */
int grp_compact; /* Set the maximum number of links to store as header messages in the group */
int grp_indexed; /* Set the minimum number of links to store in the indexed format */
int msg_size[8]; /* Minimum size of shared messages: dataspace,
@@ -151,7 +153,7 @@ int h5repack_addlayout(const char* str, pack_opt_t *options);
int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest);
int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
-int h5repack_cmp_pl(const char *fname1, const char *fname2);
+int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl);
/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
* and struct named_dt_t were located in h5repack_copy.c as static prior to
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 1044244..ae93b30 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -67,7 +67,6 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
hid_t grp_in = H5I_INVALID_HID; /* group ID */
hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
- hid_t fapl = H5P_DEFAULT; /* file access property list ID */
trav_table_t *travt = NULL;
hsize_t ub_size = 0; /* size of user block */
H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
@@ -85,7 +84,8 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
* open input file
*-------------------------------------------------------------------------
*/
- if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0)
+ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl,
+ (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, 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 */
@@ -122,12 +122,14 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
if(options->latest)
options->low_bound = options->high_bound = H5F_LIBVER_LATEST;
+
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list");
+ if (options->fout_fapl == H5P_DEFAULT)
+ if ((options->fout_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list");
/* It can be default, latest or other settings by users */
- if(H5Pset_libver_bounds(fapl, options->low_bound, options->high_bound) < 0)
+ if(H5Pset_libver_bounds(options->fout_fapl, options->low_bound, options->high_bound) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_libver_bounds failed to set format version bounds");
/* Check if we need to create a non-default file creation property list */
@@ -218,12 +220,12 @@ print_user_block(fnamein, fidin);
*/
if (options->alignment > 0) {
/* either use the FAPL already created or create a new one */
- if (fapl == H5P_DEFAULT)
+ if (options->fout_fapl == H5P_DEFAULT)
/* create a file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((options->fout_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list");
- if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
+ if (H5Pset_alignment(options->fout_fapl, options->threshold, options->alignment) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_alignment failed to set alignment");
}
@@ -233,12 +235,12 @@ print_user_block(fnamein, fidin);
*/
if (options->meta_block_size > 0) {
/* either use the FAPL already created or create a new one */
- if (fapl == H5P_DEFAULT)
+ if (options->fout_fapl == H5P_DEFAULT)
/* create a file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((options->fout_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list");
- if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0)
+ if (H5Pset_meta_block_size(options->fout_fapl, options->meta_block_size) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_meta_block_size failed to set metadata block size");
}
@@ -297,7 +299,7 @@ print_user_block(fnamein, fidin);
if (options->verbose)
HDprintf("Making new file ...\n");
- if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, options->fout_fapl)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fcreate could not create file <%s>:", fnameout);
/*-------------------------------------------------------------------------
@@ -352,7 +354,6 @@ done:
H5E_BEGIN_TRY {
H5Pclose(fcpl_in);
H5Pclose(gcpl_in);
- H5Pclose(fapl);
H5Pclose(fcpl);
H5Gclose(grp_in);
H5Fclose(fidin);
@@ -702,11 +703,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
break;
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_DATASET
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_DATASET
+ *-------------------------------------------------------------------------
+ */
case H5TRAV_TYPE_DATASET:
+ {
+ hbool_t use_h5ocopy;
+
has_filter = 0;
req_filter = 0;
@@ -764,9 +768,47 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
* otherwise we do a copy using H5Ocopy
*-------------------------------------------------------------------------
*/
- if (options->op_tbl->nelems || options->all_filter == 1
- || options->all_layout == 1 || is_ref || is_named) {
+ use_h5ocopy = !(options->op_tbl->nelems || options->all_filter == 1
+ || options->all_layout == 1 || is_ref || is_named);
+
+ /*
+ * Check if we are using different source and destination VOL connectors.
+ * In this case, we currently have to avoid usage of H5Ocopy since it
+ * doesn't support this.
+ */
+ if (use_h5ocopy && (options->fin_fapl != H5P_DEFAULT || options->fout_fapl != H5P_DEFAULT)) {
+ hid_t in_vol_id;
+ hid_t out_vol_id;
+ hid_t default_vol_id;
+
+ if (H5Pget_vol_id(H5P_FILE_ACCESS_DEFAULT, &default_vol_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_vol_id failed");
+
+ if (options->fin_fapl == H5P_DEFAULT)
+ in_vol_id = default_vol_id;
+ else
+ if (H5Pget_vol_id(options->fin_fapl, &in_vol_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_vol_id failed");
+ if (options->fout_fapl == H5P_DEFAULT)
+ out_vol_id = default_vol_id;
+ else
+ if (H5Pget_vol_id(options->fout_fapl, &out_vol_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_vol_id failed");
+
+ if (in_vol_id != out_vol_id)
+ use_h5ocopy = FALSE;
+
+ if (in_vol_id != default_vol_id)
+ if (H5VLclose(in_vol_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5VLclose failed");
+ if (out_vol_id != default_vol_id)
+ if (H5VLclose(out_vol_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5VLclose failed");
+ if (H5VLclose(default_vol_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5VLclose failed");
+ }
+ if (!use_h5ocopy) {
int j;
if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
@@ -1135,7 +1177,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
} /* end whether we have request for filter/chunking */
+
break;
+ } /* H5TRAV_TYPE_DATASET */
/*-------------------------------------------------------------------------
* H5TRAV_TYPE_NAMED_DATATYPE
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 16899a3..44b4b6c 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -62,6 +62,12 @@ static struct long_options l_opts[] = {
{ "sort_by", require_arg, 'q' },
{ "sort_order", require_arg, 'z' },
{ "enable-error-stack", no_arg, 'E' },
+ { "src-vol-id", require_arg, '1' },
+ { "src-vol-name", require_arg, '2' },
+ { "src-vol-info", require_arg, '3' },
+ { "dst-vol-id", require_arg, '4' },
+ { "dst-vol-name", require_arg, '5' },
+ { "dst-vol-info", require_arg, '6' },
{ NULL, 0, '\0' }
};
@@ -86,6 +92,18 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
PRINTVALSTREAM(rawoutstream, " occur\n");
+ PRINTVALSTREAM(rawoutstream, " --src-vol-id ID of the VOL connector to use for opening the input\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --src-vol-name Name of the VOL connector to use for opening the input\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --src-vol-info VOL-specific info to pass to the VOL connector used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the input HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --dst-vol-id ID of the VOL connector to use for opening the output\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream, " --dst-vol-name Name of the VOL connector to use for opening the output\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ 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, " -L, --latest Use latest version of file format\n");
PRINTVALSTREAM(rawoutstream, " This option will take precedence over the options\n");
PRINTVALSTREAM(rawoutstream, " --low and --high\n");
@@ -334,7 +352,7 @@ int read_info(const char *filename, pack_opt_t *options)
if (!HDstrcmp(stype, "-l")) {
if (h5repack_addlayout(comp_info, options) == -1) {
- error_msg("could not add chunck option\n");
+ error_msg("could not add chunk option\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
goto done;
@@ -412,9 +430,17 @@ set_sort_order(const char *form)
static
int parse_command_line(int argc, const char **argv, pack_opt_t* options)
{
+ h5tools_get_fapl_info_t get_in_vol_info;
+ h5tools_get_fapl_info_t get_out_vol_info;
+ hbool_t custom_in_fapl = FALSE;
+ hbool_t custom_out_fapl = FALSE;
+ hid_t tmp_fapl = H5I_INVALID_HID;
int bound, opt;
int ret_value = 0;
+ HDmemset(&get_in_vol_info, 0, sizeof(h5tools_get_fapl_info_t));
+ HDmemset(&get_out_vol_info, 0, sizeof(h5tools_get_fapl_info_t));
+
/* parse command line options */
while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) {
switch ((char) opt) {
@@ -434,13 +460,13 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'h':
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
- ret_value = -1;
+ ret_value = 1;
goto done;
case 'V':
print_version(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
- ret_value = -1;
+ ret_value = 1;
goto done;
case 'v':
@@ -478,9 +504,12 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'e':
- ret_value = read_info(opt_arg, options);
- if (ret_value < 0)
+ if ((ret_value = read_info(opt_arg, options)) < 0) {
+ error_msg("failed to read from repack options file <%s>\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
goto done;
+ }
break;
case 'n':
@@ -495,6 +524,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
bound = HDatoi(opt_arg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing low bound\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
goto done;
}
options->low_bound = bound;
@@ -504,6 +535,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
bound = HDatoi(opt_arg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing high bound\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
goto done;
}
options->high_bound = bound;
@@ -625,8 +658,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'q':
- if (H5_INDEX_UNKNOWN == set_sort_by(opt_arg)) {
- error_msg(" failed to set sort by form <%s>\n", opt_arg);
+ if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(opt_arg))) {
+ error_msg("failed to set sort by form <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -634,8 +667,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'z':
- if (set_sort_order(opt_arg) == H5_ITER_UNKNOWN) {
- error_msg(" failed to set sort order form <%s>\n", opt_arg);
+ if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(opt_arg))) {
+ error_msg("failed to set sort order form <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -646,6 +679,38 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
enable_error_stack = 1;
break;
+ case '1':
+ get_in_vol_info.get_type = GET_VOL_BY_ID;
+ get_in_vol_info.u.id = HDatol(opt_arg);
+ custom_in_fapl = TRUE;
+ break;
+
+ case '2':
+ get_in_vol_info.get_type = GET_VOL_BY_NAME;
+ get_in_vol_info.u.name = opt_arg;
+ custom_in_fapl = TRUE;
+ break;
+
+ case '3':
+ get_in_vol_info.info = opt_arg;
+ break;
+
+ case '4':
+ get_out_vol_info.get_type = GET_VOL_BY_ID;
+ get_out_vol_info.u.id = HDatol(opt_arg);
+ custom_out_fapl = TRUE;
+ break;
+
+ case '5':
+ get_out_vol_info.get_type = GET_VOL_BY_NAME;
+ get_out_vol_info.u.name = opt_arg;
+ custom_out_fapl = TRUE;
+ break;
+
+ case '6':
+ get_out_vol_info.info = opt_arg;
+ break;
+
default:
break;
} /* end switch */
@@ -653,30 +718,71 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* If neither -i nor -o given, get in and out files positionally */
if (0 == (has_i + has_o)) {
- if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
- infile = argv[opt_ind];
- outfile = argv[opt_ind + 1];
-
- if (!HDstrcmp(infile, outfile)) {
- error_msg("file names cannot be the same\n");
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- }
- }
- else {
- error_msg("file names missing\n");
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- }
- }
- else if (has_i != 1 || has_o != 1) {
- error_msg("filenames must be either both -i -o or both positional\n");
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- }
+ if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
+ infile = argv[opt_ind];
+ outfile = argv[opt_ind + 1];
+
+ if (!HDstrcmp(infile, outfile)) {
+ error_msg("file names cannot be the same\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
+ }
+ else {
+ error_msg("file names missing\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
+ }
+ else if (has_i != 1 || has_o != 1) {
+ error_msg("filenames must be either both -i -o or both positional\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
+
+ /* Setup FAPL for input and output file accesses */
+ if (custom_in_fapl) {
+ if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, &get_in_vol_info)) < 0) {
+ error_msg("failed to setup FAPL for input file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+
+ /* Close old FAPL */
+ if (options->fin_fapl != H5P_DEFAULT)
+ if (H5Pclose(options->fin_fapl) < 0) {
+ error_msg("failed to close FAPL\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+
+ options->fin_fapl = tmp_fapl;
+ }
+
+ if (custom_out_fapl) {
+ if ((tmp_fapl = h5tools_get_fapl(options->fout_fapl, &get_out_vol_info)) < 0) {
+ error_msg("failed to setup FAPL for output file\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+
+ /* Close old FAPL */
+ if (options->fout_fapl != H5P_DEFAULT)
+ if (H5Pclose(options->fout_fapl) < 0) {
+ error_msg("failed to close FAPL\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+
+ options->fout_fapl = tmp_fapl;
+ }
done:
return ret_value;
@@ -694,14 +800,18 @@ done:
*/
int main(int argc, const char **argv)
{
- pack_opt_t options; /*the global options */
+ pack_opt_t options; /*the global options */
H5E_auto2_t func;
H5E_auto2_t tools_func;
void *edata;
void *tools_edata;
+ int parse_ret;
HDmemset(&options, 0, sizeof(pack_opt_t));
+ /* Initialize h5tools lib */
+ h5tools_init();
+
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -709,29 +819,38 @@ int main(int argc, const char **argv)
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
- /* Initialize h5tools lib */
- h5tools_init();
-
/* Disable tools error reporting */
H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
/* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */
if (h5tools_getenv_update_hyperslab_bufsize() < 0) {
+ HDprintf("Error occurred while retrieving H5TOOLS_BUFSIZE value\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* initialize options */
if (h5repack_init(&options, 0, FALSE) < 0) {
+ HDprintf("Error occurred while initializing repack options\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
+
/* Initialize default indexing options */
sort_by = H5_INDEX_CRT_ORDER;
- if (parse_command_line(argc, argv, &options) < 0)
+ parse_ret = parse_command_line(argc, argv, &options);
+ if (parse_ret < 0) {
+ HDprintf("Error occurred while parsing command-line options\n");
+ h5tools_setstatus(EXIT_FAILURE);
goto done;
+ }
+ else if (parse_ret > 0) {
+ /* Short-circuit success */
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ }
if (enable_error_stack > 0) {
H5Eset_auto2(H5E_DEFAULT, func, edata);
@@ -739,9 +858,20 @@ int main(int argc, const char **argv)
}
/* pack it */
- h5tools_setstatus(h5repack(infile, outfile, &options));
+ if (h5repack(infile, outfile, &options) < 0) {
+ HDprintf("Error occurred while repacking\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ h5tools_setstatus(EXIT_SUCCESS);
done:
+ if (options.fin_fapl >= 0 && options.fin_fapl != H5P_DEFAULT)
+ H5Pclose(options.fin_fapl);
+ if (options.fout_fapl >= 0 && options.fout_fapl != H5P_DEFAULT)
+ H5Pclose(options.fout_fapl);
+
/* free tables */
h5repack_end(&options);
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 683988c..7bb5dfd 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -353,16 +353,16 @@ int verify_layout(hid_t pid, pack_info_t *obj)
*-------------------------------------------------------------------------
*/
-int h5repack_cmp_pl(const char *fname1, const char *fname2)
+int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl)
{
- hid_t fid1 =H5I_INVALID_HID; /* file ID */
- hid_t fid2 =H5I_INVALID_HID; /* file ID */
- hid_t dset1 =H5I_INVALID_HID; /* dataset ID */
- hid_t dset2 =H5I_INVALID_HID; /* dataset ID */
- hid_t gid =H5I_INVALID_HID; /* group ID */
- hid_t dcpl1 =H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t dcpl2 =H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t gcplid =H5I_INVALID_HID; /* group creation property list */
+ hid_t fid1 = H5I_INVALID_HID; /* file ID */
+ hid_t fid2 = H5I_INVALID_HID; /* file ID */
+ hid_t dset1 = H5I_INVALID_HID; /* dataset ID */
+ hid_t dset2 = H5I_INVALID_HID; /* dataset ID */
+ hid_t gid = H5I_INVALID_HID; /* group ID */
+ hid_t dcpl1 = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl2 = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t gcplid = H5I_INVALID_HID; /* group creation property list */
unsigned crt_order_flag1; /* group creation order flag */
unsigned crt_order_flag2; /* group creation order flag */
trav_table_t *trav = NULL;
@@ -374,9 +374,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
*-------------------------------------------------------------------------
*/
/* Open the files */
- if ((fid1 = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
- if ((fid2 = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------