summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorMichael Kjorling <[email protected]>2013-11-01 20:26:11 +0100
committerBrian Behlendorf <[email protected]>2013-12-18 16:46:35 -0800
commitd1d7e2689db9e03f11c069ebc9f1ba12829e5dac (patch)
tree75b9a2b23334d5f673fb31f142f74146d351865c /cmd
parent8ffef572ed2ba97e0c2d6a8aa2240012e611dc6f (diff)
cstyle: Resolve C style issues
The vast majority of these changes are in Linux specific code. They are the result of not having an automated style checker to validate the code when it was originally written. Others were caused when the common code was slightly adjusted for Linux. This patch contains no functional changes. It only refreshes the code to conform to style guide. Everyone submitting patches for inclusion upstream should now run 'make checkstyle' and resolve any warning prior to opening a pull request. The automated builders have been updated to fail a build if when 'make checkstyle' detects an issue. Signed-off-by: Brian Behlendorf <[email protected]> Closes #1821
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mount_zfs/mount_zfs.c16
-rw-r--r--cmd/zdb/zdb.c10
-rw-r--r--cmd/zfs/zfs_iter.c4
-rw-r--r--cmd/zfs/zfs_main.c4
-rw-r--r--cmd/zpios/zpios.h91
-rw-r--r--cmd/zpios/zpios_main.c358
-rw-r--r--cmd/zpios/zpios_util.c189
-rw-r--r--cmd/zpool/zpool_main.c39
-rw-r--r--cmd/zpool/zpool_util.h3
-rw-r--r--cmd/zpool/zpool_vdev.c57
-rw-r--r--cmd/ztest/ztest.c68
-rw-r--r--cmd/zvol_id/zvol_id_main.c6
12 files changed, 436 insertions, 409 deletions
diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
index f7e2d99a0..82fa67c93 100644
--- a/cmd/mount_zfs/mount_zfs.c
+++ b/cmd/mount_zfs/mount_zfs.c
@@ -272,7 +272,7 @@ out:
len = strlen(cwd);
/* Do not add one when cwd already ends in a trailing '/' */
- if (!strncmp(cwd, dataset, len))
+ if (strncmp(cwd, dataset, len) == 0)
return (dataset + len + (cwd[len-1] != '/'));
return (dataset);
@@ -444,11 +444,11 @@ main(int argc, char **argv)
* done until zfs is added to the default selinux policy configuration
* as a known filesystem type which supports xattrs.
*/
- if (is_selinux_enabled() && !(zfsflags & ZS_NOCONTEXT)) {
- (void) strlcat(mntopts, ",context=\"system_u:"
- "object_r:file_t:s0\"", sizeof (mntopts));
- (void) strlcat(mtabopt, ",context=\"system_u:"
- "object_r:file_t:s0\"", sizeof (mtabopt));
+ if (is_selinux_enabled() && !(zfsflags & ZS_NOCONTEXT)) {
+ (void) strlcat(mntopts, ",context=\"system_u:"
+ "object_r:file_t:s0\"", sizeof (mntopts));
+ (void) strlcat(mtabopt, ",context=\"system_u:"
+ "object_r:file_t:s0\"", sizeof (mtabopt));
}
#endif /* HAVE_LIBSELINUX */
@@ -501,12 +501,12 @@ main(int argc, char **argv)
* using zfs as your root file system both rc.sysinit/umountroot and
* systemd depend on 'mount -o remount <mountpoint>' to work.
*/
- if (zfsutil && !strcmp(legacy, ZFS_MOUNTPOINT_LEGACY)) {
+ if (zfsutil && (strcmp(legacy, ZFS_MOUNTPOINT_LEGACY) == 0)) {
(void) fprintf(stderr, gettext(
"filesystem '%s' cannot be mounted using 'zfs mount'.\n"
"Use 'zfs set mountpoint=%s' or 'mount -t zfs %s %s'.\n"
"See zfs(8) for more information.\n"),
- dataset, mntpoint, dataset, mntpoint);
+ dataset, mntpoint, dataset, mntpoint);
return (MOUNT_USAGE);
}
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 2bee9fab6..8e60b9b1a 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -165,7 +165,8 @@ usage(void)
(void) fprintf(stderr, " -t <txg> -- highest txg to use when "
"searching for uberblocks\n");
(void) fprintf(stderr, " -M <number of inflight I/Os> -- "
- "specify the maximum number of checksumming I/Os [default is 200]\n");
+ "specify the maximum number of checksumming I/Os "
+ "[default is 200]\n");
(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
"to make only that option verbose\n");
(void) fprintf(stderr, "Default is to dump everything non-verbosely\n");
@@ -1319,7 +1320,8 @@ dump_deadlist(dsl_deadlist_t *dl)
dle = AVL_NEXT(&dl->dl_tree, dle)) {
if (dump_opt['d'] >= 5) {
char buf[128];
- (void) snprintf(buf, sizeof (buf), "mintxg %llu -> obj %llu",
+ (void) snprintf(buf, sizeof (buf),
+ "mintxg %llu -> obj %llu",
(longlong_t)dle->dle_mintxg,
(longlong_t)dle->dle_bpobj.bpo_object);
@@ -1436,7 +1438,7 @@ dump_znode_sa_xattr(sa_handle_t *hdl)
(void) printf("\t\t%s = ", nvpair_name(elem));
nvpair_value_byte_array(elem, &value, &cnt);
- for (idx = 0 ; idx < cnt ; ++idx) {
+ for (idx = 0; idx < cnt; ++idx) {
if (isprint(value[idx]))
(void) putchar(value[idx]);
else
@@ -2394,7 +2396,7 @@ dump_block_stats(spa_t *spa)
* it's not part of any space map) is a double allocation,
* reference to a freed block, or an unclaimed log block.
*/
- bzero(&zcb, sizeof(zdb_cb_t));
+ bzero(&zcb, sizeof (zdb_cb_t));
zdb_leak_init(spa, &zcb);
/*
diff --git a/cmd/zfs/zfs_iter.c b/cmd/zfs/zfs_iter.c
index bbc47da9e..8892d91f2 100644
--- a/cmd/zfs/zfs_iter.c
+++ b/cmd/zfs/zfs_iter.c
@@ -313,8 +313,8 @@ zfs_sort(const void *larg, const void *rarg, void *data)
} else if (psc->sc_prop == ZFS_PROP_NAME) {
lvalid = rvalid = B_TRUE;
- (void) strlcpy(lbuf, zfs_get_name(l), sizeof(lbuf));
- (void) strlcpy(rbuf, zfs_get_name(r), sizeof(rbuf));
+ (void) strlcpy(lbuf, zfs_get_name(l), sizeof (lbuf));
+ (void) strlcpy(rbuf, zfs_get_name(r), sizeof (rbuf));
lstr = lbuf;
rstr = rbuf;
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 98c53dd59..3f54985b9 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -2879,13 +2879,13 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
if (pl->pl_prop == ZFS_PROP_NAME) {
(void) strlcpy(property, zfs_get_name(zhp),
- sizeof(property));
+ sizeof (property));
propstr = property;
right_justify = zfs_prop_align_right(pl->pl_prop);
} else if (pl->pl_prop != ZPROP_INVAL) {
if (zfs_prop_get(zhp, pl->pl_prop, property,
sizeof (property), NULL, NULL, 0,
- cb->cb_literal) != 0)
+ cb->cb_literal) != 0)
propstr = "-";
else
propstr = property;
diff --git a/cmd/zpios/zpios.h b/cmd/zpios/zpios.h
index 23c32377e..92d96fcbe 100644
--- a/cmd/zpios/zpios.h
+++ b/cmd/zpios/zpios.h
@@ -1,4 +1,4 @@
-/*****************************************************************************\
+/*
* ZPIOS is a heavily modified version of the original PIOS test code.
* It is designed to have the test code running in the Linux kernel
* against ZFS while still being flexibly controled from user space.
@@ -29,73 +29,74 @@
*
* You should have received a copy of the GNU General Public License along
* with ZPIOS. If not, see <http://www.gnu.org/licenses/>.
-\*****************************************************************************/
+ */
#ifndef _ZPIOS_H
-#define _ZPIOS_H
+#define _ZPIOS_H
#include <zpios-ctl.h>
-#define VERSION_SIZE 64
+#define VERSION_SIZE 64
/* Regular expressions */
-#define REGEX_NUMBERS "^[0-9]*[0-9]$"
-#define REGEX_NUMBERS_COMMA "^([0-9]+,)*[0-9]+$"
-#define REGEX_SIZE "^[0-9][0-9]*[kmgt]$"
-#define REGEX_SIZE_COMMA "^([0-9][0-9]*[kmgt]+,)*[0-9][0-9]*[kmgt]$"
+#define REGEX_NUMBERS "^[0-9]*[0-9]$"
+#define REGEX_NUMBERS_COMMA "^([0-9]+,)*[0-9]+$"
+#define REGEX_SIZE "^[0-9][0-9]*[kmgt]$"
+#define REGEX_SIZE_COMMA "^([0-9][0-9]*[kmgt]+,)*[0-9][0-9]*[kmgt]$"
/* Flags for low, high, incr */
-#define FLAG_SET 0x01
-#define FLAG_LOW 0x02
-#define FLAG_HIGH 0x04
-#define FLAG_INCR 0x08
+#define FLAG_SET 0x01
+#define FLAG_LOW 0x02
+#define FLAG_HIGH 0x04
+#define FLAG_INCR 0x08
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
-#define KB (1024)
-#define MB (KB * 1024)
-#define GB (MB * 1024)
-#define TB (GB * 1024)
+#define KB (1024)
+#define MB (KB * 1024)
+#define GB (MB * 1024)
+#define TB (GB * 1024)
-#define KMGT_SIZE 16
+#define KMGT_SIZE 16
-/* All offsets, sizes and counts can be passed to the application in
+/*
+ * All offsets, sizes and counts can be passed to the application in
* multiple ways.
* 1. a value (stored in val[0], val_count will be 1)
* 2. a comma separated list of values (stored in val[], using val_count)
* 3. a range and block sizes, low, high, factor (val_count must be 0)
*/
typedef struct pios_range_repeat {
- uint64_t val[32]; /* Comma sep array, or low, high, inc */
- uint64_t val_count; /* Num of values */
+ uint64_t val[32]; /* Comma sep array, or low, high, inc */
+ uint64_t val_count; /* Num of values */
uint64_t val_low;
uint64_t val_high;
uint64_t val_inc_perc;
- uint64_t next_val; /* Used for multiple runs in get_next() */
+ uint64_t next_val; /* For multiple runs in get_next() */
} range_repeat_t;
typedef struct cmd_args {
- range_repeat_t T; /* Thread count */
- range_repeat_t N; /* Region count */
- range_repeat_t O; /* Offset count */
- range_repeat_t C; /* Chunksize */
- range_repeat_t S; /* Regionsize */
-
- const char *pool; /* Pool */
- const char *name; /* Name */
- uint32_t flags; /* Flags */
- uint32_t io_type; /* DMUIO only */
- uint32_t verbose; /* Verbose */
- uint32_t human_readable; /* Human readable output */
-
- uint64_t regionnoise; /* Region noise */
- uint64_t chunknoise; /* Chunk noise */
- uint64_t thread_delay; /* Thread delay */
-
- char pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */
- char post[ZPIOS_PATH_SIZE]; /* Post-exec hook */
- char log[ZPIOS_PATH_SIZE]; /* Requested log dir */
+ range_repeat_t T; /* Thread count */
+ range_repeat_t N; /* Region count */
+ range_repeat_t O; /* Offset count */
+ range_repeat_t C; /* Chunksize */
+ range_repeat_t S; /* Regionsize */
+
+ const char *pool; /* Pool */
+ const char *name; /* Name */
+ uint32_t flags; /* Flags */
+ uint32_t io_type; /* DMUIO only */
+ uint32_t verbose; /* Verbose */
+ uint32_t human_readable; /* Human readable output */
+
+ uint64_t regionnoise; /* Region noise */
+ uint64_t chunknoise; /* Chunk noise */
+ uint64_t thread_delay; /* Thread delay */
+
+ char pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */
+ char post[ZPIOS_PATH_SIZE]; /* Post-exec hook */
+ char log[ZPIOS_PATH_SIZE]; /* Requested log dir */
/* Control */
int current_id;
@@ -109,9 +110,9 @@ typedef struct cmd_args {
} cmd_args_t;
int set_count(char *pattern1, char *pattern2, range_repeat_t *range,
- char *optarg, uint32_t *flags, char *arg);
+ char *optarg, uint32_t *flags, char *arg);
int set_lhi(char *pattern, range_repeat_t *range, char *optarg,
- int flag, uint32_t *flag_thread, char *arg);
+ int flag, uint32_t *flag_thread, char *arg);
int set_noise(uint64_t *noise, char *optarg, char *arg);
int set_load_params(cmd_args_t *args, char *optarg);
int check_mutual_exclusive_command_lines(uint32_t flag, char *arg);
diff --git a/cmd/zpios/zpios_main.c b/cmd/zpios/zpios_main.c
index 1c01d9a9d..b1091abe2 100644
--- a/cmd/zpios/zpios_main.c
+++ b/cmd/zpios/zpios_main.c
@@ -1,7 +1,7 @@
-/*****************************************************************************\
+/*
* ZPIOS is a heavily modified version of the original PIOS test code.
* It is designed to have the test code running in the Linux kernel
- * against ZFS while still being flexibly controled from user space.
+ * against ZFS while still being flexibly controlled from user space.
*
* Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
@@ -29,7 +29,7 @@
*
* You should have received a copy of the GNU General Public License along
* with ZPIOS. If not, see <http://www.gnu.org/licenses/>.
-\*****************************************************************************/
+ */
#include <stdlib.h>
#include <stdio.h>
@@ -42,47 +42,48 @@
#include <sys/ioctl.h>
#include "zpios.h"
-static const char short_opt[] = "t:l:h:e:n:i:j:k:o:m:q:r:c:a:b:g:s:A:B:C:"
- "L:p:M:xP:R:G:I:N:T:VzOfHv?";
+static const char short_opt[] =
+ "t:l:h:e:n:i:j:k:o:m:q:r:c:a:b:g:s:A:B:C:"
+ "L:p:M:xP:R:G:I:N:T:VzOfHv?";
static const struct option long_opt[] = {
- {"threadcount", required_argument, 0, 't' },
- {"threadcount_low", required_argument, 0, 'l' },
- {"threadcount_high", required_argument, 0, 'h' },
- {"threadcount_incr", required_argument, 0, 'e' },
- {"regioncount", required_argument, 0, 'n' },
- {"regioncount_low", required_argument, 0, 'i' },
- {"regioncount_high", required_argument, 0, 'j' },
- {"regioncount_incr", required_argument, 0, 'k' },
- {"offset", required_argument, 0, 'o' },
- {"offset_low", required_argument, 0, 'm' },
- {"offset_high", required_argument, 0, 'q' },
- {"offset_incr", required_argument, 0, 'r' },
- {"chunksize", required_argument, 0, 'c' },
- {"chunksize_low", required_argument, 0, 'a' },
- {"chunksize_high", required_argument, 0, 'b' },
- {"chunksize_incr", required_argument, 0, 'g' },
- {"regionsize", required_argument, 0, 's' },
- {"regionsize_low", required_argument, 0, 'A' },
- {"regionsize_high", required_argument, 0, 'B' },
- {"regionsize_incr", required_argument, 0, 'C' },
- {"load", required_argument, 0, 'L' },
- {"pool", required_argument, 0, 'p' },
- {"name", required_argument, 0, 'M' },
- {"cleanup", no_argument, 0, 'x' },
- {"prerun", required_argument, 0, 'P' },
- {"postrun", required_argument, 0, 'R' },
- {"log", required_argument, 0, 'G' },
- {"regionnoise", required_argument, 0, 'I' },
- {"chunknoise", required_argument, 0, 'N' },
- {"threaddelay", required_argument, 0, 'T' },
- {"verify", no_argument, 0, 'V' },
- {"zerocopy", no_argument, 0, 'z' },
- {"nowait", no_argument, 0, 'O' },
- {"noprefetch", no_argument, 0, 'f' },
- {"human-readable", no_argument, 0, 'H' },
- {"verbose", no_argument, 0, 'v' },
- {"help", no_argument, 0, '?' },
- { 0, 0, 0, 0 },
+ {"threadcount", required_argument, 0, 't' },
+ {"threadcount_low", required_argument, 0, 'l' },
+ {"threadcount_high", required_argument, 0, 'h' },
+ {"threadcount_incr", required_argument, 0, 'e' },
+ {"regioncount", required_argument, 0, 'n' },
+ {"regioncount_low", required_argument, 0, 'i' },
+ {"regioncount_high", required_argument, 0, 'j' },
+ {"regioncount_incr", required_argument, 0, 'k' },
+ {"offset", required_argument, 0, 'o' },
+ {"offset_low", required_argument, 0, 'm' },
+ {"offset_high", required_argument, 0, 'q' },
+ {"offset_incr", required_argument, 0, 'r' },
+ {"chunksize", required_argument, 0, 'c' },
+ {"chunksize_low", required_argument, 0, 'a' },
+ {"chunksize_high", required_argument, 0, 'b' },
+ {"chunksize_incr", required_argument, 0, 'g' },
+ {"regionsize", required_argument, 0, 's' },
+ {"regionsize_low", required_argument, 0, 'A' },
+ {"regionsize_high", required_argument, 0, 'B' },
+ {"regionsize_incr", required_argument, 0, 'C' },
+ {"load", required_argument, 0, 'L' },
+ {"pool", required_argument, 0, 'p' },
+ {"name", required_argument, 0, 'M' },
+ {"cleanup", no_argument, 0, 'x' },
+ {"prerun", required_argument, 0, 'P' },
+ {"postrun", required_argument, 0, 'R' },
+ {"log", required_argument, 0, 'G' },
+ {"regionnoise", required_argument, 0, 'I' },
+ {"chunknoise", required_argument, 0, 'N' },
+ {"threaddelay", required_argument, 0, 'T' },
+ {"verify", no_argument, 0, 'V' },
+ {"zerocopy", no_argument, 0, 'z' },
+ {"nowait", no_argument, 0, 'O' },
+ {"noprefetch", no_argument, 0, 'f' },
+ {"human-readable", no_argument, 0, 'H' },
+ {"verbose", no_argument, 0, 'v' },
+ {"help", no_argument, 0, '?' },
+ { 0, 0, 0, 0 },
};
static int zpiosctl_fd; /* Control file descriptor */
@@ -95,45 +96,45 @@ usage(void)
{
fprintf(stderr, "Usage: zpios\n");
fprintf(stderr,
- " --threadcount -t =values\n"
- " --threadcount_low -l =value\n"
- " --threadcount_high -h =value\n"
- " --threadcount_incr -e =value\n"
- " --regioncount -n =values\n"
- " --regioncount_low -i =value\n"
- " --regioncount_high -j =value\n"
- " --regioncount_incr -k =value\n"
- " --offset -o =values\n"
- " --offset_low -m =value\n"
- " --offset_high -q =value\n"
- " --offset_incr -r =value\n"
- " --chunksize -c =values\n"
- " --chunksize_low -a =value\n"
- " --chunksize_high -b =value\n"
- " --chunksize_incr -g =value\n"
- " --regionsize -s =values\n"
- " --regionsize_low -A =value\n"
- " --regionsize_high -B =value\n"
- " --regionsize_incr -C =value\n"
- " --load -L =dmuio|ssf|fpp\n"
- " --pool -p =pool name\n"
+ " --threadcount -t =values\n"
+ " --threadcount_low -l =value\n"
+ " --threadcount_high -h =value\n"
+ " --threadcount_incr -e =value\n"
+ " --regioncount -n =values\n"
+ " --regioncount_low -i =value\n"
+ " --regioncount_high -j =value\n"
+ " --regioncount_incr -k =value\n"
+ " --offset -o =values\n"
+ " --offset_low -m =value\n"
+ " --offset_high -q =value\n"
+ " --offset_incr -r =value\n"
+ " --chunksize -c =values\n"
+ " --chunksize_low -a =value\n"
+ " --chunksize_high -b =value\n"
+ " --chunksize_incr -g =value\n"
+ " --regionsize -s =values\n"
+ " --regionsize_low -A =value\n"
+ " --regionsize_high -B =value\n"
+ " --regionsize_incr -C =value\n"
+ " --load -L =dmuio|ssf|fpp\n"
+ " --pool -p =pool name\n"
" --name -M =test name\n"
- " --cleanup -x\n"
- " --prerun -P =pre-command\n"
- " --postrun -R =post-command\n"
- " --log -G =log directory\n"
- " --regionnoise -I =shift\n"
- " --chunknoise -N =bytes\n"
- " --threaddelay -T =jiffies\n"
- " --verify -V\n"
- " --zerocopy -z\n"
- " --nowait -O\n"
+ " --cleanup -x\n"
+ " --prerun -P =pre-command\n"
+ " --postrun -R =post-command\n"
+ " --log -G =log directory\n"
+ " --regionnoise -I =shift\n"
+ " --chunknoise -N =bytes\n"
+ " --threaddelay -T =jiffies\n"
+ " --verify -V\n"
+ " --zerocopy -z\n"
+ " --nowait -O\n"
" --noprefetch -f\n"
- " --human-readable -H\n"
- " --verbose -v =increase verbosity\n"
- " --help -? =this help\n\n");
+ " --human-readable -H\n"
+ " --verbose -v =increase verbosity\n"
+ " --help -? =this help\n\n");
- return 0;
+ return (0);
}
static void args_fini(cmd_args_t *args)
@@ -155,99 +156,99 @@ args_init(int argc, char **argv)
if (argc == 1) {
usage();
- return (cmd_args_t *)NULL;
+ return ((cmd_args_t *)NULL);
}
/* Configure and populate the args structures */
- args = malloc(sizeof(*args));
+ args = malloc(sizeof (*args));
if (args == NULL)
- return NULL;
+ return (NULL);
- memset(args, 0, sizeof(*args));
+ memset(args, 0, sizeof (*args));
- while ((c=getopt_long(argc, argv, short_opt, long_opt, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, short_opt, long_opt, NULL)) != -1) {
rc = 0;
switch (c) {
case 't': /* --thread count */
- rc = set_count(REGEX_NUMBERS, REGEX_NUMBERS_COMMA,
- &args->T, optarg, &fl_th, "threadcount");
+ rc = set_count(REGEX_NUMBERS, REGEX_NUMBERS_COMMA,
+ &args->T, optarg, &fl_th, "threadcount");
break;
case 'l': /* --threadcount_low */
rc = set_lhi(REGEX_NUMBERS, &args->T, optarg,
- FLAG_LOW, &fl_th, "threadcount_low");
+ FLAG_LOW, &fl_th, "threadcount_low");
break;
case 'h': /* --threadcount_high */
rc = set_lhi(REGEX_NUMBERS, &args->T, optarg,
- FLAG_HIGH, &fl_th, "threadcount_high");
+ FLAG_HIGH, &fl_th, "threadcount_high");
break;
case 'e': /* --threadcount_inc */
rc = set_lhi(REGEX_NUMBERS, &args->T, optarg,
- FLAG_INCR, &fl_th, "threadcount_incr");
+ FLAG_INCR, &fl_th, "threadcount_incr");
break;
case 'n': /* --regioncount */
rc = set_count(REGEX_NUMBERS, REGEX_NUMBERS_COMMA,
- &args->N, optarg, &fl_rc, "regioncount");
+ &args->N, optarg, &fl_rc, "regioncount");
break;
case 'i': /* --regioncount_low */
rc = set_lhi(REGEX_NUMBERS, &args->N, optarg,
- FLAG_LOW, &fl_rc, "regioncount_low");
+ FLAG_LOW, &fl_rc, "regioncount_low");
break;
case 'j': /* --regioncount_high */
rc = set_lhi(REGEX_NUMBERS, &args->N, optarg,
- FLAG_HIGH, &fl_rc, "regioncount_high");
+ FLAG_HIGH, &fl_rc, "regioncount_high");
break;
case 'k': /* --regioncount_inc */
rc = set_lhi(REGEX_NUMBERS, &args->N, optarg,
- FLAG_INCR, &fl_rc, "regioncount_incr");
+ FLAG_INCR, &fl_rc, "regioncount_incr");
break;
case 'o': /* --offset */
rc = set_count(REGEX_SIZE, REGEX_SIZE_COMMA,
- &args->O, optarg, &fl_of, "offset");
+ &args->O, optarg, &fl_of, "offset");
break;
case 'm': /* --offset_low */
rc = set_lhi(REGEX_SIZE, &args->O, optarg,
- FLAG_LOW, &fl_of, "offset_low");
+ FLAG_LOW, &fl_of, "offset_low");
break;
case 'q': /* --offset_high */
rc = set_lhi(REGEX_SIZE, &args->O, optarg,
- FLAG_HIGH, &fl_of, "offset_high");
+ FLAG_HIGH, &fl_of, "offset_high");
break;
case 'r': /* --offset_inc */
rc = set_lhi(REGEX_NUMBERS, &args->O, optarg,
- FLAG_INCR, &fl_of, "offset_incr");
+ FLAG_INCR, &fl_of, "offset_incr");
break;
case 'c': /* --chunksize */
rc = set_count(REGEX_SIZE, REGEX_SIZE_COMMA,
- &args->C, optarg, &fl_cs, "chunksize");
+ &args->C, optarg, &fl_cs, "chunksize");
break;
case 'a': /* --chunksize_low */
rc = set_lhi(REGEX_SIZE, &args->C, optarg,
- FLAG_LOW, &fl_cs, "chunksize_low");
+ FLAG_LOW, &fl_cs, "chunksize_low");
break;
case 'b': /* --chunksize_high */
rc = set_lhi(REGEX_SIZE, &args->C, optarg,
- FLAG_HIGH, &fl_cs, "chunksize_high");
+ FLAG_HIGH, &fl_cs, "chunksize_high");
break;
case 'g': /* --chunksize_inc */
rc = set_lhi(REGEX_NUMBERS, &args->C, optarg,
- FLAG_INCR, &fl_cs, "chunksize_incr");
+ FLAG_INCR, &fl_cs, "chunksize_incr");
break;
case 's': /* --regionsize */
rc = set_count(REGEX_SIZE, REGEX_SIZE_COMMA,
- &args->S, optarg, &fl_rs, "regionsize");
+ &args->S, optarg, &fl_rs, "regionsize");
break;
case 'A': /* --regionsize_low */
rc = set_lhi(REGEX_SIZE, &args->S, optarg,
- FLAG_LOW, &fl_rs, "regionsize_low");
+ FLAG_LOW, &fl_rs, "regionsize_low");
break;
case 'B': /* --regionsize_high */
rc = set_lhi(REGEX_SIZE, &args->S, optarg,
- FLAG_HIGH, &fl_rs, "regionsize_high");
+ FLAG_HIGH, &fl_rs, "regionsize_high");
break;
case 'C': /* --regionsize_inc */
rc = set_lhi(REGEX_NUMBERS, &args->S, optarg,
- FLAG_INCR, &fl_rs, "regionsize_incr");
+ FLAG_INCR, &fl_rs, "regionsize_incr");
break;
case 'L': /* --load */
rc = set_load_params(args, optarg);
@@ -271,13 +272,15 @@ args_init(int argc, char **argv)
strncpy(args->log, optarg, ZPIOS_PATH_SIZE - 1);
break;
case 'I': /* --regionnoise */
- rc = set_noise(&args->regionnoise, optarg, "regionnoise");
+ rc = set_noise(&args->regionnoise, optarg,
+ "regionnoise");
break;
case 'N': /* --chunknoise */
rc = set_noise(&args->chunknoise, optarg, "chunknoise");
break;
case 'T': /* --threaddelay */
- rc = set_noise(&args->thread_delay, optarg, "threaddelay");
+ rc = set_noise(&args->thread_delay, optarg,
+ "threaddelay");
break;
case 'V': /* --verify */
args->flags |= DMU_VERIFY;
@@ -301,7 +304,8 @@ args_init(int argc, char **argv)
rc = 1;
break;
default:
- fprintf(stderr,"Unknown option '%s'\n",argv[optind-1]);
+ fprintf(stderr, "Unknown option '%s'\n",
+ argv[optind - 1]);
rc = EINVAL;
break;
}
@@ -309,7 +313,7 @@ args_init(int argc, char **argv)
if (rc) {
usage();
args_fini(args);
- return NULL;
+ return (NULL);
}
}
@@ -323,19 +327,19 @@ args_init(int argc, char **argv)
fprintf(stderr, "Error: Pool not specificed\n");
usage();
args_fini(args);
- return NULL;
+ return (NULL);
}
if ((args->flags & (DMU_WRITE_ZC | DMU_READ_ZC)) &&
(args->flags & DMU_VERIFY)) {
- fprintf(stderr, "Error, --zerocopy incompatible --verify, "
- "used for performance analysis only\n");
+ fprintf(stderr, "Error, --zerocopy incompatible --verify, "
+ "used for performance analysis only\n");
usage();
args_fini(args);
- return NULL;
+ return (NULL);
}
- return args;
+ return (args);
}
static int
@@ -344,19 +348,19 @@ dev_clear(void)
zpios_cfg_t cfg;
int rc;
- memset(&cfg, 0, sizeof(cfg));
+ memset(&cfg, 0, sizeof (cfg));
cfg.cfg_magic = ZPIOS_CFG_MAGIC;
- cfg.cfg_cmd = ZPIOS_CFG_BUFFER_CLEAR;
+ cfg.cfg_cmd = ZPIOS_CFG_BUFFER_CLEAR;
cfg.cfg_arg1 = 0;
rc = ioctl(zpiosctl_fd, ZPIOS_CFG, &cfg);
if (rc)
fprintf(stderr, "Ioctl() error %lu / %d: %d\n",
- (unsigned long) ZPIOS_CFG, cfg.cfg_cmd, errno);
+ (unsigned long) ZPIOS_CFG, cfg.cfg_cmd, errno);
lseek(zpiosctl_fd, 0, SEEK_SET);
- return rc;
+ return (rc);
}
/* Passing a size of zero simply results in querying the current size */
@@ -366,19 +370,19 @@ dev_size(int size)
zpios_cfg_t cfg;
int rc;
- memset(&cfg, 0, sizeof(cfg));
+ memset(&cfg, 0, sizeof (cfg));
cfg.cfg_magic = ZPIOS_CFG_MAGIC;
- cfg.cfg_cmd = ZPIOS_CFG_BUFFER_SIZE;
+ cfg.cfg_cmd = ZPIOS_CFG_BUFFER_SIZE;
cfg.cfg_arg1 = size;
rc = ioctl(zpiosctl_fd, ZPIOS_CFG, &cfg);
if (rc) {
fprintf(stderr, "Ioctl() error %lu / %d: %d\n",
- (unsigned long) ZPIOS_CFG, cfg.cfg_cmd, errno);
- return rc;
+ (unsigned long) ZPIOS_CFG, cfg.cfg_cmd, errno);
+ return (rc);
}
- return cfg.cfg_rc1;
+ return (cfg.cfg_rc1);
}
static void
@@ -390,7 +394,7 @@ dev_fini(void)
if (zpiosctl_fd != -1) {
if (close(zpiosctl_fd) == -1) {
fprintf(stderr, "Unable to close %s: %d\n",
- ZPIOS_DEV, errno);
+ ZPIOS_DEV, errno);
}
}
}
@@ -403,7 +407,7 @@ dev_init(void)
zpiosctl_fd = open(ZPIOS_DEV, O_RDONLY);
if (zpiosctl_fd == -1) {
fprintf(stderr, "Unable to open %s: %d\n"
- "Is the zpios module loaded?\n", ZPIOS_DEV, errno);
+ "Is the zpios module loaded?\n", ZPIOS_DEV, errno);
rc = errno;
goto error;
}
@@ -422,16 +426,16 @@ dev_init(void)
}
memset(zpios_buffer, 0, zpios_buffer_size);
- return 0;
+ return (0);
error:
if (zpiosctl_fd != -1) {
if (close(zpiosctl_fd) == -1) {
fprintf(stderr, "Unable to close %s: %d\n",
- ZPIOS_DEV, errno);
+ ZPIOS_DEV, errno);
}
}
- return rc;
+ return (rc);
}
static int
@@ -440,91 +444,93 @@ get_next(uint64_t *val, range_repeat_t *range)
/* if low, incr, high is given */
if (range->val_count == 0) {
*val = (range->val_low) +
- (range->val_low * range->next_val / 100);
+ (range->val_low * range->next_val / 100);
if (*val > range->val_high)
- return 0; /* No more values, limit exceeded */
+ return (0); /* No more values, limit exceeded */
if (!range->next_val)
range->next_val = range->val_inc_perc;
else
- range->next_val = range->next_val+range->val_inc_perc;
+ range->next_val = range->next_val + range->val_inc_perc;
- return 1; /* more values to come */
+ return (1); /* more values to come */
/* if only one val is given */
} else if (range->val_count == 1) {
if (range->next_val)
- return 0; /* No more values, we only have one */
+ return (0); /* No more values, we only have one */
*val = range->val[0];
range->next_val = 1;
- return 1; /* more values to come */
+ return (1); /* more values to come */
/* if comma separated values are given */
} else if (range->val_count > 1) {
if (range->next_val > range->val_count - 1)
- return 0; /* No more values, limit exceeded */
+ return (0); /* No more values, limit exceeded */
*val = range->val[range->next_val];
range->next_val++;
- return 1; /* more values to come */
+ return (1); /* more values to come */
}
- return 0;
+ return (0);
}
static int
run_one(cmd_args_t *args, uint32_t id, uint32_t T, uint32_t N,
- uint64_t C, uint64_t S, uint64_t O)
+ uint64_t C, uint64_t S, uint64_t O)
{
zpios_cmd_t *cmd;
- int rc, rc2, cmd_size;
+ int rc, rc2, cmd_size;
- dev_clear();
+ dev_clear();
- cmd_size = sizeof(zpios_cmd_t) + ((T + N + 1) * sizeof(zpios_stats_t));
- cmd = (zpios_cmd_t *)malloc(cmd_size);
- if (cmd == NULL)
- return ENOMEM;
+ cmd_size =
+ sizeof (zpios_cmd_t)
+ + ((T + N + 1) * sizeof (zpios_stats_t));
+ cmd = (zpios_cmd_t *)malloc(cmd_size);
+ if (cmd == NULL)
+ return (ENOMEM);
- memset(cmd, 0, cmd_size);
- cmd->cmd_magic = ZPIOS_CMD_MAGIC;
+ memset(cmd, 0, cmd_size);
+ cmd->cmd_magic = ZPIOS_CMD_MAGIC;
strncpy(cmd->cmd_pool, args->pool, ZPIOS_NAME_SIZE - 1);
strncpy(cmd->cmd_pre, args->pre, ZPIOS_PATH_SIZE - 1);
strncpy(cmd->cmd_post, args->post, ZPIOS_PATH_SIZE - 1);
strncpy(cmd->cmd_log, args->log, ZPIOS_PATH_SIZE - 1);
- cmd->cmd_id = id;
- cmd->cmd_chunk_size = C;
+ cmd->cmd_id = id;
+ cmd->cmd_chunk_size = C;
cmd->cmd_thread_count = T;
cmd->cmd_region_count = N;
- cmd->cmd_region_size = S;
- cmd->cmd_offset = O;
+ cmd->cmd_region_size = S;
+ cmd->cmd_offset = O;
cmd->cmd_region_noise = args->regionnoise;
- cmd->cmd_chunk_noise = args->chunknoise;
+ cmd->cmd_chunk_noise = args->chunknoise;
cmd->cmd_thread_delay = args->thread_delay;
- cmd->cmd_flags = args->flags;
- cmd->cmd_data_size = (T + N + 1) * sizeof(zpios_stats_t);
+ cmd->cmd_flags = args->flags;
+ cmd->cmd_data_size = (T + N + 1) * sizeof (zpios_stats_t);
- rc = ioctl(zpiosctl_fd, ZPIOS_CMD, cmd);
+ rc = ioctl(zpiosctl_fd, ZPIOS_CMD, cmd);
if (rc)
args->rc = errno;
print_stats(args, cmd);
- if (args->verbose) {
- rc2 = read(zpiosctl_fd, zpios_buffer, zpios_buffer_size - 1);
- if (rc2 < 0) {
- fprintf(stdout, "Error reading results: %d\n", rc2);
- } else if ((rc2 > 0) && (strlen(zpios_buffer) > 0)) {
- fprintf(stdout, "\n%s\n", zpios_buffer);
- fflush(stdout);
- }
- }
+ if (args->verbose) {
+ rc2 = read(zpiosctl_fd, zpios_buffer, zpios_buffer_size - 1);
+ if (rc2 < 0) {
+ fprintf(stdout, "Error reading results: %d\n", rc2);
+ } else if ((rc2 > 0) && (strlen(zpios_buffer) > 0)) {
+ fprintf(stdout, "\n%s\n", zpios_buffer);
+ fflush(stdout);
+ }
+ }
- free(cmd);
+ free(cmd);
- return rc;
+ return (rc);
}
static int
@@ -534,13 +540,13 @@ run_offsets(cmd_args_t *args)
while (rc == 0 && get_next(&args->current_O, &args->O)) {
rc = run_one(args, args->current_id,
- args->current_T, args->current_N, args->current_C,
- args->current_S, args->current_O);
+ args->current_T, args->current_N, args->current_C,
+ args->current_S, args->current_O);
args->current_id++;
}
args->O.next_val = 0;
- return rc;
+ return (rc);
}
static int
@@ -549,10 +555,10 @@ run_region_counts(cmd_args_t *args)
int rc = 0;
while (rc == 0 && get_next((uint64_t *)&args->current_N, &args->N))
- rc = run_offsets(args);
+ rc = run_offsets(args);
args->N.next_val = 0;
- return rc;
+ return (rc);
}
static int
@@ -564,14 +570,14 @@ run_region_sizes(cmd_args_t *args)
if (args->current_S < args->current_C) {
fprintf(stderr, "Error: in any run chunksize can "
"not be smaller than regionsize.\n");
- return EINVAL;
+ return (EINVAL);
}
rc = run_region_counts(args);
}
args->S.next_val = 0;
- return rc;
+ return (rc);
}
static int
@@ -580,11 +586,11 @@ run_chunk_sizes(cmd_args_t *args)
int rc = 0;
while (rc == 0 && get_next(&args->current_C, &args->C)) {
- rc = run_region_sizes(args);
+ rc = run_region_sizes(args);
}
args->C.next_val = 0;
- return rc;
+ return (rc);
}
static int
@@ -595,7 +601,7 @@ run_thread_counts(cmd_args_t *args)
while (rc == 0 && get_next((uint64_t *)&args->current_T, &args->T))
rc = run_chunk_sizes(args);
- return rc;
+ return (rc);
}
int
@@ -625,5 +631,5 @@ out:
args_fini(args);
dev_fini();
- return rc;
+ return (rc);
}
diff --git a/cmd/zpios/zpios_util.c b/cmd/zpios/zpios_util.c
index 9b06655cc..b226322b0 100644
--- a/cmd/zpios/zpios_util.c
+++ b/cmd/zpios/zpios_util.c
@@ -1,4 +1,4 @@
-/*****************************************************************************\
+/*
* ZPIOS is a heavily modified version of the original PIOS test code.
* It is designed to have the test code running in the Linux kernel
* against ZFS while still being flexibly controled from user space.
@@ -29,7 +29,7 @@
*
* You should have received a copy of the GNU General Public License along
* with ZPIOS. If not, see <http://www.gnu.org/licenses/>.
-\*****************************************************************************/
+ */
#include <stdlib.h>
#include <stdio.h>
@@ -49,7 +49,7 @@ kmgt_to_uint64(const char *str, uint64_t *val)
*val = strtoll(str, &endptr, 0);
if ((str == endptr) && (*val == 0))
- return EINVAL;
+ return (EINVAL);
switch (endptr[0]) {
case 'k': case 'K':
@@ -70,7 +70,7 @@ kmgt_to_uint64(const char *str, uint64_t *val)
rc = EINVAL;
}
- return rc;
+ return (rc);
}
static char *
@@ -85,12 +85,12 @@ uint64_to_kmgt(char *str, uint64_t val)
}
if (i >= 4)
- (void)snprintf(str, KMGT_SIZE-1, "inf");
+ (void) snprintf(str, KMGT_SIZE-1, "inf");
else
- (void)snprintf(str, KMGT_SIZE-1, "%lu%c", (unsigned long)val,
- (i == -1) ? '\0' : postfix[i]);
+ (void) snprintf(str, KMGT_SIZE-1, "%lu%c", (unsigned long)val,
+ (i == -1) ? '\0' : postfix[i]);
- return str;
+ return (str);
}
static char *
@@ -106,12 +106,12 @@ kmgt_per_sec(char *str, uint64_t v, double t)
}
if (i >= 4)
- (void)snprintf(str, KMGT_SIZE-1, "inf");
+ (void) snprintf(str, KMGT_SIZE-1, "inf");
else
- (void)snprintf(str, KMGT_SIZE-1, "%.2f%c", val,
- (i == -1) ? '\0' : postfix[i]);
+ (void) snprintf(str, KMGT_SIZE-1, "%.2f%c", val,
+ (i == -1) ? '\0' : postfix[i]);
- return str;
+ return (str);
}
static char *
@@ -126,7 +126,7 @@ print_flags(char *str, uint32_t flags)
str[6] = (flags & DMU_WRITE_NOWAIT) ? 'O' : '-';
str[7] = '\0';
- return str;
+ return (str);
}
static int
@@ -138,13 +138,13 @@ regex_match(const char *string, char *pattern)
rc = regcomp(&re, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE);
if (rc) {
fprintf(stderr, "Error: Couldn't do regcomp, %d\n", rc);
- return rc;
+ return (rc);
}
rc = regexec(&re, string, (size_t) 0, NULL, 0);
regfree(&re);
- return rc;
+ return (rc);
}
/* fills the pios_range_repeat structure of comma separated values */
@@ -156,14 +156,15 @@ split_string(const char *optarg, char *pattern, range_repeat_t *range)
int rc, i = 0;
if ((rc = regex_match(optarg, pattern)))
- return rc;
+ return (rc);
cp = strdup(optarg);
if (cp == NULL)
- return ENOMEM;
+ return (ENOMEM);
do {
- /* STRTOK(3) Each subsequent call, with a null pointer as the
+ /*
+ * STRTOK(3) Each subsequent call, with a null pointer as the
* value of the * first argument, starts searching from the
* saved pointer and behaves as described above.
*/
@@ -177,12 +178,12 @@ split_string(const char *optarg, char *pattern, range_repeat_t *range)
kmgt_to_uint64(token[i], &range->val[i]);
free(cp);
- return 0;
+ return (0);
}
int
set_count(char *pattern1, char *pattern2, range_repeat_t *range,
- char *optarg, uint32_t *flags, char *arg)
+ char *optarg, uint32_t *flags, char *arg)
{
if (flags)
*flags |= FLAG_SET;
@@ -194,25 +195,27 @@ set_count(char *pattern1, char *pattern2, range_repeat_t *range,
range->val_count = 1;
} else if (split_string(optarg, pattern2, range) < 0) {
fprintf(stderr, "Error: Incorrect pattern for %s, '%s'\n",
- arg, optarg);
- return EINVAL;
+ arg, optarg);
+ return (EINVAL);
}
- return 0;
+ return (0);
}
-/* validates the value with regular expression and sets low, high, incr
- * according to value at which flag will be set. Sets the flag after. */
+/*
+ * Validates the value with regular expression and sets low, high, incr
+ * according to value at which flag will be set. Sets the flag after.
+ */
int
set_lhi(char *pattern, range_repeat_t *range, char *optarg,
- int flag, uint32_t *flag_thread, char *arg)
+ int flag, uint32_t *flag_thread, char *arg)
{
int rc;
if ((rc = regex_match(optarg, pattern))) {
fprintf(stderr, "Error: Wrong pattern in %s, '%s'\n",
arg, optarg);
- return rc;
+ return (rc);
}
switch (flag) {
@@ -231,7 +234,7 @@ set_lhi(char *pattern, range_repeat_t *range, char *optarg,
*flag_thread |= flag;
- return 0;
+ return (0);
}
int
@@ -241,10 +244,10 @@ set_noise(uint64_t *noise, char *optarg, char *arg)
kmgt_to_uint64(optarg, noise);
} else {
fprintf(stderr, "Error: Incorrect pattern for %s\n", arg);
- return EINVAL;
+ return (EINVAL);
}
- return 0;
+ return (0);
}
int
@@ -255,7 +258,7 @@ set_load_params(cmd_args_t *args, char *optarg)
search = strdup(optarg);
if (search == NULL)
- return ENOMEM;
+ return (ENOMEM);
while ((param = strtok(search, comma)) != NULL) {
search = NULL;
@@ -275,52 +278,58 @@ set_load_params(cmd_args_t *args, char *optarg)
free(search);
- return rc;
+ return (rc);
}
-/* checks the low, high, increment values against the single value for
+/*
+ * Checks the low, high, increment values against the single value for
* mutual exclusion, for e.g threadcount is mutually exclusive to
- * threadcount_low, ..._high, ..._incr */
+ * threadcount_low, ..._high, ..._incr
+ */
int
check_mutual_exclusive_command_lines(uint32_t flag, char *arg)
{
if ((flag & FLAG_SET) && (flag & (FLAG_LOW | FLAG_HIGH | FLAG_INCR))) {
fprintf(stderr, "Error: --%s can not be given with --%s_low, "
- "--%s_high or --%s_incr.\n", arg, arg, arg, arg);
- return 0;
+ "--%s_high or --%s_incr.\n", arg, arg, arg, arg);
+ return (0);
}
- if ((flag & (FLAG_LOW | FLAG_HIGH | FLAG_INCR)) && !(flag & FLAG_SET)){
+ if ((flag & (FLAG_LOW | FLAG_HIGH | FLAG_INCR)) && !(flag & FLAG_SET)) {
if (flag != (FLAG_LOW | FLAG_HIGH | FLAG_INCR)) {
fprintf(stderr, "Error: One or more values missing "
- "from --%s_low, --%s_high, --%s_incr.\n",
- arg, arg, arg);
- return 0;
+ "from --%s_low, --%s_high, --%s_incr.\n",
+ arg, arg, arg);
+ return (0);
}
}
- return 1;
+ return (1);
}
void
print_stats_header(cmd_args_t *args)
{
if (args->verbose) {
- printf("status name id\tth-cnt\trg-cnt\trg-sz\t"
- "ch-sz\toffset\trg-no\tch-no\tth-dly\tflags\ttime\t"
- "cr-time\trm-time\twr-time\trd-time\twr-data\twr-ch\t"
- "wr-bw\trd-data\trd-ch\trd-bw\n");
- printf("------------------------------------------------"
- "------------------------------------------------"
- "------------------------------------------------"
- "----------------------------------------------\n");
+ printf(
+ "status name id\tth-cnt\trg-cnt\trg-sz\t"
+ "ch-sz\toffset\trg-no\tch-no\tth-dly\tflags\ttime\t"
+ "cr-time\trm-time\twr-time\trd-time\twr-data\twr-ch\t"
+ "wr-bw\trd-data\trd-ch\trd-bw\n");
+ printf(
+ "------------------------------------------------"
+ "------------------------------------------------"
+ "------------------------------------------------"
+ "----------------------------------------------\n");
} else {
- printf("status name id\t"
- "wr-data\twr-ch\twr-bw\t"
- "rd-data\trd-ch\trd-bw\n");
- printf("-----------------------------------------"
- "--------------------------------------\n");
+ printf(
+ "status name id\t"
+ "wr-data\twr-ch\twr-bw\t"
+ "rd-data\trd-ch\trd-bw\n");
+ printf(
+ "-----------------------------------------"
+ "--------------------------------------\n");
}
}
@@ -337,17 +346,17 @@ print_stats_human_readable(cmd_args_t *args, zpios_cmd_t *cmd)
printf("PASS: ");
printf("%-12s", args->name ? args->name : ZPIOS_NAME);
- printf("%2u\t", cmd->cmd_id);
+ printf("%2u\t", cmd->cmd_id);
if (args->verbose) {
- printf("%u\t", cmd->cmd_thread_count);
- printf("%u\t", cmd->cmd_region_count);
- printf("%s\t", uint64_to_kmgt(str, cmd->cmd_region_size));
- printf("%s\t", uint64_to_kmgt(str, cmd->cmd_chunk_size));
- printf("%s\t", uint64_to_kmgt(str, cmd->cmd_offset));
- printf("%s\t", uint64_to_kmgt(str, cmd->cmd_region_noise));
- printf("%s\t", uint64_to_kmgt(str, cmd->cmd_chunk_noise));
- printf("%s\t", uint64_to_kmgt(str, cmd->cmd_thread_delay));
+ printf("%u\t", cmd->cmd_thread_count);
+ printf("%u\t", cmd->cmd_region_count);
+ printf("%s\t", uint64_to_kmgt(str, cmd->cmd_region_size));
+ printf("%s\t", uint64_to_kmgt(str, cmd->cmd_chunk_size));
+ printf("%s\t", uint64_to_kmgt(str, cmd->cmd_offset));
+ printf("%s\t", uint64_to_kmgt(str, cmd->cmd_region_noise));
+ printf("%s\t", uint64_to_kmgt(str, cmd->cmd_chunk_noise));
+ printf("%s\t", uint64_to_kmgt(str, cmd->cmd_thread_delay));
printf("%s\t", print_flags(str, cmd->cmd_flags));
}
@@ -371,12 +380,12 @@ print_stats_human_readable(cmd_args_t *args, zpios_cmd_t *cmd)
printf("%.2f\t", rd_time);
}
- printf("%s\t", uint64_to_kmgt(str, summary_stats->wr_data));
- printf("%s\t", uint64_to_kmgt(str, summary_stats->wr_chunks));
+ printf("%s\t", uint64_to_kmgt(str, summary_stats->wr_data));
+ printf("%s\t", uint64_to_kmgt(str, summary_stats->wr_chunks));
printf("%s\t", kmgt_per_sec(str, summary_stats->wr_data, wr_time));
- printf("%s\t", uint64_to_kmgt(str, summary_stats->rd_data));
- printf("%s\t", uint64_to_kmgt(str, summary_stats->rd_chunks));
+ printf("%s\t", uint64_to_kmgt(str, summary_stats->rd_data));
+ printf("%s\t", uint64_to_kmgt(str, summary_stats->rd_chunks));
printf("%s\n", kmgt_per_sec(str, summary_stats->rd_data, rd_time));
fflush(stdout);
}
@@ -393,17 +402,17 @@ print_stats_table(cmd_args_t *args, zpios_cmd_t *cmd)
printf("PASS: ");
printf("%-12s", args->name ? args->name : ZPIOS_NAME);
- printf("%2u\t", cmd->cmd_id);
+ printf("%2u\t", cmd->cmd_id);
if (args->verbose) {
- printf("%u\t", cmd->cmd_thread_count);
- printf("%u\t", cmd->cmd_region_count);
- printf("%llu\t", (long long unsigned)cmd->cmd_region_size);
- printf("%llu\t", (long long unsigned)cmd->cmd_chunk_size);
- printf("%llu\t", (long long unsigned)cmd->cmd_offset);
- printf("%u\t", cmd->cmd_region_noise);
- printf("%u\t", cmd->cmd_chunk_noise);
- printf("%u\t", cmd->cmd_thread_delay);
+ printf("%u\t", cmd->cmd_thread_count);
+ printf("%u\t", cmd->cmd_region_count);
+ printf("%llu\t", (long long unsigned)cmd->cmd_region_size);
+ printf("%llu\t", (long long unsigned)cmd->cmd_chunk_size);
+ printf("%llu\t", (long long unsigned)cmd->cmd_offset);
+ printf("%u\t", cmd->cmd_region_noise);
+ printf("%u\t", cmd->cmd_chunk_noise);
+ printf("%u\t", cmd->cmd_thread_delay);
printf("0x%x\t", cmd->cmd_flags);
}
@@ -418,28 +427,28 @@ print_stats_table(cmd_args_t *args, zpios_cmd_t *cmd)
if (args->verbose) {
printf("%ld.%02ld\t",
- (long)summary_stats->total_time.delta.ts_sec,
- (long)summary_stats->total_time.delta.ts_nsec);
+ (long)summary_stats->total_time.delta.ts_sec,
+ (long)summary_stats->total_time.delta.ts_nsec);
printf("%ld.%02ld\t",
- (long)summary_stats->cr_time.delta.ts_sec,
- (long)summary_stats->cr_time.delta.ts_nsec);
+ (long)summary_stats->cr_time.delta.ts_sec,
+ (long)summary_stats->cr_time.delta.ts_nsec);
printf("%ld.%02ld\t",
- (long)summary_stats->rm_time.delta.ts_sec,
- (long)summary_stats->rm_time.delta.ts_nsec);
+ (long)summary_stats->rm_time.delta.ts_sec,
+ (long)summary_stats->rm_time.delta.ts_nsec);
printf("%ld.%02ld\t",
- (long)summary_stats->wr_time.delta.ts_sec,
- (long)summary_stats->wr_time.delta.ts_nsec);
+ (long)summary_stats->wr_time.delta.ts_sec,
+ (long)summary_stats->wr_time.delta.ts_nsec);
printf("%ld.%02ld\t",
- (long)summary_stats->rd_time.delta.ts_sec,
- (long)summary_stats->rd_time.delta.ts_nsec);
+ (long)summary_stats->rd_time.delta.ts_sec,
+ (long)summary_stats->rd_time.delta.ts_nsec);
}
- printf("%lld\t", (long long unsigned)summary_stats->wr_data);
- printf("%lld\t", (long long unsigned)summary_stats->wr_chunks);
+ printf("%lld\t", (long long unsigned)summary_stats->wr_data);
+ printf("%lld\t", (long long unsigned)summary_stats->wr_chunks);
printf("%.4f\t", (double)summary_stats->wr_data / wr_time);
- printf("%lld\t", (long long unsigned)summary_stats->rd_data);
- printf("%lld\t", (long long unsigned)summary_stats->rd_chunks);
+ printf("%lld\t", (long long unsigned)summary_stats->rd_data);
+ printf("%lld\t", (long long unsigned)summary_stats->rd_chunks);
printf("%.4f\n", (double)summary_stats->rd_data / rd_time);
fflush(stdout);
}
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 0d21b7e73..a856fd49e 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -2568,7 +2568,7 @@ get_columns(void)
columns = 999;
}
- return columns;
+ return (columns);
}
int
@@ -5037,19 +5037,21 @@ get_history_one(zpool_handle_t *zhp, void *data)
}
(void) printf("%s [internal %s txg:%lld] %s", tbuf,
zfs_history_event_names[ievent],
- (long long int)fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG),
+ (longlong_t) fnvlist_lookup_uint64(
+ rec, ZPOOL_HIST_TXG),
fnvlist_lookup_string(rec, ZPOOL_HIST_INT_STR));
} else if (nvlist_exists(rec, ZPOOL_HIST_INT_NAME)) {
if (!cb->internal)
continue;
(void) printf("%s [txg:%lld] %s", tbuf,
- (long long int)fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG),
+ (longlong_t) fnvlist_lookup_uint64(
+ rec, ZPOOL_HIST_TXG),
fnvlist_lookup_string(rec, ZPOOL_HIST_INT_NAME));
if (nvlist_exists(rec, ZPOOL_HIST_DSNAME)) {
(void) printf(" %s (%llu)",
fnvlist_lookup_string(rec,
ZPOOL_HIST_DSNAME),
- (long long unsigned int)fnvlist_lookup_uint64(rec,
+ (u_longlong_t)fnvlist_lookup_uint64(rec,
ZPOOL_HIST_DSID));
}
(void) printf(" %s", fnvlist_lookup_string(rec,
@@ -5165,10 +5167,10 @@ zpool_do_events_short(nvlist_t *nvl)
verify(nvlist_lookup_int64_array(nvl, FM_EREPORT_TIME, &tv, &n) == 0);
memset(str, ' ', 32);
(void) ctime_r((const time_t *)&tv[0], ctime_str);
- (void) strncpy(str, ctime_str+4, 6); /* 'Jun 30' */
- (void) strncpy(str+7, ctime_str+20, 4); /* '1993' */
- (void) strncpy(str+12, ctime_str+11, 8); /* '21:49:08' */
- (void) sprintf(str+20, ".%09lld", (longlong_t)tv[1]);/* '.123456789' */
+ (void) strncpy(str, ctime_str+4, 6); /* 'Jun 30' */
+ (void) strncpy(str+7, ctime_str+20, 4); /* '1993' */
+ (void) strncpy(str+12, ctime_str+11, 8); /* '21:49:08' */
+ (void) sprintf(str+20, ".%09lld", (longlong_t)tv[1]); /* '.123456789' */
(void) printf(gettext("%s "), str);
verify(nvlist_lookup_string(nvl, FM_CLASS, &ptr) == 0);
@@ -5276,10 +5278,10 @@ zpool_do_events_nvprint(nvlist_t *nvl, int depth)
printf(gettext("(%d embedded nvlists)\n"), nelem);
for (i = 0; i < nelem; i++) {
printf(gettext("%*s%s[%d] = %s\n"),
- depth, "", name, i, "(embedded nvlist)");
+ depth, "", name, i, "(embedded nvlist)");
zpool_do_events_nvprint(val[i], depth + 8);
printf(gettext("%*s(end %s[%i])\n"),
- depth, "", name, i);
+ depth, "", name, i);
}
printf(gettext("%*s(end %s)\n"), depth, "", name);
}
@@ -5357,7 +5359,8 @@ zpool_do_events_nvprint(nvlist_t *nvl, int depth)
(void) nvpair_value_int64_array(nvp, &val, &nelem);
for (i = 0; i < nelem; i++)
- printf(gettext("0x%llx "), (u_longlong_t)val[i]);
+ printf(gettext("0x%llx "),
+ (u_longlong_t)val[i]);
break;
}
@@ -5368,7 +5371,8 @@ zpool_do_events_nvprint(nvlist_t *nvl, int depth)
(void) nvpair_value_uint64_array(nvp, &val, &nelem);
for (i = 0; i < nelem; i++)
- printf(gettext("0x%llx "), (u_longlong_t)val[i]);
+ printf(gettext("0x%llx "),
+ (u_longlong_t)val[i]);
break;
}
@@ -5392,8 +5396,8 @@ zpool_do_events_next(ev_opts_t *opts)
nvlist_t *nvl;
int cleanup_fd, ret, dropped;
- cleanup_fd = open(ZFS_DEV, O_RDWR);
- VERIFY(cleanup_fd >= 0);
+ cleanup_fd = open(ZFS_DEV, O_RDWR);
+ VERIFY(cleanup_fd >= 0);
if (!opts->scripted)
(void) printf(gettext("%-30s %s\n"), "TIME", "CLASS");
@@ -5418,7 +5422,7 @@ zpool_do_events_next(ev_opts_t *opts)
nvlist_free(nvl);
}
- VERIFY(0 == close(cleanup_fd));
+ VERIFY(0 == close(cleanup_fd));
return (ret);
}
@@ -5476,7 +5480,7 @@ zpool_do_events(int argc, char **argv)
else
ret = zpool_do_events_next(&opts);
- return ret;
+ return (ret);
}
static int
@@ -5690,8 +5694,7 @@ main(int argc, char **argv)
/*
* Special case '-?'
*/
- if ((strcmp(cmdname, "-?") == 0) ||
- strcmp(cmdname, "--help") == 0)
+ if ((strcmp(cmdname, "-?") == 0) || strcmp(cmdname, "--help") == 0)
usage(B_TRUE);
if ((g_zfs = libzfs_init()) == NULL)
diff --git a/cmd/zpool/zpool_util.h b/cmd/zpool/zpool_util.h
index b67ff8b32..1b4ce518f 100644
--- a/cmd/zpool/zpool_util.h
+++ b/cmd/zpool/zpool_util.h
@@ -44,7 +44,8 @@ uint_t num_logs(nvlist_t *nv);
*/
nvlist_t *make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force,
- int check_rep, boolean_t replacing, boolean_t dryrun, int argc, char **argv);
+ int check_rep, boolean_t replacing, boolean_t dryrun, int argc,
+ char **argv);
nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname,
nvlist_t *props, splitflags_t flags, int argc, char **argv);
diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c
index 596c0cb60..316e291c3 100644
--- a/cmd/zpool/zpool_vdev.c
+++ b/cmd/zpool/zpool_vdev.c
@@ -80,7 +80,7 @@
#ifdef HAVE_LIBBLKID
#include <blkid/blkid.h>
#else
-#define blkid_cache void *
+#define blkid_cache void *
#endif /* HAVE_LIBBLKID */
#include "zpool_util.h"
@@ -187,7 +187,7 @@ static vdev_disk_db_entry_t vdev_disk_database[] = {
{"ATA SAMSUNG MCCOE32G", 4096},
{"ATA SAMSUNG MCCOE64G", 4096},
{"ATA SAMSUNG SSD PM80", 4096},
- /* Imported from Open Solaris*/
+ /* Imported from Open Solaris */
{"ATA MARVELL SD88SA02", 4096},
/* Advanced format Hard drives */
{"ATA Hitachi HDS5C303", 4096},
@@ -231,16 +231,16 @@ check_sector_size_database(char *path, int *sector_size)
int i;
/* Prepare INQUIRY command */
- memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
+ memset(&io_hdr, 0, sizeof (sg_io_hdr_t));
io_hdr.interface_id = 'S';
- io_hdr.cmd_len = sizeof(inq_cmd_blk);
- io_hdr.mx_sb_len = sizeof(sense_buffer);
+ io_hdr.cmd_len = sizeof (inq_cmd_blk);
+ io_hdr.mx_sb_len = sizeof (sense_buffer);
io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
io_hdr.dxfer_len = INQ_REPLY_LEN;
io_hdr.dxferp = inq_buff;
io_hdr.cmdp = inq_cmd_blk;
io_hdr.sbp = sense_buffer;
- io_hdr.timeout = 10; /* 10 milliseconds is ample time */
+ io_hdr.timeout = 10; /* 10 milliseconds is ample time */
if ((fd = open(path, O_RDONLY|O_DIRECT)) < 0)
return (B_FALSE);
@@ -385,7 +385,7 @@ check_slice(const char *path, blkid_cache cache, int force, boolean_t isspare)
} else {
err = -1;
vdev_error(gettext("%s contains a filesystem of "
- "type '%s'\n"), path, value);
+ "type '%s'\n"), path, value);
}
}
@@ -403,7 +403,7 @@ check_slice(const char *path, blkid_cache cache, int force, boolean_t isspare)
*/
static int
check_disk(const char *path, blkid_cache cache, int force,
- boolean_t isspare, boolean_t iswholedisk)
+ boolean_t isspare, boolean_t iswholedisk)
{
struct dk_gpt *vtoc;
char slice_path[MAXPATHLEN];
@@ -412,7 +412,7 @@ check_disk(const char *path, blkid_cache cache, int force,
/* This is not a wholedisk we only check the given partition */
if (!iswholedisk)
- return check_slice(path, cache, force, isspare);
+ return (check_slice(path, cache, force, isspare));
/*
* When the device is a whole disk try to read the efi partition
@@ -424,19 +424,19 @@ check_disk(const char *path, blkid_cache cache, int force,
*/
if ((fd = open(path, O_RDONLY|O_DIRECT)) < 0) {
check_error(errno);
- return -1;
+ return (-1);
}
if ((err = efi_alloc_and_read(fd, &vtoc)) != 0) {
(void) close(fd);
if (force) {
- return 0;
+ return (0);
} else {
vdev_error(gettext("%s does not contain an EFI "
"label but it may contain partition\n"
"information in the MBR.\n"), path);
- return -1;
+ return (-1);
}
}
@@ -451,11 +451,11 @@ check_disk(const char *path, blkid_cache cache, int force,
if (force) {
/* Partitions will no be created using the backup */
- return 0;
+ return (0);
} else {
vdev_error(gettext("%s contains a corrupt primary "
"EFI label.\n"), path);
- return -1;
+ return (-1);
}
}
@@ -486,7 +486,7 @@ check_disk(const char *path, blkid_cache cache, int force,
static int
check_device(const char *path, boolean_t force,
- boolean_t isspare, boolean_t iswholedisk)
+ boolean_t isspare, boolean_t iswholedisk)
{
static blkid_cache cache = NULL;
@@ -500,18 +500,18 @@ check_device(const char *path, boolean_t force,
if ((err = blkid_get_cache(&cache, NULL)) != 0) {
check_error(err);
- return -1;
+ return (-1);
}
if ((err = blkid_probe_all(cache)) != 0) {
blkid_put_cache(cache);
check_error(err);
- return -1;
+ return (-1);
}
}
#endif /* HAVE_LIBBLKID */
- return check_disk(path, cache, force, isspare, iswholedisk);
+ return (check_disk(path, cache, force, isspare, iswholedisk));
}
/*
@@ -526,7 +526,7 @@ static boolean_t
is_whole_disk(const char *path)
{
struct dk_gpt *label;
- int fd;
+ int fd;
if ((fd = open(path, O_RDONLY|O_DIRECT)) < 0)
return (B_FALSE);
@@ -547,7 +547,7 @@ is_whole_disk(const char *path)
*/
static int
is_shorthand_path(const char *arg, char *path,
- struct stat64 *statbuf, boolean_t *wholedisk)
+ struct stat64 *statbuf, boolean_t *wholedisk)
{
int error;
@@ -558,8 +558,8 @@ is_shorthand_path(const char *arg, char *path,
return (0);
}
- strlcpy(path, arg, sizeof(path));
- memset(statbuf, 0, sizeof(*statbuf));
+ strlcpy(path, arg, sizeof (path));
+ memset(statbuf, 0, sizeof (*statbuf));
*wholedisk = B_FALSE;
return (error);
@@ -1136,7 +1136,7 @@ zero_label(char *path)
return (-1);
}
- return 0;
+ return (0);
}
/*
@@ -1225,7 +1225,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
* and then block until udev creates the new link.
*/
if (!is_exclusive || !is_spare(NULL, udevpath)) {
- ret = strncmp(udevpath,UDISK_ROOT,strlen(UDISK_ROOT));
+ ret = strncmp(udevpath, UDISK_ROOT, strlen(UDISK_ROOT));
if (ret == 0) {
ret = lstat64(udevpath, &statbuf);
if (ret == 0 && S_ISLNK(statbuf.st_mode))
@@ -1299,7 +1299,7 @@ check_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force,
verify(!nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path));
if (strcmp(type, VDEV_TYPE_DISK) == 0)
verify(!nvlist_lookup_uint64(nv,
- ZPOOL_CONFIG_WHOLE_DISK, &wholedisk));
+ ZPOOL_CONFIG_WHOLE_DISK, &wholedisk));
/*
* As a generic check, we look to see if this is a replace of a
@@ -1502,8 +1502,8 @@ construct_spec(nvlist_t *props, int argc, char **argv)
children * sizeof (nvlist_t *));
if (child == NULL)
zpool_no_memory();
- if ((nv = make_leaf_vdev(props, argv[c], B_FALSE))
- == NULL)
+ if ((nv = make_leaf_vdev(props, argv[c],
+ B_FALSE)) == NULL)
return (NULL);
child[children - 1] = nv;
}
@@ -1558,7 +1558,8 @@ construct_spec(nvlist_t *props, int argc, char **argv)
* We have a device. Pass off to make_leaf_vdev() to
* construct the appropriate nvlist describing the vdev.
*/
- if ((nv = make_leaf_vdev(props, argv[0], is_log)) == NULL)
+ if ((nv = make_leaf_vdev(props, argv[0],
+ is_log)) == NULL)
return (NULL);
if (is_log)
nlogs++;
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 2a0350bda..7b38dfaa6 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -3574,7 +3574,7 @@ out:
}
#undef OD_ARRAY_SIZE
-#define OD_ARRAY_SIZE 4
+#define OD_ARRAY_SIZE 4
/*
* Verify that dmu_object_{alloc,free} work as expected.
@@ -3587,7 +3587,7 @@ ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
int size;
int b;
- size = sizeof(ztest_od_t) * OD_ARRAY_SIZE;
+ size = sizeof (ztest_od_t) * OD_ARRAY_SIZE;
od = umem_alloc(size, UMEM_NOFAIL);
batchsize = OD_ARRAY_SIZE;
@@ -3609,7 +3609,7 @@ ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
}
#undef OD_ARRAY_SIZE
-#define OD_ARRAY_SIZE 2
+#define OD_ARRAY_SIZE 2
/*
* Verify that dmu_{read,write} work as expected.
@@ -3621,7 +3621,7 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
ztest_od_t *od;
objset_t *os = zd->zd_os;
- size = sizeof(ztest_od_t) * OD_ARRAY_SIZE;
+ size = sizeof (ztest_od_t) * OD_ARRAY_SIZE;
od = umem_alloc(size, UMEM_NOFAIL);
dmu_tx_t *tx;
int i, freeit, error;
@@ -3888,7 +3888,7 @@ compare_and_update_pbbufs(uint64_t s, bufwad_t *packbuf, bufwad_t *bigbuf,
}
#undef OD_ARRAY_SIZE
-#define OD_ARRAY_SIZE 2
+#define OD_ARRAY_SIZE 2
void
ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id)
@@ -3911,7 +3911,7 @@ ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id)
arc_buf_t **bigbuf_arcbufs;
dmu_object_info_t doi;
- size = sizeof(ztest_od_t) * OD_ARRAY_SIZE;
+ size = sizeof (ztest_od_t) * OD_ARRAY_SIZE;
od = umem_alloc(size, UMEM_NOFAIL);
/*
@@ -4132,7 +4132,7 @@ ztest_dmu_write_parallel(ztest_ds_t *zd, uint64_t id)
{
ztest_od_t *od;
- od = umem_alloc(sizeof(ztest_od_t), UMEM_NOFAIL);
+ od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
uint64_t offset = (1ULL << (ztest_random(20) + 43)) +
(ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT);
@@ -4149,7 +4149,7 @@ ztest_dmu_write_parallel(ztest_ds_t *zd, uint64_t id)
while (ztest_random(10) != 0)
ztest_io(zd, od->od_object, offset);
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
}
void
@@ -4162,17 +4162,18 @@ ztest_dmu_prealloc(ztest_ds_t *zd, uint64_t id)
uint64_t blocksize = ztest_random_blocksize();
void *data;
- od = umem_alloc(sizeof(ztest_od_t), UMEM_NOFAIL);
+ od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
ztest_od_init(od, id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
- if (ztest_object_init(zd, od, sizeof (ztest_od_t), !ztest_random(2)) != 0) {
- umem_free(od, sizeof(ztest_od_t));
+ if (ztest_object_init(zd, od, sizeof (ztest_od_t),
+ !ztest_random(2)) != 0) {
+ umem_free(od, sizeof (ztest_od_t));
return;
}
if (ztest_truncate(zd, od->od_object, offset, count * blocksize) != 0) {
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
return;
}
@@ -4190,7 +4191,7 @@ ztest_dmu_prealloc(ztest_ds_t *zd, uint64_t id)
}
umem_free(data, blocksize);
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
}
/*
@@ -4215,7 +4216,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id)
int error;
char *hc[2] = { "s.acl.h", ".s.open.h.hyLZlg" };
- od = umem_alloc(sizeof(ztest_od_t), UMEM_NOFAIL);
+ od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
ztest_od_init(od, id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0);
if (ztest_object_init(zd, od, sizeof (ztest_od_t),
@@ -4338,7 +4339,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id)
VERIFY3U(0, ==, zap_remove(os, object, propname, tx));
dmu_tx_commit(tx);
out:
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
}
/*
@@ -4352,7 +4353,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id)
uint64_t object, txg;
int i;
- od = umem_alloc(sizeof(ztest_od_t), UMEM_NOFAIL);
+ od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
ztest_od_init(od, id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0);
if (ztest_object_init(zd, od, sizeof (ztest_od_t),
@@ -4385,7 +4386,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id)
dmu_tx_commit(tx);
}
out:
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
}
/* ARGSUSED */
@@ -4401,11 +4402,11 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
char name[20], string_value[20];
void *data;
- od = umem_alloc(sizeof(ztest_od_t), UMEM_NOFAIL);
+ od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
ztest_od_init(od, ID_PARALLEL, FTAG, micro, DMU_OT_ZAP_OTHER, 0, 0);
if (ztest_object_init(zd, od, sizeof (ztest_od_t), B_FALSE) != 0) {
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
return;
}
@@ -4499,7 +4500,7 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
if (tx != NULL)
dmu_tx_commit(tx);
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
}
/*
@@ -4590,11 +4591,11 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
uint64_t old_txg, txg;
int i, error = 0;
- od = umem_alloc(sizeof(ztest_od_t), UMEM_NOFAIL);
+ od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
ztest_od_init(od, id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
if (ztest_object_init(zd, od, sizeof (ztest_od_t), B_FALSE) != 0) {
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
return;
}
@@ -4637,7 +4638,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
umem_free(cb_data[i], sizeof (ztest_cb_data_t));
}
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
return;
}
@@ -4709,7 +4710,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
dmu_tx_commit(tx);
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
}
/* ARGSUSED */
@@ -4790,11 +4791,12 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
dmu_objset_name(os, osname);
- (void) snprintf(snapname, sizeof (snapname), "sh1_%llu", (long long unsigned int)id);
+ (void) snprintf(snapname, sizeof (snapname), "sh1_%llu",
+ (u_longlong_t)id);
(void) snprintf(fullname, sizeof (fullname), "%s@%s", osname, snapname);
(void) snprintf(clonename, sizeof (clonename),
- "%s/ch1_%llu", osname, (long long unsigned int)id);
- (void) snprintf(tag, sizeof (tag), "tag_%llu", (long long unsigned int)id);
+ "%s/ch1_%llu", osname, (u_longlong_t)id);
+ (void) snprintf(tag, sizeof (tag), "tag_%llu", (u_longlong_t)id);
/*
* Clean up from any previous run.
@@ -5124,11 +5126,11 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
blocksize = ztest_random_blocksize();
blocksize = MIN(blocksize, 2048); /* because we write so many */
- od = umem_alloc(sizeof(ztest_od_t), UMEM_NOFAIL);
+ od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
ztest_od_init(od, id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
if (ztest_object_init(zd, od, sizeof (ztest_od_t), B_FALSE) != 0) {
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
return;
}
@@ -5143,7 +5145,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
ztest_dsl_prop_set_uint64(zd->zd_name, ZFS_PROP_COPIES, 1,
B_FALSE) != 0) {
(void) rw_exit(&ztest_name_lock);
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
return;
}
@@ -5158,7 +5160,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
txg = ztest_tx_assign(tx, TXG_WAIT, FTAG);
if (txg == 0) {
(void) rw_exit(&ztest_name_lock);
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
return;
}
@@ -5207,7 +5209,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
zio_buf_free(buf, psize);
(void) rw_exit(&ztest_name_lock);
- umem_free(od, sizeof(ztest_od_t));
+ umem_free(od, sizeof (ztest_od_t));
}
/*
@@ -5493,7 +5495,7 @@ ztest_resume_thread(void *arg)
return (NULL);
}
-#define GRACE 300
+#define GRACE 300
#if 0
static void
diff --git a/cmd/zvol_id/zvol_id_main.c b/cmd/zvol_id/zvol_id_main.c
index 018bb6672..d9c80b3f9 100644
--- a/cmd/zvol_id/zvol_id_main.c
+++ b/cmd/zvol_id/zvol_id_main.c
@@ -33,7 +33,8 @@
#include <sys/zfs_znode.h>
#include <sys/fs/zfs.h>
-int ioctl_get_msg(char *var, int fd)
+static int
+ioctl_get_msg(char *var, int fd)
{
int error = 0;
char msg[ZFS_MAXNAMELEN];
@@ -47,7 +48,8 @@ int ioctl_get_msg(char *var, int fd)
return (error);
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
int fd, error = 0;
char zvol_name[ZFS_MAXNAMELEN], zvol_name_part[ZFS_MAXNAMELEN];