]> git.proxmox.com Git - mirror_zfs-debian.git/blame - config/kernel-xattr-handler.m4
Imported Upstream version 0.6.4.2
[mirror_zfs-debian.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 #
6AC_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 };
777d4af8 21
a08ee875
LG
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,
29 [super_block uses const struct xattr_hander])
30 ],[
31 AC_MSG_RESULT([no])
32 ])
33])
f9637c6c
BB
34
35dnl #
36dnl # 2.6.33 API change,
37dnl # The xattr_hander->get() callback was changed to take a dentry
38dnl # instead of an inode, and a handler_flags argument was added.
39dnl #
40AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
41 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
42 ZFS_LINUX_TRY_COMPILE([
43 #include <linux/xattr.h>
f9637c6c 44
a08ee875
LG
45 int get(struct dentry *dentry, const char *name,
46 void *buffer, size_t size, int handler_flags) { return 0; }
47 static const struct xattr_handler
48 xops __attribute__ ((unused)) = {
49 .get = get,
50 };
51 ],[
f9637c6c
BB
52 ],[
53 AC_MSG_RESULT(yes)
54 AC_DEFINE(HAVE_DENTRY_XATTR_GET, 1,
55 [xattr_handler->get() wants dentry])
56 ],[
57 AC_MSG_RESULT(no)
58 ])
59])
60
61dnl #
62dnl # 2.6.33 API change,
63dnl # The xattr_hander->set() callback was changed to take a dentry
64dnl # instead of an inode, and a handler_flags argument was added.
65dnl #
66AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
67 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
68 ZFS_LINUX_TRY_COMPILE([
69 #include <linux/xattr.h>
f9637c6c 70
a08ee875
LG
71 int set(struct dentry *dentry, const char *name,
72 const void *buffer, size_t size, int flags,
73 int handler_flags) { return 0; }
74 static const struct xattr_handler
75 xops __attribute__ ((unused)) = {
76 .set = set,
77 };
78 ],[
f9637c6c
BB
79 ],[
80 AC_MSG_RESULT(yes)
81 AC_DEFINE(HAVE_DENTRY_XATTR_SET, 1,
82 [xattr_handler->set() wants dentry])
83 ],[
84 AC_MSG_RESULT(no)
85 ])
86])
a08ee875
LG
87
88dnl #
89dnl # 2.6.33 API change,
90dnl # The xattr_hander->list() callback was changed to take a dentry
91dnl # instead of an inode, and a handler_flags argument was added.
92dnl #
93AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
94 AC_MSG_CHECKING([whether xattr_handler->list() wants dentry])
95 ZFS_LINUX_TRY_COMPILE([
96 #include <linux/xattr.h>
97
98 size_t list(struct dentry *dentry, char *list, size_t list_size,
99 const char *name, size_t name_len, int handler_flags)
100 { return 0; }
101 static const struct xattr_handler
102 xops __attribute__ ((unused)) = {
103 .list = list,
104 };
105 ],[
106 ],[
107 AC_MSG_RESULT(yes)
108 AC_DEFINE(HAVE_DENTRY_XATTR_LIST, 1,
109 [xattr_handler->list() wants dentry])
110 ],[
111 AC_MSG_RESULT(no)
112 ])
113])
114
115dnl #
116dnl # 3.7 API change,
117dnl # The posix_acl_{from,to}_xattr functions gained a new
118dnl # parameter: user_ns
119dnl #
120AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
121 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
122 ZFS_LINUX_TRY_COMPILE([
123 #include <linux/cred.h>
124 #include <linux/fs.h>
125 #include <linux/posix_acl_xattr.h>
126 ],[
127 posix_acl_from_xattr(&init_user_ns, NULL, 0);
128 ],[
129 AC_MSG_RESULT(yes)
130 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
131 [posix_acl_from_xattr() needs user_ns])
132 ],[
133 AC_MSG_RESULT(no)
134 ])
135])
136