zdb: remove strtok
[zfs.git] / config / kernel-make-request-fn.m4
blob290ef6b8da7d9449cec40d16980f2f26d8091dc8
1 dnl #
2 dnl # Check for make_request_fn interface.
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
5         ZFS_LINUX_TEST_SRC([make_request_fn_void], [
6                 #include <linux/blkdev.h>
7                 void make_request(struct request_queue *q,
8                     struct bio *bio) { return; }
9         ],[
10                 blk_queue_make_request(NULL, &make_request);
11         ])
13         ZFS_LINUX_TEST_SRC([make_request_fn_blk_qc_t], [
14                 #include <linux/blkdev.h>
15                 blk_qc_t make_request(struct request_queue *q,
16                     struct bio *bio) { return (BLK_QC_T_NONE); }
17         ],[
18                 blk_queue_make_request(NULL, &make_request);
19         ])
21         ZFS_LINUX_TEST_SRC([blk_alloc_queue_request_fn], [
22                 #include <linux/blkdev.h>
23                 blk_qc_t make_request(struct request_queue *q,
24                     struct bio *bio) { return (BLK_QC_T_NONE); }
25         ],[
26                 struct request_queue *q __attribute__ ((unused));
27                 q = blk_alloc_queue(make_request, NUMA_NO_NODE);
28         ])
30         ZFS_LINUX_TEST_SRC([blk_alloc_queue_request_fn_rh], [
31                 #include <linux/blkdev.h>
32                 blk_qc_t make_request(struct request_queue *q,
33                     struct bio *bio) { return (BLK_QC_T_NONE); }
34         ],[
35                 struct request_queue *q __attribute__ ((unused));
36                 q = blk_alloc_queue_rh(make_request, NUMA_NO_NODE);
37         ])
39         ZFS_LINUX_TEST_SRC([block_device_operations_submit_bio], [
40                 #include <linux/blkdev.h>
41         ],[
42                 struct block_device_operations o;
43                 o.submit_bio = NULL;
44         ])
47 AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
48         dnl # Checked as part of the blk_alloc_queue_request_fn test
49         dnl #
50         dnl # Linux 5.9 API Change
51         dnl # make_request_fn was moved into block_device_operations->submit_bio
52         dnl #
53         AC_MSG_CHECKING([whether submit_bio is member of struct block_device_operations])
54         ZFS_LINUX_TEST_RESULT([block_device_operations_submit_bio], [
55                 AC_MSG_RESULT(yes)
57                 AC_DEFINE(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS, 1,
58                     [submit_bio is member of struct block_device_operations])
59         ],[
60                 AC_MSG_RESULT(no)
62                 dnl # Checked as part of the blk_alloc_queue_request_fn test
63                 dnl #
64                 dnl # Linux 5.7 API Change
65                 dnl # blk_alloc_queue() expects request function.
66                 dnl #
67                 AC_MSG_CHECKING([whether blk_alloc_queue() expects request function])
68                 ZFS_LINUX_TEST_RESULT([blk_alloc_queue_request_fn], [
69                         AC_MSG_RESULT(yes)
71                         dnl # This is currently always the case.
72                         AC_MSG_CHECKING([whether make_request_fn() returns blk_qc_t])
73                         AC_MSG_RESULT(yes)
75                         AC_DEFINE(HAVE_BLK_ALLOC_QUEUE_REQUEST_FN, 1,
76                             [blk_alloc_queue() expects request function])
77                         AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
78                             [make_request_fn() return type])
79                         AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
80                             [Noting that make_request_fn() returns blk_qc_t])
81                 ],[
82                         dnl #
83                         dnl # CentOS Stream 4.18.0-257 API Change
84                         dnl # The Linux 5.7 blk_alloc_queue() change was back-
85                         dnl # ported and the symbol renamed blk_alloc_queue_rh().
86                         dnl # As of this kernel version they're not providing
87                         dnl # any compatibility code in the kernel for this.
88                         dnl #
89                         ZFS_LINUX_TEST_RESULT([blk_alloc_queue_request_fn_rh], [
90                                 AC_MSG_RESULT(yes)
92                                 dnl # This is currently always the case.
93                                 AC_MSG_CHECKING([whether make_request_fn_rh() returns blk_qc_t])
94                                 AC_MSG_RESULT(yes)
96                                 AC_DEFINE(HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH, 1,
97                                     [blk_alloc_queue_rh() expects request function])
98                                 AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
99                                     [make_request_fn() return type])
100                                 AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
101                                     [Noting that make_request_fn() returns blk_qc_t])
102                         ],[
103                                 AC_MSG_RESULT(no)
105                                 dnl #
106                                 dnl # Linux 3.2 API Change
107                                 dnl # make_request_fn returns void.
108                                 dnl #
109                                 AC_MSG_CHECKING(
110                                     [whether make_request_fn() returns void])
111                                 ZFS_LINUX_TEST_RESULT([make_request_fn_void], [
112                                         AC_MSG_RESULT(yes)
113                                         AC_DEFINE(MAKE_REQUEST_FN_RET, void,
114                                             [make_request_fn() return type])
115                                         AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_VOID, 1,
116                                             [Noting that make_request_fn() returns void])
117                                 ],[
118                                         AC_MSG_RESULT(no)
120                                         dnl #
121                                         dnl # Linux 4.4 API Change
122                                         dnl # make_request_fn returns blk_qc_t.
123                                         dnl #
124                                         AC_MSG_CHECKING(
125                                             [whether make_request_fn() returns blk_qc_t])
126                                         ZFS_LINUX_TEST_RESULT([make_request_fn_blk_qc_t], [
127                                                 AC_MSG_RESULT(yes)
128                                                 AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
129                                                     [make_request_fn() return type])
130                                                 AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
131                                                     [Noting that make_request_fn() ]
132                                                     [returns blk_qc_t])
133                                         ],[
134                                                 ZFS_LINUX_TEST_ERROR([make_request_fn])
135                                         ])
136                                 ])
137                         ])
138                 ])
139         ])