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)) = {
105 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
107 dnl # 4.7 API change,
108 dnl # The xattr_handler->get() callback was changed to take both
109 dnl # dentry and inode.
111 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry and inode])
112 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode], [
114 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
115 [xattr_handler->get() wants both dentry and inode])
118 dnl # 4.4 API change,
119 dnl # The xattr_handler->get() callback was changed to take a
120 dnl # attr_handler, and handler_flags argument was removed and
121 dnl # should be accessed by handler->flags.
125 [whether xattr_handler->get() wants xattr_handler])
126 ZFS_LINUX_TEST_RESULT([xattr_handler_get_xattr_handler], [
128 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
129 [xattr_handler->get() wants xattr_handler])
132 dnl # 2.6.33 API change,
133 dnl # The xattr_handler->get() callback was changed
134 dnl # to take a dentry instead of an inode, and a
135 dnl # handler_flags argument was added.
139 [whether xattr_handler->get() wants dentry])
140 ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry], [
142 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
143 [xattr_handler->get() wants dentry])
145 ZFS_LINUX_TEST_ERROR([xattr get()])
152 dnl # Supported xattr handler set() interfaces checked newest to oldest.
154 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
155 ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [
156 #include <linux/xattr.h>
158 int set(const struct xattr_handler *handler,
159 struct user_namespace *mnt_userns,
160 struct dentry *dentry, struct inode *inode,
161 const char *name, const void *buffer,
162 size_t size, int flags)
164 static const struct xattr_handler
165 xops __attribute__ ((unused)) = {
170 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [
171 #include <linux/xattr.h>
173 int set(const struct xattr_handler *handler,
174 struct dentry *dentry, struct inode *inode,
175 const char *name, const void *buffer,
176 size_t size, int flags)
178 static const struct xattr_handler
179 xops __attribute__ ((unused)) = {
184 ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [
185 #include <linux/xattr.h>
187 int set(const struct xattr_handler *handler,
188 struct dentry *dentry, const char *name,
189 const void *buffer, size_t size, int flags)
191 static const struct xattr_handler
192 xops __attribute__ ((unused)) = {
197 ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [
198 #include <linux/xattr.h>
200 int set(struct dentry *dentry, const char *name,
201 const void *buffer, size_t size, int flags,
202 int handler_flags) { return 0; }
203 static const struct xattr_handler
204 xops __attribute__ ((unused)) = {
210 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
212 dnl # 5.12 API change,
213 dnl # The xattr_handler->set() callback was changed to 8 arguments, and
214 dnl # struct user_namespace* was inserted as arg #2
216 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace])
217 ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [
219 AC_DEFINE(HAVE_XATTR_SET_USERNS, 1,
220 [xattr_handler->set() takes user_namespace])
223 dnl # 4.7 API change,
224 dnl # The xattr_handler->set() callback was changed to take both
225 dnl # dentry and inode.
228 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
229 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
231 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
232 [xattr_handler->set() wants both dentry and inode])
235 dnl # 4.4 API change,
236 dnl # The xattr_handler->set() callback was changed to take a
237 dnl # xattr_handler, and handler_flags argument was removed and
238 dnl # should be accessed by handler->flags.
242 [whether xattr_handler->set() wants xattr_handler])
243 ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
245 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
246 [xattr_handler->set() wants xattr_handler])
249 dnl # 2.6.33 API change,
250 dnl # The xattr_handler->set() callback was changed
251 dnl # to take a dentry instead of an inode, and a
252 dnl # handler_flags argument was added.
256 [whether xattr_handler->set() wants dentry])
257 ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
259 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
260 [xattr_handler->set() wants dentry])
262 ZFS_LINUX_TEST_ERROR([xattr set()])
270 dnl # Supported xattr handler list() interfaces checked newest to oldest.
272 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
273 ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [
274 #include <linux/xattr.h>
276 bool list(struct dentry *dentry) { return 0; }
277 static const struct xattr_handler
278 xops __attribute__ ((unused)) = {
283 ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [
284 #include <linux/xattr.h>
286 size_t list(const struct xattr_handler *handler,
287 struct dentry *dentry, char *list, size_t list_size,
288 const char *name, size_t name_len) { return 0; }
289 static const struct xattr_handler
290 xops __attribute__ ((unused)) = {
295 ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [
296 #include <linux/xattr.h>
298 size_t list(struct dentry *dentry,
299 char *list, size_t list_size,
300 const char *name, size_t name_len,
301 int handler_flags) { return 0; }
302 static const struct xattr_handler
303 xops __attribute__ ((unused)) = {
309 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
310 dnl # 4.5 API change,
311 dnl # The xattr_handler->list() callback was changed to take only a
312 dnl # dentry and it only needs to return if it's accessible.
313 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
314 ZFS_LINUX_TEST_RESULT([xattr_handler_list_simple], [
316 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
317 [xattr_handler->list() wants simple])
320 dnl # 4.4 API change,
321 dnl # The xattr_handler->list() callback was changed to take a
322 dnl # xattr_handler, and handler_flags argument was removed
323 dnl # and should be accessed by handler->flags.
327 [whether xattr_handler->list() wants xattr_handler])
328 ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [
330 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
331 [xattr_handler->list() wants xattr_handler])
334 dnl # 2.6.33 API change,
335 dnl # The xattr_handler->list() callback was changed
336 dnl # to take a dentry instead of an inode, and a
337 dnl # handler_flags argument was added.
341 [whether xattr_handler->list() wants dentry])
342 ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [
344 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
345 [xattr_handler->list() wants dentry])
347 ZFS_LINUX_TEST_ERROR([xattr list()])
354 dnl # 3.7 API change,
355 dnl # The posix_acl_{from,to}_xattr functions gained a new
356 dnl # parameter: user_ns
358 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS], [
359 ZFS_LINUX_TEST_SRC([posix_acl_from_xattr_userns], [
360 #include <linux/cred.h>
361 #include <linux/fs.h>
362 #include <linux/posix_acl_xattr.h>
364 posix_acl_from_xattr(&init_user_ns, NULL, 0);
368 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
369 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
370 ZFS_LINUX_TEST_RESULT([posix_acl_from_xattr_userns], [
372 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
373 [posix_acl_from_xattr() needs user_ns])
375 ZFS_LINUX_TEST_ERROR([posix_acl_from_xattr()])
380 dnl # 4.9 API change,
381 dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
382 dnl # removed. xattr operations will directly go through sb->s_xattr.
384 AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR], [
385 ZFS_LINUX_TEST_SRC([have_generic_setxattr], [
386 #include <linux/fs.h>
387 #include <linux/xattr.h>
389 static const struct inode_operations
390 iops __attribute__ ((unused)) = {
391 .setxattr = generic_setxattr
396 AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [
397 AC_MSG_CHECKING([whether generic_setxattr() exists])
398 ZFS_LINUX_TEST_RESULT([have_generic_setxattr], [
400 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
401 [generic_setxattr() exists])
407 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [
408 ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER
409 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME
410 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET
411 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET
412 ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST
413 ZFS_AC_KERNEL_SRC_POSIX_ACL_FROM_XATTR_USERNS
414 ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR
417 AC_DEFUN([ZFS_AC_KERNEL_XATTR], [
418 ZFS_AC_KERNEL_CONST_XATTR_HANDLER
419 ZFS_AC_KERNEL_XATTR_HANDLER_NAME
420 ZFS_AC_KERNEL_XATTR_HANDLER_GET
421 ZFS_AC_KERNEL_XATTR_HANDLER_SET
422 ZFS_AC_KERNEL_XATTR_HANDLER_LIST
423 ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS
424 ZFS_AC_KERNEL_GENERIC_SETXATTR