xref: /freebsd/sys/contrib/openzfs/config/kernel-dentry-operations.m4 (revision 18054d0220cfc8df9c9568c437bd6fbb59d53c3c)
1dnl #
2dnl # 3.4.0 API change
3dnl # Added d_make_root() to replace previous d_alloc_root() function.
4dnl #
5AC_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	])
11])
12
13AC_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	])
22])
23
24dnl #
25dnl # 2.6.28 API change
26dnl # Added d_obtain_alias() helper function.
27dnl #
28AC_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	])
34])
35
36AC_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	])
44])
45
46dnl #
47dnl # 2.6.12 API change
48dnl # d_prune_aliases() helper function available.
49dnl #
50AC_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	])
57])
58
59AC_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	])
69])
70
71dnl #
72dnl # 2.6.38 API change
73dnl # Added d_set_d_op() helper function.
74dnl #
75AC_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	])
81])
82
83AC_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	])
91])
92
93dnl #
94dnl # 3.6 API change
95dnl #
96AC_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>
100
101		int revalidate (struct dentry *dentry,
102		    struct nameidata *nidata) { return 0; }
103
104		static const struct dentry_operations
105		    dops __attribute__ ((unused)) = {
106			.d_revalidate	= revalidate,
107		};
108	],[])
109])
110
111AC_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	])
120])
121
122dnl #
123dnl # 2.6.30 API change
124dnl # The 'struct dentry_operations' was constified in the dentry structure.
125dnl #
126AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS], [
127	ZFS_LINUX_TEST_SRC([dentry_operations_const], [
128		#include <linux/dcache.h>
129
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	])
137])
138
139AC_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	])
148])
149
150dnl #
151dnl # 2.6.38 API change
152dnl # Added sb->s_d_op default dentry_operations member
153dnl #
154AC_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	])
161])
162
163AC_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	])
170])
171
172AC_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
180])
181
182AC_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
190])
191