]> git.proxmox.com Git - mirror_zfs.git/blobdiff - cmd/zpool/zpool_vdev.c
cstyle: Resolve C style issues
[mirror_zfs.git] / cmd / zpool / zpool_vdev.c
index 596c0cb60d46e883fece1e1324867225b97cee46..316e291c3d86a5455a164f87a58b4cfce95c7d84 100644 (file)
@@ -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++;