Modules mod1, mod2 and mod3 can now be blacklisted by passing

modprobe.blacklist=mod1,mod2,mod3

on the kernel command line.

This is useful in case a module prevents the system from booting.

Cc: Jon Masters <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: Aaron Griffin <[email protected]>
Cc: Thomas Bächler <[email protected]>
Signed-off-by: Tom Gundersen <[email protected]>
---
 modprobe.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/modprobe.c b/modprobe.c
index 4721253..65de11a 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -1134,11 +1134,13 @@ static void parse_toplevel_config(const char *filename,
 }
 
 /* Read possible module arguments from the kernel command line. */
-static int parse_kcmdline(int dump_only, struct module_options **options)
+static int parse_kcmdline(int dump_only, struct modprobe_conf *conf)
 {
        char *line;
        unsigned int linenum = 0;
        FILE *kcmdline;
+       struct module_options **options = &conf->options;
+       struct module_blacklist **blacklist = &conf->blacklist;
 
        kcmdline = fopen("/proc/cmdline", "r");
        if (!kcmdline)
@@ -1151,6 +1153,17 @@ static int parse_kcmdline(int dump_only, struct 
module_options **options)
                while ((arg = strsep_skipspace(&ptr, "\t ")) != NULL) {
                        char *sep, *modname, *opt;
 
+                       if (strstr(arg, "modprobe.blacklist=") != NULL) {
+                               ptr = strchr(arg,'=') + 1;
+
+                               while ((modname = strsep(&ptr, ",")) != NULL) {
+                                       if (dump_only)
+                                               printf("blacklist %s\n", 
modname);
+
+                                       *blacklist = 
add_blacklist(underscores(modname), *blacklist);
+                               }
+                       }
+
                        sep = strchr(arg, '.');
                        if (sep) {
                                if (!strchr(sep, '='))
@@ -1836,7 +1849,7 @@ int main(int argc, char *argv[])
        parse_toplevel_config(configname, &conf, dump_config, flags & 
mit_remove);
 
        /* Read module options from kernel command line */
-       parse_kcmdline(dump_config, &conf.options);
+       parse_kcmdline(dump_config, &conf);
        
        if (dump_config) {
                char *aliasfilename, *symfilename;
-- 
1.7.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to