]> git.proxmox.com Git - mirror_zfs.git/blobdiff - lib/libzfs/libzfs_util.c
cstyle: Resolve C style issues
[mirror_zfs.git] / lib / libzfs / libzfs_util.c
index 54dc2afc5b077186e3a6a528bee284aabc0ee419..706ae1769f69f786e232b448640f72ab56bdbc26 100644 (file)
@@ -617,8 +617,8 @@ libzfs_module_loaded(const char *module)
        const char path_prefix[] = "/sys/module/";
        char path[256];
 
-       memcpy(path, path_prefix, sizeof(path_prefix) - 1);
-       strcpy(path + sizeof(path_prefix) - 1, module);
+       memcpy(path, path_prefix, sizeof (path_prefix) - 1);
+       strcpy(path + sizeof (path_prefix) - 1, module);
 
        return (access(path, F_OK) == 0);
 }
@@ -652,12 +652,12 @@ libzfs_run_process(const char *path, char *argv[], int flags)
                while ((rc = waitpid(pid, &status, 0)) == -1 &&
                        errno == EINTR);
                if (rc < 0 || !WIFEXITED(status))
-                       return -1;
+                       return (-1);
 
-               return WEXITSTATUS(status);
+               return (WEXITSTATUS(status));
        }
 
-       return -1;
+       return (-1);
 }
 
 int
@@ -666,9 +666,9 @@ libzfs_load_module(const char *module)
        char *argv[4] = {"/sbin/modprobe", "-q", (char *)module, (char *)0};
 
        if (libzfs_module_loaded(module))
-               return 0;
+               return (0);
 
-       return libzfs_run_process("/sbin/modprobe", argv, 0);
+       return (libzfs_run_process("/sbin/modprobe", argv, 0));
 }
 
 libzfs_handle_t *
@@ -678,8 +678,8 @@ libzfs_init(void)
 
        if (libzfs_load_module("zfs") != 0) {
                (void) fprintf(stderr, gettext("Failed to load ZFS module "
-                              "stack.\nLoad the module manually by running "
-                              "'insmod <location>/zfs.ko' as root.\n"));
+                   "stack.\nLoad the module manually by running "
+                   "'insmod <location>/zfs.ko' as root.\n"));
                return (NULL);
        }
 
@@ -689,11 +689,11 @@ libzfs_init(void)
 
        if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) {
                (void) fprintf(stderr, gettext("Unable to open %s: %s.\n"),
-                              ZFS_DEV, strerror(errno));
+                   ZFS_DEV, strerror(errno));
                if (errno == ENOENT)
                        (void) fprintf(stderr,
-                            gettext("Verify the ZFS module stack is "
-                            "loaded by running '/sbin/modprobe zfs'.\n"));
+                           gettext("Verify the ZFS module stack is "
+                           "loaded by running '/sbin/modprobe zfs'.\n"));
 
                free(hdl);
                return (NULL);
@@ -914,7 +914,7 @@ zfs_strcmp_shortname(char *name, char *cmp_name, int wholedisk)
                if (wholedisk)
                        path_len = zfs_append_partition(path_name, MAXPATHLEN);
 
-               if ((path_len == cmp_len) && !strcmp(path_name, cmp_name)) {
+               if ((path_len == cmp_len) && strcmp(path_name, cmp_name) == 0) {
                        error = 0;
                        break;
                }
@@ -957,7 +957,7 @@ zfs_strcmp_pathname(char *name, char *cmp, int wholedisk)
        }
 
        if (name[0] != '/')
-               return zfs_strcmp_shortname(name, cmp_name, wholedisk);
+               return (zfs_strcmp_shortname(name, cmp_name, wholedisk));
 
        strncpy(path_name, name, MAXPATHLEN);
        path_len = strlen(path_name);
@@ -1313,10 +1313,10 @@ str2shift(libzfs_handle_t *hdl, const char *buf)
         */
        if (buf[1] == '\0' ||
            (toupper(buf[0]) != 'B' &&
-            ((toupper(buf[1]) == 'B' && buf[2] == '\0') ||
-             (toupper(buf[1]) == 'I' && toupper(buf[2]) == 'B' &&
-              buf[3] == '\0'))))
-               return (10*i);
+           ((toupper(buf[1]) == 'B' && buf[2] == '\0') ||
+           (toupper(buf[1]) == 'I' && toupper(buf[2]) == 'B' &&
+           buf[3] == '\0'))))
+               return (10 * i);
 
        if (hdl)
                zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,