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.
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;
}
/* 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() */