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_CONST_XATTR_HANDLER], [
7 AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
8 ZFS_LINUX_TRY_COMPILE([
10 #include <linux/xattr.h>
12 const struct xattr_handler xattr_test_handler = {
18 const struct xattr_handler *xattr_handlers[] = {
22 const struct super_block sb __attribute__ ((unused)) = {
23 .s_xattr = xattr_handlers,
28 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
29 [super_block uses const struct xattr_handler])
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"
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>
46 static const struct xattr_handler
47 xops __attribute__ ((unused)) = {
48 .name = XATTR_NAME_POSIX_ACL_ACCESS,
53 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
54 [xattr_handler has name])
62 dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
63 dnl # removed. xattr operations will directly go through sb->s_xattr.
65 AC_DEFUN([ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR], [
66 AC_MSG_CHECKING([whether generic_setxattr() exists])
67 ZFS_LINUX_TRY_COMPILE([
69 #include <linux/xattr.h>
71 static const struct inode_operations
72 iops __attribute__ ((unused)) = {
73 .setxattr = generic_setxattr
78 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
79 [generic_setxattr() exists])
86 dnl # Supported xattr handler get() interfaces checked newest to oldest.
88 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
91 dnl # The xattr_handler->get() callback was changed to take both
92 dnl # dentry and inode.
94 AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode])
95 ZFS_LINUX_TRY_COMPILE([
96 #include <linux/xattr.h>
98 int get(const struct xattr_handler *handler,
99 struct dentry *dentry, struct inode *inode,
100 const char *name, void *buffer, size_t size) { return 0; }
101 static const struct xattr_handler
102 xops __attribute__ ((unused)) = {
108 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
109 [xattr_handler->get() wants both dentry and inode])
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.
118 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
119 ZFS_LINUX_TRY_COMPILE([
120 #include <linux/xattr.h>
122 int get(const struct xattr_handler *handler,
123 struct dentry *dentry, const char *name,
124 void *buffer, size_t size) { return 0; }
125 static const struct xattr_handler
126 xops __attribute__ ((unused)) = {
132 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
133 [xattr_handler->get() wants xattr_handler])
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.
142 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
143 ZFS_LINUX_TRY_COMPILE([
144 #include <linux/xattr.h>
146 int get(struct dentry *dentry, const char *name,
147 void *buffer, size_t size, int handler_flags)
149 static const struct xattr_handler
150 xops __attribute__ ((unused)) = {
156 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
157 [xattr_handler->get() wants dentry])
164 [whether xattr_handler->get() wants inode])
165 ZFS_LINUX_TRY_COMPILE([
166 #include <linux/xattr.h>
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)) = {
177 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
178 [xattr_handler->get() wants inode])
180 AC_MSG_ERROR([no; please file a bug report])
188 dnl # Supported xattr handler set() interfaces checked newest to oldest.
190 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
192 dnl # 4.7 API change,
193 dnl # The xattr_handler->set() callback was changed to take both
194 dnl # dentry and inode.
196 AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode])
197 ZFS_LINUX_TRY_COMPILE([
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)) = {
212 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
213 [xattr_handler->set() wants both dentry and inode])
216 dnl # 4.4 API change,
217 dnl # The xattr_handler->set() callback was changed to take a
218 dnl # xattr_handler, and handler_flags argument was removed and
219 dnl # should be accessed by handler->flags.
222 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
223 ZFS_LINUX_TRY_COMPILE([
224 #include <linux/xattr.h>
226 int set(const struct xattr_handler *handler,
227 struct dentry *dentry, const char *name,
228 const void *buffer, size_t size, int flags)
230 static const struct xattr_handler
231 xops __attribute__ ((unused)) = {
237 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
238 [xattr_handler->set() wants xattr_handler])
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.
247 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
248 ZFS_LINUX_TRY_COMPILE([
249 #include <linux/xattr.h>
251 int set(struct dentry *dentry, const char *name,
252 const void *buffer, size_t size, int flags,
253 int handler_flags) { return 0; }
254 static const struct xattr_handler
255 xops __attribute__ ((unused)) = {
261 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
262 [xattr_handler->set() wants dentry])
269 [whether xattr_handler->set() wants inode])
270 ZFS_LINUX_TRY_COMPILE([
271 #include <linux/xattr.h>
273 int set(struct inode *ip, const char *name,
274 const void *buffer, size_t size, int flags)
276 static const struct xattr_handler
277 xops __attribute__ ((unused)) = {
283 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
284 [xattr_handler->set() wants inode])
286 AC_MSG_ERROR([no; please file a bug report])
294 dnl # Supported xattr handler list() interfaces checked newest to oldest.
296 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
297 dnl # 4.5 API change,
298 dnl # The xattr_handler->list() callback was changed to take only a
299 dnl # dentry and it only needs to return if it's accessible.
300 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
301 ZFS_LINUX_TRY_COMPILE([
302 #include <linux/xattr.h>
304 bool list(struct dentry *dentry) { return 0; }
305 static const struct xattr_handler
306 xops __attribute__ ((unused)) = {
312 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
313 [xattr_handler->list() wants simple])
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.
323 [whether xattr_handler->list() wants xattr_handler])
324 ZFS_LINUX_TRY_COMPILE([
325 #include <linux/xattr.h>
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; }
330 static const struct xattr_handler
331 xops __attribute__ ((unused)) = {
337 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
338 [xattr_handler->list() wants xattr_handler])
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.
348 [whether xattr_handler->list() wants dentry])
349 ZFS_LINUX_TRY_COMPILE([
350 #include <linux/xattr.h>
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)) = {
363 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
364 [xattr_handler->list() wants dentry])
371 [whether xattr_handler->list() wants inode])
372 ZFS_LINUX_TRY_COMPILE([
373 #include <linux/xattr.h>
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)) = {
385 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
386 [xattr_handler->list() wants inode])
389 [no; please file a bug report])
397 dnl # 3.7 API change,
398 dnl # The posix_acl_{from,to}_xattr functions gained a new
399 dnl # parameter: user_ns
401 AC_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>
408 posix_acl_from_xattr(&init_user_ns, NULL, 0);
411 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
412 [posix_acl_from_xattr() needs user_ns])