ZAP: Add by_dnode variants to lookup/prefetch_uint64
[zfs.git] / config / kernel-register_sysctl_table.m4
blob12ffe9d95142d309694db3091c3a79e050615510
1 dnl #
2 dnl # Linux 6.5 removes register_sysctl_table
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_TABLE], [
5         ZFS_LINUX_TEST_SRC([has_register_sysctl_table], [
6                 #include <linux/sysctl.h>
8                 static struct ctl_table dummy_table[] = {
9                         {}
10                 };
12     ],[
13                 struct ctl_table_header *h
14                         __attribute((unused)) = register_sysctl_table(dummy_table);
15     ])
18 AC_DEFUN([ZFS_AC_KERNEL_REGISTER_SYSCTL_TABLE], [
19         AC_MSG_CHECKING([whether register_sysctl_table exists])
20         ZFS_LINUX_TEST_RESULT([has_register_sysctl_table], [
21                 AC_MSG_RESULT([yes])
22                 AC_DEFINE(HAVE_REGISTER_SYSCTL_TABLE, 1,
23                         [register_sysctl_table exists])
24         ],[
25                 AC_MSG_RESULT([no])
26         ])
29 dnl #
30 dnl # Linux 6.11 register_sysctl() enforces that sysctl tables no longer
31 dnl # supply a sentinel end-of-table element. 6.6 introduces
32 dnl # register_sysctl_sz() to enable callers to choose, so we use it if
33 dnl # available for backward compatibility.
34 dnl #
35 AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_SZ], [
36         ZFS_LINUX_TEST_SRC([has_register_sysctl_sz], [
37                 #include <linux/sysctl.h>
38         ],[
39                 struct ctl_table test_table[] __attribute__((unused)) = {0};
40                 register_sysctl_sz("", test_table, 0);
41         ])
44 AC_DEFUN([ZFS_AC_KERNEL_REGISTER_SYSCTL_SZ], [
45         AC_MSG_CHECKING([whether register_sysctl_sz exists])
46         ZFS_LINUX_TEST_RESULT([has_register_sysctl_sz], [
47                 AC_MSG_RESULT([yes])
48                 AC_DEFINE(HAVE_REGISTER_SYSCTL_SZ, 1,
49                         [register_sysctl_sz exists])
50         ],[
51                 AC_MSG_RESULT([no])
52         ])
55 dnl #
56 dnl # Linux 6.11 makes const the ctl_table arg of proc_handler
57 dnl #
58 AC_DEFUN([ZFS_AC_KERNEL_SRC_PROC_HANDLER_CTL_TABLE_CONST], [
59         ZFS_LINUX_TEST_SRC([has_proc_handler_ctl_table_const], [
60                 #include <linux/sysctl.h>
62                 static int test_handler(
63                     const struct ctl_table *ctl __attribute((unused)),
64                     int write __attribute((unused)),
65                     void *buffer __attribute((unused)),
66                     size_t *lenp __attribute((unused)),
67                     loff_t *ppos __attribute((unused)))
68                 {
69                         return (0);
70                 }
71         ], [
72                 proc_handler *ph __attribute((unused)) =
73                     &test_handler;
74         ])
77 AC_DEFUN([ZFS_AC_KERNEL_PROC_HANDLER_CTL_TABLE_CONST], [
78         AC_MSG_CHECKING([whether proc_handler ctl_table arg is const])
79         ZFS_LINUX_TEST_RESULT([has_proc_handler_ctl_table_const], [
80                 AC_MSG_RESULT([yes])
81                 AC_DEFINE(HAVE_PROC_HANDLER_CTL_TABLE_CONST, 1,
82                     [proc_handler ctl_table arg is const])
83         ], [
84                 AC_MSG_RESULT([no])
85         ])