2 dnl # 2.6.35 API change,
3 dnl # The 'struct xattr_handler' was constified in the generic
4 dnl # super_block structure.
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([
10 #include <linux/xattr.h>
12 const struct xattr_handler xattr_test_handler = {
18 const struct xattr_handler *xattr_handlers[] = {
22 const struct super_block sb __attribute__ ((unused)) = {
23 .s_xattr = xattr_handlers,
28 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
29 [super_block uses const struct xattr_handler])
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"
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>
46 static const struct xattr_handler
47 xops __attribute__ ((unused)) = {
48 .name = XATTR_NAME_POSIX_ACL_ACCESS,
53 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
54 [xattr_handler has name])
61 dnl # Supported xattr handler get() interfaces checked newest to oldest.
63 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
66 dnl # The xattr_handler->get() callback was changed to take both
67 dnl # dentry and inode.
69 AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode])
70 ZFS_LINUX_TRY_COMPILE([
71 #include <linux/xattr.h>
73 int get(const struct xattr_handler *handler,
74 struct dentry *dentry, struct inode *inode,
75 const char *name, void *buffer, size_t size) { return 0; }
76 static const struct xattr_handler
77 xops __attribute__ ((unused)) = {
83 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
84 [xattr_handler->get() wants both dentry and inode])
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.
92 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
93 ZFS_LINUX_TRY_COMPILE([
94 #include <linux/xattr.h>
96 int get(const struct xattr_handler *handler,
97 struct dentry *dentry, const char *name,
98 void *buffer, size_t size) { return 0; }
99 static const struct xattr_handler
100 xops __attribute__ ((unused)) = {
106 AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
107 [xattr_handler->get() wants xattr_handler])
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.
116 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
117 ZFS_LINUX_TRY_COMPILE([
118 #include <linux/xattr.h>
120 int get(struct dentry *dentry, const char *name,
121 void *buffer, size_t size, int handler_flags)
123 static const struct xattr_handler
124 xops __attribute__ ((unused)) = {
130 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
131 [xattr_handler->get() wants dentry])
138 [whether xattr_handler->get() wants inode])
139 ZFS_LINUX_TRY_COMPILE([
140 #include <linux/xattr.h>
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)) = {
151 AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
152 [xattr_handler->get() wants inode])
154 AC_MSG_ERROR([no; please file a bug report])
162 dnl # Supported xattr handler set() interfaces checked newest to oldest.
164 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
166 dnl # 4.7 API change,
167 dnl # The xattr_handler->set() callback was changed to take both
168 dnl # dentry and inode.
170 AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode])
171 ZFS_LINUX_TRY_COMPILE([
172 #include <linux/xattr.h>
174 int set(const struct xattr_handler *handler,
175 struct dentry *dentry, struct inode *inode,
176 const char *name, const void *buffer,
177 size_t size, int flags)
179 static const struct xattr_handler
180 xops __attribute__ ((unused)) = {
186 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
187 [xattr_handler->set() wants both dentry and inode])
190 dnl # 4.4 API change,
191 dnl # The xattr_handler->set() callback was changed to take a
192 dnl # xattr_handler, and handler_flags argument was removed and
193 dnl # should be accessed by handler->flags.
195 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
196 ZFS_LINUX_TRY_COMPILE([
197 #include <linux/xattr.h>
199 int set(const struct xattr_handler *handler,
200 struct dentry *dentry, const char *name,
201 const void *buffer, size_t size, int flags)
203 static const struct xattr_handler
204 xops __attribute__ ((unused)) = {
210 AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
211 [xattr_handler->set() wants xattr_handler])
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.
220 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
221 ZFS_LINUX_TRY_COMPILE([
222 #include <linux/xattr.h>
224 int set(struct dentry *dentry, const char *name,
225 const void *buffer, size_t size, int flags,
226 int handler_flags) { return 0; }
227 static const struct xattr_handler
228 xops __attribute__ ((unused)) = {
234 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
235 [xattr_handler->set() wants dentry])
242 [whether xattr_handler->set() wants inode])
243 ZFS_LINUX_TRY_COMPILE([
244 #include <linux/xattr.h>
246 int set(struct inode *ip, const char *name,
247 const void *buffer, size_t size, int flags)
249 static const struct xattr_handler
250 xops __attribute__ ((unused)) = {
256 AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
257 [xattr_handler->set() wants inode])
259 AC_MSG_ERROR([no; please file a bug report])
267 dnl # Supported xattr handler list() interfaces checked newest to oldest.
269 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
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])
274 ZFS_LINUX_TRY_COMPILE([
275 #include <linux/xattr.h>
277 bool list(struct dentry *dentry) { return 0; }
278 static const struct xattr_handler
279 xops __attribute__ ((unused)) = {
285 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
286 [xattr_handler->list() wants simple])
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.
296 [whether xattr_handler->list() wants xattr_handler])
297 ZFS_LINUX_TRY_COMPILE([
298 #include <linux/xattr.h>
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; }
303 static const struct xattr_handler
304 xops __attribute__ ((unused)) = {
310 AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
311 [xattr_handler->list() wants xattr_handler])
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.
321 [whether xattr_handler->list() wants dentry])
322 ZFS_LINUX_TRY_COMPILE([
323 #include <linux/xattr.h>
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)) = {
336 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
337 [xattr_handler->list() wants dentry])
344 [whether xattr_handler->list() wants inode])
345 ZFS_LINUX_TRY_COMPILE([
346 #include <linux/xattr.h>
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)) = {
358 AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
359 [xattr_handler->list() wants inode])
362 [no; please file a bug report])
370 dnl # 3.7 API change,
371 dnl # The posix_acl_{from,to}_xattr functions gained a new
372 dnl # parameter: user_ns
374 AC_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>
381 posix_acl_from_xattr(&init_user_ns, NULL, 0);
384 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
385 [posix_acl_from_xattr() needs user_ns])