diff options
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5copy/h5copy.c | 17 | ||||
-rw-r--r-- | tools/src/h5diff/h5diff_common.c | 16 | ||||
-rw-r--r-- | tools/src/h5diff/ph5diff_main.c | 2 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump.c | 18 | ||||
-rw-r--r-- | tools/src/h5ls/h5ls.c | 13 | ||||
-rw-r--r-- | tools/src/h5perf/pio_engine.c | 18 | ||||
-rw-r--r-- | tools/src/h5perf/pio_perf.c | 8 | ||||
-rw-r--r-- | tools/src/h5perf/sio_engine.c | 61 | ||||
-rw-r--r-- | tools/src/h5perf/sio_perf.c | 8 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 6 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 17 | ||||
-rw-r--r-- | tools/src/h5stat/h5stat.c | 24 | ||||
-rw-r--r-- | tools/src/misc/h5repart.c | 8 |
13 files changed, 131 insertions, 85 deletions
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 6f10fee..eacd05b 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -19,7 +19,7 @@ #define PROGRAMNAME "h5copy" /* command-line options: short and long-named parameters */ -static const char * s_opts = "d:f:hi:o:ps:vVE"; +static const char * s_opts = "d:f:hi:o:ps:vVE*"; static struct h5_long_options l_opts[] = {{"destination", require_arg, 'd'}, {"flag", require_arg, 'f'}, {"help", no_arg, 'h'}, @@ -29,7 +29,7 @@ static struct h5_long_options l_opts[] = {{"destination", require_arg, 'd'}, {"source", require_arg, 's'}, {"verbose", no_arg, 'v'}, {"version", no_arg, 'V'}, - {"enable-error-stack", no_arg, 'E'}, + {"enable-error-stack", optional_arg, 'E'}, {NULL, 0, '\0'}}; char * fname_src = NULL; char * fname_dst = NULL; @@ -93,15 +93,17 @@ usage(void) PRINTVALSTREAM(rawoutstream, " -o, --output output file name\n"); PRINTVALSTREAM(rawoutstream, " -s, --source source object name\n"); PRINTVALSTREAM(rawoutstream, " -d, --destination destination object name\n"); + PRINTVALSTREAM(rawoutstream, " ERROR\n"); + PRINTVALSTREAM(rawoutstream, + " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n"); + PRINTVALSTREAM(rawoutstream, + " Optional value 2 also prints file open errors.\n"); PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n"); PRINTVALSTREAM(rawoutstream, " -p, --parents No error if existing, make parent groups as needed\n"); PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n"); PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n"); - PRINTVALSTREAM(rawoutstream, - " Prints messages from the HDF5 error stack as they occur.\n"); PRINTVALSTREAM(rawoutstream, " -f, --flag Flag type\n\n"); PRINTVALSTREAM(rawoutstream, " Flag type is one of the following strings:\n\n"); PRINTVALSTREAM(rawoutstream, " shallow Copy only immediate members for groups\n\n"); @@ -288,7 +290,10 @@ main(int argc, char *argv[]) break; case 'E': - enable_error_stack = 1; + if (H5_optarg != NULL) + enable_error_stack = HDatoi(H5_optarg); + else + enable_error_stack = 1; break; default: diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 77a6785..2619a9d 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -25,7 +25,7 @@ static int check_d_input(const char *); * Command-line options: The user can specify short or long-named * parameters. */ -static const char * s_opts = "hVrv*qn:d:p:NcelxE:A:S"; +static const char * s_opts = "hVrv*qn:d:p:NcelxE:A:S*"; static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"version", no_arg, 'V'}, {"report", no_arg, 'r'}, @@ -41,7 +41,7 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"no-dangling-links", no_arg, 'x'}, {"exclude-path", require_arg, 'E'}, {"exclude-attribute", require_arg, 'A'}, - {"enable-error-stack", no_arg, 'S'}, + {"enable-error-stack", optional_arg, 'S'}, {"vol-value-1", require_arg, '1'}, {"vol-name-1", require_arg, '2'}, {"vol-info-1", require_arg, '3'}, @@ -300,7 +300,10 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const break; case 'S': - enable_error_stack = 1; + if (H5_optarg != NULL) + enable_error_stack = HDatoi(H5_optarg); + else + enable_error_stack = 1; break; case 'E': @@ -652,6 +655,10 @@ usage(void) PRINTVALSTREAM(rawoutstream, " [obj1] Name of an HDF5 object, in absolute path\n"); PRINTVALSTREAM(rawoutstream, " [obj2] Name of an HDF5 object, in absolute path\n"); PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " ERROR\n"); + PRINTVALSTREAM(rawoutstream, + " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n"); + PRINTVALSTREAM(rawoutstream, " Optional value 2 also prints file open errors.\n"); PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); PRINTVALSTREAM(rawoutstream, " -h, --help\n"); PRINTVALSTREAM(rawoutstream, " Print a usage message and exit.\n"); @@ -674,9 +681,6 @@ usage(void) PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n"); PRINTVALSTREAM(rawoutstream, " -q, --quiet\n"); PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n"); - PRINTVALSTREAM(rawoutstream, - " Prints messages from the HDF5 error stack as they occur.\n"); PRINTVALSTREAM(rawoutstream, " --vol-value-1 Value (ID) of the VOL connector to use for opening the\n"); PRINTVALSTREAM(rawoutstream, " first HDF5 file specified\n"); diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c index 8e5c3e8..75fb9a4 100644 --- a/tools/src/h5diff/ph5diff_main.c +++ b/tools/src/h5diff/ph5diff_main.c @@ -312,5 +312,5 @@ h5diff_exit(int status) /* Always exit(0), since MPI implementations do weird stuff when they * receive a non-zero exit value. - QAK */ - HDexit(0); + HDexit(status); } diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 8c04bc7..22b869c 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -25,8 +25,8 @@ static const char *xml_dtd_uri_g = NULL; static hbool_t use_custom_vol_g = FALSE; static hbool_t use_custom_vfd_g = FALSE; -static h5tools_vol_info_t vol_info_g; -static h5tools_vfd_info_t vfd_info_g; +static h5tools_vol_info_t vol_info_g = {0}; +static h5tools_vfd_info_t vfd_info_g = {0}; #ifdef H5_HAVE_ROS3_VFD /* Default "anonymous" S3 configuration */ @@ -165,6 +165,12 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n"); PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); + PRINTVALSTREAM(rawoutstream, "--------------- Error Options ---------------\n"); + PRINTVALSTREAM(rawoutstream, + " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n"); + PRINTVALSTREAM(rawoutstream, + " Optional value 2 also prints file open errors.\n"); + PRINTVALSTREAM(rawoutstream, " Default setting disables any error reporting.\n"); PRINTVALSTREAM(rawoutstream, "--------------- File Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -n, --contents Print a list of the file contents and exit\n"); PRINTVALSTREAM(rawoutstream, " Optional value 1 also prints attributes.\n"); @@ -254,10 +260,6 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); PRINTVALSTREAM(rawoutstream, - " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n"); - PRINTVALSTREAM(rawoutstream, - " Optional value 2 also prints file open errors.\n"); - PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n"); PRINTVALSTREAM(rawoutstream, @@ -1236,6 +1238,8 @@ end_collect: h5tools_setstatus(EXIT_FAILURE); goto done; } + + vfd_info_g.info = &ros3_fa_g; #else error_msg("Read-Only S3 VFD not enabled.\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1253,6 +1257,8 @@ end_collect: h5tools_setstatus(EXIT_FAILURE); goto done; } + + vfd_info_g.info = &hdfs_fa_g; #else error_msg("HDFS VFD not enabled.\n"); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 873cec2..389cede 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1663,7 +1663,6 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain hid_t space = H5I_INVALID_HID; hid_t type = H5I_INVALID_HID; hsize_t size[H5S_MAX_RANK]; - hsize_t nelmts = 1; int ndims; int i; H5S_class_t space_type; @@ -1705,10 +1704,8 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain case H5S_SIMPLE: /* simple dataspace */ h5tools_str_append(&buffer, " {"); - for (i = 0; i < ndims; i++) { + for (i = 0; i < ndims; i++) h5tools_str_append(&buffer, "%s%" PRIuHSIZE, i ? ", " : "", size[i]); - nelmts *= size[i]; - } h5tools_str_append(&buffer, "}\n"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); @@ -2528,7 +2525,7 @@ done: * were borrowed from the GNU less(1). * * Return: Success: Number of columns. - * Failure: Some default number of columms. + * Failure: Some default number of columns. *------------------------------------------------------------------------- */ static int @@ -2726,9 +2723,9 @@ main(int argc, char *argv[]) } else if (!HDstrcmp(argv[argno], "--enable-error-stack")) { enable_error_stack = 1; - /* deprecated --errors */ } else if (!HDstrcmp(argv[argno], "--errors")) { + /* deprecated --errors */ enable_error_stack = 1; } else if (!HDstrcmp(argv[argno], "--follow-symlinks")) { @@ -2883,6 +2880,8 @@ main(int argc, char *argv[]) usage(); leave(EXIT_FAILURE); } + + vfd_info.info = &ros3_fa; #else HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n"); usage(); @@ -2904,6 +2903,8 @@ main(int argc, char *argv[]) usage(); leave(EXIT_FAILURE); } + + vfd_info.info = &hdfs_fa; #else HDfprintf(rawerrorstream, "Error: The HDFS VFD is not enabled\n\n"); usage(); diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index 1baaca2..9d08938 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -234,7 +234,7 @@ do_pio(parameters param) } if ((snbytes % pio_mpi_nprocs_g) != 0) { HDfprintf(stderr, - "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "Dataset size (%lld) must be a multiple of the " "number of processes (%d)\n", (long long)snbytes, pio_mpi_nprocs_g); GOTOERROR(FAIL); @@ -243,7 +243,7 @@ do_pio(parameters param) if (!param.dim2d) { 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 " + "Dataset size/process (%lld) must be a multiple of the " "transfer buffer size (%zu)\n", (long long)(snbytes / pio_mpi_nprocs_g), buf_size); GOTOERROR(FAIL); @@ -252,7 +252,7 @@ do_pio(parameters param) else { if (((size_t)snbytes % buf_size) != 0) { HDfprintf(stderr, - "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "Dataset side size (%lld) must be a multiple of the " "transfer buffer size (%zu)\n", (long long)snbytes, buf_size); GOTOERROR(FAIL); @@ -625,15 +625,13 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby if (!parms->dim2d) { HDfprintf(output, "Debug(do_write): " - "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH - "d\n", + "buf_size=%zu, bytes_begin=%lld, bytes_count=%lld\n", buf_size, (long long)bytes_begin[0], (long long)bytes_count); } else { HDfprintf(output, "Debug(do_write): " - "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH - "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + "linear buf_size=%zu, bytes_begin=(%lld,%lld), bytes_count=%lld\n", buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], (long long)bytes_count); } @@ -1640,15 +1638,13 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt if (!parms->dim2d) { HDfprintf(output, "Debug(do_write): " - "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH - "d\n", + "buf_size=%zu, bytes_begin=%lld, bytes_count=%lld\n", buf_size, (long long)bytes_begin[0], (long long)bytes_count); } else { HDfprintf(output, "Debug(do_write): " - "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH - "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + "linear buf_size=%zu, bytes_begin=(%lld,%lld), bytes_count=%lld\n", buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], (long long)bytes_count); } diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c index ec0115b..9c68faf 100644 --- a/tools/src/h5perf/pio_perf.c +++ b/tools/src/h5perf/pio_perf.c @@ -1121,25 +1121,25 @@ recover_size_and_print(long long val, const char *end) if (val >= ONE_MB && (val % ONE_MB) == 0) { if (val >= ONE_GB && (val % ONE_GB) == 0) HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "GB%s", val / ONE_GB, end); else HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "MB%s", val / ONE_MB, end); } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "KB%s", val / ONE_KB, end); } } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "%s", val, end); } diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c index bdd2c08..e113e82 100644 --- a/tools/src/h5perf/sio_engine.c +++ b/tools/src/h5perf/sio_engine.c @@ -123,7 +123,6 @@ static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property * Purpose: SIO Engine where IO are executed. * Return: results * Programmer: Christian Chilan, April, 2008 - * Modifications: */ void do_sio(parameters param, results *res) @@ -134,18 +133,20 @@ do_sio(parameters param, results *res) iotype iot; /* API type */ char base_name[256]; /* test file base name */ /* return codes */ - herr_t ret_code = 0; /*return code */ + herr_t ret_code = 0; /* return code */ - char fname[FILENAME_MAX]; /* test file name */ - int i; - /* HDF5 variables */ - herr_t hrc; /*HDF5 return code */ + char *fname = NULL; + int i; - /* Sanity check parameters */ + /* HDF5 variables */ + herr_t hrc; /* HDF5 return code */ /* IO type */ iot = param.io_type; + if (NULL == (fname = HDcalloc(FILENAME_MAX, sizeof(char)))) + GOTOERROR(FAIL); + switch (iot) { case POSIXIO: fd.posixfd = -1; @@ -178,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 " + "Dataset size[%d] (%lld) must be a multiple of the " "transfer buffer size[%d] (%zu)\n", param.rank, (long long)param.dset_size[i], param.rank, param.buf_size[i]); GOTOERROR(FAIL); @@ -267,8 +268,8 @@ done: } /* release generic resources */ - if (buffer) - free(buffer); + HDfree(buffer); + HDfree(fname); res->ret_code = ret_code; } @@ -521,7 +522,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end if */ } /* end if */ - HDsprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes); + HDsnprintf(dname, sizeof(dname), "Dataset_%ld", (unsigned long)parms->num_bytes); h5ds_id = H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT); @@ -850,7 +851,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) break; case HDF5: - HDsprintf(dname, "Dataset_%ld", (long)parms->num_bytes); + HDsnprintf(dname, sizeof(dname), "Dataset_%ld", (long)parms->num_bytes); h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT); if (h5ds_id < 0) { HDfprintf(stderr, "HDF5 Dataset open failed\n"); @@ -1125,7 +1126,6 @@ done: * Purpose: Sets file driver. * Return: SUCCESS or FAIL * Programmer: Christian Chilan, April, 2008 - * Modifications: */ hid_t @@ -1164,9 +1164,11 @@ set_vfd(parameters *param) H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; haddr_t memb_addr[H5FD_MEM_NTYPES]; H5FD_mem_t mt; + struct { + char arr[H5FD_MEM_NTYPES][1024]; + } *sv = NULL; HDmemset(memb_map, 0, sizeof memb_map); HDmemset(memb_fapl, 0, sizeof memb_fapl); @@ -1174,16 +1176,22 @@ set_vfd(parameters *param) HDmemset(memb_addr, 0, sizeof memb_addr); HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + + if (NULL == (sv = HDcalloc(1, sizeof(*sv)))) + return -1; for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl[mt] = H5P_DEFAULT; - HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; + HDsnprintf(sv->arr[mt], 1024, "%%s-%c.h5", multi_letters[mt]); + memb_name[mt] = sv->arr[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) { + HDfree(sv); return -1; } + + HDfree(sv); } else if (vfd == family) { hsize_t fam_size = 1 * 1024 * 1024; /*100 MB*/ @@ -1262,14 +1270,18 @@ done: * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set. * Return: void * Programmer: Albert Cheng 2001/12/12 - * Modifications: Support for file drivers. Christian Chilan, April, 2008 */ static void do_cleanupfile(iotype iot, char *filename) { - char temp[4096 + sizeof("-?.h5")]; - int j; - hid_t driver; + char * temp = NULL; + size_t temp_sz; + int j; + hid_t driver; + + temp_sz = (4096 + sizeof("-?.h5")) * sizeof(char); + if (NULL == (temp = HDcalloc(1, temp_sz))) + goto done; if (clean_file_g == -1) clean_file_g = (HDgetenv(HDF5_NOCLEANUP) == NULL) ? 1 : 0; @@ -1286,7 +1298,7 @@ do_cleanupfile(iotype iot, char *filename) if (driver == H5FD_FAMILY) { for (j = 0; /*void*/; j++) { - HDsnprintf(temp, sizeof temp, filename, j); + HDsnprintf(temp, temp_sz, filename, j); if (HDaccess(temp, F_OK) < 0) break; @@ -1305,10 +1317,10 @@ do_cleanupfile(iotype iot, char *filename) } else if (driver == H5FD_MULTI) { H5FD_mem_t mt; - assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); + HDsnprintf(temp, temp_sz, "%s-%c.h5", filename, multi_letters[mt]); HDremove(temp); /*don't care if it fails*/ } } @@ -1325,4 +1337,7 @@ do_cleanupfile(iotype iot, char *filename) break; } } + +done: + HDfree(temp); } diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index dc2e15e..5432d6c 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -674,25 +674,25 @@ recover_size_and_print(long long val, const char *end) if (val >= ONE_MB && (val % ONE_MB) == 0) { if (val >= ONE_GB && (val % ONE_GB) == 0) HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "GB%s", val / ONE_GB, end); else HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "MB%s", val / ONE_MB, end); } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "KB%s", val / ONE_KB, end); } } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "%s", val, end); } diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index c38a431..25df5c7 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -1531,7 +1531,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ { unsigned level = cd_values[0]; - HDsprintf(temp, "(%d)", level); + HDsnprintf(temp, sizeof(temp), "(%d)", level); HDstrcat(strfilter, temp); } #endif @@ -1545,7 +1545,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/ unsigned ppb = cd_values[1]; - HDsprintf(temp, "(%d,", ppb); + HDsnprintf(temp, sizeof(temp), "(%d,", ppb); HDstrcat(strfilter, temp); if (options_mask & H5_SZIP_EC_OPTION_MASK) HDstrcpy(temp, "EC) "); @@ -1588,7 +1588,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ HDstrcpy(str, "dset "); HDstrcat(str, strfilter); - HDsprintf(temp, " (%.3f:1)", ratio); + HDsnprintf(temp, sizeof(temp), " (%.3f:1)", ratio); HDstrcat(str, temp); if (options->verbose == 2) HDprintf(FORMAT_OBJ_TIME, str, read_time, write_time, objname); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 4c88bd7..a805b3d 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -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:v*z:EG:LM:P:S:T:VXWY:Z:1:2:3:4:5:6:7:8:9:0:"; +static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:v*z:E*G:LM:P:S:T:VXWY:Z:1:2:3:4:5:6:7:8:9:0:"; static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'}, {"block", require_arg, 'b'}, {"compact", require_arg, 'c'}, @@ -52,7 +52,7 @@ static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'}, {"ublock", require_arg, 'u'}, {"verbose", optional_arg, 'v'}, {"sort_order", require_arg, 'z'}, - {"enable-error-stack", no_arg, 'E'}, + {"enable-error-stack", optional_arg, 'E'}, {"fs_pagesize", require_arg, 'G'}, {"latest", no_arg, 'L'}, {"metadata_block_size", require_arg, 'M'}, @@ -92,6 +92,11 @@ usage(const char *prog) PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] file1 file2\n", prog); PRINTVALSTREAM(rawoutstream, " file1 Input HDF5 File\n"); PRINTVALSTREAM(rawoutstream, " file2 Output HDF5 File\n"); + PRINTVALSTREAM(rawoutstream, " ERROR\n"); + PRINTVALSTREAM(rawoutstream, + " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n"); + PRINTVALSTREAM(rawoutstream, + " Optional value 2 also prints file open errors.\n"); PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n"); PRINTVALSTREAM(rawoutstream, " -v N, --verbose=N Verbose mode, print object information.\n"); @@ -99,9 +104,6 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); 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-value Value (ID) of the VOL connector to use for opening the\n"); PRINTVALSTREAM(rawoutstream, " input HDF5 file specified\n"); PRINTVALSTREAM(rawoutstream, @@ -771,7 +773,10 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) break; case 'E': - enable_error_stack = 1; + if (H5_optarg != NULL) + enable_error_stack = HDatoi(H5_optarg); + else + enable_error_stack = 1; break; case '1': diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 1fbc03c..5dcd03e 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -169,7 +169,7 @@ struct handler_t { char **obj; }; -static const char *s_opts = "Aa:Ddm:EFfhGgl:sSTO:Vw:H:"; +static const char *s_opts = "Aa:Ddm:E*FfhGgl:sSTO:Vw:H:"; /* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"filemetadata", no_arg, 'F'}, @@ -181,7 +181,7 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"object", require_arg, 'O'}, {"version", no_arg, 'V'}, {"attribute", no_arg, 'A'}, - {"enable-error-stack", no_arg, 'E'}, + {"enable-error-stack", optional_arg, 'E'}, {"numattrs", require_arg, 'a'}, {"freespace", no_arg, 's'}, {"summary", no_arg, 'S'}, @@ -211,6 +211,9 @@ usage(const char *prog) HDfflush(stdout); HDfprintf(stdout, "Usage: %s [OPTIONS] file\n", prog); HDfprintf(stdout, "\n"); + HDfprintf(stdout, " ERROR\n"); + HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); + HDfprintf(stdout, " Optional value 2 also prints file open errors\n"); HDfprintf(stdout, " OPTIONS\n"); HDfprintf(stdout, " -h, --help Print a usage message and exit\n"); HDfprintf(stdout, " -V, --version Print version number and exit\n"); @@ -235,7 +238,6 @@ usage(const char *prog) HDfprintf(stdout, " than 0. The default threshold is 10.\n"); HDfprintf(stdout, " -s, --freespace Print free space information\n"); HDfprintf(stdout, " -S, --summary Print summary of file space information\n"); - HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); HDfprintf(stdout, " --s3-cred=<cred> Access file on S3, using provided credential\n"); HDfprintf(stdout, " <cred> :: (region,id,key)\n"); HDfprintf(stdout, " If <cred> == \"(,,)\", no authentication is used.\n"); @@ -852,7 +854,10 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re break; case 'E': - enable_error_stack = 1; + if (H5_optarg != NULL) + enable_error_stack = HDatoi(H5_optarg); + else + enable_error_stack = 1; break; case 'F': @@ -1709,6 +1714,15 @@ main(int argc, char *argv[]) vfd_info.u.name = drivername; vfd_info.fname = fname; +#ifdef H5_HAVE_ROS3_VFD + if (!HDstrcmp(drivername, drivernames[ROS3_VFD_IDX])) + vfd_info.info = &ros3_fa; +#endif +#ifdef H5_HAVE_LIBHDFS + if (!HDstrcmp(drivername, drivernames[HDFS_VFD_IDX])) + vfd_info.info = &hdfs_fa; +#endif + if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &vfd_info)) < 0) { error_msg("Unable to create FAPL for file access\n"); goto done; @@ -1739,7 +1753,7 @@ main(int argc, char *argv[]) warn_msg("Unable to retrieve file size\n"); HDassert(iter.filesize != 0); - /* Get storge info for file-level structures */ + /* Get storage info for file-level structures */ if (H5Fget_info2(fid, &finfo) < 0) warn_msg("Unable to retrieve file info\n"); else { diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index f4cef6a..078883d 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -242,7 +242,7 @@ main(int argc, char *argv[]) if (argno >= argc) usage(prog_name); src_gen_name = argv[argno++]; - HDsprintf(src_name, src_gen_name, src_membno); + HDsnprintf(src_name, NAMELEN, src_gen_name, src_membno); src_is_family = strcmp(src_name, src_gen_name); if ((src = HDopen(src_name, O_RDONLY)) < 0) { @@ -264,7 +264,7 @@ main(int argc, char *argv[]) if (argno >= argc) usage(prog_name); dst_gen_name = argv[argno++]; - HDsprintf(dst_name, dst_gen_name, dst_membno); + HDsnprintf(dst_name, NAMELEN, dst_gen_name, dst_membno); dst_is_family = HDstrcmp(dst_name, dst_gen_name); if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { @@ -356,7 +356,7 @@ main(int argc, char *argv[]) dst_offset = dst_offset + (off_t)n; break; } - HDsprintf(src_name, src_gen_name, ++src_membno); + HDsnprintf(src_name, NAMELEN, src_gen_name, ++src_membno); if ((src = HDopen(src_name, O_RDONLY)) < 0 && ENOENT == errno) { dst_offset = dst_offset + (off_t)n; break; @@ -404,7 +404,7 @@ main(int argc, char *argv[]) } } HDclose(dst); - HDsprintf(dst_name, dst_gen_name, ++dst_membno); + HDsnprintf(dst_name, NAMELEN, dst_gen_name, ++dst_membno); if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { HDperror(dst_name); HDexit(EXIT_FAILURE); |