diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-08 20:51:08 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-08 20:51:08 +0200 |
commit | 8e20f93488e2fba871e28adc1453976c4c41f2f5 (patch) | |
tree | 6f4c88421b97ffc4396f8fac29e21fe2c70dbe6b /src/core | |
parent | ca41b679c675eef0f5dde496aa71099c75a30d6b (diff) | |
parent | 85c675538fd18eefe0bbfd6fc87d9e0f38f3207a (diff) |
Merge pull request #101 from zonque/kmod
kmod-setup: split warn flags
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/kmod-setup.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c index 96379058a1..cf543c81a3 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -53,26 +53,27 @@ int kmod_setup(void) { static const struct { const char *module; const char *path; - bool warn; + bool warn_if_unavailable:1; + bool warn_if_module:1; bool (*condition_fn)(void); } kmod_table[] = { /* auto-loading on use doesn't work before udev is up */ - { "autofs4", "/sys/class/misc/autofs", true, NULL }, + { "autofs4", "/sys/class/misc/autofs", true, false, NULL }, /* early configure of ::1 on the loopback device */ - { "ipv6", "/sys/module/ipv6", false, NULL }, + { "ipv6", "/sys/module/ipv6", false, true, NULL }, /* this should never be a module */ - { "unix", "/proc/net/unix", true, NULL }, + { "unix", "/proc/net/unix", true, true, NULL }, #ifdef ENABLE_KDBUS /* IPC is needed before we bring up any other services */ - { "kdbus", "/sys/fs/kdbus", false, is_kdbus_wanted }, + { "kdbus", "/sys/fs/kdbus", false, false, is_kdbus_wanted }, #endif #ifdef HAVE_LIBIPTC /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */ - { "ip_tables", "/proc/net/ip_tables_names", false, NULL }, + { "ip_tables", "/proc/net/ip_tables_names", false, false, NULL }, #endif }; struct kmod_ctx *ctx = NULL; @@ -91,7 +92,7 @@ int kmod_setup(void) { if (kmod_table[i].condition_fn && !kmod_table[i].condition_fn()) continue; - if (kmod_table[i].warn) + if (kmod_table[i].warn_if_module) log_debug("Your kernel apparently lacks built-in %s support. Might be " "a good idea to compile it in. We'll now try to work around " "this by loading the module...", kmod_table[i].module); @@ -116,8 +117,9 @@ int kmod_setup(void) { log_info("Inserted module '%s'", kmod_module_get_name(mod)); else if (r == KMOD_PROBE_APPLY_BLACKLIST) log_info("Module '%s' is blacklisted", kmod_module_get_name(mod)); - else if (kmod_table[i].warn) - log_error("Failed to insert module '%s'", kmod_module_get_name(mod)); + else + log_full((kmod_table[i].warn_if_unavailable || (r < 0 && r != -ENOENT)) ? LOG_ERR : LOG_DEBUG, + "Failed to insert module '%s'", kmod_module_get_name(mod)); kmod_module_unref(mod); } |