8b5e0a32b74e035595f5c5bb57c683529940b015
[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="${NO_UNUSED_BUT_SET_VARIABLE}"
8         ZFS_LINUX_TRY_COMPILE([
9                 #include <linux/blkdev.h>
10
11                 int blk_open(struct block_device *bdev, fmode_t mode)
12                     { return 0; }
13                 int blk_release(struct gendisk *g, fmode_t mode) { return 0; }
14                 int blk_ioctl(struct block_device *bdev, fmode_t mode,
15                     unsigned x, unsigned long y) { return 0; }
16                 int blk_compat_ioctl(struct block_device * bdev, fmode_t mode,
17                     unsigned x, unsigned long y) { return 0; }
18
19                 static const struct block_device_operations
20                     bops __attribute__ ((unused)) = {
21                         .open           = blk_open,
22                         .release        = blk_release,
23                         .ioctl          = blk_ioctl,
24                         .compat_ioctl   = blk_compat_ioctl,
25                 };
26         ],[
27         ],[
28                 AC_MSG_RESULT(struct block_device)
29                 AC_DEFINE(HAVE_BDEV_BLOCK_DEVICE_OPERATIONS, 1,
30                           [struct block_device_operations use bdevs])
31         ],[
32                 AC_MSG_RESULT(struct inode)
33         ])
34         EXTRA_KCFLAGS="$tmp_flags"
35 ])