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.
117 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
118 ZFS_LINUX_TRY_COMPILE([
119 #include <linux/xattr.h>
121 int get(const struct xattr_handler *handler,
122 struct dentry *dentry, const char *name,
123 void *buffer, size_t size) { return 0; }
124 static const struct xattr_handler
125 xops __attribute__ ((unused)) = {
131 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
132 [xattr_handler->get() wants xattr_handler])
135 dnl # 2.6.33 API change,
136 dnl # The xattr_handler->get() callback was changed to take
137 dnl # a dentry instead of an inode, and a handler_flags
138 dnl # argument was added.
141 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
142 ZFS_LINUX_TRY_COMPILE([
143 #include <linux/xattr.h>
145 int get(struct dentry *dentry, const char *name,
146 void *buffer, size_t size, int handler_flags)
148 static const struct xattr_handler
149 xops __attribute__ ((unused)) = {
155 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
156 [xattr_handler->get() wants dentry])
163 [whether xattr_handler->get() wants inode])
164 ZFS_LINUX_TRY_COMPILE([
165 #include <linux/xattr.h>
167 int get(struct inode *ip, const char *name,
168 void *buffer, size_t size) { return 0; }
169 static const struct xattr_handler
170 xops __attribute__ ((unused)) = {
176 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
177 [xattr_handler->get() wants inode])
179 AC_MSG_ERROR([no; please file a bug report])
187 dnl # Supported xattr handler set() interfaces checked newest to oldest.
189 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
191 dnl # 4.7 API change,
192 dnl # The xattr_handler->set() callback was changed to take both
193 dnl # dentry and inode.
195 AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode])
196 ZFS_LINUX_TRY_COMPILE([
197 #include <linux/xattr.h>
199 int set(const struct xattr_handler *handler,
200 struct dentry *dentry, struct inode *inode,
201 const char *name, const void *buffer,
202 size_t size, int flags)
204 static const struct xattr_handler
205 xops __attribute__ ((unused)) = {
211 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
212 [xattr_handler->set() wants both dentry and inode])
215 dnl # 4.4 API change,
216 dnl # The xattr_handler->set() callback was changed to take a
217 dnl # xattr_handler, and handler_flags argument was removed and
218 dnl # should be accessed by handler->flags.
220 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
221 ZFS_LINUX_TRY_COMPILE([
222 #include <linux/xattr.h>
224 int set(const struct xattr_handler *handler,
225 struct dentry *dentry, const char *name,
226 const void *buffer, size_t size, int flags)
228 static const struct xattr_handler
229 xops __attribute__ ((unused)) = {
235 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
236 [xattr_handler->set() wants xattr_handler])
239 dnl # 2.6.33 API change,
240 dnl # The xattr_handler->set() callback was changed to take a
241 dnl # dentry instead of an inode, and a handler_flags
242 dnl # argument was added.
245 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
246 ZFS_LINUX_TRY_COMPILE([
247 #include <linux/xattr.h>
249 int set(struct dentry *dentry, const char *name,
250 const void *buffer, size_t size, int flags,
251 int handler_flags) { return 0; }
252 static const struct xattr_handler
253 xops __attribute__ ((unused)) = {
259 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
260 [xattr_handler->set() wants dentry])
267 [whether xattr_handler->set() wants inode])
268 ZFS_LINUX_TRY_COMPILE([
269 #include <linux/xattr.h>
271 int set(struct inode *ip, const char *name,
272 const void *buffer, size_t size, int flags)
274 static const struct xattr_handler
275 xops __attribute__ ((unused)) = {
281 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
282 [xattr_handler->set() wants inode])
284 AC_MSG_ERROR([no; please file a bug report])
292 dnl # Supported xattr handler list() interfaces checked newest to oldest.
294 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
295 dnl # 4.5 API change,
296 dnl # The xattr_handler->list() callback was changed to take only a
297 dnl # dentry and it only needs to return if it's accessable.
298 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
299 ZFS_LINUX_TRY_COMPILE([
300 #include <linux/xattr.h>
302 bool list(struct dentry *dentry) { return 0; }
303 static const struct xattr_handler
304 xops __attribute__ ((unused)) = {
310 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
311 [xattr_handler->list() wants simple])
314 dnl # 4.4 API change,
315 dnl # The xattr_handler->list() callback was changed to take a
316 dnl # xattr_handler, and handler_flags argument was removed
317 dnl # and should be accessed by handler->flags.
321 [whether xattr_handler->list() wants xattr_handler])
322 ZFS_LINUX_TRY_COMPILE([
323 #include <linux/xattr.h>
325 size_t list(const struct xattr_handler *handler,
326 struct dentry *dentry, char *list, size_t list_size,
327 const char *name, size_t name_len) { return 0; }
328 static const struct xattr_handler
329 xops __attribute__ ((unused)) = {
335 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
336 [xattr_handler->list() wants xattr_handler])
339 dnl # 2.6.33 API change,
340 dnl # The xattr_handler->list() callback was changed
341 dnl # to take a dentry instead of an inode, and a
342 dnl # handler_flags argument was added.
346 [whether xattr_handler->list() wants dentry])
347 ZFS_LINUX_TRY_COMPILE([
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_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
362 [xattr_handler->list() wants dentry])
369 [whether xattr_handler->list() wants inode])
370 ZFS_LINUX_TRY_COMPILE([
371 #include <linux/xattr.h>
373 size_t list(struct inode *ip, char *lst,
374 size_t list_size, const char *name,
375 size_t name_len) { return 0; }
376 static const struct xattr_handler
377 xops __attribute__ ((unused)) = {
383 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
384 [xattr_handler->list() wants inode])
387 [no; please file a bug report])
395 dnl # 3.7 API change,
396 dnl # The posix_acl_{from,to}_xattr functions gained a new
397 dnl # parameter: user_ns
399 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
400 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
401 ZFS_LINUX_TRY_COMPILE([
402 #include <linux/cred.h>
403 #include <linux/fs.h>
404 #include <linux/posix_acl_xattr.h>
406 posix_acl_from_xattr(&init_user_ns, NULL, 0);
409 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
410 [posix_acl_from_xattr() needs user_ns])