Permalink
Browse files

Use cstyle -cpP in `make cstyle` check

Enable picky cstyle checks and resolve the new warnings.  The vast
majority of the changes needed were to handle minor issues with
whitespace formatting.  This patch contains no functional changes.

Non-whitespace changes are as follows:

* 8 times ; to { } in for/while loop
* fix missing ; in cmd/zed/agents/zfs_diagnosis.c
* comment (confim -> confirm)
* change endline , to ; in cmd/zpool/zpool_main.c
* a number of /* BEGIN CSTYLED */ /* END CSTYLED */ blocks
* /* CSTYLED */ markers
* change == 0 to !
* ulong to unsigned long in module/zfs/dsl_scan.c
* rearrangement of module_param lines in module/zfs/metaslab.c
* add { } block around statement after for_each_online_node

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Håkan Johansson <f96hajo@chalmers.se>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5465
  • Loading branch information...
1 parent d57f03e commit 02730c333c4fce8c0ead1f7f3404caca5cdb3936 @behlendorf behlendorf committed on GitHub Dec 12, 2016
Showing with 501 additions and 478 deletions.
  1. +1 −1 Makefile.am
  2. +2 −2 cmd/mount_zfs/mount_zfs.c
  3. +5 −5 cmd/raidz_test/raidz_bench.c
  4. +31 −36 cmd/raidz_test/raidz_test.c
  5. +1 −1 cmd/zdb/zdb.c
  6. +1 −1 cmd/zed/agents/zfs_diagnosis.c
  7. +2 −2 cmd/zed/agents/zfs_mod.c
  8. +2 −2 cmd/zed/agents/zfs_retire.c
  9. +1 −1 cmd/zed/zed.c
  10. +3 −3 cmd/zed/zed_conf.c
  11. +1 −1 cmd/zed/zed_disk_event.c
  12. +11 −11 cmd/zed/zed_event.c
  13. +3 −3 cmd/zed/zed_exec.c
  14. +8 −8 cmd/zed/zed_log.c
  15. +1 −1 cmd/zed/zed_strings.c
  16. +3 −8 cmd/zed/zed_strings.h
  17. +10 −10 cmd/zfs/zfs_main.c
  18. +2 −2 cmd/zinject/zinject.c
  19. +40 −41 cmd/zpios/zpios_main.c
  20. +2 −2 cmd/zpios/zpios_util.c
  21. +1 −1 cmd/zpool/zpool_iter.c
  22. +14 −14 cmd/zpool/zpool_main.c
  23. +1 −1 cmd/zpool/zpool_util.h
  24. +4 −5 cmd/ztest/ztest.c
  25. +4 −4 include/linux/simd_x86.h
  26. +2 −1 include/sys/trace_acl.h
  27. +10 −5 include/sys/trace_arc.h
  28. +4 −2 include/sys/trace_dbgmsg.h
  29. +2 −1 include/sys/trace_dmu.h
  30. +2 −1 include/sys/trace_dnode.h
  31. +2 −1 include/sys/trace_multilist.h
  32. +2 −1 include/sys/trace_txg.h
  33. +2 −1 include/sys/trace_zil.h
  34. +2 −0 include/sys/trace_zio.h
  35. +2 −1 include/sys/trace_zrlock.h
  36. +11 −11 include/sys/vdev_raidz.h
  37. +15 −15 include/sys/vdev_raidz_impl.h
  38. +1 −2 include/sys/zpl.h
  39. +3 −3 lib/libshare/libshare.c
  40. +2 −1 lib/libshare/nfs.c
  41. +2 −2 lib/libshare/smb.c
  42. +2 −1 lib/libspl/asm-generic/atomic.c
  43. +2 −2 lib/libspl/getmntany.c
  44. +2 −2 lib/libspl/include/synch.h
  45. +8 −8 lib/libzfs/libzfs_dataset.c
  46. +1 −1 lib/libzfs/libzfs_import.c
  47. +1 −1 lib/libzfs/libzfs_mount.c
  48. +5 −5 lib/libzfs/libzfs_pool.c
  49. +2 −2 lib/libzfs/libzfs_sendrecv.c
  50. +6 −6 lib/libzfs/libzfs_util.c
  51. +1 −1 lib/libzfs_core/libzfs_core.c
  52. +4 −4 lib/libzpool/kernel.c
  53. +6 −7 module/icp/algs/aes/aes_impl.c
  54. +6 −7 module/icp/algs/modes/gcm.c
  55. +3 −2 module/icp/core/kcf_prov_tabs.c
  56. +1 −1 module/icp/core/kcf_sched.c
  57. +2 −2 module/icp/os/modconf.c
  58. +6 −9 module/icp/spi/kcf_spi.c
  59. +5 −5 module/zcommon/zfs_fletcher.c
  60. +2 −2 module/zcommon/zfs_uio.c
  61. +4 −3 module/zfs/abd.c
  62. +3 −2 module/zfs/arc.c
  63. +12 −13 module/zfs/dbuf.c
  64. +1 −1 module/zfs/dmu_send.c
  65. +2 −0 module/zfs/dmu_zfetch.c
  66. +1 −1 module/zfs/dnode.c
  67. +2 −0 module/zfs/dsl_pool.c
  68. +2 −1 module/zfs/dsl_scan.c
  69. +1 −1 module/zfs/fm.c
  70. +1 −1 module/zfs/gzip.c
  71. +1 −1 module/zfs/lz4.c
  72. +17 −10 module/zfs/metaslab.c
  73. +1 −0 module/zfs/spa.c
  74. +1 −1 module/zfs/spa_config.c
  75. +2 −1 module/zfs/spa_misc.c
  76. +2 −2 module/zfs/vdev_disk.c
  77. +5 −5 module/zfs/vdev_queue.c
  78. +15 −15 module/zfs/vdev_raidz_math.c
  79. +23 −23 module/zfs/vdev_raidz_math_avx512bw.c
  80. +2 −2 module/zfs/vdev_raidz_math_avx512f.c
  81. +56 −56 module/zfs/vdev_raidz_math_impl.h
  82. +1 −1 module/zfs/zfs_ctldir.c
  83. +1 −1 module/zfs/zfs_debug.c
  84. +6 −6 module/zfs/zfs_ioctl.c
  85. +3 −2 module/zfs/zfs_vfsops.c
  86. +2 −1 module/zfs/zfs_vnops.c
  87. +2 −3 module/zfs/zfs_znode.c
  88. +1 −0 module/zfs/zil.c
  89. +3 −3 module/zfs/zio.c
  90. +1 −0 module/zfs/zpl_export.c
  91. +3 −2 module/zfs/zpl_inode.c
  92. +8 −6 module/zfs/zvol.c
  93. +15 −15 module/zpios/pios.c
  94. +1 −1 tests/zfs-tests/cmd/dir_rd_update/dir_rd_update.c
  95. +2 −2 tests/zfs-tests/cmd/mkfile/mkfile.c
  96. +15 −14 tests/zfs-tests/cmd/xattrtest/xattrtest.c
View
@@ -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 \
@@ -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);
}
}
@@ -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 "
@@ -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;
@@ -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);
}
@@ -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);
@@ -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);
@@ -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);
}
@@ -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);
}
@@ -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 */
}
}
@@ -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);
}
@@ -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];
@@ -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 */
@@ -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 */
@@ -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++;
@@ -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");
@@ -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);
@@ -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);
}
@@ -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();
View
@@ -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");
@@ -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
@@ -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 */
@@ -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);
@@ -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;
}
View
@@ -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);
View
@@ -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",
@@ -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));
@@ -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));
@@ -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)) {
/*
Oops, something went wrong.

0 comments on commit 02730c3

Please sign in to comment.