diff options
author | Christian Brauner <brauner@kernel.org> | 2022-06-26 20:45:07 +0200 |
---|---|---|
committer | Christian Brauner (Microsoft) <brauner@kernel.org> | 2022-07-15 22:08:01 +0200 |
commit | c9fa2b07fa99e648b5042a32dbfa39ba68a190db (patch) | |
tree | 021280ec7919d8d6821a889202ce7eed9f500a9b | |
parent | 45598fd4e2897306ed5006e6a80b0460c3079bbd (diff) |
mnt_idmapping: add vfs[g,u]id_into_k[g,u]id()
Add two tiny helpers to conver a vfsuid into a kuid.
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
-rw-r--r-- | include/linux/mnt_idmapping.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/mnt_idmapping.h b/include/linux/mnt_idmapping.h index 41dc80f8b67c..f6e5369d2928 100644 --- a/include/linux/mnt_idmapping.h +++ b/include/linux/mnt_idmapping.h @@ -334,6 +334,19 @@ static inline bool vfsuid_has_fsmapping(struct user_namespace *mnt_userns, } /** + * vfsuid_into_kuid - convert vfsuid into kuid + * @vfsuid: the vfsuid to convert + * + * This can be used when a vfsuid is committed as a kuid. + * + * Return: a kuid with the value of @vfsuid + */ +static inline kuid_t vfsuid_into_kuid(vfsuid_t vfsuid) +{ + return AS_KUIDT(vfsuid); +} + +/** * from_vfsgid - map a vfsgid into the filesystem idmapping * @mnt_userns: the mount's idmapping * @fs_userns: the filesystem's idmapping @@ -407,6 +420,19 @@ static inline bool vfsgid_has_fsmapping(struct user_namespace *mnt_userns, } /** + * vfsgid_into_kgid - convert vfsgid into kgid + * @vfsgid: the vfsgid to convert + * + * This can be used when a vfsgid is committed as a kgid. + * + * Return: a kgid with the value of @vfsgid + */ +static inline kgid_t vfsgid_into_kgid(vfsgid_t vfsgid) +{ + return AS_KGIDT(vfsgid); +} + +/** * mapped_fsuid - return caller's fsuid mapped up into a mnt_userns * @mnt_userns: the mount's idmapping * @fs_userns: the filesystem's idmapping |