OpenZFS 4185 - add new cryptographic checksums to ZFS: SHA-512, Skein, Edon-R
[zfs.git] / config / kernel-blk-queue-flush.m4
blob1baab83a4e8cda01d14ea7e23d56f54986dd9230
1 dnl #
2 dnl # 2.6.36 API change
3 dnl # In 2.6.36 kernels the blk_queue_ordered() interface has been
4 dnl # replaced by the simpler blk_queue_flush().  However, while the
5 dnl # old interface was available to all the new one is GPL-only.
6 dnl # Thus in addition to detecting if this function is available
7 dnl # we determine if it is GPL-only.  If the GPL-only interface is
8 dnl # there we implement our own compatibility function, otherwise
9 dnl # we use the function.  The hope is that long term this function
10 dnl # will be opened up.
11 dnl #
12 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
13         AC_MSG_CHECKING([whether blk_queue_flush() is available])
14         tmp_flags="$EXTRA_KCFLAGS"
15         EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
16         ZFS_LINUX_TRY_COMPILE([
17                 #include <linux/blkdev.h>
18         ],[
19                 struct request_queue *q = NULL;
20                 (void) blk_queue_flush(q, REQ_FLUSH);
21         ],[
22                 AC_MSG_RESULT(yes)
23                 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1,
24                           [blk_queue_flush() is available])
26                 AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only])
27                 ZFS_LINUX_TRY_COMPILE([
28                         #include <linux/module.h>
29                         #include <linux/blkdev.h>
31                         MODULE_LICENSE("$ZFS_META_LICENSE");
32                 ],[
33                         struct request_queue *q = NULL;
34                         (void) blk_queue_flush(q, REQ_FLUSH);
35                 ],[
36                         AC_MSG_RESULT(no)
37                 ],[
38                         AC_MSG_RESULT(yes)
39                         AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1,
40                                   [blk_queue_flush() is GPL-only])
41                 ])
42         ],[
43                 AC_MSG_RESULT(no)
44         ])
46         dnl #
47         dnl # 4.7 API change
48         dnl # Replace blk_queue_flush with blk_queue_write_cache
49         dnl #
50         AC_MSG_CHECKING([whether blk_queue_write_cache() exists])
51         ZFS_LINUX_TRY_COMPILE([
52                 #include <linux/kernel.h>
53                 #include <linux/blkdev.h>
55         ],[
56                 struct request_queue *q = NULL;
57                 blk_queue_write_cache(q, true, true);
58         ],[
59                 AC_MSG_RESULT(yes)
60                 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
61                         [blk_queue_write_cache() exists])
63                 AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only])
64                 ZFS_LINUX_TRY_COMPILE([
65                         #include <linux/kernel.h>
66                         #include <linux/module.h>
67                         #include <linux/blkdev.h>
69                         MODULE_LICENSE("$ZFS_META_LICENSE");
70                 ],[
71                         struct request_queue *q = NULL;
72                         blk_queue_write_cache(q, true, true);
73                 ],[
74                         AC_MSG_RESULT(no)
75                 ],[
76                         AC_MSG_RESULT(yes)
77                         AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1,
78                                   [blk_queue_write_cache() is GPL-only])
79                 ])
80         ],[
81                 AC_MSG_RESULT(no)
82         ])
84         EXTRA_KCFLAGS="$tmp_flags"