zdb: remove strtok
[zfs.git] / config / kernel-block-device-operations.m4
bloba48618185bfb0dd17f53cb7a2a440c7ffb3b9dcf
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                 unsigned int blk_check_events(struct gendisk *disk,
9                     unsigned int clearing) { return (0); }
11                 static const struct block_device_operations
12                     bops __attribute__ ((unused)) = {
13                         .check_events   = blk_check_events,
14                 };
15         ], [], [$NO_UNUSED_BUT_SET_VARIABLE])
18 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
19         AC_MSG_CHECKING([whether bops->check_events() exists])
20         ZFS_LINUX_TEST_RESULT([block_device_operations_check_events], [
21                 AC_MSG_RESULT(yes)
22         ],[
23                 ZFS_LINUX_TEST_ERROR([bops->check_events()])
24         ])
27 dnl #
28 dnl # 3.10.x API change
29 dnl #
30 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
31         ZFS_LINUX_TEST_SRC([block_device_operations_release_void], [
32                 #include <linux/blkdev.h>
34                 void blk_release(struct gendisk *g, fmode_t mode) { return; }
36                 static const struct block_device_operations
37                     bops __attribute__ ((unused)) = {
38                         .open           = NULL,
39                         .release        = blk_release,
40                         .ioctl          = NULL,
41                         .compat_ioctl   = NULL,
42                 };
43         ], [], [$NO_UNUSED_BUT_SET_VARIABLE])
46 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
47         AC_MSG_CHECKING([whether bops->release() is void])
48         ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [
49                 AC_MSG_RESULT(yes)
50         ],[
51                 ZFS_LINUX_TEST_ERROR([bops->release()])
52         ])
55 dnl #
56 dnl # 5.13 API change
57 dnl # block_device_operations->revalidate_disk() was removed
58 dnl #
59 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
60         ZFS_LINUX_TEST_SRC([block_device_operations_revalidate_disk], [
61                 #include <linux/blkdev.h>
63                 int blk_revalidate_disk(struct gendisk *disk) {
64                         return(0);
65                 }
67                 static const struct block_device_operations
68                     bops __attribute__ ((unused)) = {
69                         .revalidate_disk        = blk_revalidate_disk,
70                 };
71         ], [], [$NO_UNUSED_BUT_SET_VARIABLE])
74 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
75         AC_MSG_CHECKING([whether bops->revalidate_disk() exists])
76         ZFS_LINUX_TEST_RESULT([block_device_operations_revalidate_disk], [
77                 AC_DEFINE([HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [1],
78                         [Define if revalidate_disk() in block_device_operations])
79                 AC_MSG_RESULT(yes)
80         ],[
81                 AC_MSG_RESULT(no)
82         ])
85 AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [
86         ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
87         ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
88         ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
91 AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [
92         ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
93         ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
94         ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK