Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cstyle -cpP #5465

Merged
merged 1 commit into from
Dec 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ checkstyle: cstyle shellcheck flake8

cstyle:
@find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
! -name '*.mod.c' -type f -exec scripts/cstyle.pl {} \+
! -name '*.mod.c' -type f -exec scripts/cstyle.pl -cpP {} \+

shellcheck:
@if type shellcheck > /dev/null 2>&1; then \
Expand Down
4 changes: 2 additions & 2 deletions cmd/mount_zfs/mount_zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ zfs_selinux_setcontext(zfs_handle_t *zhp, zfs_prop_t zpt, const char *name,
if (zfs_prop_get(zhp, zpt, context, sizeof (context),
NULL, NULL, 0, B_FALSE) == 0) {
if (strcmp(context, "none") != 0)
append_mntopt(name, context, mntopts, mtabopt, B_TRUE);
append_mntopt(name, context, mntopts, mtabopt, B_TRUE);
}
}

Expand Down Expand Up @@ -600,7 +600,7 @@ main(int argc, char **argv)
gettext("filesystem '%s' (v%d) is not "
"supported by this implementation of "
"ZFS (max v%d).\n"), dataset,
(int) zfs_version, (int) ZPL_VERSION);
(int)zfs_version, (int)ZPL_VERSION);
} else {
(void) fprintf(stderr,
gettext("filesystem '%s' mount "
Expand Down
10 changes: 5 additions & 5 deletions cmd/raidz_test/raidz_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ run_gen_bench_impl(const char *impl)
start = gethrtime();
for (iter = 0; iter < iter_cnt; iter++)
vdev_raidz_generate_parity(rm_bench);
elapsed = NSEC2SEC((double) (gethrtime() - start));
elapsed = NSEC2SEC((double)(gethrtime() - start));

disksize = (1ULL << ds) / rto_opts.rto_dcols;
d_bw = (double)iter_cnt * (double)disksize;
Expand All @@ -106,7 +106,7 @@ run_gen_bench_impl(const char *impl)
(1ULL<<ds),
d_bw,
d_bw * (double)(ncols),
(unsigned) iter_cnt);
(unsigned)iter_cnt);

vdev_raidz_map_free(rm_bench);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ run_rec_bench_impl(const char *impl)
continue;

rm_bench = vdev_raidz_map_alloc(&zio_bench,
BENCH_ASHIFT, ncols, PARITY_PQR);
BENCH_ASHIFT, ncols, PARITY_PQR);

/* estimate iteration count */
iter_cnt = (REC_BENCH_MEMORY);
Expand All @@ -177,7 +177,7 @@ run_rec_bench_impl(const char *impl)
start = gethrtime();
for (iter = 0; iter < iter_cnt; iter++)
vdev_raidz_reconstruct(rm_bench, tgt[fn], nbad);
elapsed = NSEC2SEC((double) (gethrtime() - start));
elapsed = NSEC2SEC((double)(gethrtime() - start));

disksize = (1ULL << ds) / rto_opts.rto_dcols;
d_bw = (double)iter_cnt * (double)(disksize);
Expand All @@ -190,7 +190,7 @@ run_rec_bench_impl(const char *impl)
(1ULL<<ds),
d_bw,
d_bw * (double)ncols,
(unsigned) iter_cnt);
(unsigned)iter_cnt);

vdev_raidz_map_free(rm_bench);
}
Expand Down
67 changes: 31 additions & 36 deletions cmd/raidz_test/raidz_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void sig_handler(int signo)
(void) sigaction(signo, &action, NULL);

if (rto_opts.rto_gdb)
if (system(gdb));
if (system(gdb)) { }

raise(signo);
}
Expand Down Expand Up @@ -86,8 +86,7 @@ static void print_opts(raidz_test_opts_t *opts, boolean_t force)
opts->rto_dcols, /* -d */
ilog2(opts->rto_dsize), /* -s */
opts->rto_sweep ? "yes" : "no", /* -S */
verbose /* -v */
);
verbose); /* -v */
}
}

Expand All @@ -98,25 +97,24 @@ static void usage(boolean_t requested)
FILE *fp = requested ? stdout : stderr;

(void) fprintf(fp, "Usage:\n"
"\t[-a zio ashift (default: %zu)]\n"
"\t[-o zio offset, exponent radix 2 (default: %zu)]\n"
"\t[-d number of raidz data columns (default: %zu)]\n"
"\t[-s zio size, exponent radix 2 (default: %zu)]\n"
"\t[-S parameter sweep (default: %s)]\n"
"\t[-t timeout for parameter sweep test]\n"
"\t[-B benchmark all raidz implementations]\n"
"\t[-v increase verbosity (default: %zu)]\n"
"\t[-h (print help)]\n"
"\t[-T test the test, see if failure would be detected]\n"
"\t[-D debug (attach gdb on SIGSEGV)]\n"
"",
o->rto_ashift, /* -a */
ilog2(o->rto_offset), /* -o */
o->rto_dcols, /* -d */
ilog2(o->rto_dsize), /* -s */
rto_opts.rto_sweep ? "yes" : "no", /* -S */
o->rto_v /* -d */
);
"\t[-a zio ashift (default: %zu)]\n"
"\t[-o zio offset, exponent radix 2 (default: %zu)]\n"
"\t[-d number of raidz data columns (default: %zu)]\n"
"\t[-s zio size, exponent radix 2 (default: %zu)]\n"
"\t[-S parameter sweep (default: %s)]\n"
"\t[-t timeout for parameter sweep test]\n"
"\t[-B benchmark all raidz implementations]\n"
"\t[-v increase verbosity (default: %zu)]\n"
"\t[-h (print help)]\n"
"\t[-T test the test, see if failure would be detected]\n"
"\t[-D debug (attach gdb on SIGSEGV)]\n"
"",
o->rto_ashift, /* -a */
ilog2(o->rto_offset), /* -o */
o->rto_dcols, /* -d */
ilog2(o->rto_dsize), /* -s */
rto_opts.rto_sweep ? "yes" : "no", /* -S */
o->rto_v); /* -d */

exit(requested ? 0 : 1);
}
Expand Down Expand Up @@ -227,7 +225,7 @@ static int
init_rand(void *data, size_t size, void *private)
{
int i;
int *dst = (int *) data;
int *dst = (int *)data;

for (i = 0; i < size / sizeof (int); i++)
dst[i] = rand_data[i];
Expand Down Expand Up @@ -333,7 +331,7 @@ init_raidz_map(raidz_test_opts_t *opts, zio_t **zio, const int parity)
init_zio_abd(*zio);

rm = vdev_raidz_map_alloc(*zio, opts->rto_ashift,
total_ncols, parity);
total_ncols, parity);
VERIFY(rm);

/* Make sure code columns are destroyed */
Expand Down Expand Up @@ -476,18 +474,15 @@ run_rec_check_impl(raidz_test_opts_t *opts, raidz_map_t *rm, const int fn)
}
} else {
/* can reconstruct 3 failed data disk */
for (x0 = 0;
x0 < opts->rto_dcols; x0++) {
for (x0 = 0; x0 < opts->rto_dcols; x0++) {
if (x0 >= rm->rm_cols - raidz_parity(rm))
continue;
for (x1 = x0 + 1;
x1 < opts->rto_dcols; x1++) {
for (x1 = x0 + 1; x1 < opts->rto_dcols; x1++) {
if (x1 >= rm->rm_cols - raidz_parity(rm))
continue;
for (x2 = x1 + 1;
x2 < opts->rto_dcols; x2++) {
for (x2 = x1 + 1; x2 < opts->rto_dcols; x2++) {
if (x2 >=
rm->rm_cols - raidz_parity(rm))
rm->rm_cols - raidz_parity(rm))
continue;

/* Check if should stop */
Expand All @@ -504,7 +499,7 @@ run_rec_check_impl(raidz_test_opts_t *opts, raidz_map_t *rm, const int fn)

if (!opts->rto_sanity)
vdev_raidz_reconstruct(rm,
tgtidx, 3);
tgtidx, 3);

if (cmp_data(opts, rm) != 0) {
err++;
Expand Down Expand Up @@ -555,7 +550,7 @@ run_rec_check(raidz_test_opts_t *opts)
for (fn = 0; fn < RAIDZ_REC_NUM; fn++) {

LOG(D_INFO, "\t\tTesting method [%s] ...",
raidz_rec_name[fn]);
raidz_rec_name[fn]);

if (run_rec_check_impl(opts, rm_test, fn) != 0) {
LOG(D_INFO, "[FAIL]\n");
Expand Down Expand Up @@ -607,7 +602,7 @@ static void
sweep_thread(void *arg)
{
int err = 0;
raidz_test_opts_t *opts = (raidz_test_opts_t *) arg;
raidz_test_opts_t *opts = (raidz_test_opts_t *)arg;
VERIFY(opts != NULL);

err = run_test(opts);
Expand Down Expand Up @@ -708,7 +703,7 @@ run_sweep(void)
opts->rto_v = 0; /* be quiet */

VERIFY3P(zk_thread_create(NULL, 0,
(thread_func_t) sweep_thread,
(thread_func_t)sweep_thread,
(void *) opts, TS_RUN, NULL, 0, 0,
PTHREAD_CREATE_JOINABLE), !=, NULL);
}
Expand Down Expand Up @@ -765,7 +760,7 @@ main(int argc, char **argv)
kernel_init(FREAD);

/* setup random data because rand() is not reentrant */
rand_data = (int *) umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
rand_data = (int *)umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
srand((unsigned)time(NULL) * getpid());
for (i = 0; i < SPA_MAXBLOCKSIZE / sizeof (int); i++)
rand_data[i] = rand();
Expand Down
2 changes: 1 addition & 1 deletion cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ zdb_ot_name(dmu_object_type_t type)
if (type < DMU_OT_NUMTYPES)
return (dmu_ot[type].ot_name);
else if ((type & DMU_OT_NEWTYPE) &&
((type & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS))
((type & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS))
return (dmu_ot_byteswap[type & DMU_OT_BYTESWAP_MASK].ob_name);
else
return ("UNKNOWN");
Expand Down
2 changes: 1 addition & 1 deletion cmd/zed/agents/zfs_diagnosis.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ zfs_case_solve(fmd_hdl_t *hdl, zfs_case_t *zcp, const char *faultname,
boolean_t serialize;
nvlist_t *fru = NULL;
#ifdef _HAS_FMD_TOPO
nvlist_t *fmri
nvlist_t *fmri;
topo_hdl_t *thp;
int err;
#endif
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/agents/zfs_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
list_insert_tail(&g_device_list, device);

zed_log_msg(LOG_INFO, " zpool_label_disk: async '%s' (%llu)",
leafname, (u_longlong_t) guid);
leafname, (u_longlong_t)guid);

return; /* resumes at EC_DEV_ADD.ESC_DISK for partition */

Expand Down Expand Up @@ -373,7 +373,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
}

zed_log_msg(LOG_INFO, " zpool_label_disk: resume '%s' (%llu)",
physpath, (u_longlong_t) guid);
physpath, (u_longlong_t)guid);

(void) snprintf(devpath, sizeof (devpath), "%s%s",
DEV_BYID_PATH, new_devid);
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/agents/zfs_retire.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,

/*
* Note: on zfsonlinux statechange events are more than just
* healthy ones so we need to confim the actual state value.
* healthy ones so we need to confirm the actual state value.
*/
if (strcmp(class, "resource.fs.zfs.statechange") == 0 &&
nvlist_lookup_uint64(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_STATE,
&state) == 0 && state == VDEV_STATE_HEALTHY) {;
&state) == 0 && state == VDEV_STATE_HEALTHY) {
zfs_vdev_repair(hdl, nvl);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/zed/zed.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ main(int argc, char *argv[])

zed_log_msg(LOG_NOTICE,
"ZFS Event Daemon %s-%s (PID %d)",
ZFS_META_VERSION, ZFS_META_RELEASE, (int) getpid());
ZFS_META_VERSION, ZFS_META_RELEASE, (int)getpid());

if (zed_conf_open_state(zcp) < 0)
exit(EXIT_FAILURE);
Expand Down
6 changes: 3 additions & 3 deletions cmd/zed/zed_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ zed_conf_write_pid(struct zed_conf *zcp)
/*
* Write PID file.
*/
n = snprintf(buf, sizeof (buf), "%d\n", (int) getpid());
n = snprintf(buf, sizeof (buf), "%d\n", (int)getpid());
if ((n < 0) || (n >= sizeof (buf))) {
errno = ERANGE;
zed_log_msg(LOG_ERR, "Failed to write PID file \"%s\": %s",
Expand Down Expand Up @@ -637,7 +637,7 @@ zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[])
"Failed to read state file: %s", strerror(errno));
return (-1);
}
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t) -1) {
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t)-1) {
zed_log_msg(LOG_WARNING,
"Failed to reposition state file offset: %s",
strerror(errno));
Expand Down Expand Up @@ -687,7 +687,7 @@ zed_conf_write_state(struct zed_conf *zcp, uint64_t eid, int64_t etime[])
"Failed to write state file: %s", strerror(errno));
return (-1);
}
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t) -1) {
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t)-1) {
zed_log_msg(LOG_WARNING,
"Failed to reposition state file offset: %s",
strerror(errno));
Expand Down
2 changes: 1 addition & 1 deletion cmd/zed/zed_disk_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ zed_udev_monitor(void *arg)
if (strcmp(class, EC_DEV_STATUS) == 0 &&
udev_device_get_property_value(dev, "DM_UUID") &&
udev_device_get_property_value(dev, "MPATH_SBIN_PATH")) {
tmp = (char *) udev_device_get_devnode(dev);
tmp = (char *)udev_device_get_devnode(dev);
tmp2 = zfs_get_underlying_path(tmp);
if (tmp && tmp2 && (strcmp(tmp, tmp2) != 0)) {
/*
Expand Down
Loading