dfbea7dfdda4fb6745390c864adc6429c162122d
[zfs.git] / config / kernel-dentry-operations.m4
1 dnl #
2 dnl # 3.6 API change
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
5         AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata])
6         ZFS_LINUX_TRY_COMPILE([
7                 #include <linux/dcache.h>
8         ],[
9                 int (*revalidate) (struct dentry *, struct nameidata *) = NULL;
10                 struct dentry_operations dops __attribute__ ((unused)) = {
11                         .d_revalidate           = revalidate,
12                 };
13         ],[
14                 AC_MSG_RESULT(yes)
15                 AC_DEFINE(HAVE_D_REVALIDATE_NAMEIDATA, 1,
16                           [dops->d_revalidate() operation takes nameidata])
17         ],[
18                 AC_MSG_RESULT(no)
19         ])
20 ])
21
22 dnl #
23 dnl # 2.6.30 API change
24 dnl # The 'struct dentry_operations' was constified in the dentry structure.
25 dnl #
26 AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
27         AC_MSG_CHECKING([whether dentry uses const struct dentry_operations])
28         ZFS_LINUX_TRY_COMPILE([
29                 #include <linux/dcache.h>
30
31                 const struct dentry_operations test_d_op = {
32                         .d_revalidate = NULL,
33                 };
34         ],[
35                 struct dentry d __attribute__ ((unused));
36
37                 d.d_op = &test_d_op;
38         ],[
39                 AC_MSG_RESULT(yes)
40                 AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
41                           [dentry uses const struct dentry_operations])
42         ],[
43                 AC_MSG_RESULT(no)
44         ])
45 ])
46
47 dnl #
48 dnl # 2.6.38 API change
49 dnl # Added d_set_d_op() helper function.
50 dnl #
51 AC_DEFUN([ZFS_AC_KERNEL_D_SET_D_OP],
52         [AC_MSG_CHECKING([whether d_set_d_op() is available])
53         ZFS_LINUX_TRY_COMPILE_SYMBOL([
54                 #include <linux/dcache.h>
55         ], [
56                 d_set_d_op(NULL, NULL);
57         ], [d_set_d_op], [fs/dcache.c], [
58                 AC_MSG_RESULT(yes)
59                 AC_DEFINE(HAVE_D_SET_D_OP, 1,
60                           [d_set_d_op() is available])
61         ], [
62                 AC_MSG_RESULT(no)
63         ])
64 ])
65
66 dnl #
67 dnl # 2.6.38 API chage
68 dnl # Added sb->s_d_op default dentry_operations member
69 dnl #
70 AC_DEFUN([ZFS_AC_KERNEL_S_D_OP],
71         [AC_MSG_CHECKING([whether super_block has s_d_op])
72         ZFS_LINUX_TRY_COMPILE([
73                 #include <linux/fs.h>
74         ],[
75                 struct super_block sb __attribute__ ((unused));
76                 sb.s_d_op = NULL;
77         ], [
78                 AC_MSG_RESULT(yes)
79                 AC_DEFINE(HAVE_S_D_OP, 1, [struct super_block has s_d_op])
80         ], [
81                 AC_MSG_RESULT(no)
82         ])
83 ])