]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-userns-capabilities.m4
Perform KABI checks in parallel
[mirror_zfs.git] / config / kernel-userns-capabilities.m4
CommitLineData
0e85048f
WB
1dnl #
2dnl # 2.6.38 API change
3dnl # ns_capable() was introduced
4dnl #
608f8749
BB
5AC_DEFUN([ZFS_AC_KERNEL_SRC_NS_CAPABLE], [
6 ZFS_LINUX_TEST_SRC([ns_capable], [
0e85048f
WB
7 #include <linux/capability.h>
8 ],[
9 ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN);
608f8749
BB
10 ])
11])
12
13AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [
14 AC_MSG_CHECKING([whether ns_capable exists])
15 ZFS_LINUX_TEST_RESULT([ns_capable], [
0e85048f 16 AC_MSG_RESULT(yes)
608f8749 17 AC_DEFINE(HAVE_NS_CAPABLE, 1, [ns_capable exists])
0e85048f
WB
18 ],[
19 AC_MSG_RESULT(no)
20 ])
21])
22
23dnl #
24dnl # 2.6.39 API change
25dnl # struct user_namespace was added to struct cred_t as
26dnl # cred->user_ns member
27dnl # Note that current_user_ns() was added in 2.6.28.
28dnl #
608f8749
BB
29AC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [
30 ZFS_LINUX_TEST_SRC([cred_user_ns], [
0e85048f
WB
31 #include <linux/cred.h>
32 ],[
33 struct cred cr;
34 cr.user_ns = (struct user_namespace *)NULL;
608f8749
BB
35 ])
36])
37
38AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [
39 AC_MSG_CHECKING([whether cred_t->user_ns exists])
40 ZFS_LINUX_TEST_RESULT([cred_user_ns], [
0e85048f 41 AC_MSG_RESULT(yes)
608f8749 42 AC_DEFINE(HAVE_CRED_USER_NS, 1, [cred_t->user_ns exists])
0e85048f
WB
43 ],[
44 AC_MSG_RESULT(no)
45 ])
46])
47
48dnl #
49dnl # 3.4 API change
50dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish
51dnl # between internal kernel uids/gids and user namespace uids/gids.
52dnl #
608f8749
BB
53AC_DEFUN([ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING], [
54 ZFS_LINUX_TEST_SRC([kuid_has_mapping], [
0e85048f
WB
55 #include <linux/uidgid.h>
56 ],[
57 kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0));
58 kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0));
608f8749
BB
59 ])
60])
61
62AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [
63 AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist])
64 ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [
0e85048f
WB
65 AC_MSG_RESULT(yes)
66 AC_DEFINE(HAVE_KUID_HAS_MAPPING, 1,
67 [kuid_has_mapping/kgid_has_mapping exist])
68 ],[
69 AC_MSG_RESULT(no)
70 ])
71])
72
608f8749
BB
73AC_DEFUN([ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES], [
74 ZFS_AC_KERNEL_SRC_NS_CAPABLE
75 ZFS_AC_KERNEL_SRC_CRED_USER_NS
76 ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING
77])
78
0e85048f
WB
79AC_DEFUN([ZFS_AC_KERNEL_USERNS_CAPABILITIES], [
80 ZFS_AC_KERNEL_NS_CAPABLE
81 ZFS_AC_KERNEL_CRED_USER_NS
82 ZFS_AC_KERNEL_KUID_HAS_MAPPING
83])