aboutsummaryrefslogtreecommitdiffstats
path: root/config/kernel-blk-queue-discard.m4
blob: 85a29356def0c0c7ffe46d848620f2219a9a37ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
dnl #
dnl # 2.6.32 - 4.x API,
dnl #   blk_queue_discard()
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [
	ZFS_LINUX_TEST_SRC([blk_queue_discard], [
		#include <linux/blkdev.h>
	],[
		struct request_queue *q __attribute__ ((unused)) = NULL;
		int value __attribute__ ((unused));
		value = blk_queue_discard(q);
	])
])

AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [
	AC_MSG_CHECKING([whether blk_queue_discard() is available])
	ZFS_LINUX_TEST_RESULT([blk_queue_discard], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1,
		    [blk_queue_discard() is available])
	],[
		AC_MSG_RESULT(no)
	])
])

dnl #
dnl # 4.8 - 4.x API,
dnl #   blk_queue_secure_erase()
dnl #
dnl # 2.6.36 - 4.7 API,
dnl #   blk_queue_secdiscard()
dnl #
dnl # 2.6.x - 2.6.35 API,
dnl #   Unsupported by kernel
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [
	ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [
		#include <linux/blkdev.h>
	],[
		struct request_queue *q __attribute__ ((unused)) = NULL;
		int value __attribute__ ((unused));
		value = blk_queue_secure_erase(q);
	])

	ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [
		#include <linux/blkdev.h>
	],[
		struct request_queue *q __attribute__ ((unused)) = NULL;
		int value __attribute__ ((unused));
		value = blk_queue_secdiscard(q);
	])
])

AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
	AC_MSG_CHECKING([whether blk_queue_secure_erase() is available])
	ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1,
		    [blk_queue_secure_erase() is available])
	],[
		AC_MSG_RESULT(no)

		AC_MSG_CHECKING([whether blk_queue_secdiscard() is available])
		ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [
			AC_MSG_RESULT(yes)
			AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1,
			    [blk_queue_secdiscard() is available])
		],[
			AC_MSG_RESULT(no)
		])
	])
])