diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2017-04-06 11:54:04 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-06 11:54:04 +0200 |
commit | 803c85a20710b8d9026775f5668237fff496dc1e (patch) | |
tree | 4514034a5253a03e6f144f89f61e48db3657bb80 | |
parent | 9c192e7f946a351c811e2278bbf56b4dc6a4b663 (diff) | |
download | busybox-w32-803c85a20710b8d9026775f5668237fff496dc1e.tar.gz busybox-w32-803c85a20710b8d9026775f5668237fff496dc1e.tar.bz2 busybox-w32-803c85a20710b8d9026775f5668237fff496dc1e.zip |
modprobe: read modules.builtin
This allows explicit probing to succeed when the requested module
is actually built-in, and corrects the error message for removal.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | modutils/modprobe.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index a6224fa63..c82eaa8d8 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -171,6 +171,7 @@ static const char modprobe_longopts[] ALIGN1 = | |||
171 | /* "was seen in modules.dep": */ | 171 | /* "was seen in modules.dep": */ |
172 | #define MODULE_FLAG_FOUND_IN_MODDEP 0x0004 | 172 | #define MODULE_FLAG_FOUND_IN_MODDEP 0x0004 |
173 | #define MODULE_FLAG_BLACKLISTED 0x0008 | 173 | #define MODULE_FLAG_BLACKLISTED 0x0008 |
174 | #define MODULE_FLAG_BUILTIN 0x0010 | ||
174 | 175 | ||
175 | struct globals { | 176 | struct globals { |
176 | llist_t *probes; /* MEs of module(s) requested on cmdline */ | 177 | llist_t *probes; /* MEs of module(s) requested on cmdline */ |
@@ -217,7 +218,7 @@ static void add_probe(const char *name) | |||
217 | 218 | ||
218 | m = get_or_add_modentry(name); | 219 | m = get_or_add_modentry(name); |
219 | if (!(option_mask32 & (OPT_REMOVE | OPT_SHOW_DEPS)) | 220 | if (!(option_mask32 & (OPT_REMOVE | OPT_SHOW_DEPS)) |
220 | && (m->flags & MODULE_FLAG_LOADED) | 221 | && (m->flags & (MODULE_FLAG_LOADED | MODULE_FLAG_BUILTIN)) |
221 | ) { | 222 | ) { |
222 | DBG("skipping %s, it is already loaded", name); | 223 | DBG("skipping %s, it is already loaded", name); |
223 | return; | 224 | return; |
@@ -413,8 +414,10 @@ static int do_modprobe(struct module_entry *m) | |||
413 | 414 | ||
414 | if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) { | 415 | if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) { |
415 | if (!(option_mask32 & INSMOD_OPT_SILENT)) | 416 | if (!(option_mask32 & INSMOD_OPT_SILENT)) |
416 | bb_error_msg("module %s not found in modules.dep", | 417 | bb_error_msg((m->flags & MODULE_FLAG_BUILTIN) ? |
417 | humanly_readable_name(m)); | 418 | "module %s is builtin" : |
419 | "module %s not found in modules.dep", | ||
420 | humanly_readable_name(m)); | ||
418 | return -ENOENT; | 421 | return -ENOENT; |
419 | } | 422 | } |
420 | DBG("do_modprob'ing %s", m->modname); | 423 | DBG("do_modprob'ing %s", m->modname); |
@@ -618,6 +621,11 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) | |||
618 | while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL & ~PARSE_GREEDY)) | 621 | while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL & ~PARSE_GREEDY)) |
619 | get_or_add_modentry(s)->flags |= MODULE_FLAG_LOADED; | 622 | get_or_add_modentry(s)->flags |= MODULE_FLAG_LOADED; |
620 | config_close(parser); | 623 | config_close(parser); |
624 | |||
625 | parser = config_open2("modules.builtin", fopen_for_read); | ||
626 | while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL)) | ||
627 | get_or_add_modentry(s)->flags |= MODULE_FLAG_BUILTIN; | ||
628 | config_close(parser); | ||
621 | } | 629 | } |
622 | 630 | ||
623 | if (opt & (OPT_INSERT_ALL | OPT_REMOVE)) { | 631 | if (opt & (OPT_INSERT_ALL | OPT_REMOVE)) { |