]> git.proxmox.com Git - mirror_zfs.git/blob - config/kernel-userns-capabilities.m4
Fix typesetting of Errata #4
[mirror_zfs.git] / config / kernel-userns-capabilities.m4
1 dnl #
2 dnl # 2.6.38 API change
3 dnl # ns_capable() was introduced
4 dnl #
5 AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [
6 AC_MSG_CHECKING([whether ns_capable exists])
7 ZFS_LINUX_TRY_COMPILE([
8 #include <linux/capability.h>
9 ],[
10 ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN);
11 ],[
12 AC_MSG_RESULT(yes)
13 AC_DEFINE(HAVE_NS_CAPABLE, 1,
14 [ns_capable exists])
15 ],[
16 AC_MSG_RESULT(no)
17 ])
18 ])
19
20 dnl #
21 dnl # 2.6.39 API change
22 dnl # struct user_namespace was added to struct cred_t as
23 dnl # cred->user_ns member
24 dnl # Note that current_user_ns() was added in 2.6.28.
25 dnl #
26 AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [
27 AC_MSG_CHECKING([whether cred_t->user_ns exists])
28 ZFS_LINUX_TRY_COMPILE([
29 #include <linux/cred.h>
30 ],[
31 struct cred cr;
32 cr.user_ns = (struct user_namespace *)NULL;
33 ],[
34 AC_MSG_RESULT(yes)
35 AC_DEFINE(HAVE_CRED_USER_NS, 1,
36 [cred_t->user_ns exists])
37 ],[
38 AC_MSG_RESULT(no)
39 ])
40 ])
41
42 dnl #
43 dnl # 3.4 API change
44 dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish
45 dnl # between internal kernel uids/gids and user namespace uids/gids.
46 dnl #
47 AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [
48 AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist])
49 ZFS_LINUX_TRY_COMPILE([
50 #include <linux/uidgid.h>
51 ],[
52 kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0));
53 kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0));
54 ],[
55 AC_MSG_RESULT(yes)
56 AC_DEFINE(HAVE_KUID_HAS_MAPPING, 1,
57 [kuid_has_mapping/kgid_has_mapping exist])
58 ],[
59 AC_MSG_RESULT(no)
60 ])
61 ])
62
63 AC_DEFUN([ZFS_AC_KERNEL_USERNS_CAPABILITIES], [
64 ZFS_AC_KERNEL_NS_CAPABLE
65 ZFS_AC_KERNEL_CRED_USER_NS
66 ZFS_AC_KERNEL_KUID_HAS_MAPPING
67 ])