]>
Commit | Line | Data |
---|---|---|
87d546d8 TG |
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 # 4.5 API change, | |
37 | dnl # struct xattr_handler added new member "name". | |
38 | dnl # xattr_handler which matches to whole name rather than prefix should use | |
39 | dnl # "name" instead of "prefix", e.g. "system.posix_acl_access" | |
40 | dnl # | |
41 | AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [ | |
42 | AC_MSG_CHECKING([whether xattr_handler has name]) | |
43 | ZFS_LINUX_TRY_COMPILE([ | |
44 | #include <linux/xattr.h> | |
45 | ||
46 | static const struct xattr_handler | |
47 | xops __attribute__ ((unused)) = { | |
48 | .name = XATTR_NAME_POSIX_ACL_ACCESS, | |
49 | }; | |
50 | ],[ | |
51 | ],[ | |
52 | AC_MSG_RESULT(yes) | |
53 | AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, | |
54 | [xattr_handler has name]) | |
55 | ],[ | |
56 | AC_MSG_RESULT(no) | |
57 | ]) | |
58 | ]) | |
59 | ||
60 | dnl # | |
61 | dnl # 4.9 API change, | |
62 | dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are | |
63 | dnl # removed. xattr operations will directly go through sb->s_xattr. | |
64 | dnl # | |
65 | AC_DEFUN([ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR], [ | |
66 | AC_MSG_CHECKING([whether generic_setxattr() exists]) | |
67 | ZFS_LINUX_TRY_COMPILE([ | |
68 | #include <linux/fs.h> | |
69 | #include <linux/xattr.h> | |
70 | ||
71 | static const struct inode_operations | |
72 | iops __attribute__ ((unused)) = { | |
73 | .setxattr = generic_setxattr | |
74 | }; | |
75 | ],[ | |
76 | ],[ | |
77 | AC_MSG_RESULT(yes) | |
78 | AC_DEFINE(HAVE_GENERIC_SETXATTR, 1, | |
79 | [generic_setxattr() exists]) | |
80 | ],[ | |
81 | AC_MSG_RESULT(no) | |
82 | ]) | |
83 | ]) | |
84 | ||
85 | dnl # | |
86 | dnl # Supported xattr handler get() interfaces checked newest to oldest. | |
87 | dnl # | |
88 | AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ | |
89 | dnl # | |
90 | dnl # 4.7 API change, | |
91 | dnl # The xattr_handler->get() callback was changed to take both | |
92 | dnl # dentry and inode. | |
93 | dnl # | |
94 | AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode]) | |
95 | ZFS_LINUX_TRY_COMPILE([ | |
96 | #include <linux/xattr.h> | |
97 | ||
98 | int get(const struct xattr_handler *handler, | |
99 | struct dentry *dentry, struct inode *inode, | |
100 | const char *name, void *buffer, size_t size) { return 0; } | |
101 | static const struct xattr_handler | |
102 | xops __attribute__ ((unused)) = { | |
103 | .get = get, | |
104 | }; | |
105 | ],[ | |
106 | ],[ | |
107 | AC_MSG_RESULT(yes) | |
108 | AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1, | |
109 | [xattr_handler->get() wants both dentry and inode]) | |
110 | ],[ | |
111 | dnl # | |
112 | dnl # 4.4 API change, | |
113 | dnl # The xattr_handler->get() callback was changed to take a | |
114 | dnl # attr_handler, and handler_flags argument was removed and | |
115 | dnl # should be accessed by handler->flags. | |
116 | dnl # | |
117 | AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler]) | |
118 | ZFS_LINUX_TRY_COMPILE([ | |
119 | #include <linux/xattr.h> | |
120 | ||
121 | int get(const struct xattr_handler *handler, | |
122 | struct dentry *dentry, const char *name, | |
123 | void *buffer, size_t size) { return 0; } | |
124 | static const struct xattr_handler | |
125 | xops __attribute__ ((unused)) = { | |
126 | .get = get, | |
127 | }; | |
128 | ],[ | |
129 | ],[ | |
130 | AC_MSG_RESULT(yes) | |
131 | AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1, | |
132 | [xattr_handler->get() wants xattr_handler]) | |
133 | ],[ | |
134 | dnl # | |
135 | dnl # 2.6.33 API change, | |
136 | dnl # The xattr_handler->get() callback was changed to take | |
137 | dnl # a dentry instead of an inode, and a handler_flags | |
138 | dnl # argument was added. | |
139 | dnl # | |
140 | AC_MSG_RESULT(no) | |
141 | AC_MSG_CHECKING([whether xattr_handler->get() wants dentry]) | |
142 | ZFS_LINUX_TRY_COMPILE([ | |
143 | #include <linux/xattr.h> | |
144 | ||
145 | int get(struct dentry *dentry, const char *name, | |
146 | void *buffer, size_t size, int handler_flags) | |
147 | { return 0; } | |
148 | static const struct xattr_handler | |
149 | xops __attribute__ ((unused)) = { | |
150 | .get = get, | |
151 | }; | |
152 | ],[ | |
153 | ],[ | |
154 | AC_MSG_RESULT(yes) | |
155 | AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1, | |
156 | [xattr_handler->get() wants dentry]) | |
157 | ],[ | |
158 | dnl # | |
159 | dnl # 2.6.32 API | |
160 | dnl # | |
161 | AC_MSG_RESULT(no) | |
162 | AC_MSG_CHECKING( | |
163 | [whether xattr_handler->get() wants inode]) | |
164 | ZFS_LINUX_TRY_COMPILE([ | |
165 | #include <linux/xattr.h> | |
166 | ||
167 | int get(struct inode *ip, const char *name, | |
168 | void *buffer, size_t size) { return 0; } | |
169 | static const struct xattr_handler | |
170 | xops __attribute__ ((unused)) = { | |
171 | .get = get, | |
172 | }; | |
173 | ],[ | |
174 | ],[ | |
175 | AC_MSG_RESULT(yes) | |
176 | AC_DEFINE(HAVE_XATTR_GET_INODE, 1, | |
177 | [xattr_handler->get() wants inode]) | |
178 | ],[ | |
179 | AC_MSG_ERROR([no; please file a bug report]) | |
180 | ]) | |
181 | ]) | |
182 | ]) | |
183 | ]) | |
184 | ]) | |
185 | ||
186 | dnl # | |
187 | dnl # Supported xattr handler set() interfaces checked newest to oldest. | |
188 | dnl # | |
189 | AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ | |
190 | dnl # | |
191 | dnl # 4.7 API change, | |
192 | dnl # The xattr_handler->set() callback was changed to take both | |
193 | dnl # dentry and inode. | |
194 | dnl # | |
195 | AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode]) | |
196 | ZFS_LINUX_TRY_COMPILE([ | |
197 | #include <linux/xattr.h> | |
198 | ||
199 | int set(const struct xattr_handler *handler, | |
200 | struct dentry *dentry, struct inode *inode, | |
201 | const char *name, const void *buffer, | |
202 | size_t size, int flags) | |
203 | { return 0; } | |
204 | static const struct xattr_handler | |
205 | xops __attribute__ ((unused)) = { | |
206 | .set = set, | |
207 | }; | |
208 | ],[ | |
209 | ],[ | |
210 | AC_MSG_RESULT(yes) | |
211 | AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, | |
212 | [xattr_handler->set() wants both dentry and inode]) | |
213 | ],[ | |
214 | dnl # | |
215 | dnl # 4.4 API change, | |
216 | dnl # The xattr_handler->set() callback was changed to take a | |
217 | dnl # xattr_handler, and handler_flags argument was removed and | |
218 | dnl # should be accessed by handler->flags. | |
219 | dnl # | |
220 | AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler]) | |
221 | ZFS_LINUX_TRY_COMPILE([ | |
222 | #include <linux/xattr.h> | |
223 | ||
224 | int set(const struct xattr_handler *handler, | |
225 | struct dentry *dentry, const char *name, | |
226 | const void *buffer, size_t size, int flags) | |
227 | { return 0; } | |
228 | static const struct xattr_handler | |
229 | xops __attribute__ ((unused)) = { | |
230 | .set = set, | |
231 | }; | |
232 | ],[ | |
233 | ],[ | |
234 | AC_MSG_RESULT(yes) | |
235 | AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, | |
236 | [xattr_handler->set() wants xattr_handler]) | |
237 | ],[ | |
238 | dnl # | |
239 | dnl # 2.6.33 API change, | |
240 | dnl # The xattr_handler->set() callback was changed to take a | |
241 | dnl # dentry instead of an inode, and a handler_flags | |
242 | dnl # argument was added. | |
243 | dnl # | |
244 | AC_MSG_RESULT(no) | |
245 | AC_MSG_CHECKING([whether xattr_handler->set() wants dentry]) | |
246 | ZFS_LINUX_TRY_COMPILE([ | |
247 | #include <linux/xattr.h> | |
248 | ||
249 | int set(struct dentry *dentry, const char *name, | |
250 | const void *buffer, size_t size, int flags, | |
251 | int handler_flags) { return 0; } | |
252 | static const struct xattr_handler | |
253 | xops __attribute__ ((unused)) = { | |
254 | .set = set, | |
255 | }; | |
256 | ],[ | |
257 | ],[ | |
258 | AC_MSG_RESULT(yes) | |
259 | AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, | |
260 | [xattr_handler->set() wants dentry]) | |
261 | ],[ | |
262 | dnl # | |
263 | dnl # 2.6.32 API | |
264 | dnl # | |
265 | AC_MSG_RESULT(no) | |
266 | AC_MSG_CHECKING( | |
267 | [whether xattr_handler->set() wants inode]) | |
268 | ZFS_LINUX_TRY_COMPILE([ | |
269 | #include <linux/xattr.h> | |
270 | ||
271 | int set(struct inode *ip, const char *name, | |
272 | const void *buffer, size_t size, int flags) | |
273 | { return 0; } | |
274 | static const struct xattr_handler | |
275 | xops __attribute__ ((unused)) = { | |
276 | .set = set, | |
277 | }; | |
278 | ],[ | |
279 | ],[ | |
280 | AC_MSG_RESULT(yes) | |
281 | AC_DEFINE(HAVE_XATTR_SET_INODE, 1, | |
282 | [xattr_handler->set() wants inode]) | |
283 | ],[ | |
284 | AC_MSG_ERROR([no; please file a bug report]) | |
285 | ]) | |
286 | ]) | |
287 | ]) | |
288 | ]) | |
289 | ]) | |
290 | ||
291 | dnl # | |
292 | dnl # Supported xattr handler list() interfaces checked newest to oldest. | |
293 | dnl # | |
294 | AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ | |
295 | dnl # 4.5 API change, | |
296 | dnl # The xattr_handler->list() callback was changed to take only a | |
297 | dnl # dentry and it only needs to return if it's accessable. | |
298 | AC_MSG_CHECKING([whether xattr_handler->list() wants simple]) | |
299 | ZFS_LINUX_TRY_COMPILE([ | |
300 | #include <linux/xattr.h> | |
301 | ||
302 | bool list(struct dentry *dentry) { return 0; } | |
303 | static const struct xattr_handler | |
304 | xops __attribute__ ((unused)) = { | |
305 | .list = list, | |
306 | }; | |
307 | ],[ | |
308 | ],[ | |
309 | AC_MSG_RESULT(yes) | |
310 | AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1, | |
311 | [xattr_handler->list() wants simple]) | |
312 | ],[ | |
313 | dnl # | |
314 | dnl # 4.4 API change, | |
315 | dnl # The xattr_handler->list() callback was changed to take a | |
316 | dnl # xattr_handler, and handler_flags argument was removed | |
317 | dnl # and should be accessed by handler->flags. | |
318 | dnl # | |
319 | AC_MSG_RESULT(no) | |
320 | AC_MSG_CHECKING( | |
321 | [whether xattr_handler->list() wants xattr_handler]) | |
322 | ZFS_LINUX_TRY_COMPILE([ | |
323 | #include <linux/xattr.h> | |
324 | ||
325 | size_t list(const struct xattr_handler *handler, | |
326 | struct dentry *dentry, char *list, size_t list_size, | |
327 | const char *name, size_t name_len) { return 0; } | |
328 | static const struct xattr_handler | |
329 | xops __attribute__ ((unused)) = { | |
330 | .list = list, | |
331 | }; | |
332 | ],[ | |
333 | ],[ | |
334 | AC_MSG_RESULT(yes) | |
335 | AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1, | |
336 | [xattr_handler->list() wants xattr_handler]) | |
337 | ],[ | |
338 | dnl # | |
339 | dnl # 2.6.33 API change, | |
340 | dnl # The xattr_handler->list() callback was changed | |
341 | dnl # to take a dentry instead of an inode, and a | |
342 | dnl # handler_flags argument was added. | |
343 | dnl # | |
344 | AC_MSG_RESULT(no) | |
345 | AC_MSG_CHECKING( | |
346 | [whether xattr_handler->list() wants dentry]) | |
347 | ZFS_LINUX_TRY_COMPILE([ | |
348 | #include <linux/xattr.h> | |
349 | ||
350 | size_t list(struct dentry *dentry, | |
351 | char *list, size_t list_size, | |
352 | const char *name, size_t name_len, | |
353 | int handler_flags) { return 0; } | |
354 | static const struct xattr_handler | |
355 | xops __attribute__ ((unused)) = { | |
356 | .list = list, | |
357 | }; | |
358 | ],[ | |
359 | ],[ | |
360 | AC_MSG_RESULT(yes) | |
361 | AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, | |
362 | [xattr_handler->list() wants dentry]) | |
363 | ],[ | |
364 | dnl # | |
365 | dnl # 2.6.32 API | |
366 | dnl # | |
367 | AC_MSG_RESULT(no) | |
368 | AC_MSG_CHECKING( | |
369 | [whether xattr_handler->list() wants inode]) | |
370 | ZFS_LINUX_TRY_COMPILE([ | |
371 | #include <linux/xattr.h> | |
372 | ||
373 | size_t list(struct inode *ip, char *lst, | |
374 | size_t list_size, const char *name, | |
375 | size_t name_len) { return 0; } | |
376 | static const struct xattr_handler | |
377 | xops __attribute__ ((unused)) = { | |
378 | .list = list, | |
379 | }; | |
380 | ],[ | |
381 | ],[ | |
382 | AC_MSG_RESULT(yes) | |
383 | AC_DEFINE(HAVE_XATTR_LIST_INODE, 1, | |
384 | [xattr_handler->list() wants inode]) | |
385 | ],[ | |
386 | AC_MSG_ERROR( | |
387 | [no; please file a bug report]) | |
388 | ]) | |
389 | ]) | |
390 | ]) | |
391 | ]) | |
392 | ]) | |
393 | ||
394 | dnl # | |
395 | dnl # 3.7 API change, | |
396 | dnl # The posix_acl_{from,to}_xattr functions gained a new | |
397 | dnl # parameter: user_ns | |
398 | dnl # | |
399 | AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [ | |
400 | AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns]) | |
401 | ZFS_LINUX_TRY_COMPILE([ | |
402 | #include <linux/cred.h> | |
403 | #include <linux/fs.h> | |
404 | #include <linux/posix_acl_xattr.h> | |
405 | ],[ | |
406 | posix_acl_from_xattr(&init_user_ns, NULL, 0); | |
407 | ],[ | |
408 | AC_MSG_RESULT(yes) | |
409 | AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1, | |
410 | [posix_acl_from_xattr() needs user_ns]) | |
411 | ],[ | |
412 | AC_MSG_RESULT(no) | |
413 | ]) | |
414 | ]) | |
415 |