diff options
author | Andy Whitcroft <apw@canonical.com> | 2010-06-17 10:46:47 +0100 |
---|---|---|
committer | Leann Ogasawara <leann.ogasawara@canonical.com> | 2010-08-20 16:00:20 -0700 |
commit | 952ee6103302b5d536c53675af149e0eb4148c6b (patch) | |
tree | af295dd094e88d3bb0ff97e2fc4f7de00bb30ac5 /kernel | |
parent | 1c0dc8b00b2e6beeab06b59d0db9e8767d774db3 (diff) |
UBUNTU: SAUCE: add option to hand off all kernel parameters to init
BugLink: http://bugs.launchpad.net/bugs/586386
Some init packages such as upstart find having all of the kernel parameters
passed in useful. Currently they have to open up /proc/cmdline and
reparse that to obtain this information. Add a kernel configuration
option to enable passing of all options.
Note, enabling this option will reduce the chances that a fallback from
/sbin/init to /bin/bash or /bin/sh will succeed. Though it should be
noted that there are commonly unknown options present which would already
break this fallback. init=/bin/foo provides explicit control over options
which is unaffected by this change.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/params.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/params.c b/kernel/params.c index 0b30ecd53a52..0267fd1bd685 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -51,22 +51,30 @@ static int parse_one(char *param, char *val, struct kernel_param *params, unsigned num_params, - int (*handle_unknown)(char *param, char *val)) + int (*handle_arg)(char *param, char *val, int known)) { unsigned int i; /* Find parameter */ for (i = 0; i < num_params; i++) { if (parameq(param, params[i].name)) { + if (handle_arg) { + int ret; + DEBUGP("Valid argument: calling %p\n", + handle_arg); + ret = handle_arg(param, val, 1); + if (ret) + return ret; + } DEBUGP("They are equal! Calling %p\n", params[i].set); return params[i].set(val, ¶ms[i]); } } - if (handle_unknown) { - DEBUGP("Unknown argument: calling %p\n", handle_unknown); - return handle_unknown(param, val); + if (handle_arg) { + DEBUGP("Unknown argument: calling %p\n", handle_arg); + return handle_arg(param, val, 0); } DEBUGP("Unknown argument `%s'\n", param); @@ -130,7 +138,7 @@ int parse_args(const char *name, char *args, struct kernel_param *params, unsigned num, - int (*unknown)(char *param, char *val)) + int (*handle_arg)(char *param, char *val, int arg)) { char *param, *val; @@ -145,7 +153,7 @@ int parse_args(const char *name, args = next_arg(args, ¶m, &val); irq_was_disabled = irqs_disabled(); - ret = parse_one(param, val, params, num, unknown); + ret = parse_one(param, val, params, num, handle_arg); if (irq_was_disabled && !irqs_disabled()) { printk(KERN_WARNING "parse_args(): option '%s' enabled " "irq's!\n", param); |