summaryrefslogtreecommitdiff
path: root/modutils/modprobe.c
diff options
context:
space:
mode:
authorBen Hutchings2017-04-06 11:54:04 +0200
committerDenys Vlasenko2017-04-06 11:54:04 +0200
commit803c85a20710b8d9026775f5668237fff496dc1e (patch)
tree4514034a5253a03e6f144f89f61e48db3657bb80 /modutils/modprobe.c
parent9c192e7f946a351c811e2278bbf56b4dc6a4b663 (diff)
downloadbusybox-803c85a20710b8d9026775f5668237fff496dc1e.zip
busybox-803c85a20710b8d9026775f5668237fff496dc1e.tar.gz
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>
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r--modutils/modprobe.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index a6224fa..c82eaa8 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -171,6 +171,7 @@ static const char modprobe_longopts[] ALIGN1 =
/* "was seen in modules.dep": */
#define MODULE_FLAG_FOUND_IN_MODDEP 0x0004
#define MODULE_FLAG_BLACKLISTED 0x0008
+#define MODULE_FLAG_BUILTIN 0x0010
struct globals {
llist_t *probes; /* MEs of module(s) requested on cmdline */
@@ -217,7 +218,7 @@ static void add_probe(const char *name)
m = get_or_add_modentry(name);
if (!(option_mask32 & (OPT_REMOVE | OPT_SHOW_DEPS))
- && (m->flags & MODULE_FLAG_LOADED)
+ && (m->flags & (MODULE_FLAG_LOADED | MODULE_FLAG_BUILTIN))
) {
DBG("skipping %s, it is already loaded", name);
return;
@@ -413,8 +414,10 @@ static int do_modprobe(struct module_entry *m)
if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) {
if (!(option_mask32 & INSMOD_OPT_SILENT))
- bb_error_msg("module %s not found in modules.dep",
- humanly_readable_name(m));
+ bb_error_msg((m->flags & MODULE_FLAG_BUILTIN) ?
+ "module %s is builtin" :
+ "module %s not found in modules.dep",
+ humanly_readable_name(m));
return -ENOENT;
}
DBG("do_modprob'ing %s", m->modname);
@@ -618,6 +621,11 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL & ~PARSE_GREEDY))
get_or_add_modentry(s)->flags |= MODULE_FLAG_LOADED;
config_close(parser);
+
+ parser = config_open2("modules.builtin", fopen_for_read);
+ while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL))
+ get_or_add_modentry(s)->flags |= MODULE_FLAG_BUILTIN;
+ config_close(parser);
}
if (opt & (OPT_INSERT_ALL | OPT_REMOVE)) {