]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: add TODO for module hashkey handling
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 29 May 2025 14:31:36 +0000 (15:31 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Wed, 11 Jun 2025 12:54:40 +0000 (07:54 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/361
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
.clang-format
libkmod/libkmod-module.c
shared/macro.h

index cd25560b3ec657395248712bd75a6e7b7cb68bca..fba64f87e03faebf7ea1b8f075fb88fc65812544 100644 (file)
@@ -85,6 +85,7 @@ AttributeMacros:
   - _clang_suppress_alloc_
   - _cleanup_
   - _cleanup_free_
+  - _maybe_unused_
   - _must_check_
   - _nonnull_
   - _nonnull_all_
index fca6a10d5acd9f81614f6a442987171661f9328a..045822a407141a661eb9a3511e79cfdefb768228 100644 (file)
@@ -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;
index a469db73fdd9f96e52060c3762a897902dd48abb..0ad5fddc640f4444917525622b3376ce8ecce977 100644 (file)
@@ -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))