wrapper: user_namespace.h: remove backward compatibility code
[lttng-modules.git] / wrapper / user_namespace.h
index 701f3189b5c97f8e1f006c175e0bbd755d66b052..8cc6020709d7c6cd46177ae86cde1424a93ba287 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
  *
  * wrapper/user_namespace.h
  *
@@ -13,8 +13,6 @@
 #include <linux/user_namespace.h>
 
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
-
 #define lttng_current_xxuid(xxx)                               \
        (from_kuid_munged(&init_user_ns, current_##xxx()))
 
 #define lttng_current_vxxgid(xxx)                              \
        (from_kgid_munged(current_user_ns(), current_##xxx()))
 
-#else
+static inline
+uid_t lttng_task_vuid(struct task_struct *p, struct user_namespace *ns)
+{
+       uid_t uid;
+       kuid_t kuid;
+
+       kuid = task_cred_xxx(p, uid);
+       uid = from_kuid_munged(ns, kuid);
 
-#define lttng_current_xxuid(xxx)       (current_##xxx())
+       return uid;
+}
 
-#define lttng_current_vxxuid(xxx)                                      \
-       (user_ns_map_uid(current_user_ns(), current_cred(), current_##xxx()))
+static inline
+gid_t lttng_task_vgid(struct task_struct *p, struct user_namespace *ns)
+{
+       gid_t gid;
+       kgid_t kgid;
 
-#define lttng_current_xxgid(xxx)       (current_##xxx())
+       kgid = task_cred_xxx(p, gid);
+       gid = from_kgid_munged(ns, kgid);
 
-#define lttng_current_vxxgid(xxx)                                      \
-       (user_ns_map_gid(current_user_ns(), current_cred(), current_##xxx()))
-#endif
+       return gid;
+}
 
 #define lttng_current_uid()    (lttng_current_xxuid(uid))
 #define lttng_current_euid()   (lttng_current_xxuid(euid))
This page took 0.024101 seconds and 4 git commands to generate.