]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-xattr-handler.m4
Fix typo/etc in module/zfs/zfs_ctldir.c
[mirror_zfs.git] / config / kernel-xattr-handler.m4
CommitLineData
777d4af8
BB
1dnl #
2dnl # 2.6.35 API change,
3dnl # The 'struct xattr_handler' was constified in the generic
4dnl # super_block structure.
5dnl #
4967a3eb
BB
6AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
7 AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
777d4af8
BB
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 };
777d4af8 21
b83e3e48
RY
22 const struct super_block sb __attribute__ ((unused)) = {
23 .s_xattr = xattr_handlers,
24 };
25 ],[
777d4af8
BB
26 ],[
27 AC_MSG_RESULT([yes])
28 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
4967a3eb 29 [super_block uses const struct xattr_handler])
777d4af8
BB
30 ],[
31 AC_MSG_RESULT([no])
32 ])
33])
f9637c6c 34
232604b5
CC
35dnl #
36dnl # 4.5 API change,
37dnl # struct xattr_handler added new member "name".
38dnl # xattr_handler which matches to whole name rather than prefix should use
39dnl # "name" instead of "prefix", e.g. "system.posix_acl_access"
40dnl #
41AC_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 ])
0fedeedd
CC
58])
59
60dnl #
61dnl # 4.9 API change,
62dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
63dnl # removed. xattr operations will directly go through sb->s_xattr.
64dnl #
65AC_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 ])
232604b5
CC
83])
84
f9637c6c 85dnl #
4967a3eb 86dnl # Supported xattr handler get() interfaces checked newest to oldest.
61d482f7 87dnl #
f9637c6c 88AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
4967a3eb 89 dnl #
fd4c7b7a
CC
90 dnl # 4.7 API change,
91 dnl # The xattr_handler->get() callback was changed to take both
92 dnl # dentry and inode.
4967a3eb 93 dnl #
fd4c7b7a 94 AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode])
f9637c6c
BB
95 ZFS_LINUX_TRY_COMPILE([
96 #include <linux/xattr.h>
f9637c6c 97
4967a3eb 98 int get(const struct xattr_handler *handler,
fd4c7b7a
CC
99 struct dentry *dentry, struct inode *inode,
100 const char *name, void *buffer, size_t size) { return 0; }
b83e3e48
RY
101 static const struct xattr_handler
102 xops __attribute__ ((unused)) = {
103 .get = get,
104 };
105 ],[
f9637c6c
BB
106 ],[
107 AC_MSG_RESULT(yes)
fd4c7b7a 108 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
8fbbc6b4 109 [xattr_handler->get() wants both dentry and inode])
f9637c6c 110 ],[
4967a3eb 111 dnl #
fd4c7b7a
CC
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.
4967a3eb 116 dnl #
d4701011 117 AC_MSG_RESULT(no)
fd4c7b7a 118 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
61d482f7
CC
119 ZFS_LINUX_TRY_COMPILE([
120 #include <linux/xattr.h>
121
fd4c7b7a
CC
122 int get(const struct xattr_handler *handler,
123 struct dentry *dentry, const char *name,
124 void *buffer, size_t size) { return 0; }
61d482f7
CC
125 static const struct xattr_handler
126 xops __attribute__ ((unused)) = {
127 .get = get,
128 };
129 ],[
130 ],[
131 AC_MSG_RESULT(yes)
fd4c7b7a
CC
132 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
133 [xattr_handler->get() wants xattr_handler])
61d482f7 134 ],[
4967a3eb 135 dnl #
fd4c7b7a
CC
136 dnl # 2.6.33 API change,
137 dnl # The xattr_handler->get() callback was changed to take
138 dnl # a dentry instead of an inode, and a handler_flags
139 dnl # argument was added.
4967a3eb 140 dnl #
61d482f7 141 AC_MSG_RESULT(no)
fd4c7b7a 142 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
4967a3eb
BB
143 ZFS_LINUX_TRY_COMPILE([
144 #include <linux/xattr.h>
145
fd4c7b7a
CC
146 int get(struct dentry *dentry, const char *name,
147 void *buffer, size_t size, int handler_flags)
148 { return 0; }
4967a3eb
BB
149 static const struct xattr_handler
150 xops __attribute__ ((unused)) = {
151 .get = get,
152 };
153 ],[
154 ],[
155 AC_MSG_RESULT(yes)
fd4c7b7a
CC
156 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
157 [xattr_handler->get() wants dentry])
4967a3eb 158 ],[
fd4c7b7a
CC
159 dnl #
160 dnl # 2.6.32 API
161 dnl #
162 AC_MSG_RESULT(no)
163 AC_MSG_CHECKING(
164 [whether xattr_handler->get() wants inode])
165 ZFS_LINUX_TRY_COMPILE([
166 #include <linux/xattr.h>
167
168 int get(struct inode *ip, const char *name,
169 void *buffer, size_t size) { return 0; }
170 static const struct xattr_handler
171 xops __attribute__ ((unused)) = {
172 .get = get,
173 };
174 ],[
175 ],[
176 AC_MSG_RESULT(yes)
177 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
178 [xattr_handler->get() wants inode])
179 ],[
180 AC_MSG_ERROR([no; please file a bug report])
181 ])
4967a3eb 182 ])
61d482f7 183 ])
f9637c6c
BB
184 ])
185])
186
187dnl #
4967a3eb 188dnl # Supported xattr handler set() interfaces checked newest to oldest.
61d482f7 189dnl #
f9637c6c 190AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
4967a3eb 191 dnl #
8fbbc6b4
BB
192 dnl # 4.7 API change,
193 dnl # The xattr_handler->set() callback was changed to take both
194 dnl # dentry and inode.
4967a3eb 195 dnl #
8fbbc6b4 196 AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode])
f9637c6c
BB
197 ZFS_LINUX_TRY_COMPILE([
198 #include <linux/xattr.h>
f9637c6c 199
4967a3eb 200 int set(const struct xattr_handler *handler,
8fbbc6b4
BB
201 struct dentry *dentry, struct inode *inode,
202 const char *name, const void *buffer,
203 size_t size, int flags)
4967a3eb 204 { return 0; }
b83e3e48
RY
205 static const struct xattr_handler
206 xops __attribute__ ((unused)) = {
207 .set = set,
208 };
209 ],[
f9637c6c
BB
210 ],[
211 AC_MSG_RESULT(yes)
8fbbc6b4
BB
212 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
213 [xattr_handler->set() wants both dentry and inode])
f9637c6c 214 ],[
4967a3eb 215 dnl #
8fbbc6b4 216 dnl # 4.4 API change,
4967a3eb 217 dnl # The xattr_handler->set() callback was changed to take a
8fbbc6b4
BB
218 dnl # xattr_handler, and handler_flags argument was removed and
219 dnl # should be accessed by handler->flags.
4967a3eb 220 dnl #
d4701011 221 AC_MSG_RESULT(no)
8fbbc6b4 222 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
61d482f7
CC
223 ZFS_LINUX_TRY_COMPILE([
224 #include <linux/xattr.h>
225
8fbbc6b4
BB
226 int set(const struct xattr_handler *handler,
227 struct dentry *dentry, const char *name,
228 const void *buffer, size_t size, int flags)
229 { return 0; }
61d482f7
CC
230 static const struct xattr_handler
231 xops __attribute__ ((unused)) = {
232 .set = set,
233 };
234 ],[
235 ],[
236 AC_MSG_RESULT(yes)
8fbbc6b4
BB
237 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
238 [xattr_handler->set() wants xattr_handler])
61d482f7 239 ],[
4967a3eb 240 dnl #
8fbbc6b4
BB
241 dnl # 2.6.33 API change,
242 dnl # The xattr_handler->set() callback was changed to take a
243 dnl # dentry instead of an inode, and a handler_flags
244 dnl # argument was added.
4967a3eb 245 dnl #
61d482f7 246 AC_MSG_RESULT(no)
8fbbc6b4 247 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
4967a3eb
BB
248 ZFS_LINUX_TRY_COMPILE([
249 #include <linux/xattr.h>
250
8fbbc6b4
BB
251 int set(struct dentry *dentry, const char *name,
252 const void *buffer, size_t size, int flags,
253 int handler_flags) { return 0; }
4967a3eb
BB
254 static const struct xattr_handler
255 xops __attribute__ ((unused)) = {
256 .set = set,
257 };
258 ],[
259 ],[
260 AC_MSG_RESULT(yes)
8fbbc6b4
BB
261 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
262 [xattr_handler->set() wants dentry])
4967a3eb 263 ],[
8fbbc6b4
BB
264 dnl #
265 dnl # 2.6.32 API
266 dnl #
267 AC_MSG_RESULT(no)
268 AC_MSG_CHECKING(
269 [whether xattr_handler->set() wants inode])
270 ZFS_LINUX_TRY_COMPILE([
271 #include <linux/xattr.h>
272
273 int set(struct inode *ip, const char *name,
274 const void *buffer, size_t size, int flags)
275 { return 0; }
276 static const struct xattr_handler
277 xops __attribute__ ((unused)) = {
278 .set = set,
279 };
280 ],[
281 ],[
282 AC_MSG_RESULT(yes)
283 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
284 [xattr_handler->set() wants inode])
285 ],[
286 AC_MSG_ERROR([no; please file a bug report])
287 ])
4967a3eb 288 ])
61d482f7 289 ])
f9637c6c
BB
290 ])
291])
023699cd
MM
292
293dnl #
4967a3eb 294dnl # Supported xattr handler list() interfaces checked newest to oldest.
61d482f7 295dnl #
023699cd 296AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
4967a3eb
BB
297 dnl # 4.5 API change,
298 dnl # The xattr_handler->list() callback was changed to take only a
4e33ba4c 299 dnl # dentry and it only needs to return if it's accessible.
4967a3eb 300 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
023699cd
MM
301 ZFS_LINUX_TRY_COMPILE([
302 #include <linux/xattr.h>
303
4967a3eb 304 bool list(struct dentry *dentry) { return 0; }
023699cd
MM
305 static const struct xattr_handler
306 xops __attribute__ ((unused)) = {
307 .list = list,
308 };
309 ],[
310 ],[
311 AC_MSG_RESULT(yes)
4967a3eb
BB
312 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
313 [xattr_handler->list() wants simple])
023699cd 314 ],[
4967a3eb
BB
315 dnl #
316 dnl # 4.4 API change,
317 dnl # The xattr_handler->list() callback was changed to take a
318 dnl # xattr_handler, and handler_flags argument was removed
319 dnl # and should be accessed by handler->flags.
320 dnl #
023699cd 321 AC_MSG_RESULT(no)
4967a3eb
BB
322 AC_MSG_CHECKING(
323 [whether xattr_handler->list() wants xattr_handler])
61d482f7
CC
324 ZFS_LINUX_TRY_COMPILE([
325 #include <linux/xattr.h>
326
4967a3eb
BB
327 size_t list(const struct xattr_handler *handler,
328 struct dentry *dentry, char *list, size_t list_size,
329 const char *name, size_t name_len) { return 0; }
61d482f7
CC
330 static const struct xattr_handler
331 xops __attribute__ ((unused)) = {
332 .list = list,
333 };
334 ],[
335 ],[
336 AC_MSG_RESULT(yes)
4967a3eb 337 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
61d482f7
CC
338 [xattr_handler->list() wants xattr_handler])
339 ],[
4967a3eb
BB
340 dnl #
341 dnl # 2.6.33 API change,
342 dnl # The xattr_handler->list() callback was changed
343 dnl # to take a dentry instead of an inode, and a
344 dnl # handler_flags argument was added.
345 dnl #
61d482f7 346 AC_MSG_RESULT(no)
4967a3eb
BB
347 AC_MSG_CHECKING(
348 [whether xattr_handler->list() wants dentry])
349 ZFS_LINUX_TRY_COMPILE([
350 #include <linux/xattr.h>
351
352 size_t list(struct dentry *dentry,
353 char *list, size_t list_size,
354 const char *name, size_t name_len,
355 int handler_flags) { return 0; }
356 static const struct xattr_handler
357 xops __attribute__ ((unused)) = {
358 .list = list,
359 };
360 ],[
361 ],[
362 AC_MSG_RESULT(yes)
363 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
364 [xattr_handler->list() wants dentry])
365 ],[
366 dnl #
367 dnl # 2.6.32 API
368 dnl #
369 AC_MSG_RESULT(no)
370 AC_MSG_CHECKING(
371 [whether xattr_handler->list() wants inode])
372 ZFS_LINUX_TRY_COMPILE([
373 #include <linux/xattr.h>
374
375 size_t list(struct inode *ip, char *lst,
376 size_t list_size, const char *name,
377 size_t name_len) { return 0; }
378 static const struct xattr_handler
379 xops __attribute__ ((unused)) = {
380 .list = list,
381 };
382 ],[
383 ],[
384 AC_MSG_RESULT(yes)
385 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
386 [xattr_handler->list() wants inode])
387 ],[
388 AC_MSG_ERROR(
389 [no; please file a bug report])
390 ])
391 ])
61d482f7 392 ])
023699cd
MM
393 ])
394])
395
396dnl #
397dnl # 3.7 API change,
398dnl # The posix_acl_{from,to}_xattr functions gained a new
399dnl # parameter: user_ns
400dnl #
401AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
402 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
403 ZFS_LINUX_TRY_COMPILE([
404 #include <linux/cred.h>
405 #include <linux/fs.h>
406 #include <linux/posix_acl_xattr.h>
407 ],[
408 posix_acl_from_xattr(&init_user_ns, NULL, 0);
409 ],[
410 AC_MSG_RESULT(yes)
411 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
412 [posix_acl_from_xattr() needs user_ns])
413 ],[
414 AC_MSG_RESULT(no)
415 ])
416])
417