ztest: Fix scrub check in ztest_raidz_expand_check()
[zfs.git] / config / kernel-block-device-operations.m4
blob4ff20b9c413df01aa72ed6d9cbc5da978ad942df
1 dnl #
2 dnl # 2.6.38 API change
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
5         ZFS_LINUX_TEST_SRC([block_device_operations_check_events], [
6                 #include <linux/blkdev.h>
8                 static unsigned int blk_check_events(struct gendisk *disk,
9                     unsigned int clearing) {
10                         (void) disk, (void) clearing;
11                         return (0);
12                 }
14                 static const struct block_device_operations
15                     bops __attribute__ ((unused)) = {
16                         .check_events   = blk_check_events,
17                 };
18         ], [], [])
21 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
22         AC_MSG_CHECKING([whether bops->check_events() exists])
23         ZFS_LINUX_TEST_RESULT([block_device_operations_check_events], [
24                 AC_MSG_RESULT(yes)
25         ],[
26                 ZFS_LINUX_TEST_ERROR([bops->check_events()])
27         ])
30 dnl #
31 dnl # 3.10.x API change
32 dnl #
33 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
34         ZFS_LINUX_TEST_SRC([block_device_operations_release_void], [
35                 #include <linux/blkdev.h>
37                 static void blk_release(struct gendisk *g, fmode_t mode) {
38                         (void) g, (void) mode;
39                         return;
40                 }
42                 static const struct block_device_operations
43                     bops __attribute__ ((unused)) = {
44                         .open           = NULL,
45                         .release        = blk_release,
46                         .ioctl          = NULL,
47                         .compat_ioctl   = NULL,
48                 };
49         ], [], [])
52 dnl #
53 dnl # 5.9.x API change
54 dnl #
55 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG], [
56         ZFS_LINUX_TEST_SRC([block_device_operations_release_void_1arg], [
57                 #include <linux/blkdev.h>
59                 static void blk_release(struct gendisk *g) {
60                         (void) g;
61                         return;
62                 }
64                 static const struct block_device_operations
65                     bops __attribute__ ((unused)) = {
66                         .open           = NULL,
67                         .release        = blk_release,
68                         .ioctl          = NULL,
69                         .compat_ioctl   = NULL,
70                 };
71         ], [], [])
74 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
75         AC_MSG_CHECKING([whether bops->release() is void and takes 2 args])
76         ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [
77                 AC_MSG_RESULT(yes)
78         ],[
79                 AC_MSG_RESULT(no)
80                 AC_MSG_CHECKING([whether bops->release() is void and takes 1 arg])
81                 ZFS_LINUX_TEST_RESULT([block_device_operations_release_void_1arg], [
82                         AC_MSG_RESULT(yes)
83                         AC_DEFINE([HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG], [1],
84                                 [Define if release() in block_device_operations takes 1 arg])
85                 ],[
86                         ZFS_LINUX_TEST_ERROR([bops->release()])
87                 ])
88         ])
91 dnl #
92 dnl # 5.13 API change
93 dnl # block_device_operations->revalidate_disk() was removed
94 dnl #
95 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
96         ZFS_LINUX_TEST_SRC([block_device_operations_revalidate_disk], [
97                 #include <linux/blkdev.h>
99                 static int blk_revalidate_disk(struct gendisk *disk) {
100                         (void) disk;
101                         return(0);
102                 }
104                 static const struct block_device_operations
105                     bops __attribute__ ((unused)) = {
106                         .revalidate_disk        = blk_revalidate_disk,
107                 };
108         ], [], [])
111 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
112         AC_MSG_CHECKING([whether bops->revalidate_disk() exists])
113         ZFS_LINUX_TEST_RESULT([block_device_operations_revalidate_disk], [
114                 AC_DEFINE([HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [1],
115                         [Define if revalidate_disk() in block_device_operations])
116                 AC_MSG_RESULT(yes)
117         ],[
118                 AC_MSG_RESULT(no)
119         ])
122 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [
123         ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
124         ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
125         ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG
126         ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
129 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [
130         ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
131         ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
132         ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK