aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2011-03-28 06:47:38 -0400
committerMatthew Garrett <mjg@redhat.com>2011-03-28 06:47:38 -0400
commit72ed73c3f0801e860ee27e53ab6aaf47941ba324 (patch)
treeb46c546d77ee8931d47dafc97bf23b11472bffeb /include/linux/fs.h
parent883ae7992c09435927dda642b61f1455fceb5b85 (diff)
parentbd1573a5546b4351b5d042f1e4cd631ea67cc6b0 (diff)
Merge branch 'x86-platform-next' into x86-platform
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h101
1 files changed, 56 insertions, 45 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e38b50a4b9d2..b677bd77f2d6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -102,6 +102,9 @@ struct inodes_stat_t {
102/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ 102/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */
103#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) 103#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000)
104 104
105/* File is opened with O_PATH; almost nothing can be done with it */
106#define FMODE_PATH ((__force fmode_t)0x4000)
107
105/* File was opened by fanotify and shouldn't generate fanotify events */ 108/* File was opened by fanotify and shouldn't generate fanotify events */
106#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 109#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
107 110
@@ -135,16 +138,10 @@ struct inodes_stat_t {
135 * block layer could (in theory) choose to ignore this 138 * block layer could (in theory) choose to ignore this
136 * request if it runs into resource problems. 139 * request if it runs into resource problems.
137 * WRITE A normal async write. Device will be plugged. 140 * WRITE A normal async write. Device will be plugged.
138 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down 141 * WRITE_SYNC Synchronous write. Identical to WRITE, but passes down
139 * the hint that someone will be waiting on this IO 142 * the hint that someone will be waiting on this IO
140 * shortly. The device must still be unplugged explicitly, 143 * shortly. The write equivalent of READ_SYNC.
141 * WRITE_SYNC_PLUG does not do this as we could be 144 * WRITE_ODIRECT Special case write for O_DIRECT only.
142 * submitting more writes before we actually wait on any
143 * of them.
144 * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device
145 * immediately after submission. The write equivalent
146 * of READ_SYNC.
147 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only.
148 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush. 145 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush.
149 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on 146 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on
150 * non-volatile media on completion. 147 * non-volatile media on completion.
@@ -160,18 +157,14 @@ struct inodes_stat_t {
160#define WRITE RW_MASK 157#define WRITE RW_MASK
161#define READA RWA_MASK 158#define READA RWA_MASK
162 159
163#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) 160#define READ_SYNC (READ | REQ_SYNC)
164#define READ_META (READ | REQ_META) 161#define READ_META (READ | REQ_META)
165#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE) 162#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
166#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) 163#define WRITE_ODIRECT (WRITE | REQ_SYNC)
167#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
168#define WRITE_META (WRITE | REQ_META) 164#define WRITE_META (WRITE | REQ_META)
169#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 165#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
170 REQ_FLUSH) 166#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
171#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 167#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
172 REQ_FUA)
173#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
174 REQ_FLUSH | REQ_FUA)
175 168
176#define SEL_IN 1 169#define SEL_IN 1
177#define SEL_OUT 2 170#define SEL_OUT 2
@@ -583,7 +576,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
583struct address_space_operations { 576struct address_space_operations {
584 int (*writepage)(struct page *page, struct writeback_control *wbc); 577 int (*writepage)(struct page *page, struct writeback_control *wbc);
585 int (*readpage)(struct file *, struct page *); 578 int (*readpage)(struct file *, struct page *);
586 void (*sync_page)(struct page *);
587 579
588 /* Write back some dirty pages from this mapping. */ 580 /* Write back some dirty pages from this mapping. */
589 int (*writepages)(struct address_space *, struct writeback_control *); 581 int (*writepages)(struct address_space *, struct writeback_control *);
@@ -659,9 +651,9 @@ struct address_space {
659 651
660struct block_device { 652struct block_device {
661 dev_t bd_dev; /* not a kdev_t - it's a search key */ 653 dev_t bd_dev; /* not a kdev_t - it's a search key */
654 int bd_openers;
662 struct inode * bd_inode; /* will die */ 655 struct inode * bd_inode; /* will die */
663 struct super_block * bd_super; 656 struct super_block * bd_super;
664 int bd_openers;
665 struct mutex bd_mutex; /* open/close mutex */ 657 struct mutex bd_mutex; /* open/close mutex */
666 struct list_head bd_inodes; 658 struct list_head bd_inodes;
667 void * bd_claiming; 659 void * bd_claiming;
@@ -798,8 +790,7 @@ struct inode {
798#endif 790#endif
799 791
800#ifdef CONFIG_IMA 792#ifdef CONFIG_IMA
801 /* protected by i_lock */ 793 atomic_t i_readcount; /* struct files open RO */
802 unsigned int i_readcount; /* struct files open RO */
803#endif 794#endif
804 atomic_t i_writecount; 795 atomic_t i_writecount;
805#ifdef CONFIG_SECURITY 796#ifdef CONFIG_SECURITY
@@ -978,6 +969,13 @@ struct file {
978#endif 969#endif
979}; 970};
980 971
972struct file_handle {
973 __u32 handle_bytes;
974 int handle_type;
975 /* file identifier */
976 unsigned char f_handle[0];
977};
978
981#define get_file(x) atomic_long_inc(&(x)->f_count) 979#define get_file(x) atomic_long_inc(&(x)->f_count)
982#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 980#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
983#define file_count(x) atomic_long_read(&(x)->f_count) 981#define file_count(x) atomic_long_read(&(x)->f_count)
@@ -1401,6 +1399,7 @@ struct super_block {
1401 wait_queue_head_t s_wait_unfrozen; 1399 wait_queue_head_t s_wait_unfrozen;
1402 1400
1403 char s_id[32]; /* Informational name */ 1401 char s_id[32]; /* Informational name */
1402 u8 s_uuid[16]; /* UUID */
1404 1403
1405 void *s_fs_info; /* Filesystem private info */ 1404 void *s_fs_info; /* Filesystem private info */
1406 fmode_t s_mode; 1405 fmode_t s_mode;
@@ -1447,8 +1446,13 @@ enum {
1447#define put_fs_excl() atomic_dec(&current->fs_excl) 1446#define put_fs_excl() atomic_dec(&current->fs_excl)
1448#define has_fs_excl() atomic_read(&current->fs_excl) 1447#define has_fs_excl() atomic_read(&current->fs_excl)
1449 1448
1450#define is_owner_or_cap(inode) \ 1449/*
1451 ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER)) 1450 * until VFS tracks user namespaces for inodes, just make all files
1451 * belong to init_user_ns
1452 */
1453extern struct user_namespace init_user_ns;
1454#define inode_userns(inode) (&init_user_ns)
1455extern bool inode_owner_or_capable(const struct inode *inode);
1452 1456
1453/* not quite ready to be deprecated, but... */ 1457/* not quite ready to be deprecated, but... */
1454extern void lock_super(struct super_block *); 1458extern void lock_super(struct super_block *);
@@ -1621,6 +1625,8 @@ struct super_operations {
1621 void (*umount_begin) (struct super_block *); 1625 void (*umount_begin) (struct super_block *);
1622 1626
1623 int (*show_options)(struct seq_file *, struct vfsmount *); 1627 int (*show_options)(struct seq_file *, struct vfsmount *);
1628 int (*show_devname)(struct seq_file *, struct vfsmount *);
1629 int (*show_path)(struct seq_file *, struct vfsmount *);
1624 int (*show_stats)(struct seq_file *, struct vfsmount *); 1630 int (*show_stats)(struct seq_file *, struct vfsmount *);
1625#ifdef CONFIG_QUOTA 1631#ifdef CONFIG_QUOTA
1626 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1632 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
@@ -1630,7 +1636,7 @@ struct super_operations {
1630}; 1636};
1631 1637
1632/* 1638/*
1633 * Inode state bits. Protected by inode_lock. 1639 * Inode state bits. Protected by inode->i_lock
1634 * 1640 *
1635 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, 1641 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
1636 * I_DIRTY_DATASYNC and I_DIRTY_PAGES. 1642 * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
@@ -1784,8 +1790,6 @@ int sync_inode_metadata(struct inode *inode, int wait);
1784struct file_system_type { 1790struct file_system_type {
1785 const char *name; 1791 const char *name;
1786 int fs_flags; 1792 int fs_flags;
1787 int (*get_sb) (struct file_system_type *, int,
1788 const char *, void *, struct vfsmount *);
1789 struct dentry *(*mount) (struct file_system_type *, int, 1793 struct dentry *(*mount) (struct file_system_type *, int,
1790 const char *, void *); 1794 const char *, void *);
1791 void (*kill_sb) (struct super_block *); 1795 void (*kill_sb) (struct super_block *);
@@ -1808,24 +1812,12 @@ extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
1808extern struct dentry *mount_bdev(struct file_system_type *fs_type, 1812extern struct dentry *mount_bdev(struct file_system_type *fs_type,
1809 int flags, const char *dev_name, void *data, 1813 int flags, const char *dev_name, void *data,
1810 int (*fill_super)(struct super_block *, void *, int)); 1814 int (*fill_super)(struct super_block *, void *, int));
1811extern int get_sb_bdev(struct file_system_type *fs_type,
1812 int flags, const char *dev_name, void *data,
1813 int (*fill_super)(struct super_block *, void *, int),
1814 struct vfsmount *mnt);
1815extern struct dentry *mount_single(struct file_system_type *fs_type, 1815extern struct dentry *mount_single(struct file_system_type *fs_type,
1816 int flags, void *data, 1816 int flags, void *data,
1817 int (*fill_super)(struct super_block *, void *, int)); 1817 int (*fill_super)(struct super_block *, void *, int));
1818extern int get_sb_single(struct file_system_type *fs_type,
1819 int flags, void *data,
1820 int (*fill_super)(struct super_block *, void *, int),
1821 struct vfsmount *mnt);
1822extern struct dentry *mount_nodev(struct file_system_type *fs_type, 1818extern struct dentry *mount_nodev(struct file_system_type *fs_type,
1823 int flags, void *data, 1819 int flags, void *data,
1824 int (*fill_super)(struct super_block *, void *, int)); 1820 int (*fill_super)(struct super_block *, void *, int));
1825extern int get_sb_nodev(struct file_system_type *fs_type,
1826 int flags, void *data,
1827 int (*fill_super)(struct super_block *, void *, int),
1828 struct vfsmount *mnt);
1829void generic_shutdown_super(struct super_block *sb); 1821void generic_shutdown_super(struct super_block *sb);
1830void kill_block_super(struct super_block *sb); 1822void kill_block_super(struct super_block *sb);
1831void kill_anon_super(struct super_block *sb); 1823void kill_anon_super(struct super_block *sb);
@@ -1841,7 +1833,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1841 const struct super_operations *ops, 1833 const struct super_operations *ops,
1842 const struct dentry_operations *dops, 1834 const struct dentry_operations *dops,
1843 unsigned long); 1835 unsigned long);
1844extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1845 1836
1846static inline void sb_mark_dirty(struct super_block *sb) 1837static inline void sb_mark_dirty(struct super_block *sb)
1847{ 1838{
@@ -1874,6 +1865,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1874extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1865extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1875 struct vfsmount *); 1866 struct vfsmount *);
1876extern int vfs_statfs(struct path *, struct kstatfs *); 1867extern int vfs_statfs(struct path *, struct kstatfs *);
1868extern int user_statfs(const char __user *, struct kstatfs *);
1869extern int fd_statfs(int, struct kstatfs *);
1877extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1870extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1878extern int freeze_super(struct super_block *super); 1871extern int freeze_super(struct super_block *super);
1879extern int thaw_super(struct super_block *super); 1872extern int thaw_super(struct super_block *super);
@@ -1990,6 +1983,8 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset,
1990extern long do_sys_open(int dfd, const char __user *filename, int flags, 1983extern long do_sys_open(int dfd, const char __user *filename, int flags,
1991 int mode); 1984 int mode);
1992extern struct file *filp_open(const char *, int, int); 1985extern struct file *filp_open(const char *, int, int);
1986extern struct file *file_open_root(struct dentry *, struct vfsmount *,
1987 const char *, int);
1993extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 1988extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
1994 const struct cred *); 1989 const struct cred *);
1995extern int filp_close(struct file *, fl_owner_t id); 1990extern int filp_close(struct file *, fl_owner_t id);
@@ -2200,15 +2195,31 @@ static inline void allow_write_access(struct file *file)
2200 if (file) 2195 if (file)
2201 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2196 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
2202} 2197}
2198#ifdef CONFIG_IMA
2199static inline void i_readcount_dec(struct inode *inode)
2200{
2201 BUG_ON(!atomic_read(&inode->i_readcount));
2202 atomic_dec(&inode->i_readcount);
2203}
2204static inline void i_readcount_inc(struct inode *inode)
2205{
2206 atomic_inc(&inode->i_readcount);
2207}
2208#else
2209static inline void i_readcount_dec(struct inode *inode)
2210{
2211 return;
2212}
2213static inline void i_readcount_inc(struct inode *inode)
2214{
2215 return;
2216}
2217#endif
2203extern int do_pipe_flags(int *, int); 2218extern int do_pipe_flags(int *, int);
2204extern struct file *create_read_pipe(struct file *f, int flags); 2219extern struct file *create_read_pipe(struct file *f, int flags);
2205extern struct file *create_write_pipe(int flags); 2220extern struct file *create_write_pipe(int flags);
2206extern void free_write_pipe(struct file *); 2221extern void free_write_pipe(struct file *);
2207 2222
2208extern struct file *do_filp_open(int dfd, const char *pathname,
2209 int open_flag, int mode, int acc_mode);
2210extern int may_open(struct path *, int, int);
2211
2212extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2223extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2213extern struct file * open_exec(const char *); 2224extern struct file * open_exec(const char *);
2214 2225