]> git.proxmox.com Git - mirror_zfs-debian.git/blob - config/kernel-xattr-handler.m4
Imported Upstream version 0.6.5.5
[mirror_zfs-debian.git] / config / kernel-xattr-handler.m4
1 dnl #
2 dnl # 2.6.35 API change,
3 dnl # The 'struct xattr_handler' was constified in the generic
4 dnl # super_block structure.
5 dnl #
6 AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
7 AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
8 ZFS_LINUX_TRY_COMPILE([
9 #include <linux/fs.h>
10 #include <linux/xattr.h>
11
12 const struct xattr_handler xattr_test_handler = {
13 .prefix = "test",
14 .get = NULL,
15 .set = NULL,
16 };
17
18 const struct xattr_handler *xattr_handlers[] = {
19 &xattr_test_handler,
20 };
21
22 const struct super_block sb __attribute__ ((unused)) = {
23 .s_xattr = xattr_handlers,
24 };
25 ],[
26 ],[
27 AC_MSG_RESULT([yes])
28 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
29 [super_block uses const struct xattr_handler])
30 ],[
31 AC_MSG_RESULT([no])
32 ])
33 ])
34
35 dnl #
36 dnl # Supported xattr handler get() interfaces checked newest to oldest.
37 dnl #
38 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
39 dnl #
40 dnl # 4.4 API change,
41 dnl # The xattr_handler->get() callback was changed to take a
42 dnl # attr_handler, and handler_flags argument was removed and
43 dnl # should be accessed by handler->flags.
44 dnl #
45 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
46 ZFS_LINUX_TRY_COMPILE([
47 #include <linux/xattr.h>
48
49 int get(const struct xattr_handler *handler,
50 struct dentry *dentry, const char *name,
51 void *buffer, size_t size) { return 0; }
52 static const struct xattr_handler
53 xops __attribute__ ((unused)) = {
54 .get = get,
55 };
56 ],[
57 ],[
58 AC_MSG_RESULT(yes)
59 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
60 [xattr_handler->get() wants xattr_handler])
61 ],[
62 dnl #
63 dnl # 2.6.33 API change,
64 dnl # The xattr_handler->get() callback was changed to take
65 dnl # a dentry instead of an inode, and a handler_flags
66 dnl # argument was added.
67 dnl #
68 AC_MSG_RESULT(no)
69 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
70 ZFS_LINUX_TRY_COMPILE([
71 #include <linux/xattr.h>
72
73 int get(struct dentry *dentry, const char *name,
74 void *buffer, size_t size, int handler_flags)
75 { return 0; }
76 static const struct xattr_handler
77 xops __attribute__ ((unused)) = {
78 .get = get,
79 };
80 ],[
81 ],[
82 AC_MSG_RESULT(yes)
83 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
84 [xattr_handler->get() wants dentry])
85 ],[
86 dnl #
87 dnl # 2.6.32 API
88 dnl #
89 AC_MSG_RESULT(no)
90 AC_MSG_CHECKING(
91 [whether xattr_handler->get() wants inode])
92 ZFS_LINUX_TRY_COMPILE([
93 #include <linux/xattr.h>
94
95 int get(struct inode *ip, const char *name,
96 void *buffer, size_t size) { return 0; }
97 static const struct xattr_handler
98 xops __attribute__ ((unused)) = {
99 .get = get,
100 };
101 ],[
102 ],[
103 AC_MSG_RESULT(yes)
104 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
105 [xattr_handler->get() wants inode])
106 ],[
107 AC_MSG_ERROR([no; please file a bug report])
108 ])
109 ])
110 ])
111 ])
112
113 dnl #
114 dnl # Supported xattr handler set() interfaces checked newest to oldest.
115 dnl #
116 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
117 dnl #
118 dnl # 4.4 API change,
119 dnl # The xattr_handler->set() callback was changed to take a
120 dnl # xattr_handler, and handler_flags argument was removed and
121 dnl # should be accessed by handler->flags.
122 dnl #
123 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
124 ZFS_LINUX_TRY_COMPILE([
125 #include <linux/xattr.h>
126
127 int set(const struct xattr_handler *handler,
128 struct dentry *dentry, const char *name,
129 const void *buffer, size_t size, int flags)
130 { return 0; }
131 static const struct xattr_handler
132 xops __attribute__ ((unused)) = {
133 .set = set,
134 };
135 ],[
136 ],[
137 AC_MSG_RESULT(yes)
138 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
139 [xattr_handler->set() wants xattr_handler])
140 ],[
141 dnl #
142 dnl # 2.6.33 API change,
143 dnl # The xattr_handler->set() callback was changed to take a
144 dnl # dentry instead of an inode, and a handler_flags
145 dnl # argument was added.
146 dnl #
147 AC_MSG_RESULT(no)
148 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
149 ZFS_LINUX_TRY_COMPILE([
150 #include <linux/xattr.h>
151
152 int set(struct dentry *dentry, const char *name,
153 const void *buffer, size_t size, int flags,
154 int handler_flags) { return 0; }
155 static const struct xattr_handler
156 xops __attribute__ ((unused)) = {
157 .set = set,
158 };
159 ],[
160 ],[
161 AC_MSG_RESULT(yes)
162 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
163 [xattr_handler->set() wants dentry])
164 ],[
165 dnl #
166 dnl # 2.6.32 API
167 dnl #
168 AC_MSG_RESULT(no)
169 AC_MSG_CHECKING(
170 [whether xattr_handler->set() wants inode])
171 ZFS_LINUX_TRY_COMPILE([
172 #include <linux/xattr.h>
173
174 int set(struct inode *ip, const char *name,
175 const void *buffer, size_t size, int flags)
176 { return 0; }
177 static const struct xattr_handler
178 xops __attribute__ ((unused)) = {
179 .set = set,
180 };
181 ],[
182 ],[
183 AC_MSG_RESULT(yes)
184 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
185 [xattr_handler->set() wants inode])
186 ],[
187 AC_MSG_ERROR([no; please file a bug report])
188 ])
189 ])
190 ])
191 ])
192
193 dnl #
194 dnl # Supported xattr handler list() interfaces checked newest to oldest.
195 dnl #
196 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
197 dnl # 4.5 API change,
198 dnl # The xattr_handler->list() callback was changed to take only a
199 dnl # dentry and it only needs to return if it's accessable.
200 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
201 ZFS_LINUX_TRY_COMPILE([
202 #include <linux/xattr.h>
203
204 bool list(struct dentry *dentry) { return 0; }
205 static const struct xattr_handler
206 xops __attribute__ ((unused)) = {
207 .list = list,
208 };
209 ],[
210 ],[
211 AC_MSG_RESULT(yes)
212 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
213 [xattr_handler->list() wants simple])
214 ],[
215 dnl #
216 dnl # 4.4 API change,
217 dnl # The xattr_handler->list() callback was changed to take a
218 dnl # xattr_handler, and handler_flags argument was removed
219 dnl # and should be accessed by handler->flags.
220 dnl #
221 AC_MSG_RESULT(no)
222 AC_MSG_CHECKING(
223 [whether xattr_handler->list() wants xattr_handler])
224 ZFS_LINUX_TRY_COMPILE([
225 #include <linux/xattr.h>
226
227 size_t list(const struct xattr_handler *handler,
228 struct dentry *dentry, char *list, size_t list_size,
229 const char *name, size_t name_len) { return 0; }
230 static const struct xattr_handler
231 xops __attribute__ ((unused)) = {
232 .list = list,
233 };
234 ],[
235 ],[
236 AC_MSG_RESULT(yes)
237 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
238 [xattr_handler->list() wants xattr_handler])
239 ],[
240 dnl #
241 dnl # 2.6.33 API change,
242 dnl # The xattr_handler->list() callback was changed
243 dnl # to take a dentry instead of an inode, and a
244 dnl # handler_flags argument was added.
245 dnl #
246 AC_MSG_RESULT(no)
247 AC_MSG_CHECKING(
248 [whether xattr_handler->list() wants dentry])
249 ZFS_LINUX_TRY_COMPILE([
250 #include <linux/xattr.h>
251
252 size_t list(struct dentry *dentry,
253 char *list, size_t list_size,
254 const char *name, size_t name_len,
255 int handler_flags) { return 0; }
256 static const struct xattr_handler
257 xops __attribute__ ((unused)) = {
258 .list = list,
259 };
260 ],[
261 ],[
262 AC_MSG_RESULT(yes)
263 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
264 [xattr_handler->list() wants dentry])
265 ],[
266 dnl #
267 dnl # 2.6.32 API
268 dnl #
269 AC_MSG_RESULT(no)
270 AC_MSG_CHECKING(
271 [whether xattr_handler->list() wants inode])
272 ZFS_LINUX_TRY_COMPILE([
273 #include <linux/xattr.h>
274
275 size_t list(struct inode *ip, char *lst,
276 size_t list_size, const char *name,
277 size_t name_len) { return 0; }
278 static const struct xattr_handler
279 xops __attribute__ ((unused)) = {
280 .list = list,
281 };
282 ],[
283 ],[
284 AC_MSG_RESULT(yes)
285 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
286 [xattr_handler->list() wants inode])
287 ],[
288 AC_MSG_ERROR(
289 [no; please file a bug report])
290 ])
291 ])
292 ])
293 ])
294 ])
295
296 dnl #
297 dnl # 3.7 API change,
298 dnl # The posix_acl_{from,to}_xattr functions gained a new
299 dnl # parameter: user_ns
300 dnl #
301 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
302 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
303 ZFS_LINUX_TRY_COMPILE([
304 #include <linux/cred.h>
305 #include <linux/fs.h>
306 #include <linux/posix_acl_xattr.h>
307 ],[
308 posix_acl_from_xattr(&init_user_ns, NULL, 0);
309 ],[
310 AC_MSG_RESULT(yes)
311 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
312 [posix_acl_from_xattr() needs user_ns])
313 ],[
314 AC_MSG_RESULT(no)
315 ])
316 ])
317