2 dnl # 2.6.35 API change,
3 dnl # The 'struct xattr_handler' was constified in the generic
4 dnl # super_block structure.
6 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER], [
7 ZFS_LINUX_TEST_SRC([const_xattr_handler], [
9 #include <linux/xattr.h>
11 const struct xattr_handler xattr_test_handler = {
17 const struct xattr_handler *xattr_handlers[] = {
21 const struct super_block sb __attribute__ ((unused)) = {
22 .s_xattr = xattr_handlers,
27 AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
28 AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
29 ZFS_LINUX_TEST_RESULT([const_xattr_handler], [
32 ZFS_LINUX_TEST_ERROR([const xattr_handler])
38 dnl # struct xattr_handler added new member "name".
39 dnl # xattr_handler which matches to whole name rather than prefix should use
40 dnl # "name" instead of "prefix", e.g. "system.posix_acl_access"
42 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME], [
43 ZFS_LINUX_TEST_SRC([xattr_handler_name], [
44 #include <linux/xattr.h>
46 static const struct xattr_handler
47 xops __attribute__ ((unused)) = {
48 .name = XATTR_NAME_POSIX_ACL_ACCESS,
53 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [
54 AC_MSG_CHECKING([whether xattr_handler has name])
55 ZFS_LINUX_TEST_RESULT([xattr_handler_name], [
57 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
58 [xattr_handler has name])
65 dnl # Supported xattr handler get() interfaces checked newest to oldest.
67 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [
68 ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode], [
69 #include <linux/xattr.h>
71 int get(const struct xattr_handler *handler,
72 struct dentry *dentry, struct inode *inode,
73 const char *name, void *buffer, size_t size) { return 0; }
74 static const struct xattr_handler
75 xops __attribute__ ((unused)) = {
80 ZFS_LINUX_TEST_SRC([xattr_handler_get_xattr_handler], [
81 #include <linux/xattr.h>
83 int get(const struct xattr_handler *handler,
84 struct dentry *dentry, const char *name,
85 void *buffer, size_t size) { return 0; }
86 static const struct xattr_handler
87 xops __attribute__ ((unused)) = {
92 ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry], [
93 #include <linux/xattr.h>
95 int get(struct dentry *dentry, const char *name,
96 void *buffer, size_t size, int handler_flags)
98 static const struct xattr_handler
99 xops __attribute__ ((unused)) = {
104 ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode_flags], [
105 #include <linux/xattr.h>
107 int get(const struct xattr_handler *handler,
108 struct dentry *dentry, struct inode *inode,
109 const char *name, void *buffer,
110 size_t size, int flags) { return 0; }
111 static const struct xattr_handler
112 xops __attribute__ ((unused)) = {
118 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
120 dnl # 4.7 API change,
121 dnl # The xattr_handler->get() callback was changed to take both
122 dnl # dentry and inode.
124 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry and inode])
125 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode], [
127 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
128 [xattr_handler->get() wants both dentry and inode])
131 dnl # 4.4 API change,
132 dnl # The xattr_handler->get() callback was changed to take a
133 dnl # attr_handler, and handler_flags argument was removed and
134 dnl # should be accessed by handler->flags.
138 [whether xattr_handler->get() wants xattr_handler])
139 ZFS_LINUX_TEST_RESULT([xattr_handler_get_xattr_handler], [
141 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
142 [xattr_handler->get() wants xattr_handler])
145 dnl # 2.6.33 API change,
146 dnl # The xattr_handler->get() callback was changed
147 dnl # to take a dentry instead of an inode, and a
148 dnl # handler_flags argument was added.
152 [whether xattr_handler->get() wants dentry])
153 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry], [
155 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
156 [xattr_handler->get() wants dentry])
159 dnl # Android API change,
160 dnl # The xattr_handler->get() callback was
161 dnl # changed to take dentry, inode and flags.
165 [whether xattr_handler->get() wants dentry and inode and flags])
166 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode_flags], [
168 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE_FLAGS, 1,
169 [xattr_handler->get() wants dentry and inode and flags])
171 ZFS_LINUX_TEST_ERROR([xattr get()])
179 dnl # Supported xattr handler set() interfaces checked newest to oldest.
181 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
182 ZFS_LINUX_TEST_SRC([xattr_handler_set_mnt_idmap], [
183 #include <linux/xattr.h>
185 int set(const struct xattr_handler *handler,
186 struct mnt_idmap *idmap,
187 struct dentry *dentry, struct inode *inode,
188 const char *name, const void *buffer,
189 size_t size, int flags)
191 static const struct xattr_handler
192 xops __attribute__ ((unused)) = {
197 ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [
198 #include <linux/xattr.h>
200 int set(const struct xattr_handler *handler,
201 struct user_namespace *mnt_userns,
202 struct dentry *dentry, struct inode *inode,
203 const char *name, const void *buffer,
204 size_t size, int flags)
206 static const struct xattr_handler
207 xops __attribute__ ((unused)) = {
212 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [
213 #include <linux/xattr.h>
215 int set(const struct xattr_handler *handler,
216 struct dentry *dentry, struct inode *inode,
217 const char *name, const void *buffer,
218 size_t size, int flags)
220 static const struct xattr_handler
221 xops __attribute__ ((unused)) = {
226 ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [
227 #include <linux/xattr.h>
229 int set(const struct xattr_handler *handler,
230 struct dentry *dentry, const char *name,
231 const void *buffer, size_t size, int flags)
233 static const struct xattr_handler
234 xops __attribute__ ((unused)) = {
239 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [
240 #include <linux/xattr.h>
242 int set(struct dentry *dentry, const char *name,
243 const void *buffer, size_t size, int flags,
244 int handler_flags) { return 0; }
245 static const struct xattr_handler
246 xops __attribute__ ((unused)) = {
252 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
254 dnl # 5.12 API change,
255 dnl # The xattr_handler->set() callback was changed to 8 arguments, and
256 dnl # struct user_namespace* was inserted as arg #2
258 dnl # 6.3 API change,
259 dnl # The xattr_handler->set() callback 2nd arg is now struct mnt_idmap *
261 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and mnt_idmap])
262 ZFS_LINUX_TEST_RESULT([xattr_handler_set_mnt_idmap], [
264 AC_DEFINE(HAVE_XATTR_SET_IDMAP, 1,
265 [xattr_handler->set() takes mnt_idmap])
267 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace])
268 ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [
270 AC_DEFINE(HAVE_XATTR_SET_USERNS, 1,
271 [xattr_handler->set() takes user_namespace])
274 dnl # 4.7 API change,
275 dnl # The xattr_handler->set() callback was changed to take both
276 dnl # dentry and inode.
279 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
280 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
282 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
283 [xattr_handler->set() wants both dentry and inode])
286 dnl # 4.4 API change,
287 dnl # The xattr_handler->set() callback was changed to take a
288 dnl # xattr_handler, and handler_flags argument was removed and
289 dnl # should be accessed by handler->flags.
293 [whether xattr_handler->set() wants xattr_handler])
294 ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
296 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
297 [xattr_handler->set() wants xattr_handler])
300 dnl # 2.6.33 API change,
301 dnl # The xattr_handler->set() callback was changed
302 dnl # to take a dentry instead of an inode, and a
303 dnl # handler_flags argument was added.
307 [whether xattr_handler->set() wants dentry])
308 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
310 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
311 [xattr_handler->set() wants dentry])
313 ZFS_LINUX_TEST_ERROR([xattr set()])
322 dnl # Supported xattr handler list() interfaces checked newest to oldest.
324 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
325 ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [
326 #include <linux/xattr.h>
328 bool list(struct dentry *dentry) { return 0; }
329 static const struct xattr_handler
330 xops __attribute__ ((unused)) = {
335 ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [
336 #include <linux/xattr.h>
338 size_t list(const struct xattr_handler *handler,
339 struct dentry *dentry, char *list, size_t list_size,
340 const char *name, size_t name_len) { return 0; }
341 static const struct xattr_handler
342 xops __attribute__ ((unused)) = {
347 ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [
348 #include <linux/xattr.h>
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)) = {
361 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
362 dnl # 4.5 API change,
363 dnl # The xattr_handler->list() callback was changed to take only a
364 dnl # dentry and it only needs to return if it's accessible.
365 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
366 ZFS_LINUX_TEST_RESULT([xattr_handler_list_simple], [
368 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
369 [xattr_handler->list() wants simple])
372 dnl # 4.4 API change,
373 dnl # The xattr_handler->list() callback was changed to take a
374 dnl # xattr_handler, and handler_flags argument was removed
375 dnl # and should be accessed by handler->flags.
379 [whether xattr_handler->list() wants xattr_handler])
380 ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [
382 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
383 [xattr_handler->list() wants xattr_handler])
386 dnl # 2.6.33 API change,
387 dnl # The xattr_handler->list() callback was changed
388 dnl # to take a dentry instead of an inode, and a
389 dnl # handler_flags argument was added.
393 [whether xattr_handler->list() wants dentry])
394 ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [
396 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
397 [xattr_handler->list() wants dentry])
399 ZFS_LINUX_TEST_ERROR([xattr list()])
406 dnl # 3.7 API change,
407 dnl # The posix_acl_{from,to}_xattr functions gained a new
408 dnl # parameter: user_ns
410 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS], [
411 ZFS_LINUX_TEST_SRC([posix_acl_from_xattr_userns], [
412 #include <linux/cred.h>
413 #include <linux/fs.h>
414 #include <linux/posix_acl_xattr.h>
416 posix_acl_from_xattr(&init_user_ns, NULL, 0);
420 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
421 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
422 ZFS_LINUX_TEST_RESULT([posix_acl_from_xattr_userns], [
424 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
425 [posix_acl_from_xattr() needs user_ns])
427 ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()])
432 dnl # 4.9 API change,
433 dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
434 dnl # removed. xattr operations will directly go through sb->s_xattr.
436 AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR], [
437 ZFS_LINUX_TEST_SRC([have_generic_setxattr], [
438 #include <linux/fs.h>
439 #include <linux/xattr.h>
441 static const struct inode_operations
442 iops __attribute__ ((unused)) = {
443 .setxattr = generic_setxattr
448 AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [
449 AC_MSG_CHECKING([whether generic_setxattr() exists])
450 ZFS_LINUX_TEST_RESULT([have_generic_setxattr], [
452 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
453 [generic_setxattr() exists])
459 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [
460 ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER
461 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME
462 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET
463 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET
464 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST
465 ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS
466 ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR
469 AC_DEFUN([ZFS_AC_KERNEL_XATTR], [
470 ZFS_AC_KERNEL_CONST_XATTR_HANDLER
471 ZFS_AC_KERNEL_XATTR_HANDLER_NAME
472 ZFS_AC_KERNEL_XATTR_HANDLER_GET
473 ZFS_AC_KERNEL_XATTR_HANDLER_SET
474 ZFS_AC_KERNEL_XATTR_HANDLER_LIST
475 ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS
476 ZFS_AC_KERNEL_GENERIC_SETXATTR