diff options
| author | Michael Kjorling <michael@kjorling.se> | 2013-11-01 19:26:11 +0000 |
|---|---|---|
| committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2013-12-19 00:46:35 +0000 |
| commit | d1d7e2689db9e03f11c069ebc9f1ba12829e5dac (patch) | |
| tree | 75b9a2b23334d5f673fb31f142f74146d351865c /cmd/zpool | |
| parent | 8ffef572ed2ba97e0c2d6a8aa2240012e611dc6f (diff) | |
Diffstat (limited to 'cmd/zpool')
| -rw-r--r-- | cmd/zpool/zpool_main.c | 39 | ||||
| -rw-r--r-- | cmd/zpool/zpool_util.h | 3 | ||||
| -rw-r--r-- | cmd/zpool/zpool_vdev.c | 57 |
3 files changed, 52 insertions, 47 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 0d21b7e73338..a856fd49e85c 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 b67ff8b32463..1b4ce518f83b 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 596c0cb60d46..316e291c3d86 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++; |
