]> git.proxmox.com Git - mirror_zfs-debian.git/blob - config/kernel-xattr-handler.m4
Imported Upstream version 0.6.5.4
[mirror_zfs-debian.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 dnl # 4.4 API change,
41 dnl # The xattr_hander->get() callback was changed to take a xattr_handler,
42 dnl # and handler_flags argument was removed and should be accessed by
43 dnl # handler->flags.
44 dnl #
45 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
46 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
47 ZFS_LINUX_TRY_COMPILE([
48 #include <linux/xattr.h>
49
50 int get(struct dentry *dentry, const char *name,
51 void *buffer, size_t size, int handler_flags) { return 0; }
52 static const struct xattr_handler
53 xops __attribute__ ((unused)) = {
54 .get = get,
55 };
56 ],[
57 ],[
58 AC_MSG_RESULT(yes)
59 AC_DEFINE(HAVE_DENTRY_XATTR_GET, 1,
60 [xattr_handler->get() wants dentry])
61 ],[
62 AC_MSG_RESULT(no)
63 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
64 ZFS_LINUX_TRY_COMPILE([
65 #include <linux/xattr.h>
66
67 int get(const struct xattr_handler *handler, struct dentry *dentry,
68 const char *name, void *buffer, size_t size) { return 0; }
69 static const struct xattr_handler
70 xops __attribute__ ((unused)) = {
71 .get = get,
72 };
73 ],[
74 ],[
75 AC_MSG_RESULT(yes)
76 AC_DEFINE(HAVE_HANDLER_XATTR_GET, 1,
77 [xattr_handler->get() wants xattr_handler])
78 ],[
79 AC_MSG_RESULT(no)
80 ])
81 ])
82 ])
83
84 dnl #
85 dnl # 2.6.33 API change,
86 dnl # The xattr_hander->set() callback was changed to take a dentry
87 dnl # instead of an inode, and a handler_flags argument was added.
88 dnl #
89 dnl # 4.4 API change,
90 dnl # The xattr_hander->set() callback was changed to take a xattr_handler,
91 dnl # and handler_flags argument was removed and should be accessed by
92 dnl # handler->flags.
93 dnl #
94 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
95 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
96 ZFS_LINUX_TRY_COMPILE([
97 #include <linux/xattr.h>
98
99 int set(struct dentry *dentry, const char *name,
100 const void *buffer, size_t size, int flags,
101 int handler_flags) { return 0; }
102 static const struct xattr_handler
103 xops __attribute__ ((unused)) = {
104 .set = set,
105 };
106 ],[
107 ],[
108 AC_MSG_RESULT(yes)
109 AC_DEFINE(HAVE_DENTRY_XATTR_SET, 1,
110 [xattr_handler->set() wants dentry])
111 ],[
112 AC_MSG_RESULT(no)
113 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
114 ZFS_LINUX_TRY_COMPILE([
115 #include <linux/xattr.h>
116
117 int set(const struct xattr_handler *handler, struct dentry *dentry,
118 const char *name, const void *buffer, size_t size, int flags) { return 0; }
119 static const struct xattr_handler
120 xops __attribute__ ((unused)) = {
121 .set = set,
122 };
123 ],[
124 ],[
125 AC_MSG_RESULT(yes)
126 AC_DEFINE(HAVE_HANDLER_XATTR_SET, 1,
127 [xattr_handler->set() wants xattr_handler])
128 ],[
129 AC_MSG_RESULT(no)
130 ])
131 ])
132 ])
133
134 dnl #
135 dnl # 2.6.33 API change,
136 dnl # The xattr_hander->list() callback was changed to take a dentry
137 dnl # instead of an inode, and a handler_flags argument was added.
138 dnl #
139 dnl # 4.4 API change,
140 dnl # The xattr_hander->list() callback was changed to take a xattr_handler,
141 dnl # and handler_flags argument was removed and should be accessed by
142 dnl # handler->flags.
143 dnl #
144 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
145 AC_MSG_CHECKING([whether xattr_handler->list() wants dentry])
146 ZFS_LINUX_TRY_COMPILE([
147 #include <linux/xattr.h>
148
149 size_t list(struct dentry *dentry, char *list, size_t list_size,
150 const char *name, size_t name_len, int handler_flags)
151 { return 0; }
152 static const struct xattr_handler
153 xops __attribute__ ((unused)) = {
154 .list = list,
155 };
156 ],[
157 ],[
158 AC_MSG_RESULT(yes)
159 AC_DEFINE(HAVE_DENTRY_XATTR_LIST, 1,
160 [xattr_handler->list() wants dentry])
161 ],[
162 AC_MSG_RESULT(no)
163 AC_MSG_CHECKING([whether xattr_handler->list() wants xattr_handler])
164 ZFS_LINUX_TRY_COMPILE([
165 #include <linux/xattr.h>
166
167 size_t list(const struct xattr_handler *handler, struct dentry *dentry,
168 char *list, size_t list_size, const char *name, size_t name_len) { return 0; }
169 static const struct xattr_handler
170 xops __attribute__ ((unused)) = {
171 .list = list,
172 };
173 ],[
174 ],[
175 AC_MSG_RESULT(yes)
176 AC_DEFINE(HAVE_HANDLER_XATTR_LIST, 1,
177 [xattr_handler->list() wants xattr_handler])
178 ],[
179 AC_MSG_RESULT(no)
180 ])
181 ])
182 ])
183
184 dnl #
185 dnl # 3.7 API change,
186 dnl # The posix_acl_{from,to}_xattr functions gained a new
187 dnl # parameter: user_ns
188 dnl #
189 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
190 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
191 ZFS_LINUX_TRY_COMPILE([
192 #include <linux/cred.h>
193 #include <linux/fs.h>
194 #include <linux/posix_acl_xattr.h>
195 ],[
196 posix_acl_from_xattr(&init_user_ns, NULL, 0);
197 ],[
198 AC_MSG_RESULT(yes)
199 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
200 [posix_acl_from_xattr() needs user_ns])
201 ],[
202 AC_MSG_RESULT(no)
203 ])
204 ])
205