Fix build failures on PaX/GRSecurity patched kernels
[zfs.git] / config / kernel-bdev-block-device-operations.m4
1 dnl #
2 dnl # 2.6.x API change
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS], [
5         AC_MSG_CHECKING([block device operation prototypes])
6         tmp_flags="$EXTRA_KCFLAGS"
7         EXTRA_KCFLAGS="-Wno-unused-but-set-variable"
8         ZFS_LINUX_TRY_COMPILE([
9                 #include <linux/blkdev.h>
10         ],[
11                 int (*blk_open) (struct block_device *, fmode_t) = NULL;
12                 int (*blk_release) (struct gendisk *, fmode_t) = NULL;
13                 int (*blk_ioctl) (struct block_device *, fmode_t,
14                                   unsigned, unsigned long) = NULL;
15                 int (*blk_compat_ioctl) (struct block_device *, fmode_t,
16                                          unsigned, unsigned long) = NULL;
17                 struct block_device_operations blk_ops = {
18                         .open           = blk_open,
19                         .release        = blk_release,
20                         .ioctl          = blk_ioctl,
21                         .compat_ioctl   = blk_compat_ioctl,
22                 };
23                 
24                 blk_ops.open(NULL, 0);
25                 blk_ops.release(NULL, 0);
26                 blk_ops.ioctl(NULL, 0, 0, 0);
27                 blk_ops.compat_ioctl(NULL, 0, 0, 0);
28         ],[
29                 AC_MSG_RESULT(struct block_device)
30                 AC_DEFINE(HAVE_BDEV_BLOCK_DEVICE_OPERATIONS, 1,
31                           [struct block_device_operations use bdevs])
32         ],[
33                 AC_MSG_RESULT(struct inode)
34         ])
35         EXTRA_KCFLAGS="$tmp_flags"
36 ])