From: Emil Velikov Date: Wed, 23 Oct 2024 23:37:31 +0000 (+0100) Subject: libkmod: rename kmod_elf_get_strings() X-Git-Tag: v34~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9099346ce99f23689a26759bcc77d5dda9fd4557;p=thirdparty%2Fkmod.git libkmod: rename kmod_elf_get_strings() 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 Reviewed-by: Tobias Stoeckmann Link: https://github.com/kmod-project/kmod/pull/210 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 7c2891f1..d2b91438 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -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; diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h index 66c922ca..3ecf9458 100644 --- a/libkmod/libkmod-internal.h +++ b/libkmod/libkmod-internal.h @@ -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); diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index eb5861cf..8b7a056b 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -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; }