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
This commit is contained in:
Brian Behlendorf
2016-12-12 10:46:26 -08:00
committed by GitHub
parent d57f03e40e
commit 02730c333c
96 changed files with 501 additions and 478 deletions
+3 -3
View File
@@ -498,7 +498,7 @@ sa_enable_share(sa_share_t share, char *protocol)
#ifdef DEBUG
fprintf(stderr, "sa_enable_share: share->sharepath=%s, protocol=%s\n",
impl_share->sharepath, protocol);
impl_share->sharepath, protocol);
#endif
assert(impl_share->handle != NULL);
@@ -539,7 +539,7 @@ sa_disable_share(sa_share_t share, char *protocol)
#ifdef DEBUG
fprintf(stderr, "sa_disable_share: share->sharepath=%s, protocol=%s\n",
impl_share->sharepath, protocol);
impl_share->sharepath, protocol);
#endif
ret = SA_OK;
@@ -697,7 +697,7 @@ sa_parse_legacy_options(sa_group_t group, char *options, char *proto)
#ifdef DEBUG
fprintf(stderr, "sa_parse_legacy_options: options=%s, proto=%s\n",
options, proto);
options, proto);
#endif
fstype = fstypes;
+2 -1
View File
@@ -688,7 +688,8 @@ nfs_check_exportfs(void)
}
if (pid > 0) {
while ((rc = waitpid(pid, &status, 0)) <= 0 && errno == EINTR);
while ((rc = waitpid(pid, &status, 0)) <= 0 &&
errno == EINTR) { }
if (rc <= 0) {
(void) close(nfs_exportfs_temp_fd);
+2 -2
View File
@@ -154,7 +154,7 @@ smb_retrieve_shares(void)
continue; /* Incomplete share definition */
else {
shares = (smb_share_t *)
malloc(sizeof (smb_share_t));
malloc(sizeof (smb_share_t));
if (shares == NULL) {
rc = SA_NO_MEMORY;
goto out;
@@ -395,7 +395,7 @@ smb_update_shareopts(sa_share_impl_t impl_share, const char *resource,
old_shareopts = FSINFO(impl_share, smb_fstype)->shareopts;
if (FSINFO(impl_share, smb_fstype)->active && old_shareopts != NULL &&
strcmp(old_shareopts, shareopts) != 0) {
strcmp(old_shareopts, shareopts) != 0) {
needs_reshare = B_TRUE;
smb_disable_share(impl_share);
}
+2 -1
View File
@@ -39,7 +39,7 @@ pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER;
/*
* Theses are the void returning variants
*/
/* BEGIN CSTYLED */
#define ATOMIC_INC(name, type) \
void atomic_inc_##name(volatile type *target) \
{ \
@@ -381,6 +381,7 @@ ATOMIC_SWAP(32, uint32_t)
ATOMIC_SWAP(uint, uint_t)
ATOMIC_SWAP(ulong, ulong_t)
ATOMIC_SWAP(64, uint64_t)
/* END CSTYLED */
void *
atomic_swap_ptr(volatile void *target, void *bits)
+2 -2
View File
@@ -53,7 +53,7 @@ getmntany(FILE *fp, struct mnttab *mgetp, struct mnttab *mrefp)
while (
((ret = _sol_getmntent(fp, mgetp)) == 0) && (
DIFF(mnt_special) || DIFF(mnt_mountp) ||
DIFF(mnt_fstype) || DIFF(mnt_mntopts)));
DIFF(mnt_fstype) || DIFF(mnt_mntopts))) { }
return (ret);
}
@@ -86,7 +86,7 @@ getextmntent(FILE *fp, struct extmnttab *mp, int len)
int ret;
struct stat64 st;
ret = _sol_getmntent(fp, (struct mnttab *) mp);
ret = _sol_getmntent(fp, (struct mnttab *)mp);
if (ret == 0) {
if (stat64(mp->mnt_mountp, &st) != 0) {
mp->mnt_major = 0;
+2 -2
View File
@@ -53,11 +53,11 @@ rwlock_init(rwlock_t *rwlp, int type, void *arg)
switch (type) {
case USYNC_THREAD:
VERIFY0(pthread_rwlockattr_setpshared(&attr,
PTHREAD_PROCESS_PRIVATE));
PTHREAD_PROCESS_PRIVATE));
break;
case USYNC_PROCESS:
VERIFY0(pthread_rwlockattr_setpshared(&attr,
PTHREAD_PROCESS_SHARED));
PTHREAD_PROCESS_SHARED));
break;
default:
VERIFY0(1);
+8 -8
View File
@@ -1938,9 +1938,9 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
* the property is valid for the snapshot's head dataset type.
*/
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT &&
!zfs_prop_valid_for_type(prop, zhp->zfs_head_type, B_TRUE)) {
*val = zfs_prop_default_numeric(prop);
return (-1);
!zfs_prop_valid_for_type(prop, zhp->zfs_head_type, B_TRUE)) {
*val = zfs_prop_default_numeric(prop);
return (-1);
}
switch (prop) {
@@ -2343,7 +2343,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
strftime(propbuf, proplen, "%a %b %e %k:%M %Y",
&t) == 0)
(void) snprintf(propbuf, proplen, "%llu",
(u_longlong_t) val);
(u_longlong_t)val);
}
break;
@@ -2744,11 +2744,11 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
*typep = type;
isuser = (type == ZFS_PROP_USERQUOTA || type == ZFS_PROP_USERUSED ||
type == ZFS_PROP_USEROBJQUOTA ||
type == ZFS_PROP_USEROBJUSED);
type == ZFS_PROP_USEROBJQUOTA ||
type == ZFS_PROP_USEROBJUSED);
isgroup = (type == ZFS_PROP_GROUPQUOTA || type == ZFS_PROP_GROUPUSED ||
type == ZFS_PROP_GROUPOBJQUOTA ||
type == ZFS_PROP_GROUPOBJUSED);
type == ZFS_PROP_GROUPOBJQUOTA ||
type == ZFS_PROP_GROUPOBJUSED);
cp = strchr(propname, '@') + 1;
+1 -1
View File
@@ -200,7 +200,7 @@ boolean_t
udev_is_mpath(struct udev_device *dev)
{
return udev_device_get_property_value(dev, "DM_UUID") &&
udev_device_get_property_value(dev, "MPATH_SBIN_PATH");
udev_device_get_property_value(dev, "MPATH_SBIN_PATH");
}
/*
+1 -1
View File
@@ -456,7 +456,7 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
*/
if (!(flags & MS_OVERLAY)) {
if (zfs_prop_get(zhp, ZFS_PROP_OVERLAY, overlay,
sizeof (overlay), NULL, NULL, 0, B_FALSE) == 0) {
sizeof (overlay), NULL, NULL, 0, B_FALSE) == 0) {
if (strcmp(overlay, "on") == 0) {
flags |= MS_OVERLAY;
}
+5 -5
View File
@@ -308,7 +308,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
case ZPOOL_PROP_ASHIFT:
if (literal)
(void) snprintf(buf, len, "%llu",
(u_longlong_t)intval);
(u_longlong_t)intval);
else
(void) zfs_nicenum(intval, buf, len);
break;
@@ -3416,12 +3416,12 @@ zfs_strip_partition(char *path)
d = part + 1;
} else if ((tmp[0] == 'h' || tmp[0] == 's' || tmp[0] == 'v') &&
tmp[1] == 'd') {
for (d = &tmp[2]; isalpha(*d); part = ++d);
for (d = &tmp[2]; isalpha(*d); part = ++d) { }
} else if (strncmp("xvd", tmp, 3) == 0) {
for (d = &tmp[3]; isalpha(*d); part = ++d);
for (d = &tmp[3]; isalpha(*d); part = ++d) { }
}
if (part && d && *d != '\0') {
for (; isdigit(*d); d++);
for (; isdigit(*d); d++) { }
if (*d == '\0')
*part = '\0';
}
@@ -4210,7 +4210,7 @@ zpool_label_name(char *label_name, int label_size)
if (id == 0)
id = (((uint64_t)rand()) << 32) | (uint64_t)rand();
snprintf(label_name, label_size, "zfs-%016llx", (u_longlong_t) id);
snprintf(label_name, label_size, "zfs-%016llx", (u_longlong_t)id);
}
/*
+2 -2
View File
@@ -2615,7 +2615,7 @@ again:
else
progress = B_TRUE;
sprintf(guidname, "%llu",
(u_longlong_t) parent_fromsnap_guid);
(u_longlong_t)parent_fromsnap_guid);
nvlist_add_boolean(deleted, guidname);
continue;
}
@@ -2649,7 +2649,7 @@ again:
parent_fromsnap_guid != 0 &&
stream_parent_fromsnap_guid != parent_fromsnap_guid) {
sprintf(guidname, "%llu",
(u_longlong_t) parent_fromsnap_guid);
(u_longlong_t)parent_fromsnap_guid);
if (nvlist_exists(deleted, guidname)) {
progress = B_TRUE;
needagain = B_TRUE;
+6 -6
View File
@@ -617,7 +617,7 @@ zfs_nicenum_format(uint64_t num, char *buf, size_t buflen,
double val;
if (format == ZFS_NICENUM_RAW) {
snprintf(buf, buflen, "%llu", (u_longlong_t) num);
snprintf(buf, buflen, "%llu", (u_longlong_t)num);
return;
}
@@ -633,12 +633,12 @@ zfs_nicenum_format(uint64_t num, char *buf, size_t buflen,
if ((format == ZFS_NICENUM_TIME) && (num == 0)) {
(void) snprintf(buf, buflen, "-");
} else if ((index == 0) || ((num %
(uint64_t) powl(k_unit[format], index)) == 0)) {
(uint64_t)powl(k_unit[format], index)) == 0)) {
/*
* If this is an even multiple of the base, always display
* without any decimal precision.
*/
(void) snprintf(buf, buflen, "%llu%s", (u_longlong_t) n, u);
(void) snprintf(buf, buflen, "%llu%s", (u_longlong_t)n, u);
} else {
/*
@@ -652,8 +652,8 @@ zfs_nicenum_format(uint64_t num, char *buf, size_t buflen,
*/
int i;
for (i = 2; i >= 0; i--) {
val = (double) num /
(uint64_t) powl(k_unit[format], index);
val = (double)num /
(uint64_t)powl(k_unit[format], index);
/*
* Don't print floating point values for time. Note,
@@ -752,7 +752,7 @@ libzfs_run_process(const char *path, char *argv[], int flags)
int status;
while ((error = waitpid(pid, &status, 0)) == -1 &&
errno == EINTR);
errno == EINTR) { }
if (error < 0 || !WIFEXITED(status))
return (-1);
+1 -1
View File
@@ -617,7 +617,7 @@ recv_impl(const char *snapname, nvlist_t *props, const char *origin,
fnvlist_add_string(innvl, "origin", origin);
fnvlist_add_byte_array(innvl, "begin_record",
(uchar_t *) &drr, sizeof (drr));
(uchar_t *)&drr, sizeof (drr));
fnvlist_add_int32(innvl, "input_fd", input_fd);
+4 -4
View File
@@ -127,7 +127,7 @@ zk_thread_current(void)
void *
zk_thread_helper(void *arg)
{
kthread_t *kt = (kthread_t *) arg;
kthread_t *kt = (kthread_t *)arg;
VERIFY3S(pthread_setspecific(kthread_key, kt), ==, 0);
@@ -137,7 +137,7 @@ zk_thread_helper(void *arg)
(void) setpriority(PRIO_PROCESS, 0, kt->t_pri);
kt->t_tid = pthread_self();
((thread_func_arg_t) kt->t_func)(kt->t_arg);
((thread_func_arg_t)kt->t_func)(kt->t_arg);
/* Unreachable, thread must exit with thread_exit() */
abort();
@@ -916,7 +916,7 @@ __dprintf(const char *file, const char *func, int line, const char *fmt, ...)
if (dprintf_find_string("pid"))
(void) printf("%d ", getpid());
if (dprintf_find_string("tid"))
(void) printf("%u ", (uint_t) pthread_self());
(void) printf("%u ", (uint_t)pthread_self());
if (dprintf_find_string("cpu"))
(void) printf("%u ", getcpuid());
if (dprintf_find_string("time"))
@@ -1490,7 +1490,7 @@ zfs_onexit_cb_data(minor_t minor, uint64_t action_handle, void **data)
fstrans_cookie_t
spl_fstrans_mark(void)
{
return ((fstrans_cookie_t) 0);
return ((fstrans_cookie_t)0);
}
void