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