]>
Commit | Line | Data |
---|---|---|
0e85048f WB |
1 | dnl # |
2 | dnl # 2.6.38 API change | |
3 | dnl # ns_capable() was introduced | |
4 | dnl # | |
608f8749 BB |
5 | AC_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 | ||
13 | AC_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 | ||
23 | dnl # | |
24 | dnl # 2.6.39 API change | |
25 | dnl # struct user_namespace was added to struct cred_t as | |
26 | dnl # cred->user_ns member | |
27 | dnl # Note that current_user_ns() was added in 2.6.28. | |
28 | dnl # | |
608f8749 BB |
29 | AC_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 | ||
38 | AC_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 | ||
48 | dnl # | |
49 | dnl # 3.4 API change | |
50 | dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish | |
51 | dnl # between internal kernel uids/gids and user namespace uids/gids. | |
52 | dnl # | |
608f8749 BB |
53 | AC_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 | ||
62 | AC_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 |
73 | AC_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 |
79 | AC_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 | ]) |