From: Emil Velikov Date: Thu, 29 May 2025 14:31:36 +0000 (+0100) Subject: libkmod: add TODO for module hashkey handling X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=52e20d50a6109c00a9723b6f61e77a7f2f114939;p=thirdparty%2Fkmod.git libkmod: add TODO for module hashkey handling We currently "leak" the hashkey handling in a few places. As result we ignore the name passed to kmod_module_new(). Add a TODO entry and silence the unused parameter compiler warning. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/361 Signed-off-by: Lucas De Marchi --- diff --git a/.clang-format b/.clang-format index cd25560b..fba64f87 100644 --- a/.clang-format +++ b/.clang-format @@ -85,6 +85,7 @@ AttributeMacros: - _clang_suppress_alloc_ - _cleanup_ - _cleanup_free_ + - _maybe_unused_ - _must_check_ - _nonnull_ - _nonnull_all_ diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index fca6a10d..045822a4 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -232,9 +232,11 @@ bool kmod_module_is_builtin(struct kmod_module *mod) * * @key is "name\alias" or "name" (in which case alias == NULL) */ -static int kmod_module_new(struct kmod_ctx *ctx, const char *key, const char *name, - size_t namelen, const char *alias, size_t aliaslen, - struct kmod_module **mod) +/* TODO: rework to create the hash within this function and remove the _maybe_unused_ + * workaround */ +static int kmod_module_new(struct kmod_ctx *ctx, const char *key, + _maybe_unused_ const char *name, size_t namelen, + const char *alias, size_t aliaslen, struct kmod_module **mod) { struct kmod_module *m; size_t keylen; diff --git a/shared/macro.h b/shared/macro.h index a469db73..0ad5fddc 100644 --- a/shared/macro.h +++ b/shared/macro.h @@ -41,6 +41,7 @@ /* Attributes */ +#define _maybe_unused_ __attribute__((unused)) #define _must_check_ __attribute__((warn_unused_result)) #define _printf_format_(a, b) __attribute__((format(printf, a, b))) #define _always_inline_ __inline__ __attribute__((always_inline))