param: allow parse_args to work non-destructively.
RFC 1/8 param: allow parse_args to work non-destructively.
There are currently several places where we make a temporary command line to mangle: it's fairly simple for parse_args() to demangle in place.
Signed-off-by Rusty Russell <[email protected]>
--- include/linux/moduleparam.h | 3 +- init/main.c | 6 ++--- kernel/module.c | 2 - kernel/params.c | 46 +++++++++++++++++++++++++++++++++++++------- 4 files changed, 45 insertions(+), 12 deletions(-)
include/linux/moduleparam.h +2 -1
@@ -136,7 +136,8 @@ extern int parse_args(const char *name,char *args, struct kernel_param *params, unsigned num, - int (*unknown)(char *param, char *val)); + int (*unknown)(char *param, char *val), + bool restore_args);/* All the helper functions */ /* The macros to do compile-time type checking stolen from Jakub
init/main.c +2 -2
@@ -509,7 +509,7 @@ void __init parse_early_param(void)/* All fall through to do_early_param. */ strlcpy (tmp_cmdline, boot_command_line,COMMAND_LINE_SIZE ); -parse_args ("early options" , tmp_cmdline,NULL ,0 , do_early_param); +parse_args ("early options" , tmp_cmdline,NULL ,0 , do_early_param, true); done =1 ; }
@@ -589,7 +589,7 @@ asmlinkage void __init start_kernel(voidparse_early_param ();parse_args ("Booting kernel" , static_command_line, __start___param, __stop___param - __start___param, - &unknown_bootoption); + &unknown_bootoption, false);if (!irqs_disabled ()) {printk (KERN_WARNING "start_kernel(): bug: interrupts were " "enabled *very* early, fixing it\n" );
kernel/module.c +1 -1
@@ -2239,7 +2239,7 @@ static noinline struct module *load_modu*/ list_add_rcu (&mod->list, &modules); - err =parse_args (mod->name, mod->args, kp, num_kp,NULL ); + err =parse_args (mod->name, mod->args, kp, num_kp,NULL , false);if (err <0 ) goto unlink;
kernel/params.c +39 -7
90 lines not on this page · raw message