From d469acd4d505f9ea76dbead86c58274fa5711fd6 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 22 Aug 2024 17:04:21 +0100 Subject: [PATCH] build: remove linux/module.h check We include the header for the UAPI MODULE_INIT_* constants, while we also provide them locally. At a glance, at least Arch and Alpine build kmod without the uapi header, so just drop the check and ifndef guards all together. Signed-off-by: Emil Velikov Reviewed-by: Lucas De Marchi Link: https://github.com/kmod-project/kmod/pull/86 Signed-off-by: Lucas De Marchi --- configure.ac | 3 --- libkmod/libkmod-module.c | 3 --- shared/missing.h | 26 +++++++++++--------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 62781470..5396436d 100644 --- a/configure.ac +++ b/configure.ac @@ -55,9 +55,6 @@ AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include ]) # not desired here AC_CHECK_DECLS_ONCE([[strndupa], [basename]], [], [], [[#include ]]) -# Check kernel headers -AC_CHECK_HEADERS_ONCE([linux/module.h]) - AC_MSG_CHECKING([whether _Static_assert() is supported]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[_Static_assert(1, "Test");]])], diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index c23159fb..9cfc8017 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -21,9 +21,6 @@ #include #include #include -#ifdef HAVE_LINUX_MODULE_H -#include -#endif #include diff --git a/shared/missing.h b/shared/missing.h index 137c9a9f..86caf80a 100644 --- a/shared/missing.h +++ b/shared/missing.h @@ -3,21 +3,17 @@ #include #include -#ifdef HAVE_LINUX_MODULE_H -#include -#endif - -#ifndef MODULE_INIT_IGNORE_MODVERSIONS -# define MODULE_INIT_IGNORE_MODVERSIONS 1 -#endif - -#ifndef MODULE_INIT_IGNORE_VERMAGIC -# define MODULE_INIT_IGNORE_VERMAGIC 2 -#endif - -#ifndef MODULE_INIT_COMPRESSED_FILE -# define MODULE_INIT_COMPRESSED_FILE 4 -#endif +/* + * Macros pulled from linux/module.h, to avoid pulling the header. + * + * In practise very few people have it installed and distros do not install the + * relevant package during their build. + * + * Values are UAPI, so they cannot change. + */ +#define MODULE_INIT_IGNORE_MODVERSIONS 1 +#define MODULE_INIT_IGNORE_VERMAGIC 2 +#define MODULE_INIT_COMPRESSED_FILE 4 #ifndef __NR_finit_module # warning __NR_finit_module missing - kmod might not work correctly -- 2.47.3