1*eda14cbcSMatt Macydnl # 2*eda14cbcSMatt Macydnl # 2.6.38 API change 3*eda14cbcSMatt Macydnl # ns_capable() was introduced 4*eda14cbcSMatt Macydnl # 5*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_SRC_NS_CAPABLE], [ 6*eda14cbcSMatt Macy ZFS_LINUX_TEST_SRC([ns_capable], [ 7*eda14cbcSMatt Macy #include <linux/capability.h> 8*eda14cbcSMatt Macy ],[ 9*eda14cbcSMatt Macy ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN); 10*eda14cbcSMatt Macy ]) 11*eda14cbcSMatt Macy]) 12*eda14cbcSMatt Macy 13*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [ 14*eda14cbcSMatt Macy AC_MSG_CHECKING([whether ns_capable exists]) 15*eda14cbcSMatt Macy ZFS_LINUX_TEST_RESULT([ns_capable], [ 16*eda14cbcSMatt Macy AC_MSG_RESULT(yes) 17*eda14cbcSMatt Macy ],[ 18*eda14cbcSMatt Macy ZFS_LINUX_TEST_ERROR([ns_capable()]) 19*eda14cbcSMatt Macy ]) 20*eda14cbcSMatt Macy]) 21*eda14cbcSMatt Macy 22*eda14cbcSMatt Macydnl # 23*eda14cbcSMatt Macydnl # 2.6.39 API change 24*eda14cbcSMatt Macydnl # struct user_namespace was added to struct cred_t as cred->user_ns member 25*eda14cbcSMatt Macydnl # 26*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [ 27*eda14cbcSMatt Macy ZFS_LINUX_TEST_SRC([cred_user_ns], [ 28*eda14cbcSMatt Macy #include <linux/cred.h> 29*eda14cbcSMatt Macy ],[ 30*eda14cbcSMatt Macy struct cred cr; 31*eda14cbcSMatt Macy cr.user_ns = (struct user_namespace *)NULL; 32*eda14cbcSMatt Macy ]) 33*eda14cbcSMatt Macy]) 34*eda14cbcSMatt Macy 35*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [ 36*eda14cbcSMatt Macy AC_MSG_CHECKING([whether cred_t->user_ns exists]) 37*eda14cbcSMatt Macy ZFS_LINUX_TEST_RESULT([cred_user_ns], [ 38*eda14cbcSMatt Macy AC_MSG_RESULT(yes) 39*eda14cbcSMatt Macy ],[ 40*eda14cbcSMatt Macy ZFS_LINUX_TEST_ERROR([cred_t->user_ns()]) 41*eda14cbcSMatt Macy ]) 42*eda14cbcSMatt Macy]) 43*eda14cbcSMatt Macy 44*eda14cbcSMatt Macydnl # 45*eda14cbcSMatt Macydnl # 3.4 API change 46*eda14cbcSMatt Macydnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish 47*eda14cbcSMatt Macydnl # between internal kernel uids/gids and user namespace uids/gids. 48*eda14cbcSMatt Macydnl # 49*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING], [ 50*eda14cbcSMatt Macy ZFS_LINUX_TEST_SRC([kuid_has_mapping], [ 51*eda14cbcSMatt Macy #include <linux/uidgid.h> 52*eda14cbcSMatt Macy ],[ 53*eda14cbcSMatt Macy kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0)); 54*eda14cbcSMatt Macy kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0)); 55*eda14cbcSMatt Macy ]) 56*eda14cbcSMatt Macy]) 57*eda14cbcSMatt Macy 58*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [ 59*eda14cbcSMatt Macy AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist]) 60*eda14cbcSMatt Macy ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [ 61*eda14cbcSMatt Macy AC_MSG_RESULT(yes) 62*eda14cbcSMatt Macy ],[ 63*eda14cbcSMatt Macy ZFS_LINUX_TEST_ERROR([kuid_has_mapping()]) 64*eda14cbcSMatt Macy ]) 65*eda14cbcSMatt Macy]) 66*eda14cbcSMatt Macy 67*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES], [ 68*eda14cbcSMatt Macy ZFS_AC_KERNEL_SRC_NS_CAPABLE 69*eda14cbcSMatt Macy ZFS_AC_KERNEL_SRC_HAS_CAPABILITY 70*eda14cbcSMatt Macy ZFS_AC_KERNEL_SRC_CRED_USER_NS 71*eda14cbcSMatt Macy ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING 72*eda14cbcSMatt Macy]) 73*eda14cbcSMatt Macy 74*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_USERNS_CAPABILITIES], [ 75*eda14cbcSMatt Macy ZFS_AC_KERNEL_NS_CAPABLE 76*eda14cbcSMatt Macy ZFS_AC_KERNEL_HAS_CAPABILITY 77*eda14cbcSMatt Macy ZFS_AC_KERNEL_CRED_USER_NS 78*eda14cbcSMatt Macy ZFS_AC_KERNEL_KUID_HAS_MAPPING 79*eda14cbcSMatt Macy]) 80