mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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>
This commit is contained in:
parent
45598fd4e2
commit
c9fa2b07fa
1 changed files with 26 additions and 0 deletions
|
@ -333,6 +333,19 @@ static inline bool vfsuid_has_fsmapping(struct user_namespace *mnt_userns,
|
||||||
return uid_valid(from_vfsuid(mnt_userns, fs_userns, vfsuid));
|
return uid_valid(from_vfsuid(mnt_userns, fs_userns, vfsuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* from_vfsgid - map a vfsgid into the filesystem idmapping
|
||||||
* @mnt_userns: the mount's idmapping
|
* @mnt_userns: the mount's idmapping
|
||||||
|
@ -406,6 +419,19 @@ static inline bool vfsgid_has_fsmapping(struct user_namespace *mnt_userns,
|
||||||
return gid_valid(from_vfsgid(mnt_userns, fs_userns, vfsgid));
|
return gid_valid(from_vfsgid(mnt_userns, fs_userns, vfsgid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* mapped_fsuid - return caller's fsuid mapped up into a mnt_userns
|
||||||
* @mnt_userns: the mount's idmapping
|
* @mnt_userns: the mount's idmapping
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue