lkml.org 
[lkml]   [2004]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/22] Add __early_param for all arches
On Thu, Apr 01, 2004 at 11:51:41AM +1000, Rusty Russell wrote:
> On Thu, 2004-04-01 at 02:13, Tom Rini wrote:
> > My first concern is can parse_args & co really be run so very early on ?
>
> If you can run normal C code, yes. It doesn't require any
> initialization.

No malloc'ing, etc? OK. Then yes, please create some sort of merged
patchset (I don't know how Andrew wants to handle it, maybe just replace
the core patch?)

> > Also:
> > > +/* Arch code calls this early on. */
> > > +void __init parse_early_options(const char *saved_command_line)
> > > +{
> > > + static char __initdata command_line[COMMAND_LINE_SIZE];
> > > + strcpy(command_line, saved_command_line);
> >
> > Really should be:
> > /* i386 goes right to saved_command_line */
> > if (*cmdline_p != saved_command_line)
> > memcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);
> > /* ensure NUL terminated. */
> > saved_command_line[COMMAND_LINE_SIZE - 1] = '\0';
>
> Why? Other than the nul term (which I agree with), I didn't understand
> that code.
>
> Get the archs to pass some command line in. eg. i386 can do:
>
> - parse_cmdline_early(cmdline_p);
> + parse_early_options(*cmdline_p);
>
> I feel that anyone destroying command lines should do their own
> saving, and we should head that way...

memcpy(src, src, size) isn't good, is it? On i386 we start out with the
commandline in saved_command_line. Everyone else I believe has a local
var we point cmdline_p at, which gets copied into saved_command_line.

--
Tom Rini
http://gate.crashing.org/~trini/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.048 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site