@@ -1574,36 +1574,84 @@ static inline void i_gid_write(struct inode *inode, gid_t gid)
15741574 inode -> i_gid = make_kgid (inode -> i_sb -> s_user_ns , gid );
15751575}
15761576
1577+ /**
1578+ * kuid_into_mnt - map a kuid down into a mnt_userns
1579+ * @mnt_userns: user namespace of the relevant mount
1580+ * @kuid: kuid to be mapped
1581+ *
1582+ * Return: @kuid mapped according to @mnt_userns.
1583+ * If @kuid has no mapping INVALID_UID is returned.
1584+ */
15771585static inline kuid_t kuid_into_mnt (struct user_namespace * mnt_userns ,
15781586 kuid_t kuid )
15791587{
15801588 return make_kuid (mnt_userns , __kuid_val (kuid ));
15811589}
15821590
1591+ /**
1592+ * kgid_into_mnt - map a kgid down into a mnt_userns
1593+ * @mnt_userns: user namespace of the relevant mount
1594+ * @kgid: kgid to be mapped
1595+ *
1596+ * Return: @kgid mapped according to @mnt_userns.
1597+ * If @kgid has no mapping INVALID_GID is returned.
1598+ */
15831599static inline kgid_t kgid_into_mnt (struct user_namespace * mnt_userns ,
15841600 kgid_t kgid )
15851601{
15861602 return make_kgid (mnt_userns , __kgid_val (kgid ));
15871603}
15881604
1605+ /**
1606+ * i_uid_into_mnt - map an inode's i_uid down into a mnt_userns
1607+ * @mnt_userns: user namespace of the mount the inode was found from
1608+ * @inode: inode to map
1609+ *
1610+ * Return: the inode's i_uid mapped down according to @mnt_userns.
1611+ * If the inode's i_uid has no mapping INVALID_UID is returned.
1612+ */
15891613static inline kuid_t i_uid_into_mnt (struct user_namespace * mnt_userns ,
15901614 const struct inode * inode )
15911615{
15921616 return kuid_into_mnt (mnt_userns , inode -> i_uid );
15931617}
15941618
1619+ /**
1620+ * i_gid_into_mnt - map an inode's i_gid down into a mnt_userns
1621+ * @mnt_userns: user namespace of the mount the inode was found from
1622+ * @inode: inode to map
1623+ *
1624+ * Return: the inode's i_gid mapped down according to @mnt_userns.
1625+ * If the inode's i_gid has no mapping INVALID_GID is returned.
1626+ */
15951627static inline kgid_t i_gid_into_mnt (struct user_namespace * mnt_userns ,
15961628 const struct inode * inode )
15971629{
15981630 return kgid_into_mnt (mnt_userns , inode -> i_gid );
15991631}
16001632
1633+ /**
1634+ * kuid_from_mnt - map a kuid up into a mnt_userns
1635+ * @mnt_userns: user namespace of the relevant mount
1636+ * @kuid: kuid to be mapped
1637+ *
1638+ * Return: @kuid mapped up according to @mnt_userns.
1639+ * If @kuid has no mapping INVALID_UID is returned.
1640+ */
16011641static inline kuid_t kuid_from_mnt (struct user_namespace * mnt_userns ,
16021642 kuid_t kuid )
16031643{
16041644 return KUIDT_INIT (from_kuid (mnt_userns , kuid ));
16051645}
16061646
1647+ /**
1648+ * kgid_from_mnt - map a kgid up into a mnt_userns
1649+ * @mnt_userns: user namespace of the relevant mount
1650+ * @kgid: kgid to be mapped
1651+ *
1652+ * Return: @kgid mapped up according to @mnt_userns.
1653+ * If @kgid has no mapping INVALID_GID is returned.
1654+ */
16071655static inline kgid_t kgid_from_mnt (struct user_namespace * mnt_userns ,
16081656 kgid_t kgid )
16091657{
0 commit comments