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.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 09f553c59813..23b2a35d712e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -123,6 +123,9 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
123/* File is opened with O_PATH; almost nothing can be done with it */ 123/* File is opened with O_PATH; almost nothing can be done with it */
124#define FMODE_PATH ((__force fmode_t)0x4000) 124#define FMODE_PATH ((__force fmode_t)0x4000)
125 125
126/* File needs atomic accesses to f_pos */
127#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000)
128
126/* File was opened by fanotify and shouldn't generate fanotify events */ 129/* File was opened by fanotify and shouldn't generate fanotify events */
127#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 130#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
128 131
@@ -780,13 +783,14 @@ struct file {
780 const struct file_operations *f_op; 783 const struct file_operations *f_op;
781 784
782 /* 785 /*
783 * Protects f_ep_links, f_flags, f_pos vs i_size in lseek SEEK_CUR. 786 * Protects f_ep_links, f_flags.
784 * Must not be taken from IRQ context. 787 * Must not be taken from IRQ context.
785 */ 788 */
786 spinlock_t f_lock; 789 spinlock_t f_lock;
787 atomic_long_t f_count; 790 atomic_long_t f_count;
788 unsigned int f_flags; 791 unsigned int f_flags;
789 fmode_t f_mode; 792 fmode_t f_mode;
793 struct mutex f_pos_lock;
790 loff_t f_pos; 794 loff_t f_pos;
791 struct fown_struct f_owner; 795 struct fown_struct f_owner;
792 const struct cred *f_cred; 796 const struct cred *f_cred;
@@ -808,7 +812,7 @@ struct file {
808#ifdef CONFIG_DEBUG_WRITECOUNT 812#ifdef CONFIG_DEBUG_WRITECOUNT
809 unsigned long f_mnt_write_state; 813 unsigned long f_mnt_write_state;
810#endif 814#endif
811}; 815} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
812 816
813struct file_handle { 817struct file_handle {
814 __u32 handle_bytes; 818 __u32 handle_bytes;
@@ -2079,6 +2083,7 @@ extern struct file * dentry_open(const struct path *, int, const struct cred *);
2079extern int filp_close(struct file *, fl_owner_t id); 2083extern int filp_close(struct file *, fl_owner_t id);
2080 2084
2081extern struct filename *getname(const char __user *); 2085extern struct filename *getname(const char __user *);
2086extern struct filename *getname_kernel(const char *);
2082 2087
2083enum { 2088enum {
2084 FILE_CREATED = 1, 2089 FILE_CREATED = 1,
@@ -2273,7 +2278,13 @@ extern int filemap_fdatawrite_range(struct address_space *mapping,
2273extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end, 2278extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
2274 int datasync); 2279 int datasync);
2275extern int vfs_fsync(struct file *file, int datasync); 2280extern int vfs_fsync(struct file *file, int datasync);
2276extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); 2281static inline int generic_write_sync(struct file *file, loff_t pos, loff_t count)
2282{
2283 if (!(file->f_flags & O_DSYNC) && !IS_SYNC(file->f_mapping->host))
2284 return 0;
2285 return vfs_fsync_range(file, pos, pos + count - 1,
2286 (file->f_flags & __O_SYNC) ? 0 : 1);
2287}
2277extern void emergency_sync(void); 2288extern void emergency_sync(void);
2278extern void emergency_remount(void); 2289extern void emergency_remount(void);
2279#ifdef CONFIG_BLOCK 2290#ifdef CONFIG_BLOCK