[PATCH] avoid multiline /proc/cmdline content on iSeries

Olaf Hering olh at suse.de
Mon Jun 14 23:31:58 EST 2004


/proc/cmdline is filled via an OS400 call iSeries_init(). It scans the
returned data from the end, instead of the beginning. This leads to
multiple lines in /proc/cmdline
Just scan from the beginning and stop at the first newline. This patch
changes also the /proc/iSeries/mf/*/cmdline interface to do the same as
the initial setup.


diff -purN linux-2.6.7-rc3-bk6.orig/arch/ppc64/kernel/iSeries_setup.c linux-2.6.7-rc3-bk6/arch/ppc64/kernel/iSeries_setup.c
--- linux-2.6.7-rc3-bk6.orig/arch/ppc64/kernel/iSeries_setup.c	2004-06-14 15:21:47.000000000 +0200
+++ linux-2.6.7-rc3-bk6/arch/ppc64/kernel/iSeries_setup.c	2004-06-14 15:24:32.257675461 +0200
@@ -357,15 +357,14 @@ void __init iSeries_init(unsigned long r
 	HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256,
 			HvLpDma_Direction_RemoteToLocal);

-	p = q = cmd_line + 255;
-	while (p > cmd_line) {
-		if ((*p == 0) || (*p == ' ') || (*p == '\n'))
-			--p;
-		else
+	p = cmd_line;
+	q = cmd_line + 255;
+	while( p < q ) {
+		if (!*p || *p == '\n')
 			break;
+		++p;
 	}
-	if (p < q)
-		*(p + 1) = 0;
+	*p = 0;

         if (strstr(cmd_line, "dprofile=")) {
                 for (q = cmd_line; (p = strstr(q, "dprofile=")) != 0; ) {
diff -purN linux-2.6.7-rc3-bk6.orig/arch/ppc64/kernel/mf_proc.c linux-2.6.7-rc3-bk6/arch/ppc64/kernel/mf_proc.c
--- linux-2.6.7-rc3-bk6.orig/arch/ppc64/kernel/mf_proc.c	2004-06-14 15:21:47.000000000 +0200
+++ linux-2.6.7-rc3-bk6/arch/ppc64/kernel/mf_proc.c	2004-06-14 15:24:32.259675139 +0200
@@ -25,33 +25,26 @@ static int proc_mf_dump_cmdline(char *pa
 {
 	int len = count;
 	char *p;
-
+
+	if (off) {
+		*eof = 1;
+		return 0;
+	}
+
 	len = mf_getCmdLine(page, &len, (u64)data);

-	p = page + len - 1;
-	while (p > page) {
-		if ((*p == 0) || (*p == ' '))
-			--p;
-		else
+	p = page;
+	while (len < (count - 1)) {
+		if (!*p || *p == '\n')
 			break;
+		p++;
+		len++;
 	}
-	if (*p != '\n') {
-		++p;
-		*p = '\n';
-	}
-	++p;
+	*p = '\n';
+	p++;
 	*p = 0;
-	len = p - page;
-
-	len -= off;
-	if (len < count) {
-		*eof = 1;
-		if (len <= 0)
-			return 0;
-	} else
-		len = count;
-	*start = page + off;
-	return len;
+
+	return p - page;
 }

 #if 0

--
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list