mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-25 21:25:59 +07:00
modules-load: don't fail on builtin modules, better prints
Distinguish between non-existing modules, builtin modules, already loaded modules, and modules we load. Only the non-existing ones are treated as errors. https://bugzilla.redhat.com/show_bug.cgi?id=817760
This commit is contained in:
parent
75945badd2
commit
27fda47f40
@ -117,7 +117,7 @@ finish:
|
||||
}
|
||||
|
||||
static int load_module(struct kmod_ctx *ctx, const char *m) {
|
||||
const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST|KMOD_PROBE_IGNORE_LOADED;
|
||||
const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST;
|
||||
struct kmod_list *itr, *modlist = NULL;
|
||||
int r = 0;
|
||||
|
||||
@ -129,11 +129,28 @@ static int load_module(struct kmod_ctx *ctx, const char *m) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!modlist) {
|
||||
log_error("Failed to find module '%s'", m);
|
||||
return r;
|
||||
}
|
||||
|
||||
kmod_list_foreach(itr, modlist) {
|
||||
struct kmod_module *mod;
|
||||
int err;
|
||||
int state, err;
|
||||
|
||||
mod = kmod_module_get_module(itr);
|
||||
state = kmod_module_get_initstate(mod);
|
||||
|
||||
switch (state) {
|
||||
case KMOD_MODULE_BUILTIN:
|
||||
log_info("Module '%s' is builtin", kmod_module_get_name(mod));
|
||||
break;
|
||||
|
||||
case KMOD_MODULE_LIVE:
|
||||
log_info("Module '%s' is already loaded", kmod_module_get_name(mod));
|
||||
break;
|
||||
|
||||
default:
|
||||
err = kmod_module_probe_insert_module(mod, probe_flags,
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
||||
@ -146,6 +163,7 @@ static int load_module(struct kmod_ctx *ctx, const char *m) {
|
||||
strerror(-err));
|
||||
r = err;
|
||||
}
|
||||
}
|
||||
|
||||
kmod_module_unref(mod);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user