summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-03-06 23:33:00 (GMT)
committerGitHub <noreply@github.com>2022-03-06 23:33:00 (GMT)
commit78375882485a99a81caa933928ed08d7a38ef88b (patch)
treef18c41d7794d546b6562dd2aa36932c78f00a16a /tools/src
parent7e176db164d1a6f944e703c612c4952b15d333f4 (diff)
downloadhdf5-78375882485a99a81caa933928ed08d7a38ef88b.zip
hdf5-78375882485a99a81caa933928ed08d7a38ef88b.tar.gz
hdf5-78375882485a99a81caa933928ed08d7a38ef88b.tar.bz2
VFD SWMR: normalization with develop (#1472)
Much normalization with develop. Still needs tools changes wrt VFD plugins.
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5copy/h5copy.c4
-rw-r--r--tools/src/h5diff/h5diff_common.c24
-rw-r--r--tools/src/h5diff/h5diff_common.h2
-rw-r--r--tools/src/h5diff/h5diff_main.c6
-rw-r--r--tools/src/h5diff/ph5diff_main.c7
-rw-r--r--tools/src/h5dump/h5dump.c16
-rw-r--r--tools/src/h5dump/h5dump_ddl.c16
-rw-r--r--tools/src/h5dump/h5dump_xml.c58
-rw-r--r--tools/src/h5format_convert/h5format_convert.c8
-rw-r--r--tools/src/h5import/h5import.c16
-rw-r--r--tools/src/h5jam/h5jam.c18
-rw-r--r--tools/src/h5jam/h5unjam.c6
-rw-r--r--tools/src/h5ls/h5ls.c60
-rw-r--r--tools/src/h5perf/perf.c4
-rw-r--r--tools/src/h5perf/pio_engine.c20
-rw-r--r--tools/src/h5perf/pio_perf.c16
-rw-r--r--tools/src/h5perf/sio_engine.c6
-rw-r--r--tools/src/h5perf/sio_perf.c34
-rw-r--r--tools/src/h5repack/h5repack.c92
-rw-r--r--tools/src/h5repack/h5repack.h8
-rw-r--r--tools/src/h5repack/h5repack_copy.c149
-rw-r--r--tools/src/h5repack/h5repack_filters.c4
-rw-r--r--tools/src/h5repack/h5repack_main.c50
-rw-r--r--tools/src/h5repack/h5repack_refs.c11
-rw-r--r--tools/src/h5repack/h5repack_verify.c10
-rw-r--r--tools/src/h5stat/h5stat.c8
-rw-r--r--tools/src/misc/h5clear.c6
-rw-r--r--tools/src/misc/h5debug.c8
-rw-r--r--tools/src/misc/h5delete.c2
-rw-r--r--tools/src/misc/h5mkgrp.c14
30 files changed, 430 insertions, 253 deletions
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index 4e9a25e..6f10fee 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -212,7 +212,7 @@ parse_flag(const char *s_flag, unsigned *flag)
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid_src = H5I_INVALID_HID;
hid_t fid_dst = H5I_INVALID_HID;
@@ -242,7 +242,7 @@ main(int argc, const char *argv[])
} /* end if */
/* parse command line options */
- while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, (const char *const *)argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'd':
oname_dst = HDstrdup(H5_optarg);
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index b669087..1bf3994 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -200,7 +200,7 @@ parse_subset_params(const char *dset)
*/
void
-parse_command_line(int argc, const char *argv[], const char **fname1, const char **fname2,
+parse_command_line(int argc, const char *const *argv, const char **fname1, const char **fname2,
const char **objname1, const char **objname2, diff_opt_t *opts)
{
int i;
@@ -277,7 +277,7 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char
break;
case 'q':
- /* use quiet mode; supress the message "0 differences found" */
+ /* use quiet mode; suppress the message "0 differences found" */
opts->mode_quiet = 1;
break;
@@ -657,6 +657,24 @@ usage(void)
PRINTVALSTREAM(rawoutstream,
" --vol-info-2 VOL-specific info to pass to the VOL connector used for\n");
PRINTVALSTREAM(rawoutstream, " opening the second HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-value-1 Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " first HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-name-1 Name of the VFL driver to use for opening the first\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-info-1 VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the first HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-value-2 Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " second HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-name-2 Name of the VFL driver to use for opening the second\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vfd-info-2 VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the second HDF5 file specified\n");
PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
PRINTVALSTREAM(rawoutstream,
" Follow symbolic links (soft links and external links and compare the)\n");
@@ -778,7 +796,7 @@ usage(void)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Modes of output:\n");
PRINTVALSTREAM(rawoutstream,
- " Default mode: print the number of differences found and where they occured\n");
+ " Default mode: print the number of differences found and where they occurred\n");
PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n");
PRINTVALSTREAM(rawoutstream, " -v Verbose mode: print the above plus a list of objects and warnings\n");
PRINTVALSTREAM(rawoutstream, " -q Quiet mode: do not print output\n");
diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h
index 83f4255..35e5dfb 100644
--- a/tools/src/h5diff/h5diff_common.h
+++ b/tools/src/h5diff/h5diff_common.h
@@ -23,7 +23,7 @@ extern "C" {
#endif
void usage(void);
-void parse_command_line(int argc, const char *argv[], const char **fname1, const char **fname2,
+void parse_command_line(int argc, const char *const *argv, const char **fname1, const char **fname2,
const char **objname1, const char **objname2, diff_opt_t *opts);
void h5diff_exit(int status);
void print_info(diff_opt_t *opts);
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index a835953..2a43b56 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -33,7 +33,7 @@
*
* Modifications: July 2004
* Introduced the four modes:
- * Normal mode: print the number of differences found and where they occured
+ * Normal mode: print the number of differences found and where they occurred
* Report mode: print the above plus the differences
* Verbose mode: print the above plus a list of objects and warnings
* Quiet mode: do not print output
@@ -65,7 +65,7 @@
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
int ret;
int i;
@@ -86,7 +86,7 @@ main(int argc, const char *argv[])
* process the command-line
*-------------------------------------------------------------------------
*/
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
+ parse_command_line(argc, (const char *const *)argv, &fname1, &fname2, &objname1, &objname2, &opts);
/* enable error reporting if command line option */
h5tools_error_report();
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index ec78e49..8e5c3e8 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -44,7 +44,7 @@ static void ph5diff_worker(int);
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
int nID = 0;
const char *fname1 = NULL;
@@ -72,7 +72,7 @@ main(int argc, const char *argv[])
g_Parallel = 0;
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
+ parse_command_line(argc, (const char *const *)argv, &fname1, &fname2, &objname1, &objname2, &opts);
h5diff(fname1, fname2, objname1, objname2, &opts);
@@ -83,7 +83,8 @@ main(int argc, const char *argv[])
/* Have the manager process the command-line */
if (nID == 0) {
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
+ parse_command_line(argc, (const char *const *)argv, &fname1, &fname2, &objname1, &objname2,
+ &opts);
h5diff(fname1, fname2, objname1, objname2, &opts);
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 2901241..20ff29e 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -196,6 +196,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,
@@ -816,7 +824,7 @@ free_handler(struct handler_t *hand, int len)
*-------------------------------------------------------------------------
*/
static struct handler_t *
-parse_command_line(int argc, const char *argv[])
+parse_command_line(int argc, const char *const *argv)
{
struct handler_t *hand = NULL;
struct handler_t *last_dset = NULL;
@@ -1298,7 +1306,7 @@ error:
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid = H5I_INVALID_HID;
hid_t gid = H5I_INVALID_HID;
@@ -1318,7 +1326,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- if ((hand = parse_command_line(argc, argv)) == NULL) {
+ if ((hand = parse_command_line(argc, (const char *const *)argv)) == NULL) {
goto done;
}
@@ -1474,7 +1482,7 @@ main(int argc, const char *argv[])
dset_table = table_list.tables[0].dset_table;
type_table = table_list.tables[0].type_table;
- /* does there exist unamed committed datatype */
+ /* does there exist unnamed committed datatype */
for (u = 0; u < type_table->nobjs; u++)
if (!type_table->objs[u].recorded) {
unamedtype = 1;
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index 638a738..b0bce0c 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -829,7 +829,7 @@ dump_group(hid_t gid, const char *name)
if (!HDstrcmp(name, "/") && unamedtype) {
unsigned u; /* Local index variable */
- /* dump unamed type in root group */
+ /* dump unnamed type in root group */
for (u = 0; u < type_table->nobjs; u++)
if (!type_table->objs[u].recorded) {
char *obj_tok_str = NULL;
@@ -838,7 +838,7 @@ dump_group(hid_t gid, const char *name)
type = H5Dget_type(dset);
H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_tok_str);
- HDsprintf(type_name, "#%s", obj_tok_str);
+ HDsnprintf(type_name, sizeof(type_name), "#%s", obj_tok_str);
H5free_memory(obj_tok_str);
dump_function_table->dump_named_datatype_function(type, type_name);
@@ -1283,7 +1283,7 @@ dump_fcontents(hid_t fid)
{
PRINTSTREAM(rawoutstream, "%s %s\n", FILE_CONTENTS, BEGIN);
- /* special case of unamed types in root group */
+ /* special case of unnamed types in root group */
if (unamedtype) {
unsigned u;
@@ -1318,7 +1318,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
j = (int)HDstrlen(op_name) - 1;
/* find the last / */
while (j >= 0) {
- if (op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
+ if (op_name[j] == '/' && (j == 0 || (op_name[j - 1] != '\\')))
break;
j--;
}
@@ -1541,7 +1541,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
/* find the last / */
while (j >= 0) {
- if (attr[j] == '/' && (j == 0 || (j > 0 && attr[j - 1] != '\\')))
+ if (attr[j] == '/' && (j == 0 || (attr[j - 1] != '\\')))
break;
j--;
}
@@ -1959,7 +1959,7 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe,
const char *real_name = display_name ? display_name : type;
if ((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
- /* check if type is unamed datatype */
+ /* check if type is unnamed datatype */
unsigned idx = 0;
while (idx < type_table->nobjs) {
@@ -1968,9 +1968,9 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe,
if (!type_table->objs[idx].recorded) {
char *obj_tok_str = NULL;
- /* unamed datatype */
+ /* unnamed datatype */
H5Otoken_to_str(fid, &type_table->objs[idx].obj_token, &obj_tok_str);
- HDsprintf(name, "/#%s", obj_tok_str);
+ HDsnprintf(name, sizeof(name), "/#%s", obj_tok_str);
H5free_memory(obj_tok_str);
if (!HDstrcmp(name, real_name))
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 0e881df..827daf3 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -23,7 +23,7 @@
const char *xmlnsprefix = "hdf5:";
/*
- * Alternative formating for data dumped to XML
+ * Alternative formatting for data dumped to XML
* In general, the numbers are the same, but separators
* except spaces are not used.
*
@@ -591,6 +591,8 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen
if (outlen < 22)
return 1;
+ H5_CHECK_OVERFLOW(outlen, int, size_t);
+
lookup_ret = ref_path_table_lookup(str, &obj_token);
if (lookup_ret < 0) {
if (HDstrlen(str) == 0) {
@@ -600,7 +602,7 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen
ref_path_table_gen_fake(str, &obj_token);
H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str);
- HDsprintf(outstr, "xid_%s", obj_tok_str);
+ HDsnprintf(outstr, (size_t)outlen, "xid_%s", obj_tok_str);
H5free_memory(obj_tok_str);
return 0;
@@ -615,7 +617,7 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen
ref_path_table_gen_fake(str, &obj_token);
H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str);
- HDsprintf(outstr, "xid_%s", obj_tok_str);
+ HDsnprintf(outstr, (size_t)outlen, "xid_%s", obj_tok_str);
H5free_memory(obj_tok_str);
return 0;
@@ -627,7 +629,7 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen
}
H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str);
- HDsprintf(outstr, "xid_%s", obj_tok_str);
+ HDsnprintf(outstr, (size_t)outlen, "xid_%s", obj_tok_str);
H5free_memory(obj_tok_str);
return 0;
@@ -1777,8 +1779,7 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer,
- "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
- "u\" MaxDimSize=\"UNLIMITED\"/>",
+ "<%sDimension DimSize=\"%" PRIuHSIZE "\" MaxDimSize=\"UNLIMITED\"/>",
xmlnsprefix, size[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
@@ -1788,10 +1789,9 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer,
- "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
- "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix, size[i], size[i]);
+ h5tools_str_append(
+ &buffer, "<%sDimension DimSize=\"%" PRIuHSIZE "\" MaxDimSize=\"%" PRIuHSIZE "\"/>",
+ xmlnsprefix, size[i], size[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
@@ -1800,10 +1800,9 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer,
- "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
- "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix, size[i], maxsize[i]);
+ h5tools_str_append(
+ &buffer, "<%sDimension DimSize=\"%" PRIuHSIZE "\" MaxDimSize=\"%" PRIuHSIZE "\"/>",
+ xmlnsprefix, size[i], maxsize[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
@@ -2793,7 +2792,7 @@ xml_dump_group(hid_t gid, const char *name)
if (isRoot && unamedtype) {
unsigned u;
- /* Very special case: dump unamed type in root group */
+ /* Very special case: dump unnamed type in root group */
for (u = 0; u < type_table->nobjs; u++) {
if (!type_table->objs[u].recorded) {
char *obj_tok_str = NULL;
@@ -2802,7 +2801,7 @@ xml_dump_group(hid_t gid, const char *name)
type = H5Dget_type(dset);
H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_tok_str);
- HDsprintf(type_name, "#%s", obj_tok_str);
+ HDsnprintf(type_name, sizeof(type_name), "#%s", obj_tok_str);
H5free_memory(obj_tok_str);
dump_function_table->dump_named_datatype_function(type, type_name);
@@ -2886,7 +2885,7 @@ xml_dump_group(hid_t gid, const char *name)
if (isRoot && unamedtype) {
unsigned u;
- /* Very special case: dump unamed type in root group */
+ /* Very special case: dump unnamed type in root group */
for (u = 0; u < type_table->nobjs; u++) {
if (!type_table->objs[u].recorded) {
char *obj_tok_str = NULL;
@@ -2895,7 +2894,7 @@ xml_dump_group(hid_t gid, const char *name)
type = H5Dget_type(dset);
H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_tok_str);
- HDsprintf(type_name, "#%s", obj_tok_str);
+ HDsnprintf(type_name, sizeof(type_name), "#%s", obj_tok_str);
H5free_memory(obj_tok_str);
dump_function_table->dump_named_datatype_function(type, type_name);
@@ -2938,7 +2937,7 @@ xml_dump_group(hid_t gid, const char *name)
/*-------------------------------------------------------------------------
* Function: xml_print_refs
*
- * Purpose: Print a path to the objects referenced by HDF5 Referneces.
+ * Purpose: Print a path to the objects referenced by HDF5 References.
*
* Return: void
*
@@ -3598,7 +3597,10 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"");
for (i = 0; i < sz; i++) {
- h5tools_str_append(&buffer, "%x ", *(unsigned int *)buf + (i * sizeof(unsigned int)));
+ unsigned long val = *(unsigned int *)buf + (i * sizeof(unsigned int));
+
+ H5_CHECK_OVERFLOW(val, unsigned long, unsigned);
+ h5tools_str_append(&buffer, "%x ", (unsigned)val);
}
h5tools_str_append(&buffer, "\"");
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
@@ -3892,8 +3894,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />",
- xmlnsprefix, chsize[i]);
+ h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" PRIuHSIZE "\" />", xmlnsprefix,
+ chsize[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
@@ -4524,12 +4526,16 @@ xml_print_enum(hid_t type)
h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "u",
- *((unsigned long long *)((void *)(value + i * dst_size))));
+ unsigned long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(&buffer, "%llu", copy);
}
else {
- h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "d",
- *((long long *)((void *)(value + i * dst_size))));
+ long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(&buffer, "%lld", copy);
}
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index ddf129c..50d0f5d 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -94,7 +94,7 @@ usage(const char *prog)
*-------------------------------------------------------------------------
*/
static int
-parse_command_line(int argc, const char **argv)
+parse_command_line(int argc, const char *const *argv)
{
int opt;
@@ -127,7 +127,7 @@ parse_command_line(int argc, const char **argv)
dname_g = HDstrdup(H5_optarg);
if (dname_g == NULL) {
h5tools_setstatus(EXIT_FAILURE);
- error_msg("No dataset name\n", H5_optarg);
+ error_msg("No dataset name `%s`\n", H5_optarg);
usage(h5tools_getprogname());
goto error;
}
@@ -383,7 +383,7 @@ error:
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid = H5I_INVALID_HID;
@@ -394,7 +394,7 @@ main(int argc, const char *argv[])
h5tools_init();
/* Parse command line options */
- if (parse_command_line(argc, argv) < 0)
+ if (parse_command_line(argc, (const char *const *)argv) < 0)
goto done;
else if (verbose_g)
HDfprintf(stdout, "Process command line options\n");
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 7272dff..317db81 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -2126,7 +2126,7 @@ processConfigurationFile(char *infile, struct Input *in)
}
} /* while (get_next_prop) */
} /* else if(!HDstrcmp("SUBSET", key)) */
- else if (!HDstrcmp("DATA", key)) { /* FINSHED */
+ else if (!HDstrcmp("DATA", key)) { /* FINISHED */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATA key\n");
#endif
@@ -2320,7 +2320,7 @@ processConfigurationFile(char *infile, struct Input *in)
(void)HDfprintf(stderr, err12a, infile);
goto error;
}
- /* cant appear before dimension sizes have been provided */
+ /* can't appear before dimension sizes have been provided */
if (in->configOptionVector[DIM] == 0) {
(void)HDfprintf(stderr, err12b, infile);
goto error;
@@ -2387,7 +2387,7 @@ processConfigurationFile(char *infile, struct Input *in)
(void)HDfprintf(stderr, err16a, infile);
goto error;
}
- /* cant appear before dimension sizes have been provided */
+ /* can't appear before dimension sizes have been provided */
if (in->configOptionVector[DIM] == 0) {
(void)HDfprintf(stderr, err16b, infile);
goto error;
@@ -2474,14 +2474,14 @@ validateConfigurationParameters(struct Input *in)
}
}
- /* Arch cant be STD if O/p class is FP */
+ /* Arch can't be STD if O/p class is FP */
if (in->outputArchitecture == 1)
if (in->outputClass == 1) {
(void)HDfprintf(stderr, "%s", err4a);
return (-1);
}
- /* Arch cant be IEEE if O/p class is IN */
+ /* Arch can't be IEEE if O/p class is IN */
if (in->outputArchitecture == 2)
if (in->outputClass == 0) {
(void)HDfprintf(stderr, "%s", err4b);
@@ -3725,7 +3725,7 @@ getCompressionParameter(struct Input *in, FILE *strm)
int ival;
const char *err1 = "Unable to get integer value.\n";
- const char *err2 = "Invalid value for compression paramter.\n";
+ const char *err2 = "Invalid value for compression parameter.\n";
const char *err3 = "Unsupported Compression Type.\n";
switch (in->compressionType) {
@@ -3784,7 +3784,7 @@ setDefaultValues(struct Input *in, int count)
in->path.count = 1;
HDstrcpy(temp, "dataset");
- HDsprintf(num, "%d", count);
+ HDsnprintf(num, sizeof(num), "%d", count);
HDstrcat(temp, num);
HDstrcpy(in->path.group[0], temp);
@@ -4689,7 +4689,7 @@ process(struct Options *opt)
}
if (in->configOptionVector[EXTERNALSTORE] == 1) {
- /* creating the external file if it doesnt exist */
+ /* creating the external file if it doesn't exist */
if ((extfile = HDfopen(in->externFilename, "ab")) == NULL) {
(void)HDfprintf(stderr, "%s", err4);
H5Pclose(proplist);
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 7f3385c..45978bb 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -22,7 +22,7 @@
herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where);
hsize_t compute_user_block_size(hsize_t);
hsize_t copy_some_to_file(int, int, hsize_t, hsize_t, ssize_t);
-void parse_command_line(int, const char *[]);
+void parse_command_line(int, const char *const *);
int do_clobber = FALSE;
char *output_file = NULL;
@@ -104,7 +104,7 @@ leave(int ret)
*/
void
-parse_command_line(int argc, const char *argv[])
+parse_command_line(int argc, const char *const *argv)
{
int opt = FALSE;
@@ -149,7 +149,7 @@ parse_command_line(int argc, const char *argv[])
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
int ufid = -1;
int h5fid = -1;
@@ -174,7 +174,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- parse_command_line(argc, argv);
+ parse_command_line(argc, (const char *const *)argv);
/* enable error reporting if command line option */
h5tools_error_report();
@@ -358,7 +358,7 @@ done:
* Purpose: Copy part of the input file to output.
* infid: fd of file to read
* outfid: fd of file to write
- * startin: offset of where to read from infid
+ * starting: offset of where to read from infid
* startout: offset of where to write to outfid
* limit: bytes to read/write
*
@@ -373,7 +373,7 @@ done:
*-------------------------------------------------------------------------
*/
hsize_t
-copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, ssize_t limit)
+copy_some_to_file(int infid, int outfid, hsize_t starting, hsize_t startout, ssize_t limit)
{
char buf[1024];
h5_stat_t sbuf;
@@ -386,9 +386,9 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, ssiz
ssize_t toend;
ssize_t fromend;
- if (startin > startout) {
+ if (starting > startout) {
/* this case is prohibited */
- error_msg("copy_some_to_file: panic: startin > startout?\n");
+ error_msg("copy_some_to_file: panic: starting > startout?\n");
exit(EXIT_FAILURE);
} /* end if */
@@ -409,7 +409,7 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, ssiz
return 0;
toend = (ssize_t)startout + howmuch;
- fromend = (ssize_t)startin + howmuch;
+ fromend = (ssize_t)starting + howmuch;
if (howmuch > 512) {
to = toend - 512;
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index fa23b06..8ff354e 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -92,7 +92,7 @@ usage(const char *prog)
*-------------------------------------------------------------------------
*/
static int
-parse_command_line(int argc, const char *argv[])
+parse_command_line(int argc, const char *const *argv)
{
int opt = FALSE;
@@ -172,7 +172,7 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t ifile = H5I_INVALID_HID;
hid_t plist = H5I_INVALID_HID;
@@ -189,7 +189,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- if (EXIT_FAILURE == parse_command_line(argc, argv))
+ if (EXIT_FAILURE == parse_command_line(argc, (const char *const *)argv))
goto done;
/* enable error reporting if command line option */
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index bffd12b..06f537d 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -32,7 +32,7 @@
#define NAME_BUF_SIZE 2048
/*
- * Alternative formating for data dumped by H5LS
+ * Alternative formatting for data dumped by H5LS
*
* This table only affects H5LS output.
*/
@@ -78,9 +78,9 @@ static h5tool_format_t ls_dataformat = {
",", /*elmt_suf1 */
" ", /*elmt_suf2 */
- HSIZE_T_FORMAT, /*idx_n_fmt */
- ",", /*idx_sep */
- "(%s)", /*idx_fmt */
+ "%" PRIuHSIZE, /*idx_n_fmt */
+ ",", /*idx_sep */
+ "(%s)", /*idx_fmt */
65535,
/*line_ncols */ /*standard default columns */
@@ -244,6 +244,12 @@ usage(void)
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, "\n");
PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n");
@@ -940,8 +946,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print members */
for (i = 0; i < (unsigned)nmembs; i++) {
- unsigned char *copy; /* a pointer to value array */
- int nchars; /* number of output characters */
+ int nchars; /* number of output characters */
h5tools_str_append(buffer, "\n%*s", ind + 4, "");
nchars = print_string(buffer, name[i], TRUE);
@@ -955,16 +960,16 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value + i * dst_size;
- h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *)((void *)copy)));
+ unsigned long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(buffer, "%llu", copy);
}
else {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value + i * dst_size;
- h5tools_str_append(buffer, "%lld", *((long long *)((void *)copy)));
+ long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(buffer, "%lld", copy);
}
}
@@ -1183,13 +1188,13 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print dimensions */
for (i = 0; i < ndims; i++)
- h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, i ? "," : "[", dims[i]);
+ h5tools_str_append(buffer, "%s%" PRIuHSIZE, i ? "," : "[", dims[i]);
h5tools_str_append(buffer, "]");
HDfree(dims);
}
else
- h5tools_str_append(buffer, " [SCALAR]\n", rawoutstream);
+ h5tools_str_append(buffer, " [SCALAR]\n");
/* Print parent type */
h5tools_str_append(buffer, " ");
@@ -1701,7 +1706,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
/* simple dataspace */
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", size[i]);
+ h5tools_str_append(&buffer, "%s%" PRIuHSIZE, i ? ", " : "", size[i]);
nelmts *= size[i];
}
h5tools_str_append(&buffer, "}\n");
@@ -1789,12 +1794,12 @@ dataset_list1(hid_t dset)
ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", cur_size[i]);
+ h5tools_str_append(&buffer, "%s%" PRIuHSIZE, i ? ", " : "", cur_size[i]);
if (max_size[i] == H5S_UNLIMITED) {
h5tools_str_append(&buffer, "/%s", "Inf");
}
else if (max_size[i] != cur_size[i] || verbose_g > 0) {
- h5tools_str_append(&buffer, "/" HSIZE_T_FORMAT, max_size[i]);
+ h5tools_str_append(&buffer, "/%" PRIuHSIZE, max_size[i]);
}
}
if (space_type == H5S_SCALAR)
@@ -1868,10 +1873,10 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_append(&buffer, " %-10s {", "Chunks:");
total = H5Tget_size(type);
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", chsize[i]);
+ h5tools_str_append(&buffer, "%s%" PRIuHSIZE, i ? ", " : "", chsize[i]);
total *= chsize[i];
}
- h5tools_str_append(&buffer, "} " HSIZE_T_FORMAT " bytes\n", total);
+ h5tools_str_append(&buffer, "} %" PRIuHSIZE " bytes\n", total);
} break;
case H5D_COMPACT:
break;
@@ -1897,15 +1902,13 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size) <
0) {
h5tools_str_append(
- &buffer,
- " #%03d %10" H5_PRINTF_LL_WIDTH "u %10s %10s ***ERROR*** %s\n", i,
+ &buffer, " #%03d %10" PRIuHSIZE " %10s %10s ***ERROR*** %s\n", i,
total, "", "", i + 1 < nf ? "Following addresses are incorrect" : "");
}
else if (H5S_UNLIMITED == f_size) {
h5tools_str_append(&buffer,
- " #%03d %10" H5_PRINTF_LL_WIDTH
- "u %10" H5_PRINTF_LL_WIDTH "u %10s ",
- i, total, (hsize_t)f_offset, "INF");
+ " #%03d %10" PRIuHSIZE " %10" PRIuHSIZE " %10s ", i,
+ total, (hsize_t)f_offset, "INF");
print_string(&buffer, f_name, TRUE);
}
else {
@@ -1985,8 +1988,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
case H5T_ARRAY:
case H5T_NCLASSES:
default:
- h5tools_str_append(&buffer,
- HSIZE_T_FORMAT " logical byte%s, " HSIZE_T_FORMAT " allocated byte%s",
+ h5tools_str_append(&buffer, "%" PRIuHSIZE " logical byte%s, %" PRIuHSIZE " allocated byte%s",
total, 1 == total ? "" : "s", used, 1 == used ? "" : "s");
if (used > 0) {
utilization = ((double)total * 100.0) / (double)used;
@@ -2646,7 +2648,7 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t file_id = H5I_INVALID_HID;
char * fname = NULL, *oname = NULL, *x = NULL;
diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c
index 83d4ab0..84be7e8 100644
--- a/tools/src/h5perf/perf.c
+++ b/tools/src/h5perf/perf.c
@@ -119,7 +119,7 @@ static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suf
int
main(int argc, char **argv)
{
- char * buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check;
+ char * buf = NULL, *tmp = NULL, *buf2 = NULL, *tmp2 = NULL, *check = NULL;
int i, j, mynod = 0, nprocs = 1, my_correct = 1, correct, myerrno;
double stim, etim;
double write_tim = 0;
@@ -605,7 +605,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu
* we are using the split driver since both of those
* use the multi VFD under the hood.
*/
- env = HDgetenv("HDF5_DRIVER");
+ env = HDgetenv(HDF5_DRIVER);
#ifdef HDF5_DRIVER
/* Use the environment variable, then the compile-time constant */
if (!env)
diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c
index cac36d7..e316245 100644
--- a/tools/src/h5perf/pio_engine.c
+++ b/tools/src/h5perf/pio_engine.c
@@ -244,7 +244,7 @@ do_pio(parameters param)
if (((size_t)(snbytes / pio_mpi_nprocs_g) % buf_size) != 0) {
HDfprintf(stderr,
"Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size (%zu)\n",
+ "transfer buffer size (%zu)\n",
(long long)(snbytes / pio_mpi_nprocs_g), buf_size);
GOTOERROR(FAIL);
}
@@ -253,7 +253,7 @@ do_pio(parameters param)
if (((size_t)snbytes % buf_size) != 0) {
HDfprintf(stderr,
"Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size (%zu)\n",
+ "transfer buffer size (%zu)\n",
(long long)snbytes, buf_size);
GOTOERROR(FAIL);
}
@@ -282,7 +282,7 @@ do_pio(parameters param)
/* Open file for write */
char base_name[256];
- HDsprintf(base_name, "#pio_tmp_%lu", nf);
+ HDsnprintf(base_name, sizeof(base_name), "#pio_tmp_%lu", nf);
pio_create_filename(iot, base_name, fname, sizeof(fname));
if (pio_debug_level > 0)
HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname);
@@ -898,7 +898,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby
} /* end if */
} /* end else */
- HDsprintf(dname, "Dataset_%ld", ndset);
+ HDsnprintf(dname, sizeof(dname), "Dataset_%ld", ndset);
h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, h5dcpl);
if (h5ds_id < 0) {
@@ -1183,7 +1183,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby
/* Set the file view */
mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type,
- (char *)"native", h5_io_info_g);
+ "native", h5_io_info_g);
VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
/* Perform write */
@@ -1320,7 +1320,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby
else {
/* Set the file view */
mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type,
- (char *)"native", h5_io_info_g);
+ "native", h5_io_info_g);
VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
/* Perform write */
@@ -1879,7 +1879,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt
break;
case PHDF5:
- HDsprintf(dname, "Dataset_%ld", ndset);
+ HDsnprintf(dname, sizeof(dname), "Dataset_%ld", ndset);
h5ds_id = H5DOPEN(fd->h5fd, dname);
if (h5ds_id < 0) {
HDfprintf(stderr, "HDF5 Dataset open failed\n");
@@ -2154,7 +2154,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt
/* Set the file view */
mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type,
- (char *)"native", h5_io_info_g);
+ "native", h5_io_info_g);
VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
/* Perform collective read */
@@ -2291,7 +2291,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt
else {
/* Set the file view */
mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type,
- (char *)"native", h5_io_info_g);
+ "native", h5_io_info_g);
VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
/* Perform read */
@@ -2676,7 +2676,7 @@ do_cleanupfile(iotype iot, char *fname)
return;
if (clean_file_g == -1)
- clean_file_g = (getenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0;
+ clean_file_g = (getenv(HDF5_NOCLEANUP) == NULL) ? 1 : 0;
if (clean_file_g) {
switch (iot) {
diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c
index 41245d9..7e12bed 100644
--- a/tools/src/h5perf/pio_perf.c
+++ b/tools/src/h5perf/pio_perf.c
@@ -188,7 +188,7 @@ typedef struct _minmax {
/* local functions */
static off_t parse_size_directive(const char *size);
-static struct options *parse_command_line(int argc, char *argv[]);
+static struct options *parse_command_line(int argc, const char *const *argv);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
@@ -199,7 +199,7 @@ static int destroy_comm_world(void);
static void output_results(const struct options *options, const char *name, minmax *table, int table_size,
off_t data_size);
static void output_times(const struct options *options, const char *name, minmax *table, int table_size);
-static void output_report(const char *fmt, ...);
+static void output_report(const char *fmt, ...) H5_ATTR_FORMAT(printf, 1, 2);
static void print_indent(register int indent);
static void usage(const char *prog);
static void report_parameters(struct options *opts);
@@ -260,7 +260,7 @@ main(int argc, char *argv[])
pio_comm_g = MPI_COMM_WORLD;
h5_set_info_object();
- opts = parse_command_line(argc, argv);
+ opts = parse_command_line(argc, (const char *const *)argv);
if (!opts) {
exit_value = EXIT_FAILURE;
@@ -579,7 +579,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
- /* show mpi write statics */
+ /* show mpi write statistics */
if (pio_debug_level >= 3) {
/* output all of the times for all iterations */
print_indent(3);
@@ -645,7 +645,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
- /* show mpi read statics */
+ /* show mpi read statistics */
if (pio_debug_level >= 3) {
/* output all of the times for all iterations */
print_indent(3);
@@ -904,7 +904,7 @@ accumulate_minmax_stuff(minmax *mm, int count)
int i;
minmax total_mm;
- total_mm.sum = 0.0f;
+ total_mm.sum = 0.0;
total_mm.max = -DBL_MAX;
total_mm.min = DBL_MAX;
total_mm.num = count;
@@ -1276,7 +1276,7 @@ report_parameters(struct options *opts)
* Added 2D testing (Christian Chilan, 10. August 2005)
*/
static struct options *
-parse_command_line(int argc, char *argv[])
+parse_command_line(int argc, const char *const *argv)
{
register int opt;
struct options *cl_opts;
@@ -1305,7 +1305,7 @@ parse_command_line(int argc, char *argv[])
cl_opts->h5_write_only = FALSE; /* Do both read and write by default */
cl_opts->verify = FALSE; /* No Verify data correctness by default */
- while ((opt = H5_get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'a':
cl_opts->h5_alignment = parse_size_directive(H5_optarg);
diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c
index e69a7cd..95ec3ce 100644
--- a/tools/src/h5perf/sio_engine.c
+++ b/tools/src/h5perf/sio_engine.c
@@ -179,7 +179,7 @@ do_sio(parameters param, results *res)
if ((param.dset_size[i] % param.buf_size[i]) != 0) {
HDfprintf(stderr,
"Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size[%d] (%zu)\n",
+ "transfer buffer size[%d] (%zu)\n",
param.rank, (long long)param.dset_size[i], param.rank, param.buf_size[i]);
GOTOERROR(FAIL);
}
@@ -1267,12 +1267,12 @@ done:
static void
do_cleanupfile(iotype iot, char *filename)
{
- char temp[2048];
+ char temp[4096 + sizeof("-?.h5")];
int j;
hid_t driver;
if (clean_file_g == -1)
- clean_file_g = (HDgetenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0;
+ clean_file_g = (HDgetenv(HDF5_NOCLEANUP) == NULL) ? 1 : 0;
if (clean_file_g) {
diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c
index 1b200b0..87b9d65 100644
--- a/tools/src/h5perf/sio_perf.c
+++ b/tools/src/h5perf/sio_perf.c
@@ -164,7 +164,7 @@ typedef struct {
/* local functions */
static hsize_t parse_size_directive(const char *size);
-static struct options *parse_command_line(int argc, const char *argv[]);
+static struct options *parse_command_line(int argc, const char *const *argv);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
@@ -185,7 +185,7 @@ static void report_parameters(struct options *opts);
* Modifications:
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
int exit_value = EXIT_SUCCESS;
struct options *opts = NULL;
@@ -197,7 +197,7 @@ main(int argc, const char *argv[])
output = stdout;
- opts = parse_command_line(argc, argv);
+ opts = parse_command_line(argc, (const char *const *)argv);
if (!opts) {
exit_value = EXIT_FAILURE;
@@ -277,7 +277,7 @@ run_test_loop(struct options *opts)
}
/* print size information */
- output_report("Transfer Buffer Size (bytes): %d\n", buf_bytes);
+ output_report("Transfer Buffer Size (bytes): %zu\n", buf_bytes);
output_report("File Size(MB): %.2f\n", ((double)parms.num_bytes) / ONE_MB);
print_indent(0);
@@ -310,14 +310,14 @@ run_test(iotype iot, parameters parms, struct options *opts)
minmax * read_mm_table = NULL;
minmax * read_gross_mm_table = NULL;
minmax * read_raw_mm_table = NULL;
- minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax write_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax write_sys_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_gross_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_raw_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_sys_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_gross_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_raw_mm = {0.0, 0.0, 0.0, 0};
raw_size = (off_t)parms.num_bytes;
parms.io_type = iot;
@@ -427,7 +427,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
- /* show sys write statics */
+ /* show sys write statistics */
#if 0
if (sio_debug_level >= 3) {
/* output all of the times for all iterations */
@@ -473,7 +473,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
- /* show mpi read statics */
+ /* show mpi read statistics */
#if 0
if (sio_debug_level >= 3) {
/* output all of the times for all iterations */
@@ -574,7 +574,7 @@ accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm)
{
int i;
- total_mm->sum = 0.0F;
+ total_mm->sum = 0.0;
total_mm->max = -DBL_MAX;
total_mm->min = DBL_MAX;
total_mm->num = count;
@@ -817,7 +817,7 @@ report_parameters(struct options *opts)
* Added multidimensional testing (Christian Chilan, April, 2008)
*/
static struct options *
-parse_command_line(int argc, const char *argv[])
+parse_command_line(int argc, const char *const *argv)
{
int opt;
struct options *cl_opts;
@@ -1278,7 +1278,7 @@ usage(const char *prog)
HDprintf("\n");
HDprintf(" Example: 2K,2K,3K\n");
HDprintf("\n");
- HDprintf(" The example defines an object (dataset, tranfer buffer) with three\n");
+ HDprintf(" The example defines an object (dataset, transfer buffer) with three\n");
HDprintf(" dimensions. Be aware that as the number of dimensions increases, the\n");
HDprintf(" the total size of the object increases exponentially.\n");
HDprintf("\n");
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 7cad36b..d0aad79 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -221,6 +221,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
* to free the stack.
*-------------------------------------------------------------------------
*/
+
hid_t
copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt,
pack_opt_t *options)
@@ -354,24 +355,28 @@ done:
int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- hid_t attr_id = H5I_INVALID_HID; /* attr ID */
- hid_t attr_out = H5I_INVALID_HID; /* attr ID */
- hid_t space_id = H5I_INVALID_HID; /* space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
- hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
- size_t msize; /* size of type */
- void * buf = NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- htri_t is_named; /* Whether the datatype is named */
- hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
- char name[255];
- H5O_info2_t oinfo; /* object info */
- int j;
- unsigned u;
- hbool_t is_ref = 0;
- H5T_class_t type_class = -1;
- int ret_value = 0;
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
+ size_t msize; /* size of type */
+ void * buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ htri_t is_named; /* Whether the datatype is named */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ H5_timer_t timer; /* Timer for read/write operations */
+ H5_timevals_t times; /* Elapsed time for each operation */
+ static double read_time = 0;
+ static double write_time = 0;
+ char name[255];
+ H5O_info2_t oinfo; /* object info */
+ int j;
+ unsigned u;
+ hbool_t is_ref = 0;
+ H5T_class_t type_class = -1;
+ int ret_value = 0;
if (H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
@@ -468,6 +473,9 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
} /* end for each member */
} /* end if type_class is H5T_COMPOUND */
+ read_time = 0;
+ write_time = 0;
+
if (!is_ref) {
/*-----------------------------------------------------------------
* read to memory
@@ -478,8 +486,17 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
if (buf == NULL) {
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Aread(attr_id, wtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ read_time += times.elapsed;
+ }
/*-----------------------------------------------------------------
* copy
@@ -488,8 +505,18 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Acreate2 failed on ,%s>", name);
+
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Awrite(attr_out, wtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Awrite failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
/*close*/
if (H5Aclose(attr_out) < 0)
@@ -499,11 +526,14 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
* be reclaimed */
if (TRUE == h5tools_detect_vlen(wtype_id))
H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+
HDfree(buf);
buf = NULL;
} /*H5T_REFERENCE*/
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_ATTR_TIME, "attr", read_time, write_time, name);
+ else
HDprintf(FORMAT_OBJ_ATTR, "attr", name);
/*---------------------------------------------------------------------
@@ -569,7 +599,7 @@ check_options(pack_opt_t *options)
* Objects to layout
*-------------------------------------------------------------------------
*/
- if (options->verbose && have_request(options)) {
+ if (options->verbose > 0 && have_request(options)) {
if (options->all_layout == 1) {
HDprintf("All objects to modify layout are...\n");
switch (options->layout_g) {
@@ -610,7 +640,7 @@ check_options(pack_opt_t *options)
char *name = options->op_tbl->objs[i].path;
if (options->op_tbl->objs[i].chunk.rank > 0) {
- if (options->verbose) {
+ if (options->verbose > 0) {
HDprintf(" <%s> with chunk size ", name);
for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
HDprintf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]);
@@ -619,7 +649,7 @@ check_options(pack_opt_t *options)
has_ck = 1;
}
else if (options->op_tbl->objs[i].chunk.rank == -2) { /* TODO: replace 'magic number' */
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf(" <%s> %s\n", name, "NONE (contiguous)");
has_ck = 1;
}
@@ -633,7 +663,7 @@ check_options(pack_opt_t *options)
*-------------------------------------------------------------------------
*/
- if (options->verbose && have_request(options)) {
+ if (options->verbose > 0 && have_request(options)) {
if (options->all_filter == 1) {
HDprintf("All objects to apply filter are...\n");
for (k = 0; k < options->n_filter_g; k++) {
@@ -670,7 +700,7 @@ check_options(pack_opt_t *options)
char * name = pack.path;
for (j = 0; j < pack.nfilters; j++) {
- if (options->verbose) {
+ if (options->verbose > 0) {
if (pack.filter[j].filtn >= 0) {
if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) {
HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn),
@@ -708,7 +738,7 @@ check_options(pack_opt_t *options)
*------------------------------------------------------------------------
*/
if (options->ublock_filename != NULL && options->ublock_size == 0) {
- if (options->verbose) {
+ if (options->verbose > 0) {
HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
options->ublock_filename);
options->ublock_size = 1024;
@@ -758,8 +788,8 @@ check_objects(const char *fname, pack_opt_t *options)
* open the file
*-------------------------------------------------------------------------
*/
- if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT),
+ NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
/*-------------------------------------------------------------------------
@@ -781,21 +811,21 @@ check_objects(const char *fname, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
pack_info_t obj = options->op_tbl->objs[i];
char * name = obj.path;
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf(" <%s>", name);
/* the input object names are present in the file and are valid */
if (h5trav_getindext(name, travt) < 0)
H5TOOLS_GOTO_ERROR((-1), "%s Could not find <%s> in file <%s>. Exiting...\n",
- (options->verbose ? "\n" : ""), name, fname);
- if (options->verbose)
+ (options->verbose > 0 ? "\n" : ""), name, fname);
+ if (options->verbose > 0)
HDprintf("...Found\n");
for (ifil = 0; ifil < obj.nfilters; ifil++) {
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index 74525f4..65e5d40 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -27,6 +27,12 @@
#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */
#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
+/* timing formats */
+#define FORMAT_OBJ_TIME " %-27s %e/%e %s\n" /* obj type, name */
+#define FORMAT_OBJ_ATTR_TIME " %-27s %e/%e %s\n" /* obj type, name */
+#define FORMAT_OBJ_NOTIME " %-27s %s\n" /* obj type, name */
+#define FORMAT_OBJ_ATTR_NOTIME " %-27s %s\n" /* obj type, name */
+
/* File space default information */
#define FS_PAGESIZE_DEF 4096
#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
@@ -118,7 +124,7 @@ typedef struct {
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,
- datatype, fill value, filter pipleline, attribute */
+ datatype, fill value, filter pipeline, attribute */
const char * ublock_filename; /* user block file name */
hsize_t ublock_size; /* user block size */
hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 934b4d1..c38a431 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -39,7 +39,8 @@
*/
static int get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t size_datum,
hsize_t dims_hslab[], hsize_t *hslab_nbytes_p);
-static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr);
+static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr, pack_opt_t *options,
+ double read_time, double write_time);
static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options);
static int copy_user_block(const char *infile, const char *outfile, hsize_t size);
#if defined(H5REPACK_DEBUG_USER_BLOCK)
@@ -66,7 +67,7 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
hid_t fcpl = H5P_DEFAULT; /* file creation 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 */
+ H5F_fspace_strategy_t set_strategy; /* Strategy to be set in output file */
hbool_t set_persist; /* Persist free-space status to be set in output file */
hsize_t set_threshold; /* Free-space section threshold to be set in output file */
hsize_t set_pagesize; /* File space page size to be set in output file */
@@ -81,8 +82,8 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
* open input file
*-------------------------------------------------------------------------
*/
- if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, (size_t)0)) < 0)
+ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl, (options->fin_fapl != H5P_DEFAULT),
+ 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 */
@@ -187,7 +188,7 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_nindexes failed to set the number of shared "
"object header message indexes");
- /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
+ /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipeline, 4=attribute */
for (i = 0; i < (nindex - 1); i++)
if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_index failed to configure the specified "
@@ -298,7 +299,7 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
* create the output file
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf("Making new file ...\n");
if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, options->fout_fapl)) < 0)
@@ -401,18 +402,18 @@ done:
/*-------------------------------------------------------------------------
* Function: get_hyperslab
*
- * Purpose: Calulate a hyperslab from a dataset for higher performance.
- * The size of hyperslab is limitted by H5TOOLS_BUFSIZE.
- * Return the hyperslab dimentions and size in byte.
+ * Purpose: Calculate a hyperslab from a dataset for higher performance.
+ * The size of hyperslab is limited by H5TOOLS_BUFSIZE.
+ * Return the hyperslab dimensions and size in byte.
*
* Return: 0 - SUCCEED, -1 FAILED
*
* Parameters:
* dcpl_id : [IN] dataset creation property.
* rank_dset : [IN] dataset rank
- * dims_dset[] : [IN] dataset dimentions
+ * dims_dset[] : [IN] dataset dimensions
* size_datum : [IN] size of a data element in byte
- * dims_hslab[] : [OUT] calculated hyperslab dimentions
+ * dims_hslab[] : [OUT] calculated hyperslab dimensions
* * hslab_nbytes_p : [OUT] total byte of the hyperslab
*
* Update:
@@ -427,7 +428,7 @@ done:
* 3. If not chunked, each data element would be a unit of collection and
* the boundary would be dataset's dims.
*
- * The calulation starts from the last dimention (h5dump dims output).
+ * The calculation starts from the last dimension (h5dump dims output).
*-----------------------------------------*/
int
@@ -441,8 +442,8 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t si
hsize_t size_chunk = 1;
hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
- hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
+ hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimensions */
+ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimensions */
hsize_t hslab_nbytes; /* size of hyperslab in byte */
int ret_value = 0;
@@ -467,18 +468,18 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t si
/* 1. if a chunk fit in hyperslab buffer */
if (nchunk_fit >= 1) {
- /* Calulate a hyperslab that contains as many chunks that can fit
+ /* Calculate a hyperslab that contains as many chunks that can fit
* in hyperslab buffer. Hyperslab will be increased starting from
- * the last dimention of the dataset (see h5dump's dims output).
+ * the last dimension of the dataset (see h5dump's dims output).
* The calculation boundary is dataset dims.
* In the loop, used mapping from a datum to a chunk to figure out
* chunk based hyperslab.
*/
for (k = rank_dset; k > 0; --k) {
- /* map dataset dimentions with a chunk dims */
+ /* map dataset dimensions with a chunk dims */
chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1];
- /* if reminder exist, increse by 1 to cover partial edge chunks */
+ /* if reminder exist, increase by 1 to cover partial edge chunks */
if (dims_dset[k - 1] % dims_chunk[k - 1] > 0)
chunk_dims_map[k - 1]++;
@@ -491,7 +492,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t si
if (nchunk_fit == 0)
nchunk_fit = 1;
- /* get hyperslab dimentions as unmapping to actual size */
+ /* get hyperslab dimensions as unmapping to actual size */
dims_hslab[k - 1] = MIN((hs_dims_map[k - 1] * dims_chunk[k - 1]), dims_dset[k - 1]);
/* calculate total size for the hyperslab */
@@ -500,9 +501,9 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t si
}
/* 2. if a chunk is bigger than hyperslab buffer */
else {
- /* Calulate a hyperslab that contains as many data elements that
+ /* Calculate a hyperslab that contains as many data elements that
* can fit in hyperslab buffer. Hyperslab will be increased
- * starting from the last dimention of the chunk (see h5dump's dims
+ * starting from the last dimension of the chunk (see h5dump's dims
* output).
* The calculation boundary is a chunk dims.
*/
@@ -512,7 +513,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t si
/* if a datum is bigger than rest of buffer */
if (ndatum_fit == 0)
ndatum_fit = 1;
- /* get hyperslab dimentions within a chunk boundary */
+ /* get hyperslab dimensions within a chunk boundary */
dims_hslab[k - 1] = MIN(dims_chunk[k - 1], ndatum_fit);
/* calculate total size for the hyperslab */
@@ -525,9 +526,9 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t si
}
/* 3. if dataset is not chunked */
else {
- /* Calulate a hyperslab that contains as many data elements that can
+ /* Calculate a hyperslab that contains as many data elements that can
* fit in hyperslab buffer. Hyperslab will be increased starting from
- * the last dimention of the dataset (see h5dump's dims output).
+ * the last dimension of the dataset (see h5dump's dims output).
* The calculation boundary is dataset dims.
*/
for (k = rank_dset; k > 0; --k) {
@@ -536,7 +537,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t si
/* if a datum is bigger than rest of buffer */
if (ndatum_fit == 0)
ndatum_fit = 1;
- /* get hyperslab dimentions within dataset boundary */
+ /* get hyperslab dimensions within dataset boundary */
dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit);
/* calculate total size for the hyperslab */
@@ -600,7 +601,7 @@ done:
* in (2) is that, when using the strip mine size, it assures that the "remaining" part
* of the dataset that does not fill an entire strip mine is processed.
*
- * 1. figure out a hyperslab (dimentions) and size (refer to get_hyperslab()).
+ * 1. figure out a hyperslab (dimensions) and size (refer to get_hyperslab()).
* 2. Calculate the hyperslab selections as the selection is moving forward.
* Selection would be same as the hyperslab except for the remaining edge portion
* of the dataset. The code take care of the remaining portion if exist.
@@ -643,6 +644,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
int req_filter; /* there was a request for a filter */
int req_obj_layout = 0; /* request layout to current object */
unsigned crt_order_flags; /* group creation order flag */
+ H5_timer_t timer; /* Timer for read/write operations */
+ H5_timevals_t times; /* Elapsed time for each operation */
+ static double read_time = 0;
+ static double write_time = 0;
h5tool_link_info_t linkinfo;
unsigned i;
unsigned u;
@@ -661,7 +666,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*-------------------------------------------------------------------------
*/
- if (options->verbose) {
+ if (options->verbose == 2) {
+ HDprintf("-----------------------------------------------------------------\n");
+ HDprintf(" Type Filter (Compression) Timing read/write Name\n");
+ HDprintf("-----------------------------------------------------------------\n");
+ }
+ else {
HDprintf("-----------------------------------------\n");
HDprintf(" Type Filter (Compression) Name\n");
HDprintf("-----------------------------------------\n");
@@ -682,7 +692,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_GROUP:
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "group", travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "group", travt->objs[i].name);
/* open input group */
@@ -749,6 +761,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
case H5TRAV_TYPE_DATASET: {
hbool_t use_h5ocopy;
+ read_time = 0.0;
+ write_time = 0.0;
+
has_filter = 0;
req_filter = 0;
@@ -972,7 +987,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
if (dset_out == H5I_INVALID_HID) {
H5TOOLS_INFO("H5Dcreate2 failed");
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf(" warning: could not create dataset <%s>. Applying original "
"settings\n",
travt->objs[i].name);
@@ -1013,11 +1028,27 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
}
if (buf != NULL) {
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) <
0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ read_time += times.elapsed;
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
/* Check if we have VL data in the dataset's
* datatype that must be reclaimed */
@@ -1115,12 +1146,28 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
hs_select_nelmts = 1;
} /* end (else) rank == 0 */
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dread(dset_in, wtype_id, hslab_space, f_space_id,
H5P_DEFAULT, hslab_buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ read_time += times.elapsed;
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, dxpl_id,
hslab_buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
/* reclaim any VL memory, if necessary */
if (vl_data)
@@ -1149,7 +1196,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
* print amount of compression used
*-------------------------------------------------------------------------
*/
- if (options->verbose) {
+ if (options->verbose > 0) {
double ratio = 0;
/* only print the compression ration if there was a filter request */
@@ -1160,10 +1207,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
/* compression ratio = uncompressed size / compressed size */
if (dsize_out != 0)
ratio = (double)dsize_in / (double)dsize_out;
- print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
+ print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1, options,
+ read_time, write_time);
}
else
- print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+ print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0, options,
+ read_time, write_time);
/* print a message that the filter was not applied
* (in case there was a filter)
@@ -1220,6 +1269,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Ocopy(fidin, /* Source file or group identifier */
travt->objs[i].name, /* Name of the source object to be copied */
fidout, /* Destination file or group identifier */
@@ -1227,6 +1280,11 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
ocpl_id, /* Properties which apply to the copy */
H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
if (H5Pclose(ocpl_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
@@ -1247,7 +1305,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
if (H5Dclose(dset_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_TIME, "dset", 0.0, write_time, travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
} /* end whether we have request for filter/chunking */
@@ -1260,7 +1320,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "type", travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "type", travt->objs[i].name);
if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
@@ -1300,7 +1362,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*/
case H5TRAV_TYPE_LINK:
case H5TRAV_TYPE_UDLINK:
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "link", travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
/* Check -X option. */
@@ -1425,7 +1489,8 @@ done:
*-------------------------------------------------------------------------
*/
static void
-print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
+print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_t *options, double read_time,
+ double write_time)
{
char strfilter[255];
#if defined(PRINT_DEBUG)
@@ -1514,7 +1579,10 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
} /* end for each filter */
if (!pr)
- HDprintf(FORMAT_OBJ, "dset", objname);
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_TIME, "dset", read_time, write_time, objname);
+ else
+ HDprintf(FORMAT_OBJ, "dset", objname);
else {
char str[512], temp[512];
@@ -1522,7 +1590,10 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
HDstrcat(str, strfilter);
HDsprintf(temp, " (%.3f:1)", ratio);
HDstrcat(str, temp);
- HDprintf(FORMAT_OBJ, str, objname);
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_TIME, str, read_time, write_time, objname);
+ else
+ HDprintf(FORMAT_OBJ, str, objname);
}
} /* end print_dataset_info() */
@@ -1550,7 +1621,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
/* Copy the userblock from the input file to the output file */
while (size > 0) {
- ssize_t nread, nbytes; /* # of bytes transfered, etc. */
+ ssize_t nread, nbytes; /* # of bytes transferred, etc. */
char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
const char *wbuf; /* Pointer into buffer, for writing */
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index 32476ce..76bac5e 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -231,7 +231,7 @@ aux_assign_obj(const char * name, /* object name from traverse list */
* do extra checking in the case of SZIP; delete all filters in the case
* of H5Z_FILTER_NONE present in the PACK_INFO_T filter array
*
- * Return: 0 success, -1 an error occured
+ * Return: 0 success, -1 an error occurred
*-------------------------------------------------------------------------
*/
@@ -258,7 +258,7 @@ apply_filters(const char * name, /* object name from traverse list */
H5TOOLS_GOTO_DONE(0);
/*-------------------------------------------------------------------------
- * initialize the assigment object
+ * initialize the assignment object
*-------------------------------------------------------------------------
*/
init_packobject(&obj);
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 3526268..0241d62 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -18,7 +18,7 @@
/* Name of tool */
#define PROGRAMNAME "h5repack"
-static int parse_command_line(int argc, const char **argv, pack_opt_t *options);
+static int parse_command_line(int argc, const char *const *argv, pack_opt_t *options);
static void leave(int ret) H5_ATTR_NORETURN;
/* module-scoped variables */
@@ -31,7 +31,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW1:2:3:4:5:6:";
+static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:v*z:EG:LM:P:S:T:VXW1:2:3:4:5:6:";
static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"block", require_arg, 'b'},
{"compact", require_arg, 'c'},
@@ -39,18 +39,18 @@ static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"file", require_arg, 'e'},
{"filter", require_arg, 'f'},
{"help", no_arg, 'h'},
- {"infile", require_arg, 'i'}, /* for backward compability */
+ {"infile", require_arg, 'i'}, /* for backward compatibility */
{"low", require_arg, 'j'},
{"high", require_arg, 'k'},
{"layout", require_arg, 'l'},
{"minimum", require_arg, 'm'},
{"native", no_arg, 'n'},
- {"outfile", require_arg, 'o'}, /* for backward compability */
+ {"outfile", require_arg, 'o'}, /* for backward compatibility */
{"sort_by", require_arg, 'q'},
{"ssize", require_arg, 's'},
{"threshold", require_arg, 't'},
{"ublock", require_arg, 'u'},
- {"verbose", no_arg, 'v'},
+ {"verbose", optional_arg, 'v'},
{"sort_order", require_arg, 'z'},
{"enable-error-stack", no_arg, 'E'},
{"fs_pagesize", require_arg, 'G'},
@@ -88,7 +88,8 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " file2 Output HDF5 File\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n");
+ PRINTVALSTREAM(rawoutstream, " -v N, --verbose=N Verbose mode, print object information.\n");
+ PRINTVALSTREAM(rawoutstream, " N - is an integer greater than 1, 2 displays read/write timing\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
PRINTVALSTREAM(rawoutstream,
@@ -112,6 +113,24 @@ usage(const char *prog)
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,
+ " --src-vfd-value Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " input HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --src-vfd-name Name of the VFL driver to use for opening the input\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --src-vfd-info VFD-specific info to pass to the VFL driver used for\n");
+ PRINTVALSTREAM(rawoutstream, " opening the input HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --dst-vfd-value Value (ID) of the VFL driver to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream, " output HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --dst-vfd-name Name of the VFL driver to use for opening the output\n");
+ PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --dst-vfd-info VFD-specific info to pass to the VFL driver 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");
@@ -374,7 +393,7 @@ read_info(const char *filename, pack_opt_t *options)
goto done;
}
- /* find begining of info */
+ /* find beginning of info */
i = 0;
c = '0';
while (c != ' ') {
@@ -482,7 +501,7 @@ set_sort_order(const char *form)
*-------------------------------------------------------------------------
*/
static int
-parse_command_line(int argc, const char **argv, pack_opt_t *options)
+parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
{
h5tools_vol_info_t in_vol_info;
h5tools_vol_info_t out_vol_info;
@@ -525,7 +544,12 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
goto done;
case 'v':
- options->verbose = 1;
+ if (H5_optarg != NULL) {
+ if (2 == HDatoi(H5_optarg))
+ options->verbose = 2;
+ }
+ else
+ options->verbose = 1;
break;
case 'f':
@@ -665,7 +689,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
case 'a':
options->alignment = HDstrtoull(H5_optarg, NULL, 0);
if (options->alignment < 1) {
- error_msg("invalid alignment size\n", H5_optarg);
+ error_msg("invalid alignment size `%s`\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -685,7 +709,7 @@ parse_command_line(int argc, const char **argv, pack_opt_t *options)
else if (!HDstrcmp(strategy, "NONE"))
options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
else {
- error_msg("invalid file space management strategy\n", H5_optarg);
+ error_msg("invalid file space management strategy `%s`\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -858,7 +882,7 @@ done:
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char **argv)
+main(int argc, char **argv)
{
pack_opt_t options; /*the global options */
int parse_ret;
@@ -888,7 +912,7 @@ main(int argc, const char **argv)
/* Initialize default indexing options */
sort_by = H5_INDEX_CRT_ORDER;
- parse_ret = parse_command_line(argc, argv, &options);
+ parse_ret = parse_command_line(argc, (const char *const *)argv, &options);
if (parse_ret < 0) {
HDprintf("Error occurred while parsing command-line options\n");
h5tools_setstatus(EXIT_FAILURE);
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 6191624..3259b89 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -182,8 +182,11 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
/* create the reference, -1 parameter for objects */
if (H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
- if (options->verbose) {
- HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
+ if (options->verbose > 0) {
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "dset", travt->objs[i].name);
+ else
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> object reference created to <%s>\n",
travt->objs[i].name, refname);
}
@@ -276,7 +279,7 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
if (H5Sclose(region_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if (options->verbose) {
+ if (options->verbose > 0) {
HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> region reference created to <%s>\n",
travt->objs[i].name, refname);
@@ -536,7 +539,7 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) /
}
/* This line below needs to be moved in this loop instead of inserting outside. Otherwise,
ref_comp_field_n may be >0 for the next attribute, which may not be
- the reference type and will be accidently treated as the reference type.
+ the reference type and will be accidentally treated as the reference type.
It will then cause the H5Acreate2 failed since that attribute is already created.
KY 2020-02-07
*/
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 0542d03..71ee72e 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -378,11 +378,11 @@ h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t
*-------------------------------------------------------------------------
*/
/* Open the files */
- if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl,
- (fname1_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, (fname1_fapl != H5P_DEFAULT), NULL, 0)) <
+ 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
- if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl,
- (fname2_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, (fname2_fapl != H5P_DEFAULT), NULL, 0)) <
+ 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------
@@ -397,7 +397,7 @@ h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
/*-------------------------------------------------------------------------
- * traverse the suppplied object list
+ * traverse the supplied object list
*-------------------------------------------------------------------------
*/
for (i = 0; i < trav->nobjs; i++) {
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index ea4e314..9ad9203 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -33,7 +33,7 @@
#define H5_NFILTERS_IMPL \
8 /* Number of currently implemented filters + one to \
accommodate for user-define filters + one \
- to accomodate datasets whithout any filters */
+ to accommodate datasets without any filters */
/* File space management strategies: see H5Fpublic.h for declarations */
const char *FS_STRATEGY_NAME[] = {"H5F_FSPACE_STRATEGY_FSM_AGGR",
@@ -830,7 +830,7 @@ hand_free(struct handler_t *hand)
*-------------------------------------------------------------------------
*/
static int
-parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
+parse_command_line(int argc, const char *const *argv, struct handler_t **hand_ret)
{
int opt;
unsigned u;
@@ -1677,7 +1677,7 @@ print_statistics(const char *name, const iter_t *iter)
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
iter_t iter;
const char * fname = NULL;
@@ -1693,7 +1693,7 @@ main(int argc, const char *argv[])
HDmemset(&iter, 0, sizeof(iter));
- if (parse_command_line(argc, argv, &hand) < 0)
+ if (parse_command_line(argc, (const char *const *)argv, &hand) < 0)
goto done;
fname = argv[H5_optind];
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index face2f0..15c170d 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -109,7 +109,7 @@ usage(const char *prog)
*-------------------------------------------------------------------------
*/
static int
-parse_command_line(int argc, const char **argv)
+parse_command_line(int argc, const char *const *argv)
{
int opt;
@@ -224,7 +224,7 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
char * fname = NULL; /* File name */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
@@ -240,7 +240,7 @@ main(int argc, const char *argv[])
h5tools_init();
/* Parse command line options */
- if (parse_command_line(argc, argv) < 0)
+ if (parse_command_line(argc, (const char *const *)argv) < 0)
goto done;
if (fname_g == NULL)
diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c
index 72f47cb..e03c72d 100644
--- a/tools/src/misc/h5debug.c
+++ b/tools/src/misc/h5debug.c
@@ -647,7 +647,7 @@ main(int argc, char *argv[])
}
else if (!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
- * Debug an extensible aray header.
+ * Debug an extensible array header.
*/
const H5EA_class_t *cls = get_H5EA_class(sig);
HDassert(cls);
@@ -668,7 +668,7 @@ main(int argc, char *argv[])
}
else if (!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
- * Debug an extensible aray index block.
+ * Debug an extensible array index block.
*/
const H5EA_class_t *cls = get_H5EA_class(sig);
HDassert(cls);
@@ -689,7 +689,7 @@ main(int argc, char *argv[])
}
else if (!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
- * Debug an extensible aray super block.
+ * Debug an extensible array super block.
*/
const H5EA_class_t *cls = get_H5EA_class(sig);
HDassert(cls);
@@ -709,7 +709,7 @@ main(int argc, char *argv[])
}
else if (!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
- * Debug an extensible aray data block.
+ * Debug an extensible array data block.
*/
const H5EA_class_t *cls = get_H5EA_class(sig);
HDassert(cls);
diff --git a/tools/src/misc/h5delete.c b/tools/src/misc/h5delete.c
index 3c4f8d5..20e81a1 100644
--- a/tools/src/misc/h5delete.c
+++ b/tools/src/misc/h5delete.c
@@ -29,7 +29,7 @@ usage(void)
}
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hbool_t quiet = FALSE;
const char *name = NULL;
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index a85ee4d..5c2396c 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -105,6 +105,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, "\n");
} /* end usage() */
@@ -122,7 +130,7 @@ usage(const char *prog)
*-------------------------------------------------------------------------
*/
static int
-parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
+parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options)
{
int opt; /* Option from command line */
size_t curr_group; /* Current group name to copy */
@@ -252,7 +260,7 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list ID */
@@ -274,7 +282,7 @@ main(int argc, const char *argv[])
}
/* Parse command line */
- if (parse_command_line(argc, argv, &params_g) < 0) {
+ if (parse_command_line(argc, (const char *const *)argv, &params_g) < 0) {
error_msg("unable to parse command line arguments\n");
leave(EXIT_FAILURE);
}