diff options
Diffstat (limited to 'include/linux/uidgid.h')
-rw-r--r-- | include/linux/uidgid.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h index 539856829caf..8e522cbcef29 100644 --- a/include/linux/uidgid.h +++ b/include/linux/uidgid.h @@ -127,6 +127,28 @@ static inline bool gid_valid(kgid_t gid) return !gid_eq(gid, INVALID_GID); } +#ifdef CONFIG_USER_NS + +extern kuid_t make_kuid(struct user_namespace *from, uid_t uid); +extern kgid_t make_kgid(struct user_namespace *from, gid_t gid); + +extern uid_t from_kuid(struct user_namespace *to, kuid_t uid); +extern gid_t from_kgid(struct user_namespace *to, kgid_t gid); +extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid); +extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid); + +static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid) +{ + return from_kuid(ns, uid) != (uid_t) -1; +} + +static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid) +{ + return from_kgid(ns, gid) != (gid_t) -1; +} + +#else + static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid) { return KUIDT_INIT(uid); @@ -173,4 +195,6 @@ static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid) return true; } +#endif /* CONFIG_USER_NS */ + #endif /* _LINUX_UIDGID_H */ |