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_userns], [
183 #include <linux/xattr.h>
185 int set(const struct xattr_handler *handler,
186 struct user_namespace *mnt_userns,
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_dentry_inode], [
198 #include <linux/xattr.h>
200 int set(const struct xattr_handler *handler,
201 struct dentry *dentry, struct inode *inode,
202 const char *name, const void *buffer,
203 size_t size, int flags)
205 static const struct xattr_handler
206 xops __attribute__ ((unused)) = {
211 ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [
212 #include <linux/xattr.h>
214 int set(const struct xattr_handler *handler,
215 struct dentry *dentry, const char *name,
216 const void *buffer, size_t size, int flags)
218 static const struct xattr_handler
219 xops __attribute__ ((unused)) = {
224 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [
225 #include <linux/xattr.h>
227 int set(struct dentry *dentry, const char *name,
228 const void *buffer, size_t size, int flags,
229 int handler_flags) { return 0; }
230 static const struct xattr_handler
231 xops __attribute__ ((unused)) = {
237 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
239 dnl # 5.12 API change,
240 dnl # The xattr_handler->set() callback was changed to 8 arguments, and
241 dnl # struct user_namespace* was inserted as arg #2
243 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace])
244 ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [
246 AC_DEFINE(HAVE_XATTR_SET_USERNS, 1,
247 [xattr_handler->set() takes user_namespace])
250 dnl # 4.7 API change,
251 dnl # The xattr_handler->set() callback was changed to take both
252 dnl # dentry and inode.
255 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
256 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
258 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
259 [xattr_handler->set() wants both dentry and inode])
262 dnl # 4.4 API change,
263 dnl # The xattr_handler->set() callback was changed to take a
264 dnl # xattr_handler, and handler_flags argument was removed and
265 dnl # should be accessed by handler->flags.
269 [whether xattr_handler->set() wants xattr_handler])
270 ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
272 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
273 [xattr_handler->set() wants xattr_handler])
276 dnl # 2.6.33 API change,
277 dnl # The xattr_handler->set() callback was changed
278 dnl # to take a dentry instead of an inode, and a
279 dnl # handler_flags argument was added.
283 [whether xattr_handler->set() wants dentry])
284 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
286 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
287 [xattr_handler->set() wants dentry])
289 ZFS_LINUX_TEST_ERROR([xattr set()])
297 dnl # Supported xattr handler list() interfaces checked newest to oldest.
299 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
300 ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [
301 #include <linux/xattr.h>
303 bool list(struct dentry *dentry) { return 0; }
304 static const struct xattr_handler
305 xops __attribute__ ((unused)) = {
310 ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [
311 #include <linux/xattr.h>
313 size_t list(const struct xattr_handler *handler,
314 struct dentry *dentry, char *list, size_t list_size,
315 const char *name, size_t name_len) { return 0; }
316 static const struct xattr_handler
317 xops __attribute__ ((unused)) = {
322 ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [
323 #include <linux/xattr.h>
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)) = {
336 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
337 dnl # 4.5 API change,
338 dnl # The xattr_handler->list() callback was changed to take only a
339 dnl # dentry and it only needs to return if it's accessible.
340 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
341 ZFS_LINUX_TEST_RESULT([xattr_handler_list_simple], [
343 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
344 [xattr_handler->list() wants simple])
347 dnl # 4.4 API change,
348 dnl # The xattr_handler->list() callback was changed to take a
349 dnl # xattr_handler, and handler_flags argument was removed
350 dnl # and should be accessed by handler->flags.
354 [whether xattr_handler->list() wants xattr_handler])
355 ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [
357 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
358 [xattr_handler->list() wants xattr_handler])
361 dnl # 2.6.33 API change,
362 dnl # The xattr_handler->list() callback was changed
363 dnl # to take a dentry instead of an inode, and a
364 dnl # handler_flags argument was added.
368 [whether xattr_handler->list() wants dentry])
369 ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [
371 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
372 [xattr_handler->list() wants dentry])
374 ZFS_LINUX_TEST_ERROR([xattr list()])
381 dnl # 3.7 API change,
382 dnl # The posix_acl_{from,to}_xattr functions gained a new
383 dnl # parameter: user_ns
385 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS], [
386 ZFS_LINUX_TEST_SRC([posix_acl_from_xattr_userns], [
387 #include <linux/cred.h>
388 #include <linux/fs.h>
389 #include <linux/posix_acl_xattr.h>
391 posix_acl_from_xattr(&init_user_ns, NULL, 0);
395 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
396 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
397 ZFS_LINUX_TEST_RESULT([posix_acl_from_xattr_userns], [
399 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
400 [posix_acl_from_xattr() needs user_ns])
402 ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()])
407 dnl # 4.9 API change,
408 dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
409 dnl # removed. xattr operations will directly go through sb->s_xattr.
411 AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR], [
412 ZFS_LINUX_TEST_SRC([have_generic_setxattr], [
413 #include <linux/fs.h>
414 #include <linux/xattr.h>
416 static const struct inode_operations
417 iops __attribute__ ((unused)) = {
418 .setxattr = generic_setxattr
423 AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [
424 AC_MSG_CHECKING([whether generic_setxattr() exists])
425 ZFS_LINUX_TEST_RESULT([have_generic_setxattr], [
427 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
428 [generic_setxattr() exists])
434 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [
435 ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER
436 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME
437 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET
438 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET
439 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST
440 ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS
441 ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR
444 AC_DEFUN([ZFS_AC_KERNEL_XATTR], [
445 ZFS_AC_KERNEL_CONST_XATTR_HANDLER
446 ZFS_AC_KERNEL_XATTR_HANDLER_NAME
447 ZFS_AC_KERNEL_XATTR_HANDLER_GET
448 ZFS_AC_KERNEL_XATTR_HANDLER_SET
449 ZFS_AC_KERNEL_XATTR_HANDLER_LIST
450 ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS
451 ZFS_AC_KERNEL_GENERIC_SETXATTR