1dnl #
2dnl # 4.13 API change
3dnl # Renamed struct wait_queue -> struct wait_queue_entry.
4dnl #
5dnl # N.B. The type check is performed before all other checks
6dnl # since ZFS_AC_KERNEL_SRC_WAIT_QUEUE_HEAD_ENTRY depends on
7dnl # HAVE_WAIT_QUEUE_ENTRY_T being set in confdefs.h.
8dnl #
9AC_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
24dnl #
25dnl # 3.17 API change,
26dnl # wait_on_bit() no longer requires an action argument. The former
27dnl # "wait_on_bit" interface required an 'action' function to be provided
28dnl # which does the actual waiting. There were over 20 such functions in the
29dnl # kernel, many of them identical, though most cases can be satisfied by one
30dnl # of just two functions: one which uses io_schedule() and one which just
31dnl # uses schedule().  This API change was made to consolidate all of those
32dnl # redundant wait functions.
33dnl #
34AC_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
43AC_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
53dnl #
54dnl # 4.13 API change
55dnl # Renamed wait_queue_head::task_list -> wait_queue_head::head
56dnl # Renamed wait_queue_entry::task_list -> wait_queue_entry::entry
57dnl #
58AC_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
80AC_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
91AC_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
96AC_DEFUN([ZFS_AC_KERNEL_WAIT], [
97	ZFS_AC_KERNEL_WAIT_ON_BIT
98	ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
99])
100