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,
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; ) {
......
......@@ -25,33 +25,26 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
{
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
......
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