]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: rename kmod_elf_get_strings()
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 23 Oct 2024 23:37:31 +0000 (00:37 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 15 Nov 2024 16:03:46 +0000 (10:03 -0600)
Rename kmod_elf_get_strings() to kmod_elf_get_modinfo_strings() and fold
the section name within, instead of passing it as an argument.

This aligns better with the other kmod_elf function names and will allow
us to tweak the kmod_elf_get_section() handling with later commit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/210
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-elf.c
libkmod/libkmod-internal.h
libkmod/libkmod-module.c

index 7c2891f1fa0304d88940f9735b5108d9257634ac..d2b91438c03287de7446bbb2c2268978c906a602 100644 (file)
@@ -383,7 +383,7 @@ int kmod_elf_get_section(const struct kmod_elf *elf, const char *section,
 }
 
 /* array will be allocated with strings in a single malloc, just free *array */
-int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char ***array)
+int kmod_elf_get_modinfo_strings(const struct kmod_elf *elf, char ***array)
 {
        size_t i, j, count;
        size_t tmp_size, vec_size, total_size;
@@ -394,7 +394,7 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char *
 
        *array = NULL;
 
-       err = kmod_elf_get_section(elf, section, &off, &size);
+       err = kmod_elf_get_section(elf, ".modinfo", &off, &size);
        if (err < 0)
                return err;
 
index 66c922caab603f0bb73867ed5803a22cccf97e0d..3ecf9458c52ced15e45e1d016c4639d2c4e51ce4 100644 (file)
@@ -151,7 +151,7 @@ struct kmod_modversion {
 struct kmod_elf *kmod_elf_new(const void *memory, off_t size);
 _nonnull_all_ void kmod_elf_unref(struct kmod_elf *elf);
 _must_check_ _nonnull_all_ const void *kmod_elf_get_memory(const struct kmod_elf *elf);
-_must_check_ _nonnull_all_ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char ***array);
+_must_check_ _nonnull_all_ int kmod_elf_get_modinfo_strings(const struct kmod_elf *elf, char ***array);
 _must_check_ _nonnull_all_ int kmod_elf_get_modversions(const struct kmod_elf *elf, struct kmod_modversion **array);
 _must_check_ _nonnull_all_ int kmod_elf_get_symbols(const struct kmod_elf *elf, struct kmod_modversion **array);
 _must_check_ _nonnull_all_ int kmod_elf_get_dependency_symbols(const struct kmod_elf *elf, struct kmod_modversion **array);
index eb5861cf1c680282da60ed4883ae5404a484de8c..8b7a056b6ab1bda416949b24ef6c50ede995b720 100644 (file)
@@ -1876,7 +1876,7 @@ KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod,
                if (elf == NULL)
                        return -errno;
 
-               count = kmod_elf_get_strings(elf, ".modinfo", &strings);
+               count = kmod_elf_get_modinfo_strings(elf, &strings);
                if (count < 0)
                        return count;
        }