xref: /freebsd/sys/contrib/openzfs/config/kernel-make-request-fn.m4 (revision e2eeea75eb8b6dd50c1298067a0655880d186734)
1dnl #
2dnl # Check for make_request_fn interface.
3dnl #
4AC_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	])
12
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	])
20
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	])
29
30	ZFS_LINUX_TEST_SRC([block_device_operations_submit_bio], [
31		#include <linux/blkdev.h>
32	],[
33		struct block_device_operations o;
34		o.submit_bio = NULL;
35	])
36])
37
38AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
39	dnl # Checked as part of the blk_alloc_queue_request_fn test
40	dnl #
41	dnl # Linux 5.9 API Change
42	dnl # make_request_fn was moved into block_device_operations->submit_bio
43	dnl #
44	AC_MSG_CHECKING([whether submit_bio is member of struct block_device_operations])
45	ZFS_LINUX_TEST_RESULT([block_device_operations_submit_bio], [
46		AC_MSG_RESULT(yes)
47
48		AC_DEFINE(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS, 1,
49		    [submit_bio is member of struct block_device_operations])
50		],[
51		dnl # Checked as part of the blk_alloc_queue_request_fn test
52		dnl #
53		dnl # Linux 5.7 API Change
54		dnl # blk_alloc_queue() expects request function.
55		dnl #
56		AC_MSG_CHECKING([whether blk_alloc_queue() expects request function])
57		ZFS_LINUX_TEST_RESULT([blk_alloc_queue_request_fn], [
58			AC_MSG_CHECKING([whether make_request_fn() returns blk_qc_t])
59			AC_MSG_RESULT(yes)
60
61			AC_DEFINE(HAVE_BLK_ALLOC_QUEUE_REQUEST_FN, 1,
62			    [blk_alloc_queue() expects request function])
63			AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
64			    [make_request_fn() return type])
65			AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
66			    [Noting that make_request_fn() returns blk_qc_t])
67		],[
68			dnl #
69			dnl # Linux 3.2 API Change
70			dnl # make_request_fn returns void.
71			dnl #
72			AC_MSG_CHECKING([whether make_request_fn() returns void])
73			ZFS_LINUX_TEST_RESULT([make_request_fn_void], [
74				AC_MSG_RESULT(yes)
75				AC_DEFINE(MAKE_REQUEST_FN_RET, void,
76				    [make_request_fn() return type])
77				AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_VOID, 1,
78				    [Noting that make_request_fn() returns void])
79			],[
80				AC_MSG_RESULT(no)
81
82				dnl #
83				dnl # Linux 4.4 API Change
84				dnl # make_request_fn returns blk_qc_t.
85				dnl #
86				AC_MSG_CHECKING(
87				    [whether make_request_fn() returns blk_qc_t])
88				ZFS_LINUX_TEST_RESULT([make_request_fn_blk_qc_t], [
89					AC_MSG_RESULT(yes)
90					AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
91					    [make_request_fn() return type])
92					AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
93					    [Noting that make_request_fn() ]
94					    [returns blk_qc_t])
95				],[
96					ZFS_LINUX_TEST_ERROR([make_request_fn])
97				])
98			])
99		])
100	])
101])
102