2 dnl # 2.6.38 API change,
3 dnl # Added blkdev_get_by_path()
5 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [
6 ZFS_LINUX_TEST_SRC([blkdev_get_by_path], [
8 #include <linux/blkdev.h>
10 struct block_device *bdev __attribute__ ((unused)) = NULL;
11 const char *path = "path";
15 bdev = blkdev_get_by_path(path, mode, holder);
19 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [
20 AC_MSG_CHECKING([whether blkdev_get_by_path() exists])
21 ZFS_LINUX_TEST_RESULT([blkdev_get_by_path], [
24 ZFS_LINUX_TEST_ERROR([blkdev_get_by_path()])
29 dnl # 2.6.38 API change,
30 dnl # Added blkdev_put()
32 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT], [
33 ZFS_LINUX_TEST_SRC([blkdev_put], [
35 #include <linux/blkdev.h>
37 struct block_device *bdev = NULL;
40 blkdev_put(bdev, mode);
44 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_PUT], [
45 AC_MSG_CHECKING([whether blkdev_put() exists])
46 ZFS_LINUX_TEST_RESULT([blkdev_put], [
49 ZFS_LINUX_TEST_ERROR([blkdev_put()])
54 dnl # 4.1 API, exported blkdev_reread_part() symbol, back ported to the
55 dnl # 3.10.0 CentOS 7.x enterprise kernels.
57 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART], [
58 ZFS_LINUX_TEST_SRC([blkdev_reread_part], [
60 #include <linux/blkdev.h>
62 struct block_device *bdev = NULL;
65 error = blkdev_reread_part(bdev);
69 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [
70 AC_MSG_CHECKING([whether blkdev_reread_part() exists])
71 ZFS_LINUX_TEST_RESULT([blkdev_reread_part], [
73 AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1,
74 [blkdev_reread_part() exists])
81 dnl # check_disk_change() was removed in 5.10
83 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE], [
84 ZFS_LINUX_TEST_SRC([check_disk_change], [
86 #include <linux/blkdev.h>
88 struct block_device *bdev = NULL;
91 error = check_disk_change(bdev);
95 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE], [
96 AC_MSG_CHECKING([whether check_disk_change() exists])
97 ZFS_LINUX_TEST_RESULT([check_disk_change], [
99 AC_DEFINE(HAVE_CHECK_DISK_CHANGE, 1,
100 [check_disk_change() exists])
107 dnl # 5.10 API, check_disk_change() is removed, in favor of
108 dnl # bdev_check_media_change(), which doesn't force revalidation
110 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [
111 ZFS_LINUX_TEST_SRC([bdev_check_media_change], [
112 #include <linux/fs.h>
113 #include <linux/blkdev.h>
115 struct block_device *bdev = NULL;
118 error = bdev_check_media_change(bdev);
122 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [
123 AC_MSG_CHECKING([whether bdev_disk_changed() exists])
124 ZFS_LINUX_TEST_RESULT([bdev_check_media_change], [
126 AC_DEFINE(HAVE_BDEV_CHECK_MEDIA_CHANGE, 1,
127 [bdev_check_media_change() exists])
134 dnl # 2.6.22 API change
135 dnl # Single argument invalidate_bdev()
137 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV], [
138 ZFS_LINUX_TEST_SRC([invalidate_bdev], [
139 #include <linux/buffer_head.h>
140 #include <linux/blkdev.h>
142 struct block_device *bdev = NULL;
143 invalidate_bdev(bdev);
147 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV], [
148 AC_MSG_CHECKING([whether invalidate_bdev() exists])
149 ZFS_LINUX_TEST_RESULT([invalidate_bdev], [
152 ZFS_LINUX_TEST_ERROR([invalidate_bdev()])
157 dnl # 5.11 API, lookup_bdev() takes dev_t argument.
158 dnl # 2.6.27 API, lookup_bdev() was first exported.
159 dnl # 4.4.0-6.21 API, lookup_bdev() on Ubuntu takes mode argument.
161 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV], [
162 ZFS_LINUX_TEST_SRC([lookup_bdev_devt], [
163 #include <linux/blkdev.h>
165 int error __attribute__ ((unused));
166 const char path[] = "/example/path";
169 error = lookup_bdev(path, &dev);
172 ZFS_LINUX_TEST_SRC([lookup_bdev_1arg], [
173 #include <linux/fs.h>
174 #include <linux/blkdev.h>
176 struct block_device *bdev __attribute__ ((unused));
177 const char path[] = "/example/path";
179 bdev = lookup_bdev(path);
182 ZFS_LINUX_TEST_SRC([lookup_bdev_mode], [
183 #include <linux/fs.h>
185 struct block_device *bdev __attribute__ ((unused));
186 const char path[] = "/example/path";
188 bdev = lookup_bdev(path, FMODE_READ);
192 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV], [
193 AC_MSG_CHECKING([whether lookup_bdev() wants dev_t arg])
194 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_devt],
195 [lookup_bdev], [fs/block_dev.c], [
197 AC_DEFINE(HAVE_DEVT_LOOKUP_BDEV, 1,
198 [lookup_bdev() wants dev_t arg])
202 AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg])
203 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg],
204 [lookup_bdev], [fs/block_dev.c], [
206 AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1,
207 [lookup_bdev() wants 1 arg])
211 AC_MSG_CHECKING([whether lookup_bdev() wants mode arg])
212 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_mode],
213 [lookup_bdev], [fs/block_dev.c], [
215 AC_DEFINE(HAVE_MODE_LOOKUP_BDEV, 1,
216 [lookup_bdev() wants mode arg])
218 ZFS_LINUX_TEST_ERROR([lookup_bdev()])
225 dnl # 2.6.30 API change
227 dnl # The bdev_physical_block_size() interface was added to provide a way
228 dnl # to determine the smallest write which can be performed without a
229 dnl # read-modify-write operation.
231 dnl # Unfortunately, this interface isn't entirely reliable because
232 dnl # drives are sometimes known to misreport this value.
234 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [
235 ZFS_LINUX_TEST_SRC([bdev_physical_block_size], [
236 #include <linux/blkdev.h>
238 struct block_device *bdev __attribute__ ((unused)) = NULL;
239 bdev_physical_block_size(bdev);
243 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [
244 AC_MSG_CHECKING([whether bdev_physical_block_size() is available])
245 ZFS_LINUX_TEST_RESULT([bdev_physical_block_size], [
248 ZFS_LINUX_TEST_ERROR([bdev_physical_block_size()])
253 dnl # 2.6.30 API change
254 dnl # Added bdev_logical_block_size().
256 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [
257 ZFS_LINUX_TEST_SRC([bdev_logical_block_size], [
258 #include <linux/blkdev.h>
260 struct block_device *bdev __attribute__ ((unused)) = NULL;
261 bdev_logical_block_size(bdev);
265 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [
266 AC_MSG_CHECKING([whether bdev_logical_block_size() is available])
267 ZFS_LINUX_TEST_RESULT([bdev_logical_block_size], [
270 ZFS_LINUX_TEST_ERROR([bdev_logical_block_size()])
275 dnl # 5.11 API change
276 dnl # Added bdev_whole() helper.
278 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE], [
279 ZFS_LINUX_TEST_SRC([bdev_whole], [
280 #include <linux/blkdev.h>
282 struct block_device *bdev = NULL;
283 bdev = bdev_whole(bdev);
287 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE], [
288 AC_MSG_CHECKING([whether bdev_whole() is available])
289 ZFS_LINUX_TEST_RESULT([bdev_whole], [
291 AC_DEFINE(HAVE_BDEV_WHOLE, 1, [bdev_whole() is available])
297 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
298 ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH
299 ZFS_AC_KERNEL_SRC_BLKDEV_PUT
300 ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART
301 ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV
302 ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV
303 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE
304 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE
305 ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE
306 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
307 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE
310 AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
311 ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
312 ZFS_AC_KERNEL_BLKDEV_PUT
313 ZFS_AC_KERNEL_BLKDEV_REREAD_PART
314 ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV
315 ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV
316 ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE
317 ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE
318 ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE
319 ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
320 ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE