]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-block-device-operations.m4
FreeBSD: Add zfs_link_create() error handling
[mirror_zfs.git] / config / kernel-block-device-operations.m4
CommitLineData
7b98f0d9
BB
1dnl #
2dnl # 2.6.38 API change
3dnl #
608f8749
BB
4AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
5 ZFS_LINUX_TEST_SRC([block_device_operations_check_events], [
7b98f0d9
BB
6 #include <linux/blkdev.h>
7
a41d0b29 8 static unsigned int blk_check_events(struct gendisk *disk,
72154bd6
AZ
9 unsigned int clearing) {
10 (void) disk, (void) clearing;
11 return (0);
12 }
7b98f0d9
BB
13
14 static const struct block_device_operations
15 bops __attribute__ ((unused)) = {
16 .check_events = blk_check_events,
17 };
72154bd6 18 ], [], [])
608f8749
BB
19])
20
21AC_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], [
7b98f0d9 24 AC_MSG_RESULT(yes)
7b98f0d9 25 ],[
066e8252 26 ZFS_LINUX_TEST_ERROR([bops->check_events()])
7b98f0d9 27 ])
7b98f0d9
BB
28])
29
30dnl #
31dnl # 3.10.x API change
32dnl #
608f8749
BB
33AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
34 ZFS_LINUX_TEST_SRC([block_device_operations_release_void], [
7b98f0d9
BB
35 #include <linux/blkdev.h>
36
a41d0b29 37 static void blk_release(struct gendisk *g, fmode_t mode) {
72154bd6
AZ
38 (void) g, (void) mode;
39 return;
40 }
7b98f0d9
BB
41
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 };
72154bd6 49 ], [], [])
608f8749
BB
50])
51
43e8f6e3
CK
52dnl #
53dnl # 5.9.x API change
54dnl #
55AC_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>
58
a41d0b29 59 static void blk_release(struct gendisk *g) {
43e8f6e3
CK
60 (void) g;
61 return;
62 }
63
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 ], [], [])
72])
73
608f8749 74AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
43e8f6e3 75 AC_MSG_CHECKING([whether bops->release() is void and takes 2 args])
608f8749
BB
76 ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [
77 AC_MSG_RESULT(yes)
7b98f0d9 78 ],[
43e8f6e3
CK
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 ])
7b98f0d9 88 ])
608f8749
BB
89])
90
48c7b0e4
CK
91dnl #
92dnl # 5.13 API change
93dnl # block_device_operations->revalidate_disk() was removed
94dnl #
95AC_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>
98
a41d0b29 99 static int blk_revalidate_disk(struct gendisk *disk) {
72154bd6 100 (void) disk;
48c7b0e4
CK
101 return(0);
102 }
103
104 static const struct block_device_operations
105 bops __attribute__ ((unused)) = {
106 .revalidate_disk = blk_revalidate_disk,
107 };
72154bd6 108 ], [], [])
48c7b0e4
CK
109])
110
111AC_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 ])
120])
121
608f8749
BB
122AC_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
43e8f6e3 125 ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG
48c7b0e4 126 ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
608f8749
BB
127])
128
129AC_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
48c7b0e4 132 ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
7b98f0d9 133])