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 <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index cbec438..a6224fa 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 @@
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 @@
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 @@
/* 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 */