[klibc] [PATCH] kinit minor checkpatch cleanup

maximilian attems max at stro.at
Sun Aug 7 12:55:59 PDT 2011


coding style fixes.

FIXME: check that compiled bin the same1!!
---
 usr/kinit/initrd.c      |    3 ++-
 usr/kinit/kinit.c       |   12 ++++--------
 usr/kinit/kinit.h       |   20 ++++++++++----------
 usr/kinit/name_to_dev.c |    6 +++---
 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 1c3ec56..d2efc59 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 4a1f40b..a60c3be 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 c2e67b7..71414b1 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 d491285..d8c1736 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 b5ab3bb..3b80773 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;
 }
-- 
1.7.5.4



More information about the klibc mailing list