Commit 1d023f88 authored by Olaf Hering's avatar Olaf Hering Committed by Linus Torvalds

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

/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.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bf70d874
...@@ -357,15 +357,14 @@ void __init iSeries_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -357,15 +357,14 @@ void __init iSeries_init(unsigned long r3, unsigned long r4, unsigned long r5,
HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256, HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256,
HvLpDma_Direction_RemoteToLocal); HvLpDma_Direction_RemoteToLocal);
p = q = cmd_line + 255; p = cmd_line;
while (p > cmd_line) { q = cmd_line + 255;
if ((*p == 0) || (*p == ' ') || (*p == '\n')) while( p < q ) {
--p; if (!*p || *p == '\n')
else
break; break;
++p;
} }
if (p < q) *p = 0;
*(p + 1) = 0;
if (strstr(cmd_line, "dprofile=")) { if (strstr(cmd_line, "dprofile=")) {
for (q = cmd_line; (p = strstr(q, "dprofile=")) != 0; ) { for (q = cmd_line; (p = strstr(q, "dprofile=")) != 0; ) {
......
...@@ -25,33 +25,26 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off, ...@@ -25,33 +25,26 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
{ {
int len = count; int len = count;
char *p; char *p;
if (off) {
*eof = 1;
return 0;
}
len = mf_getCmdLine(page, &len, (u64)data); len = mf_getCmdLine(page, &len, (u64)data);
p = page + len - 1; p = page;
while (p > page) { while (len < (count - 1)) {
if ((*p == 0) || (*p == ' ')) if (!*p || *p == '\n')
--p;
else
break; break;
p++;
len++;
} }
if (*p != '\n') { *p = '\n';
++p; p++;
*p = '\n';
}
++p;
*p = 0; *p = 0;
len = p - page;
return p - page;
len -= off;
if (len < count) {
*eof = 1;
if (len <= 0)
return 0;
} else
len = count;
*start = page + off;
return len;
} }
#if 0 #if 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment