diff options
author | maximilian attems <max@stro.at> | 2011-08-07 19:18:02 +0200 |
---|---|---|
committer | maximilian attems <max@stro.at> | 2011-08-07 21:54:59 +0200 |
commit | 1de72795caeb03b875ed91a3bf3a03fa8805145e (patch) | |
tree | d6a734ac784868aed47232170027a434fe1fe596 | |
parent | 2901f37cd7a0a7b1d7adb8d63b38c77a23772b7c (diff) | |
download | klibc-1de72795caeb03b875ed91a3bf3a03fa8805145e.tar.gz |
[klibc] kinit minor checkpatch cleanup
Just various small coding style fixes.
Size shows that kinit didn't change as expected.
Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r-- | usr/kinit/initrd.c | 3 | ||||
-rw-r--r-- | usr/kinit/kinit.c | 12 | ||||
-rw-r--r-- | usr/kinit/kinit.h | 20 | ||||
-rw-r--r-- | usr/kinit/name_to_dev.c | 6 | ||||
-rw-r--r-- | usr/kinit/nfsroot.c | 5 |
5 files changed, 21 insertions, 25 deletions
diff --git a/usr/kinit/initrd.c b/usr/kinit/initrd.c index 1c3ec56cb1a93..d2efc596c759b 100644 --- a/usr/kinit/initrd.c +++ b/usr/kinit/initrd.c @@ -122,7 +122,8 @@ static int run_linuxrc(int argc, char *argv[], dev_t root_dev) _exit(255); } else if (pid > 0) { dprintf("kinit: Waiting for linuxrc to complete...\n"); - while (waitpid(pid, NULL, 0) != pid) ; + while (waitpid(pid, NULL, 0) != pid) + ; dprintf("kinit: linuxrc done\n"); } else { return -errno; diff --git a/usr/kinit/kinit.c b/usr/kinit/kinit.c index 4a1f40b97e188..a60c3bea3d855 100644 --- a/usr/kinit/kinit.c +++ b/usr/kinit/kinit.c @@ -26,14 +26,12 @@ void dump_args(int argc, char *argv[]) printf(" argc == %d\n", argc); - for (i = 0; i < argc; i++) { + for (i = 0; i < argc; i++) printf(" argv[%d]: \"%s\"\n", i, argv[i]); - } - if (argv[argc] != NULL) { + if (argv[argc] != NULL) printf(" argv[%d]: \"%s\" (SHOULD BE NULL)\n", argc, argv[argc]); - } } #endif /* DEBUG */ @@ -125,9 +123,8 @@ static int mount_sys_fs(const char *check, const char *fsname, { struct stat st; - if (stat(check, &st) == 0) { + if (stat(check, &st) == 0) return 0; - } mkdir(fsname, 0555); @@ -220,9 +217,8 @@ int main(int argc, char *argv[]) dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); - if (fd > STDERR_FILENO) { + if (fd > STDERR_FILENO) close(fd); - } } mnt_procfs = mount_sys_fs("/proc/cmdline", "/proc", "proc") >= 0; diff --git a/usr/kinit/kinit.h b/usr/kinit/kinit.h index c2e67b7232019..71414b1beb52b 100644 --- a/usr/kinit/kinit.h +++ b/usr/kinit/kinit.h @@ -36,17 +36,17 @@ ssize_t freadfile(FILE *f, char **pptr); * "unnecessary" pointer comparison. * From the Linux kernel. */ -#define min(x,y) ({ \ - typeof(x) _x = (x); \ - typeof(y) _y = (y); \ - (void) (&_x == &_y); \ - _x < _y ? _x : _y; }) +#define min(x, y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x < _y ? _x : _y; }) -#define max(x,y) ({ \ - typeof(x) _x = (x); \ - typeof(y) _y = (y); \ - (void) (&_x == &_y); \ - _x > _y ? _x : _y; }) +#define max(x, y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x > _y ? _x : _y; }) #ifdef DEBUG diff --git a/usr/kinit/name_to_dev.c b/usr/kinit/name_to_dev.c index d4912858e47d8..d8c17363974ef 100644 --- a/usr/kinit/name_to_dev.c +++ b/usr/kinit/name_to_dev.c @@ -69,7 +69,7 @@ static dev_t try_name(char *name, int part) return res + part; } - fail: +fail: return (dev_t) 0; } @@ -122,8 +122,8 @@ static inline dev_t name_to_dev_t_real(const char *name) return st.st_rdev; if (strncmp(name, "/dev/", 5)) { - if ((cptr = strchr(devname+5, ':')) && - cptr[1] != '\0') { + cptr = strchr(devname+5, ':'); + if (cptr && cptr[1] != '\0') { /* Colon-separated decimal device number */ *cptr = '\0'; major_num = strtoul(devname+5, &e1, 10); diff --git a/usr/kinit/nfsroot.c b/usr/kinit/nfsroot.c index b5ab3bb1b8207..3b807736facfd 100644 --- a/usr/kinit/nfsroot.c +++ b/usr/kinit/nfsroot.c @@ -56,9 +56,8 @@ int mount_nfs_root(int argc, char *argv[], int flags) dev_bootpath = dev->bootpath; break; } - if (dev->ip_addr != INADDR_NONE && dev->ip_addr != INADDR_ANY) { + if (dev->ip_addr != INADDR_NONE && dev->ip_addr != INADDR_ANY) client = dev->ip_addr; - } } /* @@ -107,6 +106,6 @@ int mount_nfs_root(int argc, char *argv[], int flags) goto done; } - done: +done: return ret; } |