[klibc] [PATCH 4/4] kinit: checkpatch cleanup

maximilian attems max at stro.at
Fri Jul 8 04:28:42 PDT 2011


fix:
ERROR: do not use assignment in if condition
..

WARNING: line over 80 characters
..

WARNING: labels should not be indented
..

ERROR: space required after that ',' (ctx:VxV)
..

Signed-off-by: maximilian attems <max at stro.at>
---
 usr/kinit/devname.c      |    6 ++++--
 usr/kinit/do_mounts.c    |    7 ++++---
 usr/kinit/do_mounts.h    |    8 ++++----
 usr/kinit/do_mounts_md.c |    8 ++++----
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/usr/kinit/devname.c b/usr/kinit/devname.c
index 03f360e..c327e3b 100644
--- a/usr/kinit/devname.c
+++ b/usr/kinit/devname.c
@@ -25,7 +25,8 @@ static int scansysdir(char *namebuf, char *sysdir, dev_t dev)
 	char *ep;
 	ssize_t rd;
 
-	if (!(dir = opendir(sysdir)))
+	dir = opendir(sysdir);
+	if (!dir)
 		return 0;
 
 	*dirtailptr++ = '/';
@@ -46,7 +47,8 @@ static int scansysdir(char *namebuf, char *sysdir, dev_t dev)
 		systail = strchr(sysdir, '\0');
 
 		strcpy(systail, "/dev");
-		if (!(sysdev = fopen(sysdir, "r")))
+		sysdev = fopen(sysdir, "r");
+		if (!sysdev)
 			continue;
 
 		/* Abusing the namebuf as temporary storage here. */
diff --git a/usr/kinit/do_mounts.c b/usr/kinit/do_mounts.c
index 6384042..3ffac91 100644
--- a/usr/kinit/do_mounts.c
+++ b/usr/kinit/do_mounts.c
@@ -78,7 +78,8 @@ const char *mount_block(const char *source, const char *target,
 		if (!p)
 			break;
 		*p++ = '\0';
-		if (*type != '\t')	/* We can't mount a block device as a "nodev" fs */
+		/* We can't mount a block device as a "nodev" fs */
+		if (*type != '\t')
 			continue;
 
 		type++;
@@ -116,7 +117,7 @@ mount_block_root(int argc, char *argv[], dev_t root_dev,
 	    && (rp = mount_block("/dev/root", "/root", NULL, flags, data)))
 		goto ok;
 
-      bad:
+bad:
 	if (errno != EINVAL) {
 		/*
 		 * Allow the user to distinguish between failed open
@@ -131,7 +132,7 @@ mount_block_root(int argc, char *argv[], dev_t root_dev,
 		return -ESRCH;
 	}
 
-      ok:
+ok:
 	printf("%s: Mounted root (%s filesystem)%s.\n",
 	       progname, rp, (flags & MS_RDONLY) ? " readonly" : "");
 	return 0;
diff --git a/usr/kinit/do_mounts.h b/usr/kinit/do_mounts.h
index c309289..99bc6a6 100644
--- a/usr/kinit/do_mounts.h
+++ b/usr/kinit/do_mounts.h
@@ -9,12 +9,12 @@
 #include <sys/sysmacros.h>
 #include <sys/stat.h>
 
-#define	Root_RAM0	__makedev(1,0)
+#define	Root_RAM0	__makedev(1, 0)
 
 /* These device numbers are only used internally */
-#define Root_NFS	__makedev(0,255)
-#define Root_MTD	__makedev(0,254)
-#define Root_MULTI	__makedev(0,253)
+#define Root_NFS	__makedev(0, 255)
+#define Root_MTD	__makedev(0, 254)
+#define Root_MULTI	__makedev(0, 253)
 
 int create_dev(const char *name, dev_t dev);
 
diff --git a/usr/kinit/do_mounts_md.c b/usr/kinit/do_mounts_md.c
index 7c6ed8d..f446620 100644
--- a/usr/kinit/do_mounts_md.c
+++ b/usr/kinit/do_mounts_md.c
@@ -204,7 +204,7 @@ static int md_setup(char *str)
 	}
 
 	fprintf(stderr, "md: Will configure md%s%d (%s) from %s, below.\n",
-		partitioned?"_d":"", minor_num, pername, str);
+		partitioned ? "_d" : "", minor_num, pername, str);
 	md_setup_args[ent].device_names = str;
 	md_setup_args[ent].partitioned = partitioned;
 	md_setup_args[ent].minor = minor_num;
@@ -330,9 +330,9 @@ static void md_setup_drive(void)
 				dev_minor);
 		else {
 			/* reread the partition table.
-			 * I (neilb) and not sure why this is needed, but I cannot
-			 * boot a kernel with devfs compiled in from partitioned md
-			 * array without it
+			 * I (neilb) and not sure why this is needed, but I
+			 * cannot boot a kernel with devfs compiled in from
+			 * partitioned md array without it
 			 */
 			close(fd);
 			fd = open(name, 0, 0);
-- 
1.7.5.4



More information about the klibc mailing list