mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-11-23 23:10:53 +07:00
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.
This commit is contained in:
parent
123e8278ed
commit
6882017f80
@ -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;
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ enum kmod_probe {
|
||||
/* codes below can be used in return value, too */
|
||||
KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000,
|
||||
KMOD_PROBE_APPLY_BLACKLIST = 0x20000,
|
||||
KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY = 0x40000,
|
||||
};
|
||||
|
||||
/* Flags to kmod_module_apply_filter() */
|
||||
|
Loading…
Reference in New Issue
Block a user