aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-12-12 10:46:26 -0800
committerGitHub <[email protected]>2016-12-12 10:46:26 -0800
commit02730c333c4fce8c0ead1f7f3404caca5cdb3936 (patch)
treee3943bf33ee177c50004a08d1d4ea4188dbfc542 /lib
parentd57f03e40ec3bbf109e75b83699b58157b9a867d (diff)
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 <[email protected]> Reviewed-by: HÃ¥kan Johansson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #5465
Diffstat (limited to 'lib')
-rw-r--r--lib/libshare/libshare.c6
-rw-r--r--lib/libshare/nfs.c3
-rw-r--r--lib/libshare/smb.c4
-rw-r--r--lib/libspl/asm-generic/atomic.c3
-rw-r--r--lib/libspl/getmntany.c4
-rw-r--r--lib/libspl/include/synch.h4
-rw-r--r--lib/libzfs/libzfs_dataset.c16
-rw-r--r--lib/libzfs/libzfs_import.c2
-rw-r--r--lib/libzfs/libzfs_mount.c2
-rw-r--r--lib/libzfs/libzfs_pool.c10
-rw-r--r--lib/libzfs/libzfs_sendrecv.c4
-rw-r--r--lib/libzfs/libzfs_util.c12
-rw-r--r--lib/libzfs_core/libzfs_core.c2
-rw-r--r--lib/libzpool/kernel.c8
14 files changed, 41 insertions, 39 deletions
diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c
index 0eb4ae00d..41fe8bb6c 100644
--- a/lib/libshare/libshare.c
+++ b/lib/libshare/libshare.c
@@ -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;
diff --git a/lib/libshare/nfs.c b/lib/libshare/nfs.c
index 9d548dccc..a542eff1b 100644
--- a/lib/libshare/nfs.c
+++ b/lib/libshare/nfs.c
@@ -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);
diff --git a/lib/libshare/smb.c b/lib/libshare/smb.c
index 343586508..76145bd93 100644
--- a/lib/libshare/smb.c
+++ b/lib/libshare/smb.c
@@ -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);
}
diff --git a/lib/libspl/asm-generic/atomic.c b/lib/libspl/asm-generic/atomic.c
index f5eb4f34b..d0023b182 100644
--- a/lib/libspl/asm-generic/atomic.c
+++ b/lib/libspl/asm-generic/atomic.c
@@ -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)
diff --git a/lib/libspl/getmntany.c b/lib/libspl/getmntany.c
index d78357af5..9e071c7ce 100644
--- a/lib/libspl/getmntany.c
+++ b/lib/libspl/getmntany.c
@@ -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;
diff --git a/lib/libspl/include/synch.h b/lib/libspl/include/synch.h
index 93d231498..d75b8b15e 100644
--- a/lib/libspl/include/synch.h
+++ b/lib/libspl/include/synch.h
@@ -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);
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c
index e0f84af50..72d86590e 100644
--- a/lib/libzfs/libzfs_dataset.c
+++ b/lib/libzfs/libzfs_dataset.c
@@ -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;
diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c
index fe783a3a3..d09367e88 100644
--- a/lib/libzfs/libzfs_import.c
+++ b/lib/libzfs/libzfs_import.c
@@ -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");
}
/*
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index ad8a3d20b..a2bb471b3 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -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;
}
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
index 9d0702b56..2cfb01981 100644
--- a/lib/libzfs/libzfs_pool.c
+++ b/lib/libzfs/libzfs_pool.c
@@ -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);
}
/*
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index 2334245c1..b140abe35 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -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;
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c
index 95ec0b49d..a9c8374f1 100644
--- a/lib/libzfs/libzfs_util.c
+++ b/lib/libzfs/libzfs_util.c
@@ -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);
diff --git a/lib/libzfs_core/libzfs_core.c b/lib/libzfs_core/libzfs_core.c
index 4fad64eaf..9be34d34b 100644
--- a/lib/libzfs_core/libzfs_core.c
+++ b/lib/libzfs_core/libzfs_core.c
@@ -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);
diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c
index f4bda8a39..bda9d01fe 100644
--- a/lib/libzpool/kernel.c
+++ b/lib/libzpool/kernel.c
@@ -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