From 915205a6e85cf6486b4afc91bab4a3a5848d75d2 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 16 Nov 2009 10:31:10 -0800 Subject: [PATCH] Add autoconf checks for zvol integration. --- config/kernel-bdev-block-device-operations.m4 | 33 +++++++++++++++++++ config/kernel-blk-end-request.m4 | 18 ++++++++++ config/kernel-blk-fetch-request.m4 | 22 +++++++++++++ config/kernel-blk-requeue-request.m4 | 22 +++++++++++++ config/kernel-blk-rq-bytes.m4 | 18 ++++++++++ config/kernel-blk-rq-pos.m4 | 18 ++++++++++ config/kernel-blk-rq-sectors.m4 | 18 ++++++++++ config/kernel-get-disk-ro.m4 | 18 ++++++++++ config/kernel-rq-is_sync.m4 | 18 ++++++++++ config/kernel.m4 | 11 ++++++- 10 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 config/kernel-bdev-block-device-operations.m4 create mode 100644 config/kernel-blk-end-request.m4 create mode 100644 config/kernel-blk-fetch-request.m4 create mode 100644 config/kernel-blk-requeue-request.m4 create mode 100644 config/kernel-blk-rq-bytes.m4 create mode 100644 config/kernel-blk-rq-pos.m4 create mode 100644 config/kernel-blk-rq-sectors.m4 create mode 100644 config/kernel-get-disk-ro.m4 create mode 100644 config/kernel-rq-is_sync.m4 diff --git a/config/kernel-bdev-block-device-operations.m4 b/config/kernel-bdev-block-device-operations.m4 new file mode 100644 index 0000000000..daf14f0f9e --- /dev/null +++ b/config/kernel-bdev-block-device-operations.m4 @@ -0,0 +1,33 @@ +dnl # +dnl # 2.6.x API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS], [ + AC_MSG_CHECKING([block device operation prototypes]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + int (*blk_open) (struct block_device *, fmode_t) = NULL; + int (*blk_release) (struct gendisk *, fmode_t) = NULL; + int (*blk_ioctl) (struct block_device *, fmode_t, + unsigned, unsigned long) = NULL; + int (*blk_compat_ioctl) (struct block_device *, fmode_t, + unsigned, unsigned long) = NULL; + struct block_device_operations blk_ops = { + .open = blk_open, + .release = blk_release, + .ioctl = blk_ioctl, + .compat_ioctl = blk_compat_ioctl, + }; + + blk_ops.open(NULL, 0); + blk_ops.release(NULL, 0); + blk_ops.ioctl(NULL, 0, 0, 0); + blk_ops.compat_ioctl(NULL, 0, 0, 0); + ],[ + AC_MSG_RESULT(struct block_device) + AC_DEFINE(HAVE_BDEV_BLOCK_DEVICE_OPERATIONS, 1, + [struct block_device_operations use bdevs]) + ],[ + AC_MSG_RESULT(struct inode) + ]) +]) diff --git a/config/kernel-blk-end-request.m4 b/config/kernel-blk-end-request.m4 new file mode 100644 index 0000000000..6719516c14 --- /dev/null +++ b/config/kernel-blk-end-request.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # 2.6.18 API change +nl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_END_REQUEST], [ + AC_MSG_CHECKING([whether blk_end_request() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct request *req = NULL; + (void) blk_end_request(req, 0, 0); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_END_REQUEST, 1, + [blk_end_request() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-blk-fetch-request.m4 b/config/kernel-blk-fetch-request.m4 new file mode 100644 index 0000000000..34a5d2fa8f --- /dev/null +++ b/config/kernel-blk-fetch-request.m4 @@ -0,0 +1,22 @@ +dnl # +dnl # 2.6.31 API change +dnl # Request queue peek/retrieval interface cleanup, the blk_fetch_request() +dnl # function replaces the elv_next_request() and blk_fetch_request() +dnl # functions. The updated blk_fetch_request() function returns the +dnl # next available request and removed it from the request queue. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_FETCH_REQUEST], [ + AC_MSG_CHECKING([whether blk_fetch_request() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct request_queue *q = NULL; + (void) blk_fetch_request(q); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_FETCH_REQUEST, 1, + [blk_fetch_request() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-blk-requeue-request.m4 b/config/kernel-blk-requeue-request.m4 new file mode 100644 index 0000000000..f676f85cb2 --- /dev/null +++ b/config/kernel-blk-requeue-request.m4 @@ -0,0 +1,22 @@ +dnl # +dnl # 2.6.31 API change +dnl # Request queue peek/retrieval interface cleanup, the +dnl # elv_requeue_request() function has been replaced with the +dnl # blk_requeue_request() function. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_REQUEUE_REQUEST], [ + AC_MSG_CHECKING([whether blk_requeue_request() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct request_queue *q = NULL; + struct request *req = NULL; + blk_requeue_request(q, req); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_REQUEUE_REQUEST, 1, + [blk_requeue_request() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-blk-rq-bytes.m4 b/config/kernel-blk-rq-bytes.m4 new file mode 100644 index 0000000000..2655a8f007 --- /dev/null +++ b/config/kernel-blk-rq-bytes.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # 2.6.31 API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_BYTES], [ + AC_MSG_CHECKING([whether blk_rq_bytes() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct request *req = NULL; + (void) blk_rq_bytes(req); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_RQ_BYTES, 1, + [blk_rq_bytes() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-blk-rq-pos.m4 b/config/kernel-blk-rq-pos.m4 new file mode 100644 index 0000000000..aaa464665c --- /dev/null +++ b/config/kernel-blk-rq-pos.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # 2.6.31 API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_POS], [ + AC_MSG_CHECKING([whether blk_rq_pos() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct request *req = NULL; + (void) blk_rq_pos(req); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_RQ_POS, 1, + [blk_rq_pos() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-blk-rq-sectors.m4 b/config/kernel-blk-rq-sectors.m4 new file mode 100644 index 0000000000..db8c43938d --- /dev/null +++ b/config/kernel-blk-rq-sectors.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # 2.6.31 API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_SECTORS], [ + AC_MSG_CHECKING([whether blk_rq_sectors() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct request *req = NULL; + (void) blk_rq_sectors(req); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_RQ_SECTORS, 1, + [blk_rq_sectors() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-get-disk-ro.m4 b/config/kernel-get-disk-ro.m4 new file mode 100644 index 0000000000..365afdbc69 --- /dev/null +++ b/config/kernel-get-disk-ro.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # 2.6.x API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [ + AC_MSG_CHECKING([whether get_disk_ro() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct gendisk *disk = NULL; + (void) get_disk_ro(disk); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GET_DISK_RO, 1, + [blk_disk_ro() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-rq-is_sync.m4 b/config/kernel-rq-is_sync.m4 new file mode 100644 index 0000000000..40d0de80cd --- /dev/null +++ b/config/kernel-rq-is_sync.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # 2.6.x API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_RQ_IS_SYNC], [ + AC_MSG_CHECKING([whether rq_is_sync() is available]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct request *req = NULL; + (void) rq_is_sync(req); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RQ_IS_SYNC, 1, + [rq_is_sync() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index de0c8575a4..415c928593 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -4,12 +4,21 @@ dnl # AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL ZFS_AC_SPL + ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE + ZFS_AC_KERNEL_BIO_EMPTY_BARRIER ZFS_AC_KERNEL_BIO_END_IO_T_ARGS ZFS_AC_KERNEL_BIO_RW_SYNCIO - ZFS_AC_KERNEL_BIO_EMPTY_BARRIER + ZFS_AC_KERNEL_BLK_END_REQUEST + ZFS_AC_KERNEL_BLK_FETCH_REQUEST + ZFS_AC_KERNEL_BLK_REQUEUE_REQUEST + ZFS_AC_KERNEL_BLK_RQ_BYTES + ZFS_AC_KERNEL_BLK_RQ_POS + ZFS_AC_KERNEL_BLK_RQ_SECTORS + ZFS_AC_KERNEL_GET_DISK_RO + ZFS_AC_KERNEL_RQ_IS_SYNC dnl # Kernel build make options dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build