]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-wait.m4
ztest: use ASSERT3P to compare pointers
[FreeBSD/FreeBSD.git] / config / kernel-wait.m4
1 dnl #
2 dnl # 4.13 API change
3 dnl # Renamed struct wait_queue -> struct wait_queue_entry.
4 dnl #
5 dnl # N.B. The type check is performed before all other checks
6 dnl # since ZFS_AC_KERNEL_SRC_WAIT_QUEUE_HEAD_ENTRY depends on
7 dnl # HAVE_WAIT_QUEUE_ENTRY_T being set in confdefs.h.
8 dnl #
9 AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T], [
10         AC_MSG_CHECKING([whether wait_queue_entry_t exists])
11         ZFS_LINUX_TRY_COMPILE([
12                 #include <linux/wait.h>
13         ],[
14                 wait_queue_entry_t *entry __attribute__ ((unused));
15         ],[
16                 AC_MSG_RESULT(yes)
17                 AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_T, 1,
18                     [wait_queue_entry_t exists])
19         ],[
20                 AC_MSG_RESULT(no)
21         ])
22 ])
23
24 dnl #
25 dnl # 3.17 API change,
26 dnl # wait_on_bit() no longer requires an action argument. The former
27 dnl # "wait_on_bit" interface required an 'action' function to be provided
28 dnl # which does the actual waiting. There were over 20 such functions in the
29 dnl # kernel, many of them identical, though most cases can be satisfied by one
30 dnl # of just two functions: one which uses io_schedule() and one which just
31 dnl # uses schedule().  This API change was made to consolidate all of those
32 dnl # redundant wait functions.
33 dnl #
34 AC_DEFUN([ZFS_AC_KERNEL_SRC_WAIT_ON_BIT], [
35         ZFS_LINUX_TEST_SRC([wait_on_bit], [
36                 #include <linux/wait.h>
37         ],[
38                 int (*action)(void *) = NULL;
39                 wait_on_bit(NULL, 0, action, 0);
40         ])
41 ])
42
43 AC_DEFUN([ZFS_AC_KERNEL_WAIT_ON_BIT], [
44         AC_MSG_CHECKING([whether wait_on_bit() takes an action])
45         ZFS_LINUX_TEST_RESULT([wait_on_bit], [
46                 AC_MSG_RESULT(yes)
47                 AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])
48         ],[
49                 AC_MSG_RESULT(no)
50         ])
51 ])
52
53 dnl #
54 dnl # 4.13 API change
55 dnl # Renamed wait_queue_head::task_list -> wait_queue_head::head
56 dnl # Renamed wait_queue_entry::task_list -> wait_queue_entry::entry
57 dnl #
58 AC_DEFUN([ZFS_AC_KERNEL_SRC_WAIT_QUEUE_HEAD_ENTRY], [
59         ZFS_LINUX_TEST_SRC([wait_queue_head_entry], [
60                 #include <linux/wait.h>
61
62                 #ifdef HAVE_WAIT_QUEUE_ENTRY_T
63                 typedef wait_queue_head_t       spl_wait_queue_head_t;
64                 typedef wait_queue_entry_t      spl_wait_queue_entry_t;
65                 #else
66                 typedef wait_queue_head_t       spl_wait_queue_head_t;
67                 typedef wait_queue_t            spl_wait_queue_entry_t;
68                 #endif
69         ],[
70                 spl_wait_queue_head_t wq_head;
71                 spl_wait_queue_entry_t wq_entry;
72                 struct list_head *head __attribute__ ((unused));
73                 struct list_head *entry __attribute__ ((unused));
74
75                 head = &wq_head.head;
76                 entry = &wq_entry.entry;
77         ])
78 ])
79
80 AC_DEFUN([ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY], [
81         AC_MSG_CHECKING([whether wq_head->head and wq_entry->entry exist])
82         ZFS_LINUX_TEST_RESULT([wait_queue_head_entry], [
83                 AC_MSG_RESULT(yes)
84                 AC_DEFINE(HAVE_WAIT_QUEUE_HEAD_ENTRY, 1,
85                     [wq_head->head and wq_entry->entry exist])
86         ],[
87                 AC_MSG_RESULT(no)
88         ])
89 ])
90
91 AC_DEFUN([ZFS_AC_KERNEL_SRC_WAIT], [
92         ZFS_AC_KERNEL_SRC_WAIT_ON_BIT
93         ZFS_AC_KERNEL_SRC_WAIT_QUEUE_HEAD_ENTRY
94 ])
95
96 AC_DEFUN([ZFS_AC_KERNEL_WAIT], [
97         ZFS_AC_KERNEL_WAIT_ON_BIT
98         ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
99 ])