summarylogtreecommitdiffstats
path: root/0007-cf-Introduce-AC_CHECK_LINUX_SYMBOL.patch
blob: 676b7747362863a410cae02870d27c2abb29f5ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 0b2ef666cadb356edfc202313218d10f3215c8bd Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 9 May 2025 14:45:31 -0600
Subject: [PATCH 07/10] cf: Introduce AC_CHECK_LINUX_SYMBOL

Linux 6.15 converted some #defines that are used into enums.  A #ifdef
cannot be used as a test to see if these symbols are defined.

Introduce a new autoconf test, AC_CHECK_LINUX_SYMBOL that takes a
symbol and an include and tries to assign it to an integer variable.

Add a new autoconf file, 'linux-kernel-symbol.m4' to hold the individual
tests.

Change-Id: I35fb952f222c27a1cde628268130d85c2741a3de
---
 src/cf/linux-checks.m4        |  1 +
 src/cf/linux-kernel-symbol.m4 |  3 +++
 src/cf/linux-test1.m4         | 13 +++++++++++++
 3 files changed, 17 insertions(+)
 create mode 100644 src/cf/linux-kernel-symbol.m4

diff --git a/src/cf/linux-checks.m4 b/src/cf/linux-checks.m4
index 81a015e7d..01406c4d4 100644
--- a/src/cf/linux-checks.m4
+++ b/src/cf/linux-checks.m4
@@ -41,6 +41,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
         OPENAFS_LINUX_KERNEL_SIG_CHECKS
         OPENAFS_LINUX_KERNEL_HEADER_CHECKS
         OPENAFS_LINUX_KERNEL_TYPE_CHECKS
+	OPENAFS_LINUX_KERNEL_SYMBOL_CHECKS
         OPENAFS_LINUX_KERNEL_STRUCT_CHECKS
         OPENAFS_LINUX_KERNEL_FUNC_CHECKS
         OPENAFS_LINUX_KERNEL_ASSORTED_CHECKS
diff --git a/src/cf/linux-kernel-symbol.m4 b/src/cf/linux-kernel-symbol.m4
new file mode 100644
index 000000000..5400a736a
--- /dev/null
+++ b/src/cf/linux-kernel-symbol.m4
@@ -0,0 +1,3 @@
+AC_DEFUN([OPENAFS_LINUX_KERNEL_SYMBOL_CHECKS],[
+dnl Type existence checks
+])
diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4
index 581dc10e2..25d76f484 100644
--- a/src/cf/linux-test1.m4
+++ b/src/cf/linux-test1.m4
@@ -179,6 +179,19 @@ AC_DEFUN([AC_CHECK_LINUX_TYPE],
                        [Define if kernel defines $1])
  ])
 
+dnl AC_CHECK_LINUX_SYMBOL([sym], [includes])
+dnl Linux 6.15 has started converting some defines into enums
+dnl for constants that we use, a simple #ifdef no longer works
+AC_DEFUN([AC_CHECK_LINUX_SYMBOL],
+ [AC_CHECK_LINUX_BUILD([for symbol $1],
+                       [ac_cv_linux_symbol_$1_exists],
+                       [#include <linux/$2>],
+                       [static int _test_ = $1; ],
+                       AS_TR_CPP(HAVE_LINUX_SYMBOL_$1),
+                       [Define if kernel defines symbol $1])
+ ])
+
+
 dnl AC_CHECK_LINUX_STRUCT([structure], [element], [includes])
 AC_DEFUN([AC_CHECK_LINUX_STRUCT],
  [AC_CHECK_LINUX_TYPED_STRUCT([struct $1], [$2], [$3])
-- 
2.49.0