Add support for DISCARD to ZVOLs.
[zfs.git] / config / kernel-security-inode-init.m4
1 dnl #
2 dnl # 2.6.39 API change
3 dnl # The security_inode_init_security() function now takes an additional
4 dnl # qstr argument which must be passed in from the dentry if available.
5 dnl # Passing a NULL is safe when no qstr is available the relevant
6 dnl # security checks will just be skipped.
7 dnl #
8 AC_DEFUN([ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY], [
9         AC_MSG_CHECKING([whether security_inode_init_security wants 6 args])
10         tmp_flags="$EXTRA_KCFLAGS"
11         EXTRA_KCFLAGS="-Werror"
12         ZFS_LINUX_TRY_COMPILE([
13                 #include <linux/security.h>
14         ],[
15                 struct inode *ip __attribute__ ((unused)) = NULL;
16                 struct inode *dip __attribute__ ((unused)) = NULL;
17                 const struct qstr *str __attribute__ ((unused)) = NULL;
18                 char *name __attribute__ ((unused)) = NULL;
19                 void *value __attribute__ ((unused)) = NULL;
20                 size_t len __attribute__ ((unused)) = 0;
21
22                 security_inode_init_security(ip, dip, str, &name, &value, &len);
23         ],[
24                 AC_MSG_RESULT(yes)
25                 AC_DEFINE(HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY, 1,
26                           [security_inode_init_security wants 6 args])
27         ],[
28                 AC_MSG_RESULT(no)
29         ])
30         EXTRA_KCFLAGS="$tmp_flags"
31 ])
32
33 dnl #
34 dnl # 3.2 API change
35 dnl # The security_inode_init_security() API has been changed to include
36 dnl # a filesystem specific callback to write security extended attributes.
37 dnl # This was done to support the initialization of multiple LSM xattrs
38 dnl # and the EVM xattr.
39 dnl #
40 AC_DEFUN([ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY], [
41         AC_MSG_CHECKING([whether security_inode_init_security wants callback])
42         tmp_flags="$EXTRA_KCFLAGS"
43         EXTRA_KCFLAGS="-Werror"
44         ZFS_LINUX_TRY_COMPILE([
45                 #include <linux/security.h>
46         ],[
47                 struct inode *ip __attribute__ ((unused)) = NULL;
48                 struct inode *dip __attribute__ ((unused)) = NULL;
49                 const struct qstr *str __attribute__ ((unused)) = NULL;
50                 initxattrs func __attribute__ ((unused)) = NULL;
51
52                 security_inode_init_security(ip, dip, str, func, NULL);
53         ],[
54                 AC_MSG_RESULT(yes)
55                 AC_DEFINE(HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY, 1,
56                           [security_inode_init_security wants callback])
57         ],[
58                 AC_MSG_RESULT(no)
59         ])
60         EXTRA_KCFLAGS="$tmp_flags"
61 ])