aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2012-04-27 16:30:34 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-30 14:05:27 -0400
commit9fb48c744ba6a4bf58b666f4e6fdac3008ea1bd4 (patch)
treef145e07824a3a9bae9f8da3e5c39ea5073bd872e /init/main.c
parent3faa286055c02291dc9b6d838601dcb105a64a14 (diff)
params: add 3rd arg to option handler callback signature
Add a 3rd arg, named "doing", to unknown-options callbacks invoked from parse_args(). The arg is passed as: "Booting kernel" from start_kernel(), initcall_level_names[i] from do_initcall_level(), mod->name from load_module(), via parse_args(), parse_one() parse_args() already has the "name" parameter, which is renamed to "doing" to better reflect current uses 1,2 above. parse_args() passes it to an altered parse_one(), which now passes it down into the unknown option handler callbacks. The mod->name will be needed to handle dyndbg for loadable modules, since params passed by modprobe are not qualified (they do not have a "$modname." prefix), and by the time the unknown-param callback is called, the module name is not otherwise available. Minor tweaks: Add param-name to parse_one's pr_debug(), current message doesnt identify the param being handled, add it. Add a pr_info to print current level and level_name of the initcall, and number of registered initcalls at that level. This adds 7 lines to dmesg output, like: initlevel:6=device, 172 registered initcalls Drop "parameters" from initcall_level_names[], its unhelpful in the pr_info() added above. This array is passed into parse_args() by do_initcall_level(). CC: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Acked-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/init/main.c b/init/main.c
index 9d454f09f3b1..11bc6f7ed866 100644
--- a/init/main.c
+++ b/init/main.c
@@ -229,7 +229,8 @@ early_param("loglevel", loglevel);
229 * Unknown boot options get handed to init, unless they look like 229 * Unknown boot options get handed to init, unless they look like
230 * unused parameters (modprobe will find them in /proc/cmdline). 230 * unused parameters (modprobe will find them in /proc/cmdline).
231 */ 231 */
232static int __init unknown_bootoption(char *param, char *val) 232static int __init unknown_bootoption(char *param, char *val,
233 const char *unused)
233{ 234{
234 /* Change NUL term back to "=", to make "param" the whole string. */ 235 /* Change NUL term back to "=", to make "param" the whole string. */
235 if (val) { 236 if (val) {
@@ -379,7 +380,7 @@ static noinline void __init_refok rest_init(void)
379} 380}
380 381
381/* Check for early params. */ 382/* Check for early params. */
382static int __init do_early_param(char *param, char *val) 383static int __init do_early_param(char *param, char *val, const char *unused)
383{ 384{
384 const struct obs_kernel_param *p; 385 const struct obs_kernel_param *p;
385 386
@@ -722,17 +723,18 @@ static initcall_t *initcall_levels[] __initdata = {
722}; 723};
723 724
724static char *initcall_level_names[] __initdata = { 725static char *initcall_level_names[] __initdata = {
725 "early parameters", 726 "early",
726 "core parameters", 727 "core",
727 "postcore parameters", 728 "postcore",
728 "arch parameters", 729 "arch",
729 "subsys parameters", 730 "subsys",
730 "fs parameters", 731 "fs",
731 "device parameters", 732 "device",
732 "late parameters", 733 "late",
733}; 734};
734 735
735static int __init ignore_unknown_bootoption(char *param, char *val) 736static int __init ignore_unknown_bootoption(char *param, char *val,
737 const char *doing)
736{ 738{
737 return 0; 739 return 0;
738} 740}
@@ -747,7 +749,7 @@ static void __init do_initcall_level(int level)
747 static_command_line, __start___param, 749 static_command_line, __start___param,
748 __stop___param - __start___param, 750 __stop___param - __start___param,
749 level, level, 751 level, level,
750 ignore_unknown_bootoption); 752 &ignore_unknown_bootoption);
751 753
752 for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++) 754 for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
753 do_one_initcall(*fn); 755 do_one_initcall(*fn);
@@ -757,8 +759,13 @@ static void __init do_initcalls(void)
757{ 759{
758 int level; 760 int level;
759 761
760 for (level = 0; level < ARRAY_SIZE(initcall_levels) - 1; level++) 762 for (level = 0; level < ARRAY_SIZE(initcall_levels) - 1; level++) {
763 pr_info("initlevel:%d=%s, %d registered initcalls\n",
764 level, initcall_level_names[level],
765 (int) (initcall_levels[level+1]
766 - initcall_levels[level]));
761 do_initcall_level(level); 767 do_initcall_level(level);
768 }
762} 769}
763 770
764/* 771/*