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.h229
1 files changed, 163 insertions, 66 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d490779f18d..a6a625be13f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -60,6 +60,8 @@ extern int dir_notify_enable;
60#define MAY_WRITE 2 60#define MAY_WRITE 2
61#define MAY_READ 4 61#define MAY_READ 4
62#define MAY_APPEND 8 62#define MAY_APPEND 8
63#define MAY_ACCESS 16
64#define MAY_OPEN 32
63 65
64#define FMODE_READ 1 66#define FMODE_READ 1
65#define FMODE_WRITE 2 67#define FMODE_WRITE 2
@@ -83,7 +85,10 @@ extern int dir_notify_enable;
83#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 85#define READ_SYNC (READ | (1 << BIO_RW_SYNC))
84#define READ_META (READ | (1 << BIO_RW_META)) 86#define READ_META (READ | (1 << BIO_RW_META))
85#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 87#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
86#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) 88#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
89#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
90#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
91#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
87 92
88#define SEL_IN 1 93#define SEL_IN 1
89#define SEL_OUT 2 94#define SEL_OUT 2
@@ -219,6 +224,7 @@ extern int dir_notify_enable;
219#define BLKTRACESTART _IO(0x12,116) 224#define BLKTRACESTART _IO(0x12,116)
220#define BLKTRACESTOP _IO(0x12,117) 225#define BLKTRACESTOP _IO(0x12,117)
221#define BLKTRACETEARDOWN _IO(0x12,118) 226#define BLKTRACETEARDOWN _IO(0x12,118)
227#define BLKDISCARD _IO(0x12,119)
222 228
223#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 229#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
224#define FIBMAP _IO(0x00,1) /* bmap access */ 230#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -228,6 +234,7 @@ extern int dir_notify_enable;
228#define FS_IOC_SETFLAGS _IOW('f', 2, long) 234#define FS_IOC_SETFLAGS _IOW('f', 2, long)
229#define FS_IOC_GETVERSION _IOR('v', 1, long) 235#define FS_IOC_GETVERSION _IOR('v', 1, long)
230#define FS_IOC_SETVERSION _IOW('v', 2, long) 236#define FS_IOC_SETVERSION _IOW('v', 2, long)
237#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
231#define FS_IOC32_GETFLAGS _IOR('f', 1, int) 238#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
232#define FS_IOC32_SETFLAGS _IOW('f', 2, int) 239#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
233#define FS_IOC32_GETVERSION _IOR('v', 1, int) 240#define FS_IOC32_GETVERSION _IOR('v', 1, int)
@@ -276,7 +283,7 @@ extern int dir_notify_enable;
276#include <linux/types.h> 283#include <linux/types.h>
277#include <linux/kdev_t.h> 284#include <linux/kdev_t.h>
278#include <linux/dcache.h> 285#include <linux/dcache.h>
279#include <linux/namei.h> 286#include <linux/path.h>
280#include <linux/stat.h> 287#include <linux/stat.h>
281#include <linux/cache.h> 288#include <linux/cache.h>
282#include <linux/kobject.h> 289#include <linux/kobject.h>
@@ -288,6 +295,7 @@ extern int dir_notify_enable;
288#include <linux/mutex.h> 295#include <linux/mutex.h>
289#include <linux/capability.h> 296#include <linux/capability.h>
290#include <linux/semaphore.h> 297#include <linux/semaphore.h>
298#include <linux/fiemap.h>
291 299
292#include <asm/atomic.h> 300#include <asm/atomic.h>
293#include <asm/byteorder.h> 301#include <asm/byteorder.h>
@@ -317,22 +325,23 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
317 * Attribute flags. These should be or-ed together to figure out what 325 * Attribute flags. These should be or-ed together to figure out what
318 * has been changed! 326 * has been changed!
319 */ 327 */
320#define ATTR_MODE 1 328#define ATTR_MODE (1 << 0)
321#define ATTR_UID 2 329#define ATTR_UID (1 << 1)
322#define ATTR_GID 4 330#define ATTR_GID (1 << 2)
323#define ATTR_SIZE 8 331#define ATTR_SIZE (1 << 3)
324#define ATTR_ATIME 16 332#define ATTR_ATIME (1 << 4)
325#define ATTR_MTIME 32 333#define ATTR_MTIME (1 << 5)
326#define ATTR_CTIME 64 334#define ATTR_CTIME (1 << 6)
327#define ATTR_ATIME_SET 128 335#define ATTR_ATIME_SET (1 << 7)
328#define ATTR_MTIME_SET 256 336#define ATTR_MTIME_SET (1 << 8)
329#define ATTR_FORCE 512 /* Not a change, but a change it */ 337#define ATTR_FORCE (1 << 9) /* Not a change, but a change it */
330#define ATTR_ATTR_FLAG 1024 338#define ATTR_ATTR_FLAG (1 << 10)
331#define ATTR_KILL_SUID 2048 339#define ATTR_KILL_SUID (1 << 11)
332#define ATTR_KILL_SGID 4096 340#define ATTR_KILL_SGID (1 << 12)
333#define ATTR_FILE 8192 341#define ATTR_FILE (1 << 13)
334#define ATTR_KILL_PRIV 16384 342#define ATTR_KILL_PRIV (1 << 14)
335#define ATTR_OPEN 32768 /* Truncating from open(O_TRUNC) */ 343#define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
344#define ATTR_TIMES_SET (1 << 16)
336 345
337/* 346/*
338 * This is the Inode Attributes structure, used for notify_change(). It 347 * This is the Inode Attributes structure, used for notify_change(). It
@@ -439,6 +448,27 @@ static inline size_t iov_iter_count(struct iov_iter *i)
439 return i->count; 448 return i->count;
440} 449}
441 450
451/*
452 * "descriptor" for what we're up to with a read.
453 * This allows us to use the same read code yet
454 * have multiple different users of the data that
455 * we read from a file.
456 *
457 * The simplest case just copies the data to user
458 * mode.
459 */
460typedef struct {
461 size_t written;
462 size_t count;
463 union {
464 char __user *buf;
465 void *data;
466 } arg;
467 int error;
468} read_descriptor_t;
469
470typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
471 unsigned long, unsigned long);
442 472
443struct address_space_operations { 473struct address_space_operations {
444 int (*writepage)(struct page *page, struct writeback_control *wbc); 474 int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -480,6 +510,8 @@ struct address_space_operations {
480 int (*migratepage) (struct address_space *, 510 int (*migratepage) (struct address_space *,
481 struct page *, struct page *); 511 struct page *, struct page *);
482 int (*launder_page) (struct page *); 512 int (*launder_page) (struct page *);
513 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
514 unsigned long);
483}; 515};
484 516
485/* 517/*
@@ -498,7 +530,7 @@ struct backing_dev_info;
498struct address_space { 530struct address_space {
499 struct inode *host; /* owner: inode, block_device */ 531 struct inode *host; /* owner: inode, block_device */
500 struct radix_tree_root page_tree; /* radix tree of all pages */ 532 struct radix_tree_root page_tree; /* radix tree of all pages */
501 rwlock_t tree_lock; /* and rwlock protecting it */ 533 spinlock_t tree_lock; /* and lock protecting it */
502 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 534 unsigned int i_mmap_writable;/* count VM_SHARED mappings */
503 struct prio_tree_root i_mmap; /* tree of private and shared mappings */ 535 struct prio_tree_root i_mmap; /* tree of private and shared mappings */
504 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 536 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
@@ -791,7 +823,7 @@ struct file {
791#define f_dentry f_path.dentry 823#define f_dentry f_path.dentry
792#define f_vfsmnt f_path.mnt 824#define f_vfsmnt f_path.mnt
793 const struct file_operations *f_op; 825 const struct file_operations *f_op;
794 atomic_t f_count; 826 atomic_long_t f_count;
795 unsigned int f_flags; 827 unsigned int f_flags;
796 mode_t f_mode; 828 mode_t f_mode;
797 loff_t f_pos; 829 loff_t f_pos;
@@ -820,8 +852,8 @@ extern spinlock_t files_lock;
820#define file_list_lock() spin_lock(&files_lock); 852#define file_list_lock() spin_lock(&files_lock);
821#define file_list_unlock() spin_unlock(&files_lock); 853#define file_list_unlock() spin_unlock(&files_lock);
822 854
823#define get_file(x) atomic_inc(&(x)->f_count) 855#define get_file(x) atomic_long_inc(&(x)->f_count)
824#define file_count(x) atomic_read(&(x)->f_count) 856#define file_count(x) atomic_long_read(&(x)->f_count)
825 857
826#ifdef CONFIG_DEBUG_WRITECOUNT 858#ifdef CONFIG_DEBUG_WRITECOUNT
827static inline void file_take_write(struct file *f) 859static inline void file_take_write(struct file *f)
@@ -885,6 +917,12 @@ static inline int file_check_writeable(struct file *filp)
885#define FL_SLEEP 128 /* A blocking lock */ 917#define FL_SLEEP 128 /* A blocking lock */
886 918
887/* 919/*
920 * Special return value from posix_lock_file() and vfs_lock_file() for
921 * asynchronous locking.
922 */
923#define FILE_LOCK_DEFERRED 1
924
925/*
888 * The POSIX file lock owner is determined by 926 * The POSIX file lock owner is determined by
889 * the "struct files_struct" in the thread group 927 * the "struct files_struct" in the thread group
890 * (or NULL for no owner - BSD locks). 928 * (or NULL for no owner - BSD locks).
@@ -894,8 +932,6 @@ static inline int file_check_writeable(struct file *filp)
894typedef struct files_struct *fl_owner_t; 932typedef struct files_struct *fl_owner_t;
895 933
896struct file_lock_operations { 934struct file_lock_operations {
897 void (*fl_insert)(struct file_lock *); /* lock insertion callback */
898 void (*fl_remove)(struct file_lock *); /* lock removal callback */
899 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 935 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
900 void (*fl_release_private)(struct file_lock *); 936 void (*fl_release_private)(struct file_lock *);
901}; 937};
@@ -911,6 +947,14 @@ struct lock_manager_operations {
911 int (*fl_change)(struct file_lock **, int); 947 int