aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2010-03-15 15:34:38 +0000
committerAlan Jenkins <alan-jenkins@tuffmail.co.uk>2010-03-17 10:24:57 +0000
commit7a623868b280b0f8c38e0652ac9442a23c569b17 (patch)
tree0ed9906284a8a157da815d0de7b594f3d74aca41
parent95ff1ab26c50f25ba39683878148b86d644eb693 (diff)
downloadmodule-init-tools-7a623868b280b0f8c38e0652ac9442a23c569b17.tar.gz
modprobe: fix softdep flags
1. When a softdep is present, all the flags e.g. --use-blacklist are being ignored. Fix that. 2. When processing softdeps, mask out the "first_time" flag. This brings them into line with both install commands and normal dependencies. (We don't need to worry about "ignore_commands", because it would prevent softdeps from being loaded in the first place). If we're unloading, we should also mask in the "quiet_inuse" flag.
-rw-r--r--modprobe.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/modprobe.c b/modprobe.c
index 47f3a9b..0f9494e 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -1325,8 +1325,14 @@ static void do_softdep(const struct module_softdep *softdep,
modprobe_flags_t flags)
{
struct string_table *pre_modnames, *post_modnames;
+ modprobe_flags_t softdep_flags = flags;
int i, j;
+ softdep_flags &= ~mit_first_time;
+ softdep_flags &= ~mit_ignore_commands;
+ if (flags & mit_remove)
+ softdep_flags |= mit_quiet_inuse;
+
if (++recursion_depth >= MAX_RECURSION)
fatal("modprobe: softdep dependency loop encountered %s %s\n",
(flags & mit_remove) ? "removing" : "inserting",
@@ -1348,7 +1354,7 @@ static void do_softdep(const struct module_softdep *softdep,
j = (flags & mit_remove) ? pre_modnames->cnt-1 - i : i;
do_modprobe(pre_modnames->str[j], NULL, "",
- conf, dirname, warn, flags);
+ conf, dirname, warn, softdep_flags);
}
/* Modprobe main module, passing cmdline_opts, ignoring softdep */
@@ -1363,7 +1369,7 @@ static void do_softdep(const struct module_softdep *softdep,
j = (flags & mit_remove) ? post_modnames->cnt-1 - i : i;
do_modprobe(post_modnames->str[j], NULL, "", conf,
- dirname, warn, flags);
+ dirname, warn, softdep_flags);
}
}
@@ -1416,8 +1422,7 @@ static int insmod(struct list_head *list,
softdep = find_softdep(mod->modname, conf->softdeps);
if (softdep && !(flags & mit_ignore_commands)) {
- do_softdep(softdep, cmdline_opts, conf, dirname,
- error, flags & (mit_remove | mit_dry_run));
+ do_softdep(softdep, cmdline_opts, conf, dirname, error, flags);
goto out;
}
@@ -1512,8 +1517,7 @@ static void rmmod(struct list_head *list,
softdep = find_softdep(mod->modname, conf->softdeps);
if (softdep && !(flags & mit_ignore_commands)) {
- do_softdep(softdep, cmdline_opts, conf, dirname,
- error, flags & (mit_remove | mit_dry_run));
+ do_softdep(softdep, cmdline_opts, conf, dirname, error, flags);
goto remove_rest;
}