summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2022-02-09 18:21:03 -0800
committerLucas De Marchi <lucas.demarchi@intel.com>2022-02-11 22:06:33 -0800
commita965641625dab1688b202e1f8b8b52497d75eeb1 (patch)
treebedc5f6a010a9f1b82a8f15074acf3b2061da5a0
parent4e391ac92d1b9a2c8c0e9d8735d2913ee86c0ad8 (diff)
downloadkmod-a965641625dab1688b202e1f8b8b52497d75eeb1.tar.gz
kmod-a965641625dab1688b202e1f8b8b52497d75eeb1.tar.bz2
kmod-a965641625dab1688b202e1f8b8b52497d75eeb1.zip
libkmod: Prefer builtin index over builtin.alias
The modules.builtin.alias.bin is way larger than the modules.builtin.bin. On a normal "distro kernel": 21k modules.builtin.alias.bin 11k modules.builtin.bin From the kernel we get both modules.builtin and modules.builtin.modinfo. depmod generates modules.builtin.bin and modules.builtin.alias.bin from them respectively. modules.bultin is not going away: it's not deprecated by the new index added. So, let's just stop duplicating the information inside modules.builtin.alias.bin and just use the other index.
-rw-r--r--libkmod/libkmod-module.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 6f7747c..6423339 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -576,13 +576,15 @@ KMOD_EXPORT int kmod_module_new_from_lookup(struct kmod_ctx *ctx,
err = kmod_lookup_alias_from_aliases_file(ctx, alias, list);
CHECK_ERR_AND_FINISH(err, fail, list, finish);
+ DBG(ctx, "lookup modules.builtin %s\n", alias);
+ err = kmod_lookup_alias_from_builtin_file(ctx, alias, list);
+ CHECK_ERR_AND_FINISH(err, fail, list, finish);
+
DBG(ctx, "lookup modules.builtin.modinfo %s\n", alias);
err = kmod_lookup_alias_from_kernel_builtin_file(ctx, alias, list);
- if (err == -ENOSYS) {
- /* Optional index missing, try the old one */
- DBG(ctx, "lookup modules.builtin %s\n", alias);
- err = kmod_lookup_alias_from_builtin_file(ctx, alias, list);
- }
+ /* Optional index missing, ignore */
+ if (err == -ENOSYS)
+ err = 0;
CHECK_ERR_AND_FINISH(err, fail, list, finish);