]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-xattr-handler.m4
Fix Large kmem_alloc in vdev_metaslab_init
[mirror_zfs.git] / config / kernel-xattr-handler.m4
CommitLineData
777d4af8
BB
1dnl #
2dnl # 2.6.35 API change,
3dnl # The 'struct xattr_handler' was constified in the generic
4dnl # super_block structure.
5dnl #
4967a3eb
BB
6AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
7 AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
777d4af8
BB
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 };
777d4af8 21
b83e3e48
RY
22 const struct super_block sb __attribute__ ((unused)) = {
23 .s_xattr = xattr_handlers,
24 };
25 ],[
777d4af8
BB
26 ],[
27 AC_MSG_RESULT([yes])
28 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
4967a3eb 29 [super_block uses const struct xattr_handler])
777d4af8
BB
30 ],[
31 AC_MSG_RESULT([no])
32 ])
33])
f9637c6c 34
232604b5
CC
35dnl #
36dnl # 4.5 API change,
37dnl # struct xattr_handler added new member "name".
38dnl # xattr_handler which matches to whole name rather than prefix should use
39dnl # "name" instead of "prefix", e.g. "system.posix_acl_access"
40dnl #
41AC_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
f9637c6c 60dnl #
4967a3eb 61dnl # Supported xattr handler get() interfaces checked newest to oldest.
61d482f7 62dnl #
f9637c6c 63AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
4967a3eb 64 dnl #
fd4c7b7a
CC
65 dnl # 4.7 API change,
66 dnl # The xattr_handler->get() callback was changed to take both
67 dnl # dentry and inode.
4967a3eb 68 dnl #
fd4c7b7a 69 AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode])
f9637c6c
BB
70 ZFS_LINUX_TRY_COMPILE([
71 #include <linux/xattr.h>
f9637c6c 72
4967a3eb 73 int get(const struct xattr_handler *handler,
fd4c7b7a
CC
74 struct dentry *dentry, struct inode *inode,
75 const char *name, void *buffer, size_t size) { return 0; }
b83e3e48
RY
76 static const struct xattr_handler
77 xops __attribute__ ((unused)) = {
78 .get = get,
79 };
80 ],[
f9637c6c
BB
81 ],[
82 AC_MSG_RESULT(yes)
fd4c7b7a 83 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
8fbbc6b4 84 [xattr_handler->get() wants both dentry and inode])
f9637c6c 85 ],[
4967a3eb 86 dnl #
fd4c7b7a
CC
87 dnl # 4.4 API change,
88 dnl # The xattr_handler->get() callback was changed to take a
89 dnl # attr_handler, and handler_flags argument was removed and
90 dnl # should be accessed by handler->flags.
4967a3eb 91 dnl #
fd4c7b7a 92 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
61d482f7
CC
93 ZFS_LINUX_TRY_COMPILE([
94 #include <linux/xattr.h>
95
fd4c7b7a
CC
96 int get(const struct xattr_handler *handler,
97 struct dentry *dentry, const char *name,
98 void *buffer, size_t size) { return 0; }
61d482f7
CC
99 static const struct xattr_handler
100 xops __attribute__ ((unused)) = {
101 .get = get,
102 };
103 ],[
104 ],[
105 AC_MSG_RESULT(yes)
fd4c7b7a
CC
106 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
107 [xattr_handler->get() wants xattr_handler])
61d482f7 108 ],[
4967a3eb 109 dnl #
fd4c7b7a
CC
110 dnl # 2.6.33 API change,
111 dnl # The xattr_handler->get() callback was changed to take
112 dnl # a dentry instead of an inode, and a handler_flags
113 dnl # argument was added.
4967a3eb 114 dnl #
61d482f7 115 AC_MSG_RESULT(no)
fd4c7b7a 116 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
4967a3eb
BB
117 ZFS_LINUX_TRY_COMPILE([
118 #include <linux/xattr.h>
119
fd4c7b7a
CC
120 int get(struct dentry *dentry, const char *name,
121 void *buffer, size_t size, int handler_flags)
122 { return 0; }
4967a3eb
BB
123 static const struct xattr_handler
124 xops __attribute__ ((unused)) = {
125 .get = get,
126 };
127 ],[
128 ],[
129 AC_MSG_RESULT(yes)
fd4c7b7a
CC
130 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
131 [xattr_handler->get() wants dentry])
4967a3eb 132 ],[
fd4c7b7a
CC
133 dnl #
134 dnl # 2.6.32 API
135 dnl #
136 AC_MSG_RESULT(no)
137 AC_MSG_CHECKING(
138 [whether xattr_handler->get() wants inode])
139 ZFS_LINUX_TRY_COMPILE([
140 #include <linux/xattr.h>
141
142 int get(struct inode *ip, const char *name,
143 void *buffer, size_t size) { return 0; }
144 static const struct xattr_handler
145 xops __attribute__ ((unused)) = {
146 .get = get,
147 };
148 ],[
149 ],[
150 AC_MSG_RESULT(yes)
151 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
152 [xattr_handler->get() wants inode])
153 ],[
154 AC_MSG_ERROR([no; please file a bug report])
155 ])
4967a3eb 156 ])
61d482f7 157 ])
f9637c6c
BB
158 ])
159])
160
161dnl #
4967a3eb 162dnl # Supported xattr handler set() interfaces checked newest to oldest.
61d482f7 163dnl #
f9637c6c 164AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
4967a3eb 165 dnl #
8fbbc6b4
BB
166 dnl # 4.7 API change,
167 dnl # The xattr_handler->set() callback was changed to take both
168 dnl # dentry and inode.
4967a3eb 169 dnl #
8fbbc6b4 170 AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode])
f9637c6c
BB
171 ZFS_LINUX_TRY_COMPILE([
172 #include <linux/xattr.h>
f9637c6c 173
4967a3eb 174 int set(const struct xattr_handler *handler,
8fbbc6b4
BB
175 struct dentry *dentry, struct inode *inode,
176 const char *name, const void *buffer,
177 size_t size, int flags)
4967a3eb 178 { return 0; }
b83e3e48
RY
179 static const struct xattr_handler
180 xops __attribute__ ((unused)) = {
181 .set = set,
182 };
183 ],[
f9637c6c
BB
184 ],[
185 AC_MSG_RESULT(yes)
8fbbc6b4
BB
186 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
187 [xattr_handler->set() wants both dentry and inode])
f9637c6c 188 ],[
4967a3eb 189 dnl #
8fbbc6b4 190 dnl # 4.4 API change,
4967a3eb 191 dnl # The xattr_handler->set() callback was changed to take a
8fbbc6b4
BB
192 dnl # xattr_handler, and handler_flags argument was removed and
193 dnl # should be accessed by handler->flags.
4967a3eb 194 dnl #
8fbbc6b4 195 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
61d482f7
CC
196 ZFS_LINUX_TRY_COMPILE([
197 #include <linux/xattr.h>
198
8fbbc6b4
BB
199 int set(const struct xattr_handler *handler,
200 struct dentry *dentry, const char *name,
201 const void *buffer, size_t size, int flags)
202 { return 0; }
61d482f7
CC
203 static const struct xattr_handler
204 xops __attribute__ ((unused)) = {
205 .set = set,
206 };
207 ],[
208 ],[
209 AC_MSG_RESULT(yes)
8fbbc6b4
BB
210 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
211 [xattr_handler->set() wants xattr_handler])
61d482f7 212 ],[
4967a3eb 213 dnl #
8fbbc6b4
BB
214 dnl # 2.6.33 API change,
215 dnl # The xattr_handler->set() callback was changed to take a
216 dnl # dentry instead of an inode, and a handler_flags
217 dnl # argument was added.
4967a3eb 218 dnl #
61d482f7 219 AC_MSG_RESULT(no)
8fbbc6b4 220 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
4967a3eb
BB
221 ZFS_LINUX_TRY_COMPILE([
222 #include <linux/xattr.h>
223
8fbbc6b4
BB
224 int set(struct dentry *dentry, const char *name,
225 const void *buffer, size_t size, int flags,
226 int handler_flags) { return 0; }
4967a3eb
BB
227 static const struct xattr_handler
228 xops __attribute__ ((unused)) = {
229 .set = set,
230 };
231 ],[
232 ],[
233 AC_MSG_RESULT(yes)
8fbbc6b4
BB
234 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
235 [xattr_handler->set() wants dentry])
4967a3eb 236 ],[
8fbbc6b4
BB
237 dnl #
238 dnl # 2.6.32 API
239 dnl #
240 AC_MSG_RESULT(no)
241 AC_MSG_CHECKING(
242 [whether xattr_handler->set() wants inode])
243 ZFS_LINUX_TRY_COMPILE([
244 #include <linux/xattr.h>
245
246 int set(struct inode *ip, const char *name,
247 const void *buffer, size_t size, int flags)
248 { return 0; }
249 static const struct xattr_handler
250 xops __attribute__ ((unused)) = {
251 .set = set,
252 };
253 ],[
254 ],[
255 AC_MSG_RESULT(yes)
256 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
257 [xattr_handler->set() wants inode])
258 ],[
259 AC_MSG_ERROR([no; please file a bug report])
260 ])
4967a3eb 261 ])
61d482f7 262 ])
f9637c6c
BB
263 ])
264])
023699cd
MM
265
266dnl #
4967a3eb 267dnl # Supported xattr handler list() interfaces checked newest to oldest.
61d482f7 268dnl #
023699cd 269AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
4967a3eb
BB
270 dnl # 4.5 API change,
271 dnl # The xattr_handler->list() callback was changed to take only a
272 dnl # dentry and it only needs to return if it's accessable.
273 AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
023699cd
MM
274 ZFS_LINUX_TRY_COMPILE([
275 #include <linux/xattr.h>
276
4967a3eb 277 bool list(struct dentry *dentry) { return 0; }
023699cd
MM
278 static const struct xattr_handler
279 xops __attribute__ ((unused)) = {
280 .list = list,
281 };
282 ],[
283 ],[
284 AC_MSG_RESULT(yes)
4967a3eb
BB
285 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
286 [xattr_handler->list() wants simple])
023699cd 287 ],[
4967a3eb
BB
288 dnl #
289 dnl # 4.4 API change,
290 dnl # The xattr_handler->list() callback was changed to take a
291 dnl # xattr_handler, and handler_flags argument was removed
292 dnl # and should be accessed by handler->flags.
293 dnl #
023699cd 294 AC_MSG_RESULT(no)
4967a3eb
BB
295 AC_MSG_CHECKING(
296 [whether xattr_handler->list() wants xattr_handler])
61d482f7
CC
297 ZFS_LINUX_TRY_COMPILE([
298 #include <linux/xattr.h>
299
4967a3eb
BB
300 size_t list(const struct xattr_handler *handler,
301 struct dentry *dentry, char *list, size_t list_size,
302 const char *name, size_t name_len) { return 0; }
61d482f7
CC
303 static const struct xattr_handler
304 xops __attribute__ ((unused)) = {
305 .list = list,
306 };
307 ],[
308 ],[
309 AC_MSG_RESULT(yes)
4967a3eb 310 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
61d482f7
CC
311 [xattr_handler->list() wants xattr_handler])
312 ],[
4967a3eb
BB
313 dnl #
314 dnl # 2.6.33 API change,
315 dnl # The xattr_handler->list() callback was changed
316 dnl # to take a dentry instead of an inode, and a
317 dnl # handler_flags argument was added.
318 dnl #
61d482f7 319 AC_MSG_RESULT(no)
4967a3eb
BB
320 AC_MSG_CHECKING(
321 [whether xattr_handler->list() wants dentry])
322 ZFS_LINUX_TRY_COMPILE([
323 #include <linux/xattr.h>
324
325 size_t list(struct dentry *dentry,
326 char *list, size_t list_size,
327 const char *name, size_t name_len,
328 int handler_flags) { return 0; }
329 static const struct xattr_handler
330 xops __attribute__ ((unused)) = {
331 .list = list,
332 };
333 ],[
334 ],[
335 AC_MSG_RESULT(yes)
336 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
337 [xattr_handler->list() wants dentry])
338 ],[
339 dnl #
340 dnl # 2.6.32 API
341 dnl #
342 AC_MSG_RESULT(no)
343 AC_MSG_CHECKING(
344 [whether xattr_handler->list() wants inode])
345 ZFS_LINUX_TRY_COMPILE([
346 #include <linux/xattr.h>
347
348 size_t list(struct inode *ip, char *lst,
349 size_t list_size, const char *name,
350 size_t name_len) { return 0; }
351 static const struct xattr_handler
352 xops __attribute__ ((unused)) = {
353 .list = list,
354 };
355 ],[
356 ],[
357 AC_MSG_RESULT(yes)
358 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
359 [xattr_handler->list() wants inode])
360 ],[
361 AC_MSG_ERROR(
362 [no; please file a bug report])
363 ])
364 ])
61d482f7 365 ])
023699cd
MM
366 ])
367])
368
369dnl #
370dnl # 3.7 API change,
371dnl # The posix_acl_{from,to}_xattr functions gained a new
372dnl # parameter: user_ns
373dnl #
374AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
375 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
376 ZFS_LINUX_TRY_COMPILE([
377 #include <linux/cred.h>
378 #include <linux/fs.h>
379 #include <linux/posix_acl_xattr.h>
380 ],[
381 posix_acl_from_xattr(&init_user_ns, NULL, 0);
382 ],[
383 AC_MSG_RESULT(yes)
384 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
385 [posix_acl_from_xattr() needs user_ns])
386 ],[
387 AC_MSG_RESULT(no)
388 ])
389])
390