xref: /freebsd/sys/contrib/openzfs/config/kernel-block-device-operations.m4 (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1dnl #
2dnl # 2.6.38 API change
3dnl #
4AC_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>
7
8		unsigned int blk_check_events(struct gendisk *disk,
9		    unsigned int clearing) { return (0); }
10
11		static const struct block_device_operations
12		    bops __attribute__ ((unused)) = {
13			.check_events	= blk_check_events,
14		};
15	], [], [$NO_UNUSED_BUT_SET_VARIABLE])
16])
17
18AC_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	])
25])
26
27dnl #
28dnl # 3.10.x API change
29dnl #
30AC_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>
33
34		void blk_release(struct gendisk *g, fmode_t mode) { return; }
35
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])
44])
45
46AC_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	])
53])
54
55AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [
56	ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
57	ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
58])
59
60AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [
61	ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
62	ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
63])
64