aboutsummaryrefslogtreecommitdiff
path: root/libkmod/libkmod-module.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-08-17 09:38:05 -0300
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-08-17 09:42:15 -0300
commit6882017f809691d070e4df26414676d0219145d5 (patch)
tree9067d69aa9b8cac5ae48f1fee471457f0a118152 /libkmod/libkmod-module.c
parent123e8278ed8db4bd2f9a774dd700124de79d3bf4 (diff)
downloadkmod-6882017f809691d070e4df26414676d0219145d5.tar.gz
libkmod-module: Add KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY flag
With this flag kmod_module_probe_insert_module() check if module is blacklisted only if it's also an alias. This is needed in order to allow blacklisting a module by name and effectively blacklisting all its aliases as module-init-tools was doing. Before this patch we could load pcspkr module as follows: /etc/modprobe.d/test.conf: alias yay pcspkr blacklist pcspkr $ modprobe yay Now libkmod has support to blacklist "yay" because "pcspkr" is blacklisted.
Diffstat (limited to 'libkmod/libkmod-module.c')
-rw-r--r--libkmod/libkmod-module.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 1271c70..9756d57 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -1172,9 +1172,15 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
return 0;
}
- err = flags & (KMOD_PROBE_APPLY_BLACKLIST |
- KMOD_PROBE_APPLY_BLACKLIST_ALL);
- if (err != 0) {
+ /*
+ * Ugly assignement + check. We need to check if we were told to check
+ * blacklist and also return the reason why we failed.
+ * KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY will take effect only if the
+ * module is an alias, so we also need to check it
+ */
+ if ((mod->alias != NULL && ((err = flags & KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY)))
+ || (err = flags & KMOD_PROBE_APPLY_BLACKLIST_ALL)
+ || (err = flags & KMOD_PROBE_APPLY_BLACKLIST)) {
if (module_is_blacklisted(mod))
return err;
}