summaryrefslogtreecommitdiff
path: root/libkmod/libkmod.c
diff options
context:
space:
mode:
authorAlexey Gladkov <gladkov.alexey@gmail.com>2019-11-08 18:25:22 +0100
committerLucas De Marchi <lucas.demarchi@intel.com>2019-12-18 16:56:58 -0800
commitb866b2165ae6cf18fb26b635f4a7ee57c0334731 (patch)
treeba634e5ce071c1e3b6d7dec08c20e60421f1962d /libkmod/libkmod.c
parent73eed2aba3cbe18bbda40f18f7bc32e8de1ec81f (diff)
downloadkmod-b866b2165ae6cf18fb26b635f4a7ee57c0334731.tar.gz
kmod-b866b2165ae6cf18fb26b635f4a7ee57c0334731.tar.bz2
kmod-b866b2165ae6cf18fb26b635f4a7ee57c0334731.zip
Lookup aliases in the modules.builtin.modinfo
New modules.builtin.modinfo duplicates modules.builtin in the built-in module name search. If it exists, then we can use this file, but if not, then we need to fallback to the old file. Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
Diffstat (limited to 'libkmod/libkmod.c')
-rw-r--r--libkmod/libkmod.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 69fe431..c9d9e2a 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -57,6 +57,7 @@ static struct _index_files {
[KMOD_INDEX_MODULES_DEP] = { .fn = "modules.dep", .prefix = "" },
[KMOD_INDEX_MODULES_ALIAS] = { .fn = "modules.alias", .prefix = "alias " },
[KMOD_INDEX_MODULES_SYMBOL] = { .fn = "modules.symbols", .prefix = "alias "},
+ [KMOD_INDEX_MODULES_BUILTIN_ALIAS] = { .fn = "modules.builtin.alias", .prefix = "" },
[KMOD_INDEX_MODULES_BUILTIN] = { .fn = "modules.builtin", .prefix = ""},
};
@@ -522,6 +523,30 @@ static char *lookup_builtin_file(struct kmod_ctx *ctx, const char *name)
return line;
}
+int kmod_lookup_alias_from_kernel_builtin_file(struct kmod_ctx *ctx,
+ const char *name,
+ struct kmod_list **list)
+{
+ struct kmod_list *l;
+ int ret = kmod_lookup_alias_from_alias_bin(ctx,
+ KMOD_INDEX_MODULES_BUILTIN_ALIAS,
+ name, list);
+ if (ret > 0) {
+ kmod_list_foreach(l, *list) {
+ struct kmod_module *mod = l->data;
+ kmod_module_set_builtin(mod, true);
+ }
+ } else if (ret == -ENOSYS) {
+ /*
+ * If the system does not support this yet, then
+ * there is no need to return an error.
+ */
+ ret = 0;
+ }
+
+ return ret;
+}
+
int kmod_lookup_alias_from_builtin_file(struct kmod_ctx *ctx, const char *name,
struct kmod_list **list)
{