From b1d6a2c6247bae0b9f1903ba0e0d16c56f4ef556 Mon Sep 17 00:00:00 2001 From: Kang-Che Sung Date: Tue, 31 Jan 2017 21:09:17 +0800 Subject: cmdline module options can be disabled on "big" modutils Allow module options on command line to be disabled on "big" modutils. Config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is renamed to FEATURE_CMDLINE_MODULE_OPTIONS and no longer depends on !MODPROBE_SMALL (I'm not sure if disabling this is useful on "big" modutils, but at least the macro can serve as a marker and ensure both implementations of same feature have consistent behavior.) Signed-off-by: Kang-Che Sung Signed-off-by: Denys Vlasenko --- modutils/modprobe.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modutils/modprobe.c') diff --git a/modutils/modprobe.c b/modutils/modprobe.c index cbec43888..a6224fa63 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -112,7 +112,7 @@ //usage: //usage:#define modprobe_trivial_usage //usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]" -//usage: " MODULE [SYMBOL=VALUE]..." +//usage: " MODULE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") //usage:#define modprobe_full_usage "\n\n" //usage: " -a Load multiple MODULEs" //usage: "\n -l List (MODULE is a pattern)" @@ -174,7 +174,9 @@ static const char modprobe_longopts[] ALIGN1 = struct globals { llist_t *probes; /* MEs of module(s) requested on cmdline */ +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS char *cmdline_mopts; /* module options from cmdline */ +#endif int num_unresolved_deps; /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */ smallint need_symbols; @@ -458,8 +460,10 @@ static int do_modprobe(struct module_entry *m) options = m2->options; m2->options = NULL; options = parse_and_add_kcmdline_module_options(options, m2->modname); +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS if (m == m2) options = gather_options_str(options, G.cmdline_mopts); +#endif if (option_mask32 & OPT_SHOW_DEPS) { printf(options ? "insmod %s/%s/%s %s\n" @@ -626,7 +630,9 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) /* First argument is module name, rest are parameters */ DBG("probing just module %s", *argv); add_probe(argv[0]); +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS G.cmdline_mopts = parse_cmdline_module_options(argv, /*quote_spaces:*/ 1); +#endif } /* Happens if all requested modules are already loaded */ -- cgit v1.2.3