]> git.proxmox.com Git - mirror_zfs.git/blob - config/kernel-xattr-handler.m4
Refactor inode_owner_or_capable() autotools check
[mirror_zfs.git] / config / kernel-xattr-handler.m4
1 dnl #
2 dnl # 2.6.35 API change,
3 dnl # The 'struct xattr_handler' was constified in the generic
4 dnl # super_block structure.
5 dnl #
6 AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER],
7 [AC_MSG_CHECKING([whether super_block uses const struct xattr_hander])
8 ZFS_LINUX_TRY_COMPILE([
9 #include <linux/fs.h>
10 #include <linux/xattr.h>
11
12 const struct xattr_handler xattr_test_handler = {
13 .prefix = "test",
14 .get = NULL,
15 .set = NULL,
16 };
17
18 const struct xattr_handler *xattr_handlers[] = {
19 &xattr_test_handler,
20 };
21
22 const struct super_block sb __attribute__ ((unused)) = {
23 .s_xattr = xattr_handlers,
24 };
25 ],[
26 ],[
27 AC_MSG_RESULT([yes])
28 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
29 [super_block uses const struct xattr_hander])
30 ],[
31 AC_MSG_RESULT([no])
32 ])
33 ])
34
35 dnl #
36 dnl # 2.6.33 API change,
37 dnl # The xattr_hander->get() callback was changed to take a dentry
38 dnl # instead of an inode, and a handler_flags argument was added.
39 dnl #
40 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
41 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
42 ZFS_LINUX_TRY_COMPILE([
43 #include <linux/xattr.h>
44
45 int get(struct dentry *dentry, const char *name,
46 void *buffer, size_t size, int handler_flags) { return 0; }
47 static const struct xattr_handler
48 xops __attribute__ ((unused)) = {
49 .get = get,
50 };
51 ],[
52 ],[
53 AC_MSG_RESULT(yes)
54 AC_DEFINE(HAVE_DENTRY_XATTR_GET, 1,
55 [xattr_handler->get() wants dentry])
56 ],[
57 AC_MSG_RESULT(no)
58 ])
59 ])
60
61 dnl #
62 dnl # 2.6.33 API change,
63 dnl # The xattr_hander->set() callback was changed to take a dentry
64 dnl # instead of an inode, and a handler_flags argument was added.
65 dnl #
66 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
67 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
68 ZFS_LINUX_TRY_COMPILE([
69 #include <linux/xattr.h>
70
71 int set(struct dentry *dentry, const char *name,
72 const void *buffer, size_t size, int flags,
73 int handler_flags) { return 0; }
74 static const struct xattr_handler
75 xops __attribute__ ((unused)) = {
76 .set = set,
77 };
78 ],[
79 ],[
80 AC_MSG_RESULT(yes)
81 AC_DEFINE(HAVE_DENTRY_XATTR_SET, 1,
82 [xattr_handler->set() wants dentry])
83 ],[
84 AC_MSG_RESULT(no)
85 ])
86 ])
87
88 dnl #
89 dnl # 2.6.33 API change,
90 dnl # The xattr_hander->list() callback was changed to take a dentry
91 dnl # instead of an inode, and a handler_flags argument was added.
92 dnl #
93 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
94 AC_MSG_CHECKING([whether xattr_handler->list() wants dentry])
95 ZFS_LINUX_TRY_COMPILE([
96 #include <linux/xattr.h>
97
98 size_t list(struct dentry *dentry, char *list, size_t list_size,
99 const char *name, size_t name_len, int handler_flags)
100 { return 0; }
101 static const struct xattr_handler
102 xops __attribute__ ((unused)) = {
103 .list = list,
104 };
105 ],[
106 ],[
107 AC_MSG_RESULT(yes)
108 AC_DEFINE(HAVE_DENTRY_XATTR_LIST, 1,
109 [xattr_handler->list() wants dentry])
110 ],[
111 AC_MSG_RESULT(no)
112 ])
113 ])
114
115 dnl #
116 dnl # 3.7 API change,
117 dnl # The posix_acl_{from,to}_xattr functions gained a new
118 dnl # parameter: user_ns
119 dnl #
120 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
121 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
122 ZFS_LINUX_TRY_COMPILE([
123 #include <linux/cred.h>
124 #include <linux/fs.h>
125 #include <linux/posix_acl_xattr.h>
126 ],[
127 posix_acl_from_xattr(&init_user_ns, NULL, 0);
128 ],[
129 AC_MSG_RESULT(yes)
130 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
131 [posix_acl_from_xattr() needs user_ns])
132 ],[
133 AC_MSG_RESULT(no)
134 ])
135 ])
136