]> git.proxmox.com Git - mirror_zfs-debian.git/blob - config/kernel-xattr-handler.m4
Reflow changelog from last upload to avoid lintian warning.
[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_handler])
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_handler])
30 ],[
31 AC_MSG_RESULT([no])
32 ])
33 ])
34
35 dnl #
36 dnl # 4.5 API change,
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"
40 dnl #
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>
45
46 static const struct xattr_handler
47 xops __attribute__ ((unused)) = {
48 .name = XATTR_NAME_POSIX_ACL_ACCESS,
49 };
50 ],[
51 ],[
52 AC_MSG_RESULT(yes)
53 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
54 [xattr_handler has name])
55 ],[
56 AC_MSG_RESULT(no)
57 ])
58 ])
59
60 dnl #
61 dnl # Supported xattr handler get() interfaces checked newest to oldest.
62 dnl #
63 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
64 dnl #
65 dnl # 4.4 API change,
66 dnl # The xattr_handler->get() callback was changed to take a
67 dnl # attr_handler, and handler_flags argument was removed and
68 dnl # should be accessed by handler->flags.
69 dnl #
70 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
71 ZFS_LINUX_TRY_COMPILE([
72 #include <linux/xattr.h>
73
74 int get(const struct xattr_handler *handler,
75 struct dentry *dentry, const char *name,
76 void *buffer, size_t size) { return 0; }
77 static const struct xattr_handler
78 xops __attribute__ ((unused)) = {
79 .get = get,
80 };
81 ],[
82 ],[
83 AC_MSG_RESULT(yes)
84 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
85 [xattr_handler->get() wants xattr_handler])
86 ],[
87 dnl #
88 dnl # 2.6.33 API change,
89 dnl # The xattr_handler->get() callback was changed to take
90 dnl # a dentry instead of an inode, and a handler_flags
91 dnl # argument was added.
92 dnl #
93 AC_MSG_RESULT(no)
94 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
95 ZFS_LINUX_TRY_COMPILE([
96 #include <linux/xattr.h>
97
98 int get(struct dentry *dentry, const char *name,
99 void *buffer, size_t size, int handler_flags)
100 { return 0; }
101 static const struct xattr_handler
102 xops __attribute__ ((unused)) = {
103 .get = get,
104 };
105 ],[
106 ],[
107 AC_MSG_RESULT(yes)
108 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
109 [xattr_handler->get() wants dentry])
110 ],[
111 dnl #
112 dnl # 2.6.32 API
113 dnl #
114 AC_MSG_RESULT(no)
115 AC_MSG_CHECKING(
116 [whether xattr_handler->get() wants inode])
117 ZFS_LINUX_TRY_COMPILE([
118 #include <linux/xattr.h>
119
120 int get(struct inode *ip, const char *name,
121 void *buffer, size_t size) { return 0; }
122 static const struct xattr_handler
123 xops __attribute__ ((unused)) = {
124 .get = get,
125 };
126 ],[
127 ],[
128 AC_MSG_RESULT(yes)
129 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
130 [xattr_handler->get() wants inode])
131 ],[
132 AC_MSG_ERROR([no; please file a bug report])
133 ])
134 ])
135 ])
136 ])
137
138 dnl #
139 dnl # Supported xattr handler set() interfaces checked newest to oldest.
140 dnl #
141 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
142 dnl #
143 dnl # 4.4 API change,
144 dnl # The xattr_handler->set() callback was changed to take a
145 dnl # xattr_handler, and handler_flags argument was removed and
146 dnl # should be accessed by handler->flags.
147 dnl #
148 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
149 ZFS_LINUX_TRY_COMPILE([
150 #include <linux/xattr.h>
151
152 int set(const struct xattr_handler *handler,
153 struct dentry *dentry, const char *name,
154 const void *buffer, size_t size, int flags)
155 { return 0; }
156 static const struct xattr_handler
157 xops __attribute__ ((unused)) = {
158 .set = set,
159 };
160 ],[
161 ],[
162 AC_MSG_RESULT(yes)
163 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
164 [xattr_handler->set() wants xattr_handler])
165 ],[
166 dnl #
167 dnl # 2.6.33 API change,
168 dnl # The xattr_handler->set() callback was changed to take a
169 dnl # dentry instead of an inode, and a handler_flags
170 dnl # argument was added.
171 dnl #
172 AC_MSG_RESULT(no)
173 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
174 ZFS_LINUX_TRY_COMPILE([
175 #include <linux/xattr.h>
176
177 int set(struct dentry *dentry, const char *name,
178 const void *buffer, size_t size, int flags,
179 int handler_flags) { return 0; }
180 static const struct xattr_handler
181 xops __attribute__ ((unused)) = {
182 .set = set,
183 };
184 ],[
185 ],[
186 AC_MSG_RESULT(yes)
187 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
188 [xattr_handler->set() wants dentry])
189 ],[
190 dnl #
191 dnl # 2.6.32 API
192 dnl #
193 AC_MSG_RESULT(no)
194 AC_MSG_CHECKING(
195 [whether xattr_handler->set() wants inode])
196 ZFS_LINUX_TRY_COMPILE([
197 #include <linux/xattr.h>
198
199 int set(struct inode *ip, const char *name,
200 const void *buffer, size_t size, int flags)
201 { return 0; }
202 static const struct xattr_handler
203 xops __attribute__ ((unused)) = {
204 .set = set,
205 };
206 ],[
207 ],[
208 AC_MSG_RESULT(yes)
209 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
210 [xattr_handler->set() wants inode])
211 ],[
212 AC_MSG_ERROR([no; please file a bug report])
213 ])
214 ])
215 ])
216 ])
217
218 dnl #
219 dnl # Supported xattr handler list() interfaces checked newest to oldest.
220 dnl #
221 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
222 dnl # 4.5 API change,
223 dnl # The xattr_handler->list() callback was changed to take only a
224 dnl # dentry and it only needs to return if it's accessable.
225 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
226 ZFS_LINUX_TRY_COMPILE([
227 #include <linux/xattr.h>
228
229 bool list(struct dentry *dentry) { return 0; }
230 static const struct xattr_handler
231 xops __attribute__ ((unused)) = {
232 .list = list,
233 };
234 ],[
235 ],[
236 AC_MSG_RESULT(yes)
237 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
238 [xattr_handler->list() wants simple])
239 ],[
240 dnl #
241 dnl # 4.4 API change,
242 dnl # The xattr_handler->list() callback was changed to take a
243 dnl # xattr_handler, and handler_flags argument was removed
244 dnl # and should be accessed by handler->flags.
245 dnl #
246 AC_MSG_RESULT(no)
247 AC_MSG_CHECKING(
248 [whether xattr_handler->list() wants xattr_handler])
249 ZFS_LINUX_TRY_COMPILE([
250 #include <linux/xattr.h>
251
252 size_t list(const struct xattr_handler *handler,
253 struct dentry *dentry, char *list, size_t list_size,
254 const char *name, size_t name_len) { return 0; }
255 static const struct xattr_handler
256 xops __attribute__ ((unused)) = {
257 .list = list,
258 };
259 ],[
260 ],[
261 AC_MSG_RESULT(yes)
262 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
263 [xattr_handler->list() wants xattr_handler])
264 ],[
265 dnl #
266 dnl # 2.6.33 API change,
267 dnl # The xattr_handler->list() callback was changed
268 dnl # to take a dentry instead of an inode, and a
269 dnl # handler_flags argument was added.
270 dnl #
271 AC_MSG_RESULT(no)
272 AC_MSG_CHECKING(
273 [whether xattr_handler->list() wants dentry])
274 ZFS_LINUX_TRY_COMPILE([
275 #include <linux/xattr.h>
276
277 size_t list(struct dentry *dentry,
278 char *list, size_t list_size,
279 const char *name, size_t name_len,
280 int handler_flags) { return 0; }
281 static const struct xattr_handler
282 xops __attribute__ ((unused)) = {
283 .list = list,
284 };
285 ],[
286 ],[
287 AC_MSG_RESULT(yes)
288 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
289 [xattr_handler->list() wants dentry])
290 ],[
291 dnl #
292 dnl # 2.6.32 API
293 dnl #
294 AC_MSG_RESULT(no)
295 AC_MSG_CHECKING(
296 [whether xattr_handler->list() wants inode])
297 ZFS_LINUX_TRY_COMPILE([
298 #include <linux/xattr.h>
299
300 size_t list(struct inode *ip, char *lst,
301 size_t list_size, const char *name,
302 size_t name_len) { return 0; }
303 static const struct xattr_handler
304 xops __attribute__ ((unused)) = {
305 .list = list,
306 };
307 ],[
308 ],[
309 AC_MSG_RESULT(yes)
310 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
311 [xattr_handler->list() wants inode])
312 ],[
313 AC_MSG_ERROR(
314 [no; please file a bug report])
315 ])
316 ])
317 ])
318 ])
319 ])
320
321 dnl #
322 dnl # 3.7 API change,
323 dnl # The posix_acl_{from,to}_xattr functions gained a new
324 dnl # parameter: user_ns
325 dnl #
326 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
327 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
328 ZFS_LINUX_TRY_COMPILE([
329 #include <linux/cred.h>
330 #include <linux/fs.h>
331 #include <linux/posix_acl_xattr.h>
332 ],[
333 posix_acl_from_xattr(&init_user_ns, NULL, 0);
334 ],[
335 AC_MSG_RESULT(yes)
336 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
337 [posix_acl_from_xattr() needs user_ns])
338 ],[
339 AC_MSG_RESULT(no)
340 ])
341 ])
342