diff options
author | Michael Kjorling <[email protected]> | 2013-11-01 20:26:11 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-12-18 16:46:35 -0800 |
commit | d1d7e2689db9e03f11c069ebc9f1ba12829e5dac (patch) | |
tree | 75b9a2b23334d5f673fb31f142f74146d351865c /lib/libzfs/libzfs_util.c | |
parent | 8ffef572ed2ba97e0c2d6a8aa2240012e611dc6f (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 'lib/libzfs/libzfs_util.c')
-rw-r--r-- | lib/libzfs/libzfs_util.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 54dc2afc5..706ae1769 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -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, |