2 dnl # 2.6.38 API change
3 dnl # ns_capable() was introduced
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>
10 ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN);
13 AC_DEFINE(HAVE_NS_CAPABLE, 1,
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.
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>
32 cr.user_ns = (struct user_namespace *)NULL;
35 AC_DEFINE(HAVE_CRED_USER_NS, 1,
36 [cred_t->user_ns exists])
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.
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>
52 kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0));
53 kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0));
56 AC_DEFINE(HAVE_KUID_HAS_MAPPING, 1,
57 [kuid_has_mapping/kgid_has_mapping exist])
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