zdb: Fix minor memory leak
[zfs.git] / config / kernel-dentry-operations.m4
blobdd470d7607b4b20d1960b51d1c7f46caebefcad7
1 dnl #
2 dnl # 3.4.0 API change
3 dnl # Added d_make_root() to replace previous d_alloc_root() function.
4 dnl #
5 AC_DEFUN([ZFS_AC_KERNEL_SRC_D_MAKE_ROOT], [
6         ZFS_LINUX_TEST_SRC([d_make_root], [
7                 #include <linux/dcache.h>
8         ], [
9                 d_make_root(NULL);
10         ])
13 AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT], [
14         AC_MSG_CHECKING([whether d_make_root() is available])
15         ZFS_LINUX_TEST_RESULT_SYMBOL([d_make_root],
16             [d_make_root], [fs/dcache.c], [
17                 AC_MSG_RESULT(yes)
18                 AC_DEFINE(HAVE_D_MAKE_ROOT, 1, [d_make_root() is available])
19         ], [
20                 AC_MSG_RESULT(no)
21         ])
24 dnl #
25 dnl # 2.6.28 API change
26 dnl # Added d_obtain_alias() helper function.
27 dnl #
28 AC_DEFUN([ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS], [
29         ZFS_LINUX_TEST_SRC([d_obtain_alias], [
30                 #include <linux/dcache.h>
31         ], [
32                 d_obtain_alias(NULL);
33         ])
36 AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [
37         AC_MSG_CHECKING([whether d_obtain_alias() is available])
38         ZFS_LINUX_TEST_RESULT_SYMBOL([d_obtain_alias],
39             [d_obtain_alias], [fs/dcache.c], [
40                 AC_MSG_RESULT(yes)
41         ], [
42                 ZFS_LINUX_TEST_ERROR([d_obtain_alias()])
43         ])
46 dnl #
47 dnl # 2.6.12 API change
48 dnl # d_prune_aliases() helper function available.
49 dnl #
50 AC_DEFUN([ZFS_AC_KERNEL_SRC_D_PRUNE_ALIASES], [
51         ZFS_LINUX_TEST_SRC([d_prune_aliases], [
52                 #include <linux/dcache.h>
53         ], [
54                 struct inode *ip = NULL;
55                 d_prune_aliases(ip);
56         ])
59 AC_DEFUN([ZFS_AC_KERNEL_D_PRUNE_ALIASES], [
60         AC_MSG_CHECKING([whether d_prune_aliases() is available])
61         ZFS_LINUX_TEST_RESULT_SYMBOL([d_prune_aliases],
62             [d_prune_aliases], [fs/dcache.c], [
63                 AC_MSG_RESULT(yes)
64                 AC_DEFINE(HAVE_D_PRUNE_ALIASES, 1,
65                     [d_prune_aliases() is available])
66         ], [
67                 ZFS_LINUX_TEST_ERROR([d_prune_aliases()])
68         ])
71 dnl #
72 dnl # 2.6.38 API change
73 dnl # Added d_set_d_op() helper function.
74 dnl #
75 AC_DEFUN([ZFS_AC_KERNEL_SRC_D_SET_D_OP], [
76         ZFS_LINUX_TEST_SRC([d_set_d_op], [
77                 #include <linux/dcache.h>
78         ], [
79                 d_set_d_op(NULL, NULL);
80         ])
83 AC_DEFUN([ZFS_AC_KERNEL_D_SET_D_OP], [
84         AC_MSG_CHECKING([whether d_set_d_op() is available])
85         ZFS_LINUX_TEST_RESULT_SYMBOL([d_set_d_op],
86             [d_set_d_op], [fs/dcache.c], [
87                 AC_MSG_RESULT(yes)
88         ], [
89                 ZFS_LINUX_TEST_ERROR([d_set_d_op])
90         ])
93 dnl #
94 dnl # 3.6 API change
95 dnl #
96 AC_DEFUN([ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA], [
97         ZFS_LINUX_TEST_SRC([dentry_operations_revalidate], [
98                 #include <linux/dcache.h>
99                 #include <linux/sched.h>
101                 int revalidate (struct dentry *dentry,
102                     struct nameidata *nidata) { return 0; }
104                 static const struct dentry_operations
105                     dops __attribute__ ((unused)) = {
106                         .d_revalidate   = revalidate,
107                 };
108         ],[])
111 AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
112         AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata])
113         ZFS_LINUX_TEST_RESULT([dentry_operations_revalidate], [
114                 AC_MSG_RESULT(yes)
115                 AC_DEFINE(HAVE_D_REVALIDATE_NAMEIDATA, 1,
116                     [dops->d_revalidate() operation takes nameidata])
117         ],[
118                 AC_MSG_RESULT(no)
119         ])
122 dnl #
123 dnl # 2.6.30 API change
124 dnl # The 'struct dentry_operations' was constified in the dentry structure.
125 dnl #
126 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS], [
127         ZFS_LINUX_TEST_SRC([dentry_operations_const], [
128                 #include <linux/dcache.h>
130                 const struct dentry_operations test_d_op = {
131                         .d_revalidate = NULL,
132                 };
133         ],[
134                 struct dentry d __attribute__ ((unused));
135                 d.d_op = &test_d_op;
136         ])
139 AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
140         AC_MSG_CHECKING([whether dentry uses const struct dentry_operations])
141         ZFS_LINUX_TEST_RESULT([dentry_operations_const], [
142                 AC_MSG_RESULT(yes)
143                 AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
144                     [dentry uses const struct dentry_operations])
145         ],[
146                 ZFS_LINUX_TEST_ERROR([const dentry_operations])
147         ])
150 dnl #
151 dnl # 2.6.38 API change
152 dnl # Added sb->s_d_op default dentry_operations member
153 dnl #
154 AC_DEFUN([ZFS_AC_KERNEL_SRC_S_D_OP], [
155         ZFS_LINUX_TEST_SRC([super_block_s_d_op], [
156                 #include <linux/fs.h>
157         ],[
158                 struct super_block sb __attribute__ ((unused));
159                 sb.s_d_op = NULL;
160         ])
163 AC_DEFUN([ZFS_AC_KERNEL_S_D_OP], [
164         AC_MSG_CHECKING([whether super_block has s_d_op])
165         ZFS_LINUX_TEST_RESULT([super_block_s_d_op], [
166                 AC_MSG_RESULT(yes)
167         ], [
168                 ZFS_LINUX_TEST_ERROR([super_block s_d_op])
169         ])
172 AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY], [
173         ZFS_AC_KERNEL_SRC_D_MAKE_ROOT
174         ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS
175         ZFS_AC_KERNEL_SRC_D_PRUNE_ALIASES
176         ZFS_AC_KERNEL_SRC_D_SET_D_OP
177         ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA
178         ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS
179         ZFS_AC_KERNEL_SRC_S_D_OP
182 AC_DEFUN([ZFS_AC_KERNEL_DENTRY], [
183         ZFS_AC_KERNEL_D_MAKE_ROOT
184         ZFS_AC_KERNEL_D_OBTAIN_ALIAS
185         ZFS_AC_KERNEL_D_PRUNE_ALIASES
186         ZFS_AC_KERNEL_D_SET_D_OP
187         ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
188         ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
189         ZFS_AC_KERNEL_S_D_OP