@@ -1574,36 +1574,84 @@ static inline void i_gid_write(struct inode *inode, gid_t gid)
1574
1574
inode -> i_gid = make_kgid (inode -> i_sb -> s_user_ns , gid );
1575
1575
}
1576
1576
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
+ */
1577
1585
static inline kuid_t kuid_into_mnt (struct user_namespace * mnt_userns ,
1578
1586
kuid_t kuid )
1579
1587
{
1580
1588
return make_kuid (mnt_userns , __kuid_val (kuid ));
1581
1589
}
1582
1590
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
+ */
1583
1599
static inline kgid_t kgid_into_mnt (struct user_namespace * mnt_userns ,
1584
1600
kgid_t kgid )
1585
1601
{
1586
1602
return make_kgid (mnt_userns , __kgid_val (kgid ));
1587
1603
}
1588
1604
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
+ */
1589
1613
static inline kuid_t i_uid_into_mnt (struct user_namespace * mnt_userns ,
1590
1614
const struct inode * inode )
1591
1615
{
1592
1616
return kuid_into_mnt (mnt_userns , inode -> i_uid );
1593
1617
}
1594
1618
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
+ */
1595
1627
static inline kgid_t i_gid_into_mnt (struct user_namespace * mnt_userns ,
1596
1628
const struct inode * inode )
1597
1629
{
1598
1630
return kgid_into_mnt (mnt_userns , inode -> i_gid );
1599
1631
}
1600
1632
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
+ */
1601
1641
static inline kuid_t kuid_from_mnt (struct user_namespace * mnt_userns ,
1602
1642
kuid_t kuid )
1603
1643
{
1604
1644
return KUIDT_INIT (from_kuid (mnt_userns , kuid ));
1605
1645
}
1606
1646
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
+ */
1607
1655
static inline kgid_t kgid_from_mnt (struct user_namespace * mnt_userns ,
1608
1656
kgid_t kgid )
1609
1657
{
0 commit comments