aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h46
1 files changed, 39 insertions, 7 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bd3215940c37..2f5a71d6d766 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
@@ -649,6 +652,7 @@ struct address_space {
649 spinlock_t private_lock; /* for use by the address_space */ 652 spinlock_t private_lock; /* for use by the address_space */
650 struct list_head private_list; /* ditto */ 653 struct list_head private_list; /* ditto */
651 struct address_space *assoc_mapping; /* ditto */ 654 struct address_space *assoc_mapping; /* ditto */
655 struct mutex unmap_mutex; /* to protect unmapping */
652} __attribute__((aligned(sizeof(long)))); 656} __attribute__((aligned(sizeof(long))));
653 /* 657 /*
654 * On most architectures that alignment is already the case; but 658 * On most architectures that alignment is already the case; but
@@ -797,8 +801,7 @@ struct inode {
797#endif 801#endif
798 802
799#ifdef CONFIG_IMA 803#ifdef CONFIG_IMA
800 /* protected by i_lock */ 804 atomic_t i_readcount; /* struct files open RO */
801 unsigned int i_readcount; /* struct files open RO */
802#endif 805#endif
803 atomic_t i_writecount; 806 atomic_t i_writecount;
804#ifdef CONFIG_SECURITY 807#ifdef CONFIG_SECURITY
@@ -977,6 +980,13 @@ struct file {
977#endif 980#endif
978}; 981};
979 982
983struct file_handle {
984 __u32 handle_bytes;
985 int handle_type;
986 /* file identifier */
987 unsigned char f_handle[0];
988};
989
980#define get_file(x) atomic_long_inc(&(x)->f_count) 990#define get_file(x) atomic_long_inc(&(x)->f_count)
981#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 991#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
982#define file_count(x) atomic_long_read(&(x)->f_count) 992#define file_count(x) atomic_long_read(&(x)->f_count)
@@ -1400,6 +1410,7 @@ struct super_block {
1400 wait_queue_head_t s_wait_unfrozen; 1410 wait_queue_head_t s_wait_unfrozen;
1401 1411
1402 char s_id[32]; /* Informational name */ 1412 char s_id[32]; /* Informational name */
1413 u8 s_uuid[16]; /* UUID */
1403 1414
1404 void *s_fs_info; /* Filesystem private info */ 1415 void *s_fs_info; /* Filesystem private info */
1405 fmode_t s_mode; 1416 fmode_t s_mode;
@@ -1873,6 +1884,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1873extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1884extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1874 struct vfsmount *); 1885 struct vfsmount *);
1875extern int vfs_statfs(struct path *, struct kstatfs *); 1886extern int vfs_statfs(struct path *, struct kstatfs *);
1887extern int user_statfs(const char __user *, struct kstatfs *);
1888extern int fd_statfs(int, struct kstatfs *);
1876extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1889extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1877extern int freeze_super(struct super_block *super); 1890extern int freeze_super(struct super_block *super);
1878extern int thaw_super(struct super_block *super); 1891extern int thaw_super(struct super_block *super);
@@ -1989,6 +2002,8 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset,
1989extern long do_sys_open(int dfd, const char __user *filename, int flags, 2002extern long do_sys_open(int dfd, const char __user *filename, int flags,
1990 int mode); 2003 int mode);
1991extern struct file *filp_open(const char *, int, int); 2004extern struct file *filp_open(const char *, int, int);
2005extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2006 const char *, int);
1992extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 2007extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
1993 const struct cred *); 2008 const struct cred *);
1994extern int filp_close(struct file *, fl_owner_t id); 2009extern int filp_close(struct file *, fl_owner_t id);
@@ -2139,7 +2154,7 @@ extern void check_disk_size_change(struct gendisk *disk,
2139 struct block_device *bdev); 2154 struct block_device *bdev);
2140extern int revalidate_disk(struct gendisk *); 2155extern int revalidate_disk(struct gendisk *);
2141extern int check_disk_change(struct block_device *); 2156extern int check_disk_change(struct block_device *);
2142extern int __invalidate_device(struct block_device *); 2157extern int __invalidate_device(struct block_device *, bool);
2143extern int invalidate_partition(struct gendisk *, int); 2158extern int invalidate_partition(struct gendisk *, int);
2144#endif 2159#endif
2145unsigned long invalidate_mapping_pages(struct address_space *mapping, 2160unsigned long invalidate_mapping_pages(struct address_space *mapping,
@@ -2199,15 +2214,31 @@ static inline void allow_write_access(struct file *file)
2199 if (file) 2214 if (file)
2200 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2215 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
2201} 2216}
2217#ifdef CONFIG_IMA
2218static inline void i_readcount_dec(struct inode *inode)
2219{
2220 BUG_ON(!atomic_read(&inode->i_readcount));
2221 atomic_dec(&inode->i_readcount);
2222}
2223static inline void i_readcount_inc(struct inode *inode)
2224{
2225 atomic_inc(&inode->i_readcount);
2226}
2227#else
2228static inline void i_readcount_dec(struct inode *inode)
2229{
2230 return;
2231}
2232static inline void i_readcount_inc(struct inode *inode)
2233{
2234 return;
2235}
2236#endif
2202extern int do_pipe_flags(int *, int); 2237extern int do_pipe_flags(int *, int);
2203extern struct file *create_read_pipe(struct file *f, int flags); 2238extern struct file *create_read_pipe(struct file *f, int flags);
2204extern struct file *create_write_pipe(int flags); 2239extern struct file *create_write_pipe(int flags);
2205extern void free_write_pipe(struct file *); 2240extern void free_write_pipe(struct file *);
2206 2241
2207extern struct file *do_filp_open(int dfd, const char *pathname,
2208 int open_flag, int mode, int acc_mode);
2209extern int may_open(struct path *, int, int);
2210
2211extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2242extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2212extern struct file * open_exec(const char *); 2243extern struct file * open_exec(const char *);
2213 2244
@@ -2225,6 +2256,7 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
2225 2256
2226extern int inode_init_always(struct super_block *, struct inode *); 2257extern int inode_init_always(struct super_block *, struct inode *);
2227extern void inode_init_once(struct inode *); 2258extern void inode_init_once(struct inode *);
2259extern void address_space_init_once(struct address_space *mapping);
2228extern void ihold(struct inode * inode); 2260extern void ihold(struct inode * inode);
2229extern void iput(struct inode *); 2261extern void iput(struct inode *);
2230extern struct inode * igrab(struct inode *); 2262extern struct inode * igrab(struct inode *);