Tag 2.2.0-rc4
[zfs.git] / config / kernel-bdi.m4
blob9758863a9cbf1790ec68ca8d315613a0e6010ef1
1 dnl #
2 dnl # Check available BDI interfaces.
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_BDI], [
5         ZFS_LINUX_TEST_SRC([super_setup_bdi_name], [
6                 #include <linux/fs.h>
7                 struct super_block sb;
8         ], [
9                 char *name = "bdi";
10                 atomic_long_t zfs_bdi_seq;
11                 int error __attribute__((unused));
12                 atomic_long_set(&zfs_bdi_seq, 0);
13                 error =
14                     super_setup_bdi_name(&sb, "%.28s-%ld", name,
15                     atomic_long_inc_return(&zfs_bdi_seq));
16         ])
18         ZFS_LINUX_TEST_SRC([bdi_setup_and_register], [
19                 #include <linux/backing-dev.h>
20                 struct backing_dev_info bdi;
21         ], [
22                 char *name = "bdi";
23                 int error __attribute__((unused)) =
24                     bdi_setup_and_register(&bdi, name);
25         ])
27         ZFS_LINUX_TEST_SRC([bdi_setup_and_register_3args], [
28                 #include <linux/backing-dev.h>
29                 struct backing_dev_info bdi;
30         ], [
31                 char *name = "bdi";
32                 unsigned int cap = BDI_CAP_MAP_COPY;
33                 int error __attribute__((unused)) =
34                     bdi_setup_and_register(&bdi, name, cap);
35         ])
38 AC_DEFUN([ZFS_AC_KERNEL_BDI], [
39         dnl #
40         dnl # 4.12, super_setup_bdi_name() introduced.
41         dnl #
42         AC_MSG_CHECKING([whether super_setup_bdi_name() exists])
43         ZFS_LINUX_TEST_RESULT_SYMBOL([super_setup_bdi_name],
44             [super_setup_bdi_name], [fs/super.c], [
45                 AC_MSG_RESULT(yes)
46                 AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
47                     [super_setup_bdi_name() exits])
48         ], [
49                 AC_MSG_RESULT(no)
51                 dnl #
52                 dnl # 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments.
53                 dnl #
54                 AC_MSG_CHECKING(
55                     [whether bdi_setup_and_register() wants 2 args])
56                 ZFS_LINUX_TEST_RESULT_SYMBOL([bdi_setup_and_register],
57                     [bdi_setup_and_register], [mm/backing-dev.c], [
58                         AC_MSG_RESULT(yes)
59                         AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1,
60                             [bdi_setup_and_register() wants 2 args])
61                 ], [
62                         AC_MSG_RESULT(no)
64                         dnl #
65                         dnl # 2.6.34 - 3.19, bdi_setup_and_register()
66                         dnl # takes 3 arguments.
67                         dnl #
68                         AC_MSG_CHECKING(
69                             [whether bdi_setup_and_register() wants 3 args])
70                         ZFS_LINUX_TEST_RESULT_SYMBOL(
71                             [bdi_setup_and_register_3args],
72                             [bdi_setup_and_register], [mm/backing-dev.c], [
73                                 AC_MSG_RESULT(yes)
74                                 AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1,
75                                     [bdi_setup_and_register() wants 3 args])
76                         ], [
77                                 ZFS_LINUX_TEST_ERROR([bdi_setup])
78                         ])
79                 ])
80         ])