summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2015-02-27 15:39:36 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2015-02-27 15:39:36 -0300
commit764b7fa208c6be2c88eaacb50e4613f9656ad600 (patch)
treec601d12efb16be3fb3ba9057c94adc9ea609a555
parentfade2fc3e8baa22d6d46872b94e710b972a1bef2 (diff)
downloadkmod-764b7fa208c6be2c88eaacb50e4613f9656ad600.tar.gz
modprobe: stop checking initstate for builtin modules
builtin modules are handled in libkmod by looking at the modules.builtin index. There's no need to check again for the module's initstate to decide if it's builtin.
-rw-r--r--tools/modprobe.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 3af16c7..8af4922 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -455,34 +455,6 @@ static int rmmod_all(struct kmod_ctx *ctx, char **args, int nargs)
return err;
}
-static int handle_failed_lookup(struct kmod_ctx *ctx, const char *alias)
-{
- struct kmod_module *mod;
- int state, err;
-
- DBG("lookup failed - trying to check if it's builtin\n");
-
- err = kmod_module_new_from_name(ctx, alias, &mod);
- if (err < 0)
- return err;
-
- state = kmod_module_get_initstate(mod);
- kmod_module_unref(mod);
-
- if (state != KMOD_MODULE_BUILTIN) {
- LOG("Module %s not found.\n", alias);
- return -ENOENT;
- }
-
- if (first_time) {
- LOG("Module %s already in kernel (builtin).\n", alias);
- return -ENOENT;
- }
-
- SHOW("builtin %s\n", alias);
- return 0;
-}
-
static void print_action(struct kmod_module *m, bool install,
const char *options)
{
@@ -520,8 +492,10 @@ static int insmod(struct kmod_ctx *ctx, const char *alias,
if (err < 0)
return err;
- if (list == NULL)
- return handle_failed_lookup(ctx, alias);
+ if (list == NULL) {
+ LOG("Module %s not found.\n", alias);
+ return -ENOENT;
+ }
if (strip_modversion || force)
flags |= KMOD_PROBE_FORCE_MODVERSION;