]>
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) |
0e85048f | 17 | ],[ |
066e8252 | 18 | ZFS_LINUX_TEST_ERROR([ns_capable()]) |
0e85048f WB |
19 | ]) |
20 | ]) | |
21 | ||
e862b7ec BB |
22 | dnl # |
23 | dnl # 4.10 API change | |
24 | dnl # has_capability() was exported. | |
25 | dnl # | |
26 | AC_DEFUN([ZFS_AC_KERNEL_SRC_HAS_CAPABILITY], [ | |
27 | ZFS_LINUX_TEST_SRC([has_capability], [ | |
28 | #include <linux/capability.h> | |
29 | ],[ | |
30 | struct task_struct *task = NULL; | |
31 | int cap = 0; | |
32 | bool result __attribute__ ((unused)); | |
33 | ||
34 | result = has_capability(task, cap); | |
35 | ]) | |
36 | ]) | |
37 | ||
38 | AC_DEFUN([ZFS_AC_KERNEL_HAS_CAPABILITY], [ | |
39 | AC_MSG_CHECKING([whether has_capability() is available]) | |
40 | ZFS_LINUX_TEST_RESULT_SYMBOL([has_capability], | |
41 | [has_capability], [kernel/capability.c], [ | |
42 | AC_MSG_RESULT(yes) | |
43 | AC_DEFINE(HAVE_HAS_CAPABILITY, 1, [has_capability() is available]) | |
44 | ],[ | |
45 | AC_MSG_RESULT(no) | |
46 | ]) | |
47 | ]) | |
48 | ||
0e85048f WB |
49 | dnl # |
50 | dnl # 2.6.39 API change | |
066e8252 | 51 | dnl # struct user_namespace was added to struct cred_t as cred->user_ns member |
0e85048f | 52 | dnl # |
608f8749 BB |
53 | AC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [ |
54 | ZFS_LINUX_TEST_SRC([cred_user_ns], [ | |
0e85048f WB |
55 | #include <linux/cred.h> |
56 | ],[ | |
57 | struct cred cr; | |
58 | cr.user_ns = (struct user_namespace *)NULL; | |
608f8749 BB |
59 | ]) |
60 | ]) | |
61 | ||
62 | AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [ | |
63 | AC_MSG_CHECKING([whether cred_t->user_ns exists]) | |
64 | ZFS_LINUX_TEST_RESULT([cred_user_ns], [ | |
0e85048f | 65 | AC_MSG_RESULT(yes) |
0e85048f | 66 | ],[ |
066e8252 | 67 | ZFS_LINUX_TEST_ERROR([cred_t->user_ns()]) |
0e85048f WB |
68 | ]) |
69 | ]) | |
70 | ||
71 | dnl # | |
72 | dnl # 3.4 API change | |
73 | dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish | |
74 | dnl # between internal kernel uids/gids and user namespace uids/gids. | |
75 | dnl # | |
608f8749 BB |
76 | AC_DEFUN([ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING], [ |
77 | ZFS_LINUX_TEST_SRC([kuid_has_mapping], [ | |
0e85048f WB |
78 | #include <linux/uidgid.h> |
79 | ],[ | |
80 | kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0)); | |
81 | kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0)); | |
608f8749 BB |
82 | ]) |
83 | ]) | |
84 | ||
85 | AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [ | |
86 | AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist]) | |
87 | ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [ | |
0e85048f | 88 | AC_MSG_RESULT(yes) |
0e85048f | 89 | ],[ |
066e8252 | 90 | ZFS_LINUX_TEST_ERROR([kuid_has_mapping()]) |
0e85048f WB |
91 | ]) |
92 | ]) | |
93 | ||
608f8749 BB |
94 | AC_DEFUN([ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES], [ |
95 | ZFS_AC_KERNEL_SRC_NS_CAPABLE | |
e862b7ec | 96 | ZFS_AC_KERNEL_SRC_HAS_CAPABILITY |
608f8749 BB |
97 | ZFS_AC_KERNEL_SRC_CRED_USER_NS |
98 | ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING | |
99 | ]) | |
100 | ||
0e85048f WB |
101 | AC_DEFUN([ZFS_AC_KERNEL_USERNS_CAPABILITIES], [ |
102 | ZFS_AC_KERNEL_NS_CAPABLE | |
e862b7ec | 103 | ZFS_AC_KERNEL_HAS_CAPABILITY |
0e85048f WB |
104 | ZFS_AC_KERNEL_CRED_USER_NS |
105 | ZFS_AC_KERNEL_KUID_HAS_MAPPING | |
106 | ]) |