]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-userns-capabilities.m4
OpenZFS 9185 - Enable testing over NFS in ZFS performance tests
[mirror_zfs.git] / config / kernel-userns-capabilities.m4
CommitLineData
0e85048f
WB
1dnl #
2dnl # 2.6.38 API change
3dnl # ns_capable() was introduced
4dnl #
5AC_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
20dnl #
21dnl # 2.6.39 API change
22dnl # struct user_namespace was added to struct cred_t as
23dnl # cred->user_ns member
24dnl # Note that current_user_ns() was added in 2.6.28.
25dnl #
26AC_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
42dnl #
43dnl # 3.4 API change
44dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish
45dnl # between internal kernel uids/gids and user namespace uids/gids.
46dnl #
47AC_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
63AC_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])