fs.h (647bfd26bf054313305ea9c2c4a1c71f3bbfee63) fs.h (5298d4bfe80f6ae6ae2777bcd1357b0022d98573)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_FS_H
3#define _LINUX_FS_H
4
5#include <linux/linkage.h>
6#include <linux/wait_bit.h>
7#include <linux/kdev_t.h>
8#include <linux/dcache.h>

--- 27 unchanged lines hidden (view full) ---

36#include <linux/uuid.h>
37#include <linux/errseq.h>
38#include <linux/ioprio.h>
39#include <linux/fs_types.h>
40#include <linux/build_bug.h>
41#include <linux/stddef.h>
42#include <linux/mount.h>
43#include <linux/cred.h>
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_FS_H
3#define _LINUX_FS_H
4
5#include <linux/linkage.h>
6#include <linux/wait_bit.h>
7#include <linux/kdev_t.h>
8#include <linux/dcache.h>

--- 27 unchanged lines hidden (view full) ---

36#include <linux/uuid.h>
37#include <linux/errseq.h>
38#include <linux/ioprio.h>
39#include <linux/fs_types.h>
40#include <linux/build_bug.h>
41#include <linux/stddef.h>
42#include <linux/mount.h>
43#include <linux/cred.h>
44#include <linux/mnt_idmapping.h>
44
45#include <asm/byteorder.h>
46#include <uapi/linux/fs.h>
47
48struct backing_dev_info;
49struct bdi_writeback;
50struct bio;
51struct io_comp_batch;

--- 1163 unchanged lines hidden (view full) ---

1215static inline int fcntl_setlk(unsigned int fd, struct file *file,
1216 unsigned int cmd, struct flock __user *user)
1217{
1218 return -EACCES;
1219}
1220
1221#if BITS_PER_LONG == 32
1222static inline int fcntl_getlk64(struct file *file, unsigned int cmd,
45
46#include <asm/byteorder.h>
47#include <uapi/linux/fs.h>
48
49struct backing_dev_info;
50struct bdi_writeback;
51struct bio;
52struct io_comp_batch;

--- 1163 unchanged lines hidden (view full) ---

1216static inline int fcntl_setlk(unsigned int fd, struct file *file,
1217 unsigned int cmd, struct flock __user *user)
1218{
1219 return -EACCES;
1220}
1221
1222#if BITS_PER_LONG == 32
1223static inline int fcntl_getlk64(struct file *file, unsigned int cmd,
1223 struct flock64 __user *user)
1224 struct flock64 *user)
1224{
1225 return -EINVAL;
1226}
1227
1228static inline int fcntl_setlk64(unsigned int fd, struct file *file,
1225{
1226 return -EINVAL;
1227}
1228
1229static inline int fcntl_setlk64(unsigned int fd, struct file *file,
1229 unsigned int cmd, struct flock64 __user *user)
1230 unsigned int cmd, struct flock64 *user)
1230{
1231 return -EACCES;
1232}
1233#endif
1234static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1235{
1236 return -EINVAL;
1237}

--- 246 unchanged lines hidden (view full) ---

1484 const struct xattr_handler **s_xattr;
1485#ifdef CONFIG_FS_ENCRYPTION
1486 const struct fscrypt_operations *s_cop;
1487 struct key *s_master_keys; /* master crypto keys in use */
1488#endif
1489#ifdef CONFIG_FS_VERITY
1490 const struct fsverity_operations *s_vop;
1491#endif
1231{
1232 return -EACCES;
1233}
1234#endif
1235static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1236{
1237 return -EINVAL;
1238}

--- 246 unchanged lines hidden (view full) ---

1485 const struct xattr_handler **s_xattr;
1486#ifdef CONFIG_FS_ENCRYPTION
1487 const struct fscrypt_operations *s_cop;
1488 struct key *s_master_keys; /* master crypto keys in use */
1489#endif
1490#ifdef CONFIG_FS_VERITY
1491 const struct fsverity_operations *s_vop;
1492#endif
1492#ifdef CONFIG_UNICODE
1493#if IS_ENABLED(CONFIG_UNICODE)
1493 struct unicode_map *s_encoding;
1494 __u16 s_encoding_flags;
1495#endif
1496 struct hlist_bl_head s_roots; /* alternate root dentries for NFS */
1497 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1498 struct block_device *s_bdev;
1499 struct backing_dev_info *s_bdi;
1500 struct mtd_info *s_mtd;

--- 93 unchanged lines hidden (view full) ---

1594 /* s_inode_list_lock protects s_inodes */
1595 spinlock_t s_inode_list_lock ____cacheline_aligned_in_smp;
1596 struct list_head s_inodes; /* all inodes */
1597
1598 spinlock_t s_inode_wblist_lock;
1599 struct list_head s_inodes_wb; /* writeback inodes */
1600} __randomize_layout;
1601
1494 struct unicode_map *s_encoding;
1495 __u16 s_encoding_flags;
1496#endif
1497 struct hlist_bl_head s_roots; /* alternate root dentries for NFS */
1498 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1499 struct block_device *s_bdev;
1500 struct backing_dev_info *s_bdi;
1501 struct mtd_info *s_mtd;

--- 93 unchanged lines hidden (view full) ---

1595 /* s_inode_list_lock protects s_inodes */
1596 spinlock_t s_inode_list_lock ____cacheline_aligned_in_smp;
1597 struct list_head s_inodes; /* all inodes */
1598
1599 spinlock_t s_inode_wblist_lock;
1600 struct list_head s_inodes_wb; /* writeback inodes */
1601} __randomize_layout;
1602
1603static inline struct user_namespace *i_user_ns(const struct inode *inode)
1604{
1605 return inode->i_sb->s_user_ns;
1606}
1607
1602/* Helper functions so that in most cases filesystems will
1603 * not need to deal directly with kuid_t and kgid_t and can
1604 * instead deal with the raw numeric values that are stored
1605 * in the filesystem.
1606 */
1607static inline uid_t i_uid_read(const struct inode *inode)
1608{
1608/* Helper functions so that in most cases filesystems will
1609 * not need to deal directly with kuid_t and kgid_t and can
1610 * instead deal with the raw numeric values that are stored
1611 * in the filesystem.
1612 */
1613static inline uid_t i_uid_read(const struct inode *inode)
1614{
1609 return from_kuid(inode->i_sb->s_user_ns, inode->i_uid);
1615 return from_kuid(i_user_ns(inode), inode->i_uid);
1610}
1611
1612static inline gid_t i_gid_read(const struct inode *inode)
1613{
1616}
1617
1618static inline gid_t i_gid_read(const struct inode *inode)
1619{
1614 return from_kgid(inode->i_sb->s_user_ns, inode->i_gid);
1620 return from_kgid(i_user_ns(inode), inode->i_gid);
1615}
1616
1617static inline void i_uid_write(struct inode *inode, uid_t uid)
1618{
1621}
1622
1623static inline void i_uid_write(struct inode *inode, uid_t uid)
1624{
1619 inode->i_uid = make_kuid(inode->i_sb->s_user_ns, uid);
1625 inode->i_uid = make_kuid(i_user_ns(inode), uid);
1620}
1621
1622static inline void i_gid_write(struct inode *inode, gid_t gid)
1623{
1626}
1627
1628static inline void i_gid_write(struct inode *inode, gid_t gid)
1629{
1624 inode->i_gid = make_kgid(inode->i_sb->s_user_ns, gid);
1630 inode->i_gid = make_kgid(i_user_ns(inode), gid);
1625}
1626
1627/**
1631}
1632
1633/**
1628 * kuid_into_mnt - map a kuid down into a mnt_userns
1629 * @mnt_userns: user namespace of the relevant mount
1630 * @kuid: kuid to be mapped
1631 *
1632 * Return: @kuid mapped according to @mnt_userns.
1633 * If @kuid has no mapping INVALID_UID is returned.
1634 */
1635static inline kuid_t kuid_into_mnt(struct user_namespace *mnt_userns,
1636 kuid_t kuid)
1637{
1638 return make_kuid(mnt_userns, __kuid_val(kuid));
1639}
1640
1641/**
1642 * kgid_into_mnt - map a kgid down into a mnt_userns
1643 * @mnt_userns: user namespace of the relevant mount
1644 * @kgid: kgid to be mapped
1645 *
1646 * Return: @kgid mapped according to @mnt_userns.
1647 * If @kgid has no mapping INVALID_GID is returned.
1648 */
1649static inline kgid_t kgid_into_mnt(struct user_namespace *mnt_userns,
1650 kgid_t kgid)
1651{
1652 return make_kgid(mnt_userns, __kgid_val(kgid));
1653}
1654
1655/**
1656 * i_uid_into_mnt - map an inode's i_uid down into a mnt_userns
1657 * @mnt_userns: user namespace of the mount the inode was found from
1658 * @inode: inode to map
1659 *
1660 * Return: the inode's i_uid mapped down according to @mnt_userns.
1661 * If the inode's i_uid has no mapping INVALID_UID is returned.
1662 */
1663static inline kuid_t i_uid_into_mnt(struct user_namespace *mnt_userns,
1664 const struct inode *inode)
1665{
1634 * i_uid_into_mnt - map an inode's i_uid down into a mnt_userns
1635 * @mnt_userns: user namespace of the mount the inode was found from
1636 * @inode: inode to map
1637 *
1638 * Return: the inode's i_uid mapped down according to @mnt_userns.
1639 * If the inode's i_uid has no mapping INVALID_UID is returned.
1640 */
1641static inline kuid_t i_uid_into_mnt(struct user_namespace *mnt_userns,
1642 const struct inode *inode)
1643{
1666 return kuid_into_mnt(mnt_userns, inode->i_uid);
1644 return mapped_kuid_fs(mnt_userns, i_user_ns(inode), inode->i_uid);
1667}
1668
1669/**
1670 * i_gid_into_mnt - map an inode's i_gid down into a mnt_userns
1671 * @mnt_userns: user namespace of the mount the inode was found from
1672 * @inode: inode to map
1673 *
1674 * Return: the inode's i_gid mapped down according to @mnt_userns.
1675 * If the inode's i_gid has no mapping INVALID_GID is returned.
1676 */
1677static inline kgid_t i_gid_into_mnt(struct user_namespace *mnt_userns,
1678 const struct inode *inode)
1679{
1645}
1646
1647/**
1648 * i_gid_into_mnt - map an inode's i_gid down into a mnt_userns
1649 * @mnt_userns: user namespace of the mount the inode was found from
1650 * @inode: inode to map
1651 *
1652 * Return: the inode's i_gid mapped down according to @mnt_userns.
1653 * If the inode's i_gid has no mapping INVALID_GID is returned.
1654 */
1655static inline kgid_t i_gid_into_mnt(struct user_namespace *mnt_userns,
1656 const struct inode *inode)
1657{
1680 return kgid_into_mnt(mnt_userns, inode->i_gid);
1658 return mapped_kgid_fs(mnt_userns, i_user_ns(inode), inode->i_gid);
1681}
1682
1683/**
1659}
1660
1661/**
1684 * kuid_from_mnt - map a kuid up into a mnt_userns
1685 * @mnt_userns: user namespace of the relevant mount
1686 * @kuid: kuid to be mapped
1687 *
1688 * Return: @kuid mapped up according to @mnt_userns.
1689 * If @kuid has no mapping INVALID_UID is returned.
1690 */
1691static inline kuid_t kuid_from_mnt(struct user_namespace *mnt_userns,
1692 kuid_t kuid)
1693{
1694 return KUIDT_INIT(from_kuid(mnt_userns, kuid));
1695}
1696
1697/**
1698 * kgid_from_mnt - map a kgid up into a mnt_userns
1699 * @mnt_userns: user namespace of the relevant mount
1700 * @kgid: kgid to be mapped
1701 *
1702 * Return: @kgid mapped up according to @mnt_userns.
1703 * If @kgid has no mapping INVALID_GID is returned.
1704 */
1705static inline kgid_t kgid_from_mnt(struct user_namespace *mnt_userns,
1706 kgid_t kgid)
1707{
1708 return KGIDT_INIT(from_kgid(mnt_userns, kgid));
1709}
1710
1711/**
1712 * mapped_fsuid - return caller's fsuid mapped up into a mnt_userns
1713 * @mnt_userns: user namespace of the relevant mount
1714 *
1715 * Use this helper to initialize a new vfs or filesystem object based on
1716 * the caller's fsuid. A common example is initializing the i_uid field of
1717 * a newly allocated inode triggered by a creation event such as mkdir or
1718 * O_CREAT. Other examples include the allocation of quotas for a specific
1719 * user.
1720 *
1721 * Return: the caller's current fsuid mapped up according to @mnt_userns.
1722 */
1723static inline kuid_t mapped_fsuid(struct user_namespace *mnt_userns)
1724{
1725 return kuid_from_mnt(mnt_userns, current_fsuid());
1726}
1727
1728/**
1729 * mapped_fsgid - return caller's fsgid mapped up into a mnt_userns
1730 * @mnt_userns: user namespace of the relevant mount
1731 *
1732 * Use this helper to initialize a new vfs or filesystem object based on
1733 * the caller's fsgid. A common example is initializing the i_gid field of
1734 * a newly allocated inode triggered by a creation event such as mkdir or
1735 * O_CREAT. Other examples include the allocation of quotas for a specific
1736 * user.
1737 *
1738 * Return: the caller's current fsgid mapped up according to @mnt_userns.
1739 */
1740static inline kgid_t mapped_fsgid(struct user_namespace *mnt_userns)
1741{
1742 return kgid_from_mnt(mnt_userns, current_fsgid());
1743}
1744
1745/**
1746 * inode_fsuid_set - initialize inode's i_uid field with callers fsuid
1747 * @inode: inode to initialize
1748 * @mnt_userns: user namespace of the mount the inode was found from
1749 *
1750 * Initialize the i_uid field of @inode. If the inode was found/created via
1751 * an idmapped mount map the caller's fsuid according to @mnt_users.
1752 */
1753static inline void inode_fsuid_set(struct inode *inode,
1754 struct user_namespace *mnt_userns)
1755{
1662 * inode_fsuid_set - initialize inode's i_uid field with callers fsuid
1663 * @inode: inode to initialize
1664 * @mnt_userns: user namespace of the mount the inode was found from
1665 *
1666 * Initialize the i_uid field of @inode. If the inode was found/created via
1667 * an idmapped mount map the caller's fsuid according to @mnt_users.
1668 */
1669static inline void inode_fsuid_set(struct inode *inode,
1670 struct user_namespace *mnt_userns)
1671{
1756 inode->i_uid = mapped_fsuid(mnt_userns);
1672 inode->i_uid = mapped_fsuid(mnt_userns, i_user_ns(inode));
1757}
1758
1759/**
1760 * inode_fsgid_set - initialize inode's i_gid field with callers fsgid
1761 * @inode: inode to initialize
1762 * @mnt_userns: user namespace of the mount the inode was found from
1763 *
1764 * Initialize the i_gid field of @inode. If the inode was found/created via
1765 * an idmapped mount map the caller's fsgid according to @mnt_users.
1766 */
1767static inline void inode_fsgid_set(struct inode *inode,
1768 struct user_namespace *mnt_userns)
1769{
1673}
1674
1675/**
1676 * inode_fsgid_set - initialize inode's i_gid field with callers fsgid
1677 * @inode: inode to initialize
1678 * @mnt_userns: user namespace of the mount the inode was found from
1679 *
1680 * Initialize the i_gid field of @inode. If the inode was found/created via
1681 * an idmapped mount map the caller's fsgid according to @mnt_users.
1682 */
1683static inline void inode_fsgid_set(struct inode *inode,
1684 struct user_namespace *mnt_userns)
1685{
1770 inode->i_gid = mapped_fsgid(mnt_userns);
1686 inode->i_gid = mapped_fsgid(mnt_userns, i_user_ns(inode));
1771}
1772
1773/**
1774 * fsuidgid_has_mapping() - check whether caller's fsuid/fsgid is mapped
1775 * @sb: the superblock we want a mapping in
1776 * @mnt_userns: user namespace of the relevant mount
1777 *
1778 * Check whether the caller's fsuid and fsgid have a valid mapping in the
1779 * s_user_ns of the superblock @sb. If the caller is on an idmapped mount map
1780 * the caller's fsuid and fsgid according to the @mnt_userns first.
1781 *
1782 * Return: true if fsuid and fsgid is mapped, false if not.
1783 */
1784static inline bool fsuidgid_has_mapping(struct super_block *sb,
1785 struct user_namespace *mnt_userns)
1786{
1687}
1688
1689/**
1690 * fsuidgid_has_mapping() - check whether caller's fsuid/fsgid is mapped
1691 * @sb: the superblock we want a mapping in
1692 * @mnt_userns: user namespace of the relevant mount
1693 *
1694 * Check whether the caller's fsuid and fsgid have a valid mapping in the
1695 * s_user_ns of the superblock @sb. If the caller is on an idmapped mount map
1696 * the caller's fsuid and fsgid according to the @mnt_userns first.
1697 *
1698 * Return: true if fsuid and fsgid is mapped, false if not.
1699 */
1700static inline bool fsuidgid_has_mapping(struct super_block *sb,
1701 struct user_namespace *mnt_userns)
1702{
1787 struct user_namespace *s_user_ns = sb->s_user_ns;
1703 struct user_namespace *fs_userns = sb->s_user_ns;
1704 kuid_t kuid;
1705 kgid_t kgid;
1788
1706
1789 return kuid_has_mapping(s_user_ns, mapped_fsuid(mnt_userns)) &&
1790 kgid_has_mapping(s_user_ns, mapped_fsgid(mnt_userns));
1707 kuid = mapped_fsuid(mnt_userns, fs_userns);
1708 if (!uid_valid(kuid))
1709 return false;
1710 kgid = mapped_fsgid(mnt_userns, fs_userns);
1711 if (!gid_valid(kgid))
1712 return false;
1713 return kuid_has_mapping(fs_userns, kuid) &&
1714 kgid_has_mapping(fs_userns, kgid);
1791}
1792
1793extern struct timespec64 current_time(struct inode *inode);
1794
1795/*
1796 * Snapshotting support.
1797 */
1798

--- 445 unchanged lines hidden (view full) ---

2244#ifdef CONFIG_FS_DAX
2245#define S_DAX (1 << 13) /* Direct Access, avoiding the page cache */
2246#else
2247#define S_DAX 0 /* Make all the DAX code disappear */
2248#endif
2249#define S_ENCRYPTED (1 << 14) /* Encrypted file (using fs/crypto/) */
2250#define S_CASEFOLD (1 << 15) /* Casefolded file */
2251#define S_VERITY (1 << 16) /* Verity file (using fs/verity/) */
1715}
1716
1717extern struct timespec64 current_time(struct inode *inode);
1718
1719/*
1720 * Snapshotting support.
1721 */
1722

--- 445 unchanged lines hidden (view full) ---

2168#ifdef CONFIG_FS_DAX
2169#define S_DAX (1 << 13) /* Direct Access, avoiding the page cache */
2170#else
2171#define S_DAX 0 /* Make all the DAX code disappear */
2172#endif
2173#define S_ENCRYPTED (1 << 14) /* Encrypted file (using fs/crypto/) */
2174#define S_CASEFOLD (1 << 15) /* Casefolded file */
2175#define S_VERITY (1 << 16) /* Verity file (using fs/verity/) */
2176#define S_KERNEL_FILE (1 << 17) /* File is in use by the kernel (eg. fs/cachefiles) */
2252
2253/*
2254 * Note that nosuid etc flags are inode-specific: setting some file-system
2255 * flags just means all the inodes inherit those flags by default. It might be
2256 * possible to override it selectively if you really wanted to with some
2257 * ioctl() that is not currently implemented.
2258 *
2259 * Exception: SB_RDONLY is always applied to the entire file system.

--- 153 unchanged lines hidden (view full) ---

2413 * I_CREATING New object's inode in the middle of setting up.
2414 *
2415 * I_DONTCACHE Evict inode as soon as it is not used anymore.
2416 *
2417 * I_SYNC_QUEUED Inode is queued in b_io or b_more_io writeback lists.
2418 * Used to detect that mark_inode_dirty() should not move
2419 * inode between dirty lists.
2420 *
2177
2178/*
2179 * Note that nosuid etc flags are inode-specific: setting some file-system
2180 * flags just means all the inodes inherit those flags by default. It might be
2181 * possible to override it selectively if you really wanted to with some
2182 * ioctl() that is not currently implemented.
2183 *
2184 * Exception: SB_RDONLY is always applied to the entire file system.

--- 153 unchanged lines hidden (view full) ---

2338 * I_CREATING New object's inode in the middle of setting up.
2339 *
2340 * I_DONTCACHE Evict inode as soon as it is not used anymore.
2341 *
2342 * I_SYNC_QUEUED Inode is queued in b_io or b_more_io writeback lists.
2343 * Used to detect that mark_inode_dirty() should not move
2344 * inode between dirty lists.
2345 *
2346 * I_PINNING_FSCACHE_WB Inode is pinning an fscache object for writeback.
2347 *
2421 * Q: What is the difference between I_WILL_FREE and I_FREEING?
2422 */
2423#define I_DIRTY_SYNC (1 << 0)
2424#define I_DIRTY_DATASYNC (1 << 1)
2425#define I_DIRTY_PAGES (1 << 2)
2426#define __I_NEW 3
2427#define I_NEW (1 << __I_NEW)
2428#define I_WILL_FREE (1 << 4)

--- 6 unchanged lines hidden (view full) ---

2435#define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP)
2436#define I_LINKABLE (1 << 10)
2437#define I_DIRTY_TIME (1 << 11)
2438#define I_WB_SWITCH (1 << 13)
2439#define I_OVL_INUSE (1 << 14)
2440#define I_CREATING (1 << 15)
2441#define I_DONTCACHE (1 << 16)
2442#define I_SYNC_QUEUED (1 << 17)
2348 * Q: What is the difference between I_WILL_FREE and I_FREEING?
2349 */
2350#define I_DIRTY_SYNC (1 << 0)
2351#define I_DIRTY_DATASYNC (1 << 1)
2352#define I_DIRTY_PAGES (1 << 2)
2353#define __I_NEW 3
2354#define I_NEW (1 << __I_NEW)
2355#define I_WILL_FREE (1 << 4)

--- 6 unchanged lines hidden (view full) ---

2362#define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP)
2363#define I_LINKABLE (1 << 10)
2364#define I_DIRTY_TIME (1 << 11)
2365#define I_WB_SWITCH (1 << 13)
2366#define I_OVL_INUSE (1 << 14)
2367#define I_CREATING (1 << 15)
2368#define I_DONTCACHE (1 << 16)
2369#define I_SYNC_QUEUED (1 << 17)
2370#define I_PINNING_FSCACHE_WB (1 << 18)
2443
2444#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
2445#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
2446#define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME)
2447
2448extern void __mark_inode_dirty(struct inode *, int);
2449static inline void mark_inode_dirty(struct inode *inode)
2450{

--- 268 unchanged lines hidden (view full) ---

2719 const char iname[];
2720};
2721static_assert(offsetof(struct filename, iname) % sizeof(long) == 0);
2722
2723static inline struct user_namespace *file_mnt_user_ns(struct file *file)
2724{
2725 return mnt_user_ns(file->f_path.mnt);
2726}
2371
2372#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
2373#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
2374#define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME)
2375
2376extern void __mark_inode_dirty(struct inode *, int);
2377static inline void mark_inode_dirty(struct inode *inode)
2378{

--- 268 unchanged lines hidden (view full) ---

2647 const char iname[];
2648};
2649static_assert(offsetof(struct filename, iname) % sizeof(long) == 0);
2650
2651static inline struct user_namespace *file_mnt_user_ns(struct file *file)
2652{
2653 return mnt_user_ns(file->f_path.mnt);
2654}
2655
2656/**
2657 * is_idmapped_mnt - check whether a mount is mapped
2658 * @mnt: the mount to check
2659 *
2660 * If @mnt has an idmapping attached different from the
2661 * filesystem's idmapping then @mnt is mapped.
2662 *
2663 * Return: true if mount is mapped, false if not.
2664 */
2665static inline bool is_idmapped_mnt(const struct vfsmount *mnt)
2666{
2667 return mnt_user_ns(mnt) != mnt->mnt_sb->s_user_ns;
2668}
2669
2727extern long vfs_truncate(const struct path *, loff_t);
2728int do_truncate(struct user_namespace *, struct dentry *, loff_t start,
2729 unsigned int time_attrs, struct file *filp);
2730extern int vfs_fallocate(struct file *file, int mode, loff_t offset,
2731 loff_t len);
2732extern long do_sys_open(int dfd, const char __user *filename, int flags,
2733 umode_t mode);
2734extern struct file *file_open_name(struct filename *, int, umode_t);

--- 107 unchanged lines hidden (view full) ---

2842
2843static inline int filemap_fdatawait(struct address_space *mapping)
2844{
2845 return filemap_fdatawait_range(mapping, 0, LLONG_MAX);
2846}
2847
2848extern bool filemap_range_has_page(struct address_space *, loff_t lstart,
2849 loff_t lend);
2670extern long vfs_truncate(const struct path *, loff_t);
2671int do_truncate(struct user_namespace *, struct dentry *, loff_t start,
2672 unsigned int time_attrs, struct file *filp);
2673extern int vfs_fallocate(struct file *file, int mode, loff_t offset,
2674 loff_t len);
2675extern long do_sys_open(int dfd, const char __user *filename, int flags,
2676 umode_t mode);
2677extern struct file *file_open_name(struct filename *, int, umode_t);

--- 107 unchanged lines hidden (view full) ---

2785
2786static inline int filemap_fdatawait(struct address_space *mapping)
2787{
2788 return filemap_fdatawait_range(mapping, 0, LLONG_MAX);
2789}
2790
2791extern bool filemap_range_has_page(struct address_space *, loff_t lstart,
2792 loff_t lend);
2850extern bool filemap_range_needs_writeback(struct address_space *,
2851 loff_t lstart, loff_t lend);
2852extern int filemap_write_and_wait_range(struct address_space *mapping,
2853 loff_t lstart, loff_t lend);
2854extern int __filemap_fdatawrite_range(struct address_space *mapping,
2855 loff_t start, loff_t end, int sync_mode);
2856extern int filemap_fdatawrite_range(struct address_space *mapping,
2857 loff_t start, loff_t end);
2858extern int filemap_check_errors(struct address_space *mapping);
2859extern void __filemap_set_wb_err(struct address_space *mapping, int err);

--- 287 unchanged lines hidden (view full) ---

3147extern void lockdep_annotate_inode_mutex_key(struct inode *inode);
3148#else
3149static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { };
3150#endif
3151extern void unlock_new_inode(struct inode *);
3152extern void discard_new_inode(struct inode *);
3153extern unsigned int get_next_ino(void);
3154extern void evict_inodes(struct super_block *sb);
2793extern int filemap_write_and_wait_range(struct address_space *mapping,
2794 loff_t lstart, loff_t lend);
2795extern int __filemap_fdatawrite_range(struct address_space *mapping,
2796 loff_t start, loff_t end, int sync_mode);
2797extern int filemap_fdatawrite_range(struct address_space *mapping,
2798 loff_t start, loff_t end);
2799extern int filemap_check_errors(struct address_space *mapping);
2800extern void __filemap_set_wb_err(struct address_space *mapping, int err);

--- 287 unchanged lines hidden (view full) ---

3088extern void lockdep_annotate_inode_mutex_key(struct inode *inode);
3089#else
3090static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { };
3091#endif
3092extern void unlock_new_inode(struct inode *);
3093extern void discard_new_inode(struct inode *);
3094extern unsigned int get_next_ino(void);
3095extern void evict_inodes(struct super_block *sb);
3096void dump_mapping(const struct address_space *);
3155
3156/*
3157 * Userspace may rely on the the inode number being non-zero. For example, glibc
3158 * simply ignores files with zero i_ino in unlink() and other places.
3159 *
3160 * As an additional complication, if userspace was compiled with
3161 * _FILE_OFFSET_BITS=32 on a 64-bit kernel we'll only end up reading out the
3162 * lower 32 bits, so we need to check that those aren't zero explicitly. With

--- 536 unchanged lines hidden ---
3097
3098/*
3099 * Userspace may rely on the the inode number being non-zero. For example, glibc
3100 * simply ignores files with zero i_ino in unlink() and other places.
3101 *
3102 * As an additional complication, if userspace was compiled with
3103 * _FILE_OFFSET_BITS=32 on a 64-bit kernel we'll only end up reading out the
3104 * lower 32 bits, so we need to check that those aren't zero explicitly. With

--- 536 unchanged lines hidden ---