Implement a new type of zfs receive: corrective receive (-c)
[zfs.git] / config / kernel-timer.m4
blob403cff3f41897c894e1e821364dca90c6e26baec
1 dnl # 4.14-rc3 API change
2 dnl # https://lwn.net/Articles/735887/
3 dnl #
4 dnl # Check if timer_list.func get passed a timer_list or an unsigned long
5 dnl # (older kernels).  Also sanity check the from_timer() and timer_setup()
6 dnl # macros are available as well, since they will be used in the same newer
7 dnl # kernels that support the new timer_list.func signature.
8 dnl #
9 dnl # Also check for the existence of flags in struct timer_list, they were
10 dnl # added in 4.1-rc8 via 0eeda71bc30d.
11 dnl #
12 AC_DEFUN([ZFS_AC_KERNEL_SRC_TIMER_SETUP], [
13         ZFS_LINUX_TEST_SRC([timer_setup], [
14                 #include <linux/timer.h>
16                 struct my_task_timer {
17                         struct timer_list timer;
18                         int data;
19                 };
21                 void task_expire(struct timer_list *tl)
22                 {
23                         struct my_task_timer *task_timer =
24                             from_timer(task_timer, tl, timer);
25                         task_timer->data = 42;
26                 }
27         ],[
28                 struct my_task_timer task_timer;
29                 timer_setup(&task_timer.timer, task_expire, 0);
30         ])
32         ZFS_LINUX_TEST_SRC([timer_list_function], [
33                 #include <linux/timer.h>
34                 void task_expire(struct timer_list *tl) {}
35         ],[
36                 struct timer_list tl;
37                 tl.function = task_expire;
38         ])
40         ZFS_LINUX_TEST_SRC([timer_list_flags], [
41                 #include <linux/timer.h>
42         ],[
43                 struct timer_list tl;
44                 tl.flags = 2;
45         ])
48 AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
49         AC_MSG_CHECKING([whether timer_setup() is available])
50         ZFS_LINUX_TEST_RESULT([timer_setup], [
51                 AC_MSG_RESULT(yes)
52                 AC_DEFINE(HAVE_KERNEL_TIMER_SETUP, 1,
53                     [timer_setup() is available])
54         ],[
55                 AC_MSG_RESULT(no)
56         ])
58         AC_MSG_CHECKING([whether timer function expects timer_list])
59         ZFS_LINUX_TEST_RESULT([timer_list_function], [
60                 AC_MSG_RESULT(yes)
61                 AC_DEFINE(HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST, 1,
62                     [timer_list.function gets a timer_list])
63         ],[
64                 AC_MSG_RESULT(no)
65         ])
67         AC_MSG_CHECKING([whether struct timer_list has flags])
68         ZFS_LINUX_TEST_RESULT([timer_list_flags], [
69                 AC_MSG_RESULT(yes)
70                 AC_DEFINE(HAVE_KERNEL_TIMER_LIST_FLAGS, 1,
71                     [struct timer_list has a flags member])
72         ],[
73                 AC_MSG_RESULT(no)
74         ])