diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
commit | feb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch) | |
tree | e15d7e751af4e3c42e77ea955d91db4cf27a71cf /test/vfd_swmr_bigset_writer.c | |
parent | bdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff) | |
download | hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2 |
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'test/vfd_swmr_bigset_writer.c')
-rw-r--r-- | test/vfd_swmr_bigset_writer.c | 753 |
1 files changed, 343 insertions, 410 deletions
diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c index 4d1ccbe..dad33ce 100644 --- a/test/vfd_swmr_bigset_writer.c +++ b/test/vfd_swmr_bigset_writer.c @@ -66,8 +66,8 @@ * user-selectable. */ -#define H5C_FRIEND /*suppress error about including H5Cpkg */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "hdf5.h" @@ -105,7 +105,7 @@ typedef struct _quadrant { hsize_t stride[RANK]; hsize_t block[RANK]; hsize_t count[RANK]; - hid_t space, src_space; + hid_t space, src_space; } quadrant_t; typedef struct _sources { @@ -115,58 +115,55 @@ typedef struct _sources { #define MANY_FILES 4 typedef struct { - hid_t *dataset; - sources_t *sources; - hid_t file[MANY_FILES]; - hid_t dapl, filetype, memspace, one_by_one_sid, quadrant_dcpl; - unsigned ndatasets; - const char *filename[MANY_FILES]; - char progname[PATH_MAX]; - struct timespec update_interval; - struct { - quadrant_t ul, ur, bl, br, src; - } quadrants; - unsigned int cols, rows; - unsigned int asteps; - unsigned int nsteps; - bool two_dee; - bool wait_for_signal; - enum {vds_off, vds_single, vds_multi} vds; - bool use_vfd_swmr; - bool writer; - bool fixed_array; - hsize_t chunk_dims[RANK]; - hsize_t one_dee_max_dims[RANK]; + hid_t * dataset; + sources_t * sources; + hid_t file[MANY_FILES]; + hid_t dapl, filetype, memspace, one_by_one_sid, quadrant_dcpl; + unsigned ndatasets; + const char * filename[MANY_FILES]; + char progname[PATH_MAX]; + struct timespec update_interval; + struct { + quadrant_t ul, ur, bl, br, src; + } quadrants; + unsigned int cols, rows; + unsigned int asteps; + unsigned int nsteps; + bool two_dee; + bool wait_for_signal; + enum { vds_off, vds_single, vds_multi } vds; + bool use_vfd_swmr; + bool writer; + bool fixed_array; + hsize_t chunk_dims[RANK]; + hsize_t one_dee_max_dims[RANK]; } state_t; static inline state_t state_initializer(void) { - return (state_t){ - .memspace = H5I_INVALID_HID - , .dapl = H5I_INVALID_HID - , .file = {H5I_INVALID_HID, H5I_INVALID_HID, - H5I_INVALID_HID, H5I_INVALID_HID} - , .filetype = H5T_NATIVE_UINT32 - , .one_by_one_sid = H5I_INVALID_HID - , .quadrant_dcpl = H5I_INVALID_HID - , .rows = ROWS - , .cols = COLS - , .ndatasets = 5 - , .asteps = 10 - , .nsteps = 100 - , .filename = {"", "", "", ""} - , .two_dee = false - , .wait_for_signal = true - , .vds = vds_off - , .use_vfd_swmr = true - , .writer = true - , .fixed_array = false - , .one_dee_max_dims = {ROWS, H5S_UNLIMITED} - , .chunk_dims = {ROWS, COLS} - , .update_interval = (struct timespec){ - .tv_sec = 0 - , .tv_nsec = 1000000000UL / 30 /* 1/30 second */}}; + return (state_t){.memspace = H5I_INVALID_HID, + .dapl = H5I_INVALID_HID, + .file = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID}, + .filetype = H5T_NATIVE_UINT32, + .one_by_one_sid = H5I_INVALID_HID, + .quadrant_dcpl = H5I_INVALID_HID, + .rows = ROWS, + .cols = COLS, + .ndatasets = 5, + .asteps = 10, + .nsteps = 100, + .filename = {"", "", "", ""}, + .two_dee = false, + .wait_for_signal = true, + .vds = vds_off, + .use_vfd_swmr = true, + .writer = true, + .fixed_array = false, + .one_dee_max_dims = {ROWS, H5S_UNLIMITED}, + .chunk_dims = {ROWS, COLS}, + .update_interval = + (struct timespec){.tv_sec = 0, .tv_nsec = 1000000000UL / 30 /* 1/30 second */}}; } static void state_init(state_t *, int, char **); @@ -210,65 +207,61 @@ newmat(unsigned rows, unsigned cols) static void usage(const char *progname) { - fprintf(stderr, "usage: %s [-F] [-M] [-S] [-V] [-W] [-a steps] [-b] [-c cols]\n" - " [-d dims]\n" - " [-n iterations] [-r rows] [-s datasets]\n" - " [-u milliseconds]\n" - "\n" - "-F: fixed maximal dimension for the chunked datasets\n" - "-M: use virtual datasets and many source\n" - " files\n" - "-S: do not use VFD SWMR\n" - "-V: use virtual datasets and a single\n" - " source file\n" - "-W: do not wait for a signal before\n" - " exiting\n" - "-a steps: `steps` between adding attributes\n" - "-b: write data in big-endian byte order\n" - "-c cols: `cols` columns per chunk\n" - "-d 1|one|2|two|both: select dataset expansion in one or\n" - " both dimensions\n" - "-n iterations: how many times to expand each dataset\n" - "-r rows: `rows` rows per chunk\n" - "-s datasets: number of datasets to create\n" - "-u ms: milliseconds interval between updates\n" - " to %s.h5\n" - "\n", - progname, progname); - exit(EXIT_FAILURE); + fprintf(stderr, + "usage: %s [-F] [-M] [-S] [-V] [-W] [-a steps] [-b] [-c cols]\n" + " [-d dims]\n" + " [-n iterations] [-r rows] [-s datasets]\n" + " [-u milliseconds]\n" + "\n" + "-F: fixed maximal dimension for the chunked datasets\n" + "-M: use virtual datasets and many source\n" + " files\n" + "-S: do not use VFD SWMR\n" + "-V: use virtual datasets and a single\n" + " source file\n" + "-W: do not wait for a signal before\n" + " exiting\n" + "-a steps: `steps` between adding attributes\n" + "-b: write data in big-endian byte order\n" + "-c cols: `cols` columns per chunk\n" + "-d 1|one|2|two|both: select dataset expansion in one or\n" + " both dimensions\n" + "-n iterations: how many times to expand each dataset\n" + "-r rows: `rows` rows per chunk\n" + "-s datasets: number of datasets to create\n" + "-u ms: milliseconds interval between updates\n" + " to %s.h5\n" + "\n", + progname, progname); + exit(EXIT_FAILURE); } static void make_quadrant_dataspace(state_t *s, quadrant_t *q) { q->space = H5Screate_simple(NELMTS(s->chunk_dims), s->chunk_dims, - s->two_dee ? two_dee_max_dims : s->one_dee_max_dims); + s->two_dee ? two_dee_max_dims : s->one_dee_max_dims); if (q->space < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } - if (H5Sselect_hyperslab(q->space, H5S_SELECT_SET, q->start, q->stride, - q->count, q->block) < 0) + if (H5Sselect_hyperslab(q->space, H5S_SELECT_SET, q->start, q->stride, q->count, q->block) < 0) errx(EXIT_FAILURE, "%s: H5Sselect_hyperslab failed", __func__); } static void state_init(state_t *s, int argc, char **argv) { - unsigned long tmp; - int ch; - unsigned i; - const hsize_t dims = 1; - char tfile[PATH_MAX]; - char *end; - unsigned long millis; - quadrant_t * const ul = &s->quadrants.ul, - * const ur = &s->quadrants.ur, - * const bl = &s->quadrants.bl, - * const br = &s->quadrants.br, - * const src = &s->quadrants.src; + unsigned long tmp; + int ch; + unsigned i; + const hsize_t dims = 1; + char tfile[PATH_MAX]; + char * end; + unsigned long millis; + quadrant_t *const ul = &s->quadrants.ul, *const ur = &s->quadrants.ur, *const bl = &s->quadrants.bl, + *const br = &s->quadrants.br, *const src = &s->quadrants.src; const char *personality; *s = state_initializer(); @@ -277,91 +270,86 @@ state_init(state_t *s, int argc, char **argv) while ((ch = getopt(argc, argv, "FMSVWa:bc:d:n:qr:s:u:")) != -1) { switch (ch) { - case 'F': - /* The flag to indicate whether the maximal dimension of the chunked datasets is fixed or unlimited */ - s->fixed_array = true; - break; - case 'M': - s->vds = vds_multi; - break; - case 'S': - s->use_vfd_swmr = false; - break; - case 'V': - s->vds = vds_single; - break; - case 'W': - s->wait_for_signal = false; - break; - case 'd': - if (strcmp(optarg, "1") == 0 || - strcmp(optarg, "one") == 0) - s->two_dee = false; - else if (strcmp(optarg, "2") == 0 || - strcmp(optarg, "two") == 0 || - strcmp(optarg, "both") == 0) - s->two_dee = true; - else { - errx(EXIT_FAILURE, - "bad -d argument \"%s\"", optarg); - } - break; - case 'a': - case 'c': - case 'n': - case 'r': - case 's': - errno = 0; - tmp = strtoul(optarg, &end, 0); - if (end == optarg || *end != '\0') { - errx(EXIT_FAILURE, "couldn't parse `-%c` argument `%s`", ch, - optarg); - } else if (errno != 0) { - err(EXIT_FAILURE, "couldn't parse `-%c` argument `%s`", ch, - optarg); - } else if (tmp > UINT_MAX) - errx(EXIT_FAILURE, "`-%c` argument `%lu` too large", ch, tmp); - - if ((ch == 'c' || ch == 'r') && tmp == 0) { - errx(EXIT_FAILURE, "`-%c` argument `%lu` must be >= 1", ch, - tmp); - } - - if (ch == 'a') - s->asteps = (unsigned)tmp; - else if (ch == 'c') - s->cols = (unsigned)tmp; - else if (ch == 'n') - s->nsteps = (unsigned)tmp; - else if (ch == 'r') - s->rows = (unsigned)tmp; - else - s->ndatasets = (unsigned)tmp; - break; - case 'b': - s->filetype = H5T_STD_U32BE; - break; - case 'q': - verbosity = 0; - break; - case 'u': - errno = 0; - millis = strtoul(optarg, &end, 0); - if (millis == ULONG_MAX && errno == ERANGE) { - err(EXIT_FAILURE, - "option -p argument \"%s\"", optarg); - } else if (*end != '\0') { - errx(EXIT_FAILURE, - "garbage after -p argument \"%s\"", optarg); - } - s->update_interval.tv_sec = (time_t)(millis / 1000UL); - s->update_interval.tv_nsec = - (long)((millis * 1000000UL) % 1000000000UL); - break; - case '?': - default: - usage(s->progname); - break; + case 'F': + /* The flag to indicate whether the maximal dimension of the chunked datasets is fixed or + * unlimited */ + s->fixed_array = true; + break; + case 'M': + s->vds = vds_multi; + break; + case 'S': + s->use_vfd_swmr = false; + break; + case 'V': + s->vds = vds_single; + break; + case 'W': + s->wait_for_signal = false; + break; + case 'd': + if (strcmp(optarg, "1") == 0 || strcmp(optarg, "one") == 0) + s->two_dee = false; + else if (strcmp(optarg, "2") == 0 || strcmp(optarg, "two") == 0 || + strcmp(optarg, "both") == 0) + s->two_dee = true; + else { + errx(EXIT_FAILURE, "bad -d argument \"%s\"", optarg); + } + break; + case 'a': + case 'c': + case 'n': + case 'r': + case 's': + errno = 0; + tmp = strtoul(optarg, &end, 0); + if (end == optarg || *end != '\0') { + errx(EXIT_FAILURE, "couldn't parse `-%c` argument `%s`", ch, optarg); + } + else if (errno != 0) { + err(EXIT_FAILURE, "couldn't parse `-%c` argument `%s`", ch, optarg); + } + else if (tmp > UINT_MAX) + errx(EXIT_FAILURE, "`-%c` argument `%lu` too large", ch, tmp); + + if ((ch == 'c' || ch == 'r') && tmp == 0) { + errx(EXIT_FAILURE, "`-%c` argument `%lu` must be >= 1", ch, tmp); + } + + if (ch == 'a') + s->asteps = (unsigned)tmp; + else if (ch == 'c') + s->cols = (unsigned)tmp; + else if (ch == 'n') + s->nsteps = (unsigned)tmp; + else if (ch == 'r') + s->rows = (unsigned)tmp; + else + s->ndatasets = (unsigned)tmp; + break; + case 'b': + s->filetype = H5T_STD_U32BE; + break; + case 'q': + verbosity = 0; + break; + case 'u': + errno = 0; + millis = strtoul(optarg, &end, 0); + if (millis == ULONG_MAX && errno == ERANGE) { + err(EXIT_FAILURE, "option -p argument \"%s\"", optarg); + } + else if (*end != '\0') { + errx(EXIT_FAILURE, "garbage after -p argument \"%s\"", optarg); + } + s->update_interval.tv_sec = (time_t)(millis / 1000UL); + s->update_interval.tv_nsec = (long)((millis * 1000000UL) % 1000000000UL); + break; + case '?': + default: + usage(s->progname); + break; } } argc -= optind; @@ -371,115 +359,104 @@ state_init(state_t *s, int argc, char **argv) errx(EXIT_FAILURE, "unexpected command-line arguments"); if (s->vds != vds_off && s->two_dee) { - errx(EXIT_FAILURE, - "virtual datasets and 2D datasets are mutually exclusive"); + errx(EXIT_FAILURE, "virtual datasets and 2D datasets are mutually exclusive"); } - s->chunk_dims[0] = s->rows; - s->chunk_dims[1] = s->cols; + s->chunk_dims[0] = s->rows; + s->chunk_dims[1] = s->cols; s->one_dee_max_dims[0] = s->rows; - if(s->fixed_array) { + if (s->fixed_array) { s->one_dee_max_dims[1] = s->cols * s->nsteps; - two_dee_max_dims[0] = s->rows * s->nsteps; - two_dee_max_dims[1] = s->cols * s->nsteps; - } else { + two_dee_max_dims[0] = s->rows * s->nsteps; + two_dee_max_dims[1] = s->cols * s->nsteps; + } + else { s->one_dee_max_dims[1] = H5S_UNLIMITED; two_dee_max_dims[0] = two_dee_max_dims[1] = H5S_UNLIMITED; } if (s->vds != vds_off) { const hsize_t half_chunk_dims[RANK] = {s->rows / 2, s->cols / 2}; - hsize_t half_max_dims[RANK]; + hsize_t half_max_dims[RANK]; - if(s->fixed_array) { + if (s->fixed_array) { half_max_dims[0] = s->rows / 2; half_max_dims[1] = (s->cols * s->nsteps) / 2; - } else { + } + else { half_max_dims[0] = s->rows / 2; half_max_dims[1] = H5S_UNLIMITED; } if ((s->quadrant_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Pcreate failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Pcreate failed", __func__, __LINE__); } if (H5Pset_chunk(s->quadrant_dcpl, RANK, half_chunk_dims) < 0) errx(EXIT_FAILURE, "H5Pset_chunk failed"); - *ul = (quadrant_t){ - .start = {0, 0} - , .stride = {s->rows, s->cols} - , .block = {s->rows / 2, s->cols / 2} - , .count = {1, H5S_UNLIMITED}}; - - *ur = (quadrant_t){ - .start = {s->rows / 2, 0} - , .stride = {s->rows, s->cols} - , .block = {s->rows / 2, s->cols / 2} - , .count = {1, H5S_UNLIMITED}}; - - *bl = (quadrant_t){ - .start = {0, s->cols / 2} - , .stride = {s->rows, s->cols} - , .block = {s->rows / 2, s->cols / 2} - , .count = {1, H5S_UNLIMITED}}; - - *br = (quadrant_t){ - .start = {s->rows / 2, s->cols / 2} - , .stride = {s->rows, s->cols} - , .block = {s->rows / 2, s->cols / 2} - , .count = {1, H5S_UNLIMITED}}; + *ul = (quadrant_t){.start = {0, 0}, + .stride = {s->rows, s->cols}, + .block = {s->rows / 2, s->cols / 2}, + .count = {1, H5S_UNLIMITED}}; + + *ur = (quadrant_t){.start = {s->rows / 2, 0}, + .stride = {s->rows, s->cols}, + .block = {s->rows / 2, s->cols / 2}, + .count = {1, H5S_UNLIMITED}}; + + *bl = (quadrant_t){.start = {0, s->cols / 2}, + .stride = {s->rows, s->cols}, + .block = {s->rows / 2, s->cols / 2}, + .count = {1, H5S_UNLIMITED}}; + + *br = (quadrant_t){.start = {s->rows / 2, s->cols / 2}, + .stride = {s->rows, s->cols}, + .block = {s->rows / 2, s->cols / 2}, + .count = {1, H5S_UNLIMITED}}; make_quadrant_dataspace(s, ul); make_quadrant_dataspace(s, ur); make_quadrant_dataspace(s, bl); make_quadrant_dataspace(s, br); - *src = (quadrant_t){ - .start = {0, 0} - , .stride = {s->rows / 2, s->cols / 2} - , .block = {s->rows / 2, s->cols / 2} - , .count = {1, H5S_UNLIMITED}}; + *src = (quadrant_t){.start = {0, 0}, + .stride = {s->rows / 2, s->cols / 2}, + .block = {s->rows / 2, s->cols / 2}, + .count = {1, H5S_UNLIMITED}}; - src->space = H5Screate_simple(RANK, half_chunk_dims, - half_max_dims); + src->space = H5Screate_simple(RANK, half_chunk_dims, half_max_dims); if (src->space < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } - if (H5Sselect_hyperslab(src->space, H5S_SELECT_SET, src->start, - src->stride, src->count, src->block) < 0) + if (H5Sselect_hyperslab(src->space, H5S_SELECT_SET, src->start, src->stride, src->count, src->block) < + 0) errx(EXIT_FAILURE, "%s: H5Sselect_hyperslab failed", __func__); ul->src_space = H5Screate_simple(RANK, half_chunk_dims, half_max_dims); if (ul->src_space < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } ur->src_space = H5Screate_simple(RANK, half_chunk_dims, half_max_dims); if (ur->src_space < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } bl->src_space = H5Screate_simple(RANK, half_chunk_dims, half_max_dims); if (bl->src_space < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } br->src_space = H5Screate_simple(RANK, half_chunk_dims, half_max_dims); if (br->src_space < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } } @@ -496,16 +473,14 @@ state_init(state_t *s, int argc, char **argv) err(EXIT_FAILURE, "could not allocate quadrant dataset handles"); for (i = 0; i < s->ndatasets; i++) { - s->dataset[i] = badhid; - s->sources[i].ul = s->sources[i].ur = s->sources[i].bl = - s->sources[i].br = badhid; + s->dataset[i] = badhid; + s->sources[i].ul = s->sources[i].ur = s->sources[i].bl = s->sources[i].br = badhid; } s->memspace = H5Screate_simple(RANK, s->chunk_dims, NULL); if (s->memspace < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } s->filename[0] = "vfd_swmr_bigset.h5"; @@ -513,7 +488,8 @@ state_init(state_t *s, int argc, char **argv) s->filename[1] = "vfd_swmr_bigset-ur.h5"; s->filename[2] = "vfd_swmr_bigset-bl.h5"; s->filename[3] = "vfd_swmr_bigset-br.h5"; - } else { + } + else { s->filename[1] = s->filename[0]; s->filename[2] = s->filename[0]; s->filename[3] = s->filename[0]; @@ -521,26 +497,21 @@ state_init(state_t *s, int argc, char **argv) personality = strstr(s->progname, "vfd_swmr_bigset_"); - if (personality != NULL && - strcmp(personality, "vfd_swmr_bigset_writer") == 0) + if (personality != NULL && strcmp(personality, "vfd_swmr_bigset_writer") == 0) s->writer = true; - else if (personality != NULL && - strcmp(personality, "vfd_swmr_bigset_reader") == 0) + else if (personality != NULL && strcmp(personality, "vfd_swmr_bigset_reader") == 0) s->writer = false; else { - errx(EXIT_FAILURE, - "unknown personality, expected vfd_swmr_bigset_{reader,writer}"); + errx(EXIT_FAILURE, "unknown personality, expected vfd_swmr_bigset_{reader,writer}"); } if ((s->dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) errx(EXIT_FAILURE, "%s.%d: H5Pcreate failed", __func__, __LINE__); - if (H5Pset_chunk_cache(s->dapl, 0, 0, - H5D_CHUNK_CACHE_W0_DEFAULT) < 0) + if (H5Pset_chunk_cache(s->dapl, 0, 0, H5D_CHUNK_CACHE_W0_DEFAULT) < 0) errx(EXIT_FAILURE, "H5Pset_chunk_cache failed"); - if (s->vds != vds_off && - H5Pset_virtual_view(s->dapl, H5D_VDS_FIRST_MISSING) < 0) + if (s->vds != vds_off && H5Pset_virtual_view(s->dapl, H5D_VDS_FIRST_MISSING) < 0) errx(EXIT_FAILURE, "H5Pset_virtual_view failed"); } @@ -555,14 +526,10 @@ state_destroy(state_t *s) s->dapl = badhid; if (s->vds != vds_off) { - quadrant_t * const ul = &s->quadrants.ul, - * const ur = &s->quadrants.ur, - * const bl = &s->quadrants.bl, - * const br = &s->quadrants.br; - - if (H5Sclose(ul->src_space) < 0 || - H5Sclose(ur->src_space) < 0 || - H5Sclose(bl->src_space) < 0 || + quadrant_t *const ul = &s->quadrants.ul, *const ur = &s->quadrants.ur, *const bl = &s->quadrants.bl, + *const br = &s->quadrants.br; + + if (H5Sclose(ul->src_space) < 0 || H5Sclose(ur->src_space) < 0 || H5Sclose(bl->src_space) < 0 || H5Sclose(br->src_space) < 0) errx(EXIT_FAILURE, "H5Sclose failed"); @@ -592,16 +559,11 @@ state_destroy(state_t *s) static void create_extensible_dset(state_t *s, unsigned int which) { - quadrant_t * const ul = &s->quadrants.ul, - * const ur = &s->quadrants.ur, - * const bl = &s->quadrants.bl, - * const br = &s->quadrants.br, - * const src = &s->quadrants.src; + quadrant_t *const ul = &s->quadrants.ul, *const ur = &s->quadrants.ur, *const bl = &s->quadrants.bl, + *const br = &s->quadrants.br, *const src = &s->quadrants.src; char dname[sizeof("/dataset-9999999999")]; - char ul_dname[sizeof("/ul-dataset-9999999999")], - ur_dname[sizeof("/ur-dataset-9999999999")], - bl_dname[sizeof("/bl-dataset-9999999999")], - br_dname[sizeof("/br-dataset-9999999999")]; + char ul_dname[sizeof("/ul-dataset-9999999999")], ur_dname[sizeof("/ur-dataset-9999999999")], + bl_dname[sizeof("/bl-dataset-9999999999")], br_dname[sizeof("/br-dataset-9999999999")]; hid_t dcpl, ds, filespace; assert(which < s->ndatasets); @@ -610,72 +572,65 @@ create_extensible_dset(state_t *s, unsigned int which) esnprintf(dname, sizeof(dname), "/dataset-%d", which); if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Pcreate failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Pcreate failed", __func__, __LINE__); } if (H5Pset_chunk(dcpl, RANK, s->chunk_dims) < 0) errx(EXIT_FAILURE, "H5Pset_chunk failed"); if (s->vds != vds_off) { - sources_t * const srcs = &s->sources[which]; + sources_t *const srcs = &s->sources[which]; esnprintf(ul_dname, sizeof(ul_dname), "/ul-dataset-%d", which); esnprintf(ur_dname, sizeof(ur_dname), "/ur-dataset-%d", which); esnprintf(bl_dname, sizeof(bl_dname), "/bl-dataset-%d", which); esnprintf(br_dname, sizeof(br_dname), "/br-dataset-%d", which); - srcs->ul = H5Dcreate2(s->file[0], ul_dname, s->filetype, ul->src_space, - H5P_DEFAULT, s->quadrant_dcpl, s->dapl); + srcs->ul = H5Dcreate2(s->file[0], ul_dname, s->filetype, ul->src_space, H5P_DEFAULT, s->quadrant_dcpl, + s->dapl); if (srcs->ul < 0) errx(EXIT_FAILURE, "H5Dcreate(, \"%s\", ) failed", ul_dname); - srcs->ur = H5Dcreate2(s->file[1], ur_dname, s->filetype, ur->src_space, - H5P_DEFAULT, s->quadrant_dcpl, s->dapl); + srcs->ur = H5Dcreate2(s->file[1], ur_dname, s->filetype, ur->src_space, H5P_DEFAULT, s->quadrant_dcpl, + s->dapl); if (srcs->ur < 0) errx(EXIT_FAILURE, "H5Dcreate(, \"%s\", ) failed", ur_dname); - srcs->bl = H5Dcreate2(s->file[2], bl_dname, s->filetype, bl->src_space, - H5P_DEFAULT, s->quadrant_dcpl, s->dapl); + srcs->bl = H5Dcreate2(s->file[2], bl_dname, s->filetype, bl->src_space, H5P_DEFAULT, s->quadrant_dcpl, + s->dapl); if (srcs->bl < 0) errx(EXIT_FAILURE, "H5Dcreate(, \"%s\", ) failed", bl_dname); - srcs->br = H5Dcreate2(s->file[3], br_dname, s->filetype, br->src_space, - H5P_DEFAULT, s->quadrant_dcpl, s->dapl); + srcs->br = H5Dcreate2(s->file[3], br_dname, s->filetype, br->src_space, H5P_DEFAULT, s->quadrant_dcpl, + s->dapl); if (srcs->br < 0) errx(EXIT_FAILURE, "H5Dcreate(, \"%s\", ) failed", br_dname); - if (H5Pset_virtual(dcpl, ul->space, s->filename[0], ul_dname, - src->space) < 0) + if (H5Pset_virtual(dcpl, ul->space, s->filename[0], ul_dname, src->space) < 0) errx(EXIT_FAILURE, "%s: H5Pset_virtual failed", __func__); - if (H5Pset_virtual(dcpl, ur->space, s->filename[1], ur_dname, - src->space) < 0) + if (H5Pset_virtual(dcpl, ur->space, s->filename[1], ur_dname, src->space) < 0) errx(EXIT_FAILURE, "%s: H5Pset_virtual failed", __func__); - if (H5Pset_virtual(dcpl, bl->space, s->filename[2], bl_dname, - src->space) < 0) + if (H5Pset_virtual(dcpl, bl->space, s->filename[2], bl_dname, src->space) < 0) errx(EXIT_FAILURE, "%s: H5Pset_virtual failed", __func__); - if (H5Pset_virtual(dcpl, br->space, s->filename[3], br_dname, - src->space) < 0) + if (H5Pset_virtual(dcpl, br->space, s->filename[3], br_dname, src->space) < 0) errx(EXIT_FAILURE, "%s: H5Pset_virtual failed", __func__); } filespace = H5Screate_simple(NELMTS(s->chunk_dims), s->chunk_dims, - s->two_dee ? two_dee_max_dims : s->one_dee_max_dims); + s->two_dee ? two_dee_max_dims : s->one_dee_max_dims); if (filespace < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Screate_simple failed", __func__, __LINE__); } - ds = H5Dcreate2(s->file[0], dname, s->filetype, filespace, - H5P_DEFAULT, dcpl, s->dapl); + ds = H5Dcreate2(s->file[0], dname, s->filetype, filespace, H5P_DEFAULT, dcpl, s->dapl); if (ds < 0) errx(EXIT_FAILURE, "H5Dcreate(, \"%s\", ) failed", dname); @@ -692,7 +647,7 @@ create_extensible_dset(state_t *s, unsigned int which) static void close_extensible_dset(state_t *s, unsigned int which) { - char dname[sizeof("/dataset-9999999999")]; + char dname[sizeof("/dataset-9999999999")]; hid_t ds; assert(which < s->ndatasets); @@ -707,10 +662,10 @@ close_extensible_dset(state_t *s, unsigned int which) s->dataset[which] = badhid; if (s->vds != vds_off && s->writer) { - sources_t * const srcs = &s->sources[which]; + sources_t *const srcs = &s->sources[which]; - if (H5Dclose(srcs->ul) < 0 || H5Dclose(srcs->ur) < 0 || - H5Dclose(srcs->bl) < 0 || H5Dclose(srcs->br) < 0) + if (H5Dclose(srcs->ul) < 0 || H5Dclose(srcs->ur) < 0 || H5Dclose(srcs->bl) < 0 || + H5Dclose(srcs->br) < 0) errx(EXIT_FAILURE, "H5Dclose failed"); srcs->ul = srcs->ur = srcs->bl = srcs->br = badhid; @@ -720,14 +675,14 @@ close_extensible_dset(state_t *s, unsigned int which) static void open_extensible_dset(state_t *s, unsigned int which) { - hsize_t dims[RANK], maxdims[RANK]; - char dname[sizeof("/dataset-9999999999")]; - hid_t ds, filespace, ty; - const int tries = 10000; - int i; - struct timespec last = {0, 0}; + hsize_t dims[RANK], maxdims[RANK]; + char dname[sizeof("/dataset-9999999999")]; + hid_t ds, filespace, ty; + const int tries = 10000; + int i; + struct timespec last = {0, 0}; static const struct timespec ival = {5, 0}; - estack_state_t es; + estack_state_t es; assert(which < s->ndatasets); assert(s->dataset[which] == badhid); @@ -736,8 +691,7 @@ open_extensible_dset(state_t *s, unsigned int which) es = disable_estack(); for (i = 0; i < tries; i++) { - struct timespec one_tenth = {.tv_sec = 0, - .tv_nsec = 1000000000L / 10}; + struct timespec one_tenth = {.tv_sec = 0, .tv_nsec = 1000000000L / 10}; ds = H5Dopen(s->file[0], dname, s->dapl); @@ -745,8 +699,7 @@ open_extensible_dset(state_t *s, unsigned int which) break; if (below_speed_limit(&last, &ival)) { - warnx("H5Dopen(, \"%s\", ) transient failure, %d retries remain", - dname, tries - i - 1); + warnx("H5Dopen(, \"%s\", ) transient failure, %d retries remain", dname, tries - i - 1); } while (nanosleep(&one_tenth, &one_tenth) == -1 && errno == EINTR) ; // do nothing @@ -754,8 +707,7 @@ open_extensible_dset(state_t *s, unsigned int which) restore_estack(es); if (i == tries) { - errx(EXIT_FAILURE, "H5Dopen(, \"%s\", ) failed after %d tries", - dname, tries); + errx(EXIT_FAILURE, "H5Dopen(, \"%s\", ) failed after %d tries", dname, tries); } if ((ty = H5Dget_type(ds)) < 0) @@ -779,18 +731,17 @@ open_extensible_dset(state_t *s, unsigned int which) filespace = badhid; if (s->two_dee) { - if (maxdims[0] != two_dee_max_dims[0] || - maxdims[1] != two_dee_max_dims[1] || + if (maxdims[0] != two_dee_max_dims[0] || maxdims[1] != two_dee_max_dims[1] || maxdims[0] != maxdims[1]) { - errx(EXIT_FAILURE, "Unexpected maximum dimensions %" - PRIuHSIZE " x %" PRIuHSIZE, maxdims[0], maxdims[1]); + errx(EXIT_FAILURE, "Unexpected maximum dimensions %" PRIuHSIZE " x %" PRIuHSIZE, maxdims[0], + maxdims[1]); } - } else if (maxdims[0] != s->one_dee_max_dims[0] || - maxdims[1] != s->one_dee_max_dims[1] || - dims[0] != s->chunk_dims[0]) { - errx(EXIT_FAILURE, "Unexpected maximum dimensions %" - PRIuHSIZE " x %" PRIuHSIZE " or columns %" PRIuHSIZE, - maxdims[0], maxdims[1], dims[1]); + } + else if (maxdims[0] != s->one_dee_max_dims[0] || maxdims[1] != s->one_dee_max_dims[1] || + dims[0] != s->chunk_dims[0]) { + errx(EXIT_FAILURE, + "Unexpected maximum dimensions %" PRIuHSIZE " x %" PRIuHSIZE " or columns %" PRIuHSIZE, + maxdims[0], maxdims[1], dims[1]); } s->dataset[which] = ds; @@ -830,9 +781,7 @@ set_or_verify_matrix(mat_t *mat, unsigned int which, base_t base, bool do_set) for (row = 0; row < mat->rows; row++) { for (col = 0; col < mat->cols; col++) { uint32_t v; - hsize_t i = base.row + row, - j = base.col + col, - u; + hsize_t i = base.row + row, j = base.col + col, u; if (j <= i) u = (i + 1) * (i + 1) - 1 - j; @@ -844,10 +793,11 @@ set_or_verify_matrix(mat_t *mat, unsigned int which, base_t base, bool do_set) if (do_set) matset(mat, row, col, v); else if (matget(mat, row, col) != v) { - errx(EXIT_FAILURE, "matrix mismatch " - "at %" PRIuHSIZE ", %" PRIuHSIZE " (%u, %u), " - "read %" PRIu32 " expecting %" PRIu32, - i, j, row, col, matget(mat, row, col), v); + errx(EXIT_FAILURE, + "matrix mismatch " + "at %" PRIuHSIZE ", %" PRIuHSIZE " (%u, %u), " + "read %" PRIu32 " expecting %" PRIu32, + i, j, row, col, matget(mat, row, col), v); } } } @@ -866,28 +816,24 @@ verify_matrix(mat_t *mat, unsigned int which, base_t base) } static void -verify_chunk(state_t *s, hid_t filespace, - mat_t *mat, unsigned which, base_t base) +verify_chunk(state_t *s, hid_t filespace, mat_t *mat, unsigned which, base_t base) { hsize_t offset[RANK] = {base.row, base.col}; - herr_t status; - hid_t ds; + herr_t status; + hid_t ds; assert(which < s->ndatasets); - dbgf(1, "verifying chunk %" PRIuHSIZE ", %" PRIuHSIZE "\n", - base.row, base.col); + dbgf(1, "verifying chunk %" PRIuHSIZE ", %" PRIuHSIZE "\n", base.row, base.col); ds = s->dataset[which]; - status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, - NULL, s->chunk_dims, NULL); + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, s->chunk_dims, NULL); if (status < 0) errx(EXIT_FAILURE, "H5Sselect_hyperslab failed"); - status = H5Dread(ds, H5T_NATIVE_UINT32, s->memspace, filespace, - H5P_DEFAULT, mat->elt); + status = H5Dread(ds, H5T_NATIVE_UINT32, s->memspace, filespace, H5P_DEFAULT, mat->elt); if (status < 0) errx(EXIT_FAILURE, "H5Dread failed"); @@ -896,12 +842,11 @@ verify_chunk(state_t *s, hid_t filespace, } static void -init_and_write_chunk(state_t *s, hid_t filespace, - mat_t *mat, unsigned which, base_t base) +init_and_write_chunk(state_t *s, hid_t filespace, mat_t *mat, unsigned which, base_t base) { hsize_t offset[RANK] = {base.row, base.col}; - herr_t status; - hid_t ds; + herr_t status; + hid_t ds; assert(which < s->ndatasets); @@ -909,14 +854,12 @@ init_and_write_chunk(state_t *s, hid_t filespace, init_matrix(mat, which, base); - status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, - NULL, s->chunk_dims, NULL); + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, s->chunk_dims, NULL); if (status < 0) errx(EXIT_FAILURE, "H5Sselect_hyperslab failed"); - status = H5Dwrite(ds, H5T_NATIVE_UINT32, s->memspace, filespace, - H5P_DEFAULT, mat->elt); + status = H5Dwrite(ds, H5T_NATIVE_UINT32, s->memspace, filespace, H5P_DEFAULT, mat->elt); if (status < 0) errx(EXIT_FAILURE, "H5Dwrite failed"); @@ -926,13 +869,12 @@ static void verify_dset_attribute(hid_t ds, unsigned int which, unsigned int step) { unsigned int read_step; - hid_t aid; - char name[sizeof("attr-9999999999")]; + hid_t aid; + char name[sizeof("attr-9999999999")]; esnprintf(name, sizeof(name), "attr-%u", step); - dbgf(1, "verifying attribute %s on dataset %u equals %u\n", name, which, - step); + dbgf(1, "verifying attribute %s on dataset %u equals %u\n", name, which, step); if ((aid = H5Aopen(ds, name, H5P_DEFAULT)) < 0) errx(EXIT_FAILURE, "H5Aopen failed"); @@ -948,12 +890,11 @@ verify_dset_attribute(hid_t ds, unsigned int which, unsigned int step) } static void -verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, - unsigned *stepp) +verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, unsigned *stepp) { - hid_t ds, filespace; - hsize_t size[RANK]; - base_t base, last; + hid_t ds, filespace; + hsize_t size[RANK]; + base_t base, last; unsigned int ncols, last_step, step; assert(which < s->ndatasets); @@ -983,27 +924,26 @@ verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, dbgf(1, "%s: which %u step %u\n", __func__, which, step); if (s->two_dee) { - size[0] = s->chunk_dims[0] * (1 + step); - size[1] = s->chunk_dims[1] * (1 + step); + size[0] = s->chunk_dims[0] * (1 + step); + size[1] = s->chunk_dims[1] * (1 + step); last.row = s->chunk_dims[0] * step + ofs; last.col = s->chunk_dims[1] * step + ofs; - } else { - size[0] = s->chunk_dims[0]; - size[1] = s->chunk_dims[1] * (1 + step); + } + else { + size[0] = s->chunk_dims[0]; + size[1] = s->chunk_dims[1] * (1 + step); last.row = 0; last.col = s->chunk_dims[1] * step + ofs; } dbgf(1, "new size %" PRIuHSIZE ", %" PRIuHSIZE "\n", size[0], size[1]); - dbgf(1, "last row %" PRIuHSIZE " col %" PRIuHSIZE "\n", last.row, - last.col); + dbgf(1, "last row %" PRIuHSIZE " col %" PRIuHSIZE "\n", last.row, last.col); if (s->two_dee) { /* Down the right side, intersecting the bottom row. */ base.col = last.col; - for (base.row = ofs; base.row <= last.row; - base.row += s->chunk_dims[0]) { + for (base.row = ofs; base.row <= last.row; base.row += s->chunk_dims[0]) { verify_chunk(s, filespace, mat, which, base); } @@ -1011,11 +951,11 @@ verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, * avoid re-reading the bottom-right chunk. */ base.row = last.row; - for (base.col = ofs; base.col < last.col; - base.col += s->chunk_dims[1]) { + for (base.col = ofs; base.col < last.col; base.col += s->chunk_dims[1]) { verify_chunk(s, filespace, mat, which, base); } - } else { + } + else { verify_chunk(s, filespace, mat, which, last); } if (s->asteps != 0 && step % s->asteps == 0) @@ -1030,18 +970,16 @@ out: } static void -add_dset_attribute(const state_t *s, hid_t ds, hid_t sid, unsigned int which, - unsigned int step) +add_dset_attribute(const state_t *s, hid_t ds, hid_t sid, unsigned int which, unsigned int step) { hid_t aid; - char name[sizeof("attr-9999999999")]; + char name[sizeof("attr-9999999999")]; esnprintf(name, sizeof(name), "attr-%u", step); dbgf(1, "setting attribute %s on dataset %u to %u\n", name, which, step); - if ((aid = H5Acreate2(ds, name, s->filetype, sid, H5P_DEFAULT, - H5P_DEFAULT)) < 0) + if ((aid = H5Acreate2(ds, name, s->filetype, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) errx(EXIT_FAILURE, "H5Acreate2 failed"); if (H5Awrite(aid, H5T_NATIVE_UINT, &step) < 0) @@ -1051,12 +989,11 @@ add_dset_attribute(const state_t *s, hid_t ds, hid_t sid, unsigned int which, } static void -write_extensible_dset(state_t *s, unsigned int which, unsigned int step, - mat_t *mat) +write_extensible_dset(state_t *s, unsigned int which, unsigned int step, mat_t *mat) { - hid_t ds, filespace; + hid_t ds, filespace; hsize_t size[RANK]; - base_t base, last; + base_t base, last; dbgf(1, "%s: which %u step %u\n", __func__, which, step); @@ -1068,13 +1005,14 @@ write_extensible_dset(state_t *s, unsigned int which, unsigned int step, add_dset_attribute(s, ds, s->one_by_one_sid, which, step); if (s->two_dee) { - size[0] = s->chunk_dims[0] * (1 + step); - size[1] = s->chunk_dims[1] * (1 + step); + size[0] = s->chunk_dims[0] * (1 + step); + size[1] = s->chunk_dims[1] * (1 + step); last.row = s->chunk_dims[0] * step; last.col = s->chunk_dims[1] * step; - } else { - size[0] = s->chunk_dims[0]; - size[1] = s->chunk_dims[1] * (1 + step); + } + else { + size[0] = s->chunk_dims[0]; + size[1] = s->chunk_dims[1] * (1 + step); last.row = 0; last.col = s->chunk_dims[1] * step; } @@ -1082,27 +1020,23 @@ write_extensible_dset(state_t *s, unsigned int which, unsigned int step, dbgf(1, "new size %" PRIuHSIZE ", %" PRIuHSIZE "\n", size[0], size[1]); if (s->vds != vds_off) { - const hsize_t half_size[RANK] = {size[0] / 2, size[1] / 2}; - sources_t * const srcs = &s->sources[which]; + const hsize_t half_size[RANK] = {size[0] / 2, size[1] / 2}; + sources_t *const srcs = &s->sources[which]; if (H5Dset_extent(srcs->ul, half_size) < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", __func__, __LINE__); } if (H5Dset_extent(srcs->ur, half_size) < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", __func__, __LINE__); } if (H5Dset_extent(srcs->bl, half_size) < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", __func__, __LINE__); } if (H5Dset_extent(srcs->br, half_size) < 0) { - errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", - __func__, __LINE__); + errx(EXIT_FAILURE, "%s.%d: H5Dset_extent failed", __func__, __LINE__); } - - } else if (H5Dset_extent(ds, size) < 0) + } + else if (H5Dset_extent(ds, size) < 0) errx(EXIT_FAILURE, "H5Dset_extent failed"); filespace = H5Dget_space(ds); @@ -1113,35 +1047,34 @@ write_extensible_dset(state_t *s, unsigned int which, unsigned int step, if (s->two_dee) { base.col = last.col; for (base.row = 0; base.row <= last.row; base.row += s->chunk_dims[0]) { - dbgf(1, "writing chunk %" PRIuHSIZE ", %" PRIuHSIZE "\n", - base.row, base.col); + dbgf(1, "writing chunk %" PRIuHSIZE ", %" PRIuHSIZE "\n", base.row, base.col); init_and_write_chunk(s, filespace, mat, which, base); } base.row = last.row; for (base.col = 0; base.col < last.col; base.col += s->chunk_dims[1]) { - dbgf(1, "writing chunk %" PRIuHSIZE ", %" PRIuHSIZE "\n", - base.row, base.col); + dbgf(1, "writing chunk %" PRIuHSIZE ", %" PRIuHSIZE "\n", base.row, base.col); init_and_write_chunk(s, filespace, mat, which, base); } - } else { + } + else { init_and_write_chunk(s, filespace, mat, which, last); } if (H5Sclose(filespace) < 0) - errx(EXIT_FAILURE, "H5Sclose failed"); + errx(EXIT_FAILURE, "H5Sclose failed"); } int main(int argc, char **argv) { - mat_t *mat; - hid_t fcpl; + mat_t * mat; + hid_t fcpl; sigset_t oldsigs; - herr_t ret; + herr_t ret; unsigned step, which; - state_t s; - size_t i; + state_t s; + size_t i; state_init(&s, argc, argv); @@ -1156,7 +1089,7 @@ main(int argc, char **argv) errx(EXIT_FAILURE, "H5Pset_file_space_strategy"); for (i = 0; i < NELMTS(s.file); i++) { - hid_t fapl; + hid_t fapl; H5F_vfd_swmr_config_t config; if (s.vds != vds_multi && i > 0) { @@ -1173,9 +1106,8 @@ main(int argc, char **argv) if (fapl < 0) errx(EXIT_FAILURE, "vfd_swmr_create_fapl"); - s.file[i] = - s.writer ? H5Fcreate(s.filename[i], H5F_ACC_TRUNC, fcpl, fapl) - : H5Fopen(s.filename[i], H5F_ACC_RDONLY, fapl); + s.file[i] = s.writer ? H5Fcreate(s.filename[i], H5F_ACC_TRUNC, fcpl, fapl) + : H5Fopen(s.filename[i], H5F_ACC_RDONLY, fapl); if (s.file[i] == badhid) errx(EXIT_FAILURE, s.writer ? "H5Fcreate" : "H5Fopen"); @@ -1200,9 +1132,10 @@ main(int argc, char **argv) if (s.ndatasets > s.nsteps) nanosleep(&s.update_interval, NULL); } - } else { + } + else { unsigned *nextstep = calloc(s.ndatasets, sizeof(*nextstep)); - unsigned finished_step; + unsigned finished_step; if (nextstep == NULL) err(EXIT_FAILURE, "could not allocate `nextstep` array"); @@ -1211,11 +1144,11 @@ main(int argc, char **argv) open_extensible_dset(&s, which - 1); do { - finished_step = UINT_MAX; /* the greatest step finished on - * *all* datasets - */ + finished_step = UINT_MAX; /* the greatest step finished on + * *all* datasets + */ - for (which = s.ndatasets; which-- > 0; ) { + for (which = s.ndatasets; which-- > 0;) { dbgf(2, "step %d which %d\n", nextstep[which], which); verify_extensible_dset(&s, which, mat, &nextstep[which]); if (nextstep[which] < finished_step) |