]>
Commit | Line | Data |
---|---|---|
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 # Supported xattr handler get() interfaces checked newest to oldest. | |
62 | dnl # | |
63 | AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ | |
64 | dnl # | |
65 | dnl # 4.7 API change, | |
66 | dnl # The xattr_handler->get() callback was changed to take both | |
67 | dnl # dentry and inode. | |
68 | dnl # | |
69 | AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode]) | |
70 | ZFS_LINUX_TRY_COMPILE([ | |
71 | #include <linux/xattr.h> | |
72 | ||
73 | int get(const struct xattr_handler *handler, | |
74 | struct dentry *dentry, struct inode *inode, | |
75 | const char *name, void *buffer, size_t size) { 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_INODE, 1, | |
84 | [xattr_handler->get() wants both dentry and inode]) | |
85 | ],[ | |
86 | dnl # | |
87 | dnl # 4.4 API change, | |
88 | dnl # The xattr_handler->get() callback was changed to take a | |
89 | dnl # attr_handler, and handler_flags argument was removed and | |
90 | dnl # should be accessed by handler->flags. | |
91 | dnl # | |
92 | AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler]) | |
93 | ZFS_LINUX_TRY_COMPILE([ | |
94 | #include <linux/xattr.h> | |
95 | ||
96 | int get(const struct xattr_handler *handler, | |
97 | struct dentry *dentry, const char *name, | |
98 | void *buffer, size_t size) { return 0; } | |
99 | static const struct xattr_handler | |
100 | xops __attribute__ ((unused)) = { | |
101 | .get = get, | |
102 | }; | |
103 | ],[ | |
104 | ],[ | |
105 | AC_MSG_RESULT(yes) | |
106 | AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1, | |
107 | [xattr_handler->get() wants xattr_handler]) | |
108 | ],[ | |
109 | dnl # | |
110 | dnl # 2.6.33 API change, | |
111 | dnl # The xattr_handler->get() callback was changed to take | |
112 | dnl # a dentry instead of an inode, and a handler_flags | |
113 | dnl # argument was added. | |
114 | dnl # | |
115 | AC_MSG_RESULT(no) | |
116 | AC_MSG_CHECKING([whether xattr_handler->get() wants dentry]) | |
117 | ZFS_LINUX_TRY_COMPILE([ | |
118 | #include <linux/xattr.h> | |
119 | ||
120 | int get(struct dentry *dentry, const char *name, | |
121 | void *buffer, size_t size, int handler_flags) | |
122 | { return 0; } | |
123 | static const struct xattr_handler | |
124 | xops __attribute__ ((unused)) = { | |
125 | .get = get, | |
126 | }; | |
127 | ],[ | |
128 | ],[ | |
129 | AC_MSG_RESULT(yes) | |
130 | AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1, | |
131 | [xattr_handler->get() wants dentry]) | |
132 | ],[ | |
133 | dnl # | |
134 | dnl # 2.6.32 API | |
135 | dnl # | |
136 | AC_MSG_RESULT(no) | |
137 | AC_MSG_CHECKING( | |
138 | [whether xattr_handler->get() wants inode]) | |
139 | ZFS_LINUX_TRY_COMPILE([ | |
140 | #include <linux/xattr.h> | |
141 | ||
142 | int get(struct inode *ip, const char *name, | |
143 | void *buffer, size_t size) { return 0; } | |
144 | static const struct xattr_handler | |
145 | xops __attribute__ ((unused)) = { | |
146 | .get = get, | |
147 | }; | |
148 | ],[ | |
149 | ],[ | |
150 | AC_MSG_RESULT(yes) | |
151 | AC_DEFINE(HAVE_XATTR_GET_INODE, 1, | |
152 | [xattr_handler->get() wants inode]) | |
153 | ],[ | |
154 | AC_MSG_ERROR([no; please file a bug report]) | |
155 | ]) | |
156 | ]) | |
157 | ]) | |
158 | ]) | |
159 | ]) | |
160 | ||
161 | dnl # | |
162 | dnl # Supported xattr handler set() interfaces checked newest to oldest. | |
163 | dnl # | |
164 | AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ | |
165 | dnl # | |
166 | dnl # 4.7 API change, | |
167 | dnl # The xattr_handler->set() callback was changed to take both | |
168 | dnl # dentry and inode. | |
169 | dnl # | |
170 | AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode]) | |
171 | ZFS_LINUX_TRY_COMPILE([ | |
172 | #include <linux/xattr.h> | |
173 | ||
174 | int set(const struct xattr_handler *handler, | |
175 | struct dentry *dentry, struct inode *inode, | |
176 | const char *name, const void *buffer, | |
177 | size_t size, int flags) | |
178 | { return 0; } | |
179 | static const struct xattr_handler | |
180 | xops __attribute__ ((unused)) = { | |
181 | .set = set, | |
182 | }; | |
183 | ],[ | |
184 | ],[ | |
185 | AC_MSG_RESULT(yes) | |
186 | AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, | |
187 | [xattr_handler->set() wants both dentry and inode]) | |
188 | ],[ | |
189 | dnl # | |
190 | dnl # 4.4 API change, | |
191 | dnl # The xattr_handler->set() callback was changed to take a | |
192 | dnl # xattr_handler, and handler_flags argument was removed and | |
193 | dnl # should be accessed by handler->flags. | |
194 | dnl # | |
195 | AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler]) | |
196 | ZFS_LINUX_TRY_COMPILE([ | |
197 | #include <linux/xattr.h> | |
198 | ||
199 | int set(const struct xattr_handler *handler, | |
200 | struct dentry *dentry, const char *name, | |
201 | const void *buffer, size_t size, int flags) | |
202 | { return 0; } | |
203 | static const struct xattr_handler | |
204 | xops __attribute__ ((unused)) = { | |
205 | .set = set, | |
206 | }; | |
207 | ],[ | |
208 | ],[ | |
209 | AC_MSG_RESULT(yes) | |
210 | AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, | |
211 | [xattr_handler->set() wants xattr_handler]) | |
212 | ],[ | |
213 | dnl # | |
214 | dnl # 2.6.33 API change, | |
215 | dnl # The xattr_handler->set() callback was changed to take a | |
216 | dnl # dentry instead of an inode, and a handler_flags | |
217 | dnl # argument was added. | |
218 | dnl # | |
219 | AC_MSG_RESULT(no) | |
220 | AC_MSG_CHECKING([whether xattr_handler->set() wants dentry]) | |
221 | ZFS_LINUX_TRY_COMPILE([ | |
222 | #include <linux/xattr.h> | |
223 | ||
224 | int set(struct dentry *dentry, const char *name, | |
225 | const void *buffer, size_t size, int flags, | |
226 | int handler_flags) { return 0; } | |
227 | static const struct xattr_handler | |
228 | xops __attribute__ ((unused)) = { | |
229 | .set = set, | |
230 | }; | |
231 | ],[ | |
232 | ],[ | |
233 | AC_MSG_RESULT(yes) | |
234 | AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, | |
235 | [xattr_handler->set() wants dentry]) | |
236 | ],[ | |
237 | dnl # | |
238 | dnl # 2.6.32 API | |
239 | dnl # | |
240 | AC_MSG_RESULT(no) | |
241 | AC_MSG_CHECKING( | |
242 | [whether xattr_handler->set() wants inode]) | |
243 | ZFS_LINUX_TRY_COMPILE([ | |
244 | #include <linux/xattr.h> | |
245 | ||
246 | int set(struct inode *ip, const char *name, | |
247 | const void *buffer, size_t size, int flags) | |
248 | { return 0; } | |
249 | static const struct xattr_handler | |
250 | xops __attribute__ ((unused)) = { | |
251 | .set = set, | |
252 | }; | |
253 | ],[ | |
254 | ],[ | |
255 | AC_MSG_RESULT(yes) | |
256 | AC_DEFINE(HAVE_XATTR_SET_INODE, 1, | |
257 | [xattr_handler->set() wants inode]) | |
258 | ],[ | |
259 | AC_MSG_ERROR([no; please file a bug report]) | |
260 | ]) | |
261 | ]) | |
262 | ]) | |
263 | ]) | |
264 | ]) | |
265 | ||
266 | dnl # | |
267 | dnl # Supported xattr handler list() interfaces checked newest to oldest. | |
268 | dnl # | |
269 | AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ | |
270 | dnl # 4.5 API change, | |
271 | dnl # The xattr_handler->list() callback was changed to take only a | |
272 | dnl # dentry and it only needs to return if it's accessable. | |
273 | AC_MSG_CHECKING([whether xattr_handler->list() wants simple]) | |
274 | ZFS_LINUX_TRY_COMPILE([ | |
275 | #include <linux/xattr.h> | |
276 | ||
277 | bool list(struct dentry *dentry) { 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_SIMPLE, 1, | |
286 | [xattr_handler->list() wants simple]) | |
287 | ],[ | |
288 | dnl # | |
289 | dnl # 4.4 API change, | |
290 | dnl # The xattr_handler->list() callback was changed to take a | |
291 | dnl # xattr_handler, and handler_flags argument was removed | |
292 | dnl # and should be accessed by handler->flags. | |
293 | dnl # | |
294 | AC_MSG_RESULT(no) | |
295 | AC_MSG_CHECKING( | |
296 | [whether xattr_handler->list() wants xattr_handler]) | |
297 | ZFS_LINUX_TRY_COMPILE([ | |
298 | #include <linux/xattr.h> | |
299 | ||
300 | size_t list(const struct xattr_handler *handler, | |
301 | struct dentry *dentry, char *list, size_t list_size, | |
302 | const char *name, size_t name_len) { 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_HANDLER, 1, | |
311 | [xattr_handler->list() wants xattr_handler]) | |
312 | ],[ | |
313 | dnl # | |
314 | dnl # 2.6.33 API change, | |
315 | dnl # The xattr_handler->list() callback was changed | |
316 | dnl # to take a dentry instead of an inode, and a | |
317 | dnl # handler_flags argument was added. | |
318 | dnl # | |
319 | AC_MSG_RESULT(no) | |
320 | AC_MSG_CHECKING( | |
321 | [whether xattr_handler->list() wants dentry]) | |
322 | ZFS_LINUX_TRY_COMPILE([ | |
323 | #include <linux/xattr.h> | |
324 | ||
325 | size_t list(struct dentry *dentry, | |
326 | char *list, size_t list_size, | |
327 | const char *name, size_t name_len, | |
328 | int handler_flags) { return 0; } | |
329 | static const struct xattr_handler | |
330 | xops __attribute__ ((unused)) = { | |
331 | .list = list, | |
332 | }; | |
333 | ],[ | |
334 | ],[ | |
335 | AC_MSG_RESULT(yes) | |
336 | AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, | |
337 | [xattr_handler->list() wants dentry]) | |
338 | ],[ | |
339 | dnl # | |
340 | dnl # 2.6.32 API | |
341 | dnl # | |
342 | AC_MSG_RESULT(no) | |
343 | AC_MSG_CHECKING( | |
344 | [whether xattr_handler->list() wants inode]) | |
345 | ZFS_LINUX_TRY_COMPILE([ | |
346 | #include <linux/xattr.h> | |
347 | ||
348 | size_t list(struct inode *ip, char *lst, | |
349 | size_t list_size, const char *name, | |
350 | size_t name_len) { return 0; } | |
351 | static const struct xattr_handler | |
352 | xops __attribute__ ((unused)) = { | |
353 | .list = list, | |
354 | }; | |
355 | ],[ | |
356 | ],[ | |
357 | AC_MSG_RESULT(yes) | |
358 | AC_DEFINE(HAVE_XATTR_LIST_INODE, 1, | |
359 | [xattr_handler->list() wants inode]) | |
360 | ],[ | |
361 | AC_MSG_ERROR( | |
362 | [no; please file a bug report]) | |
363 | ]) | |
364 | ]) | |
365 | ]) | |
366 | ]) | |
367 | ]) | |
368 | ||
369 | dnl # | |
370 | dnl # 3.7 API change, | |
371 | dnl # The posix_acl_{from,to}_xattr functions gained a new | |
372 | dnl # parameter: user_ns | |
373 | dnl # | |
374 | AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [ | |
375 | AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns]) | |
376 | ZFS_LINUX_TRY_COMPILE([ | |
377 | #include <linux/cred.h> | |
378 | #include <linux/fs.h> | |
379 | #include <linux/posix_acl_xattr.h> | |
380 | ],[ | |
381 | posix_acl_from_xattr(&init_user_ns, NULL, 0); | |
382 | ],[ | |
383 | AC_MSG_RESULT(yes) | |
384 | AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1, | |
385 | [posix_acl_from_xattr() needs user_ns]) | |
386 | ],[ | |
387 | AC_MSG_RESULT(no) | |
388 | ]) | |
389 | ]) | |
390 |