diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 120 |
1 files changed, 67 insertions, 53 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 9c2ac5c0ef5c..580b513668fe 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 |
@@ -277,7 +279,7 @@ extern int dir_notify_enable; | |||
277 | #include <linux/types.h> | 279 | #include <linux/types.h> |
278 | #include <linux/kdev_t.h> | 280 | #include <linux/kdev_t.h> |
279 | #include <linux/dcache.h> | 281 | #include <linux/dcache.h> |
280 | #include <linux/namei.h> | 282 | #include <linux/path.h> |
281 | #include <linux/stat.h> | 283 | #include <linux/stat.h> |
282 | #include <linux/cache.h> | 284 | #include <linux/cache.h> |
283 | #include <linux/kobject.h> | 285 | #include <linux/kobject.h> |
@@ -318,22 +320,23 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | |||
318 | * Attribute flags. These should be or-ed together to figure out what | 320 | * Attribute flags. These should be or-ed together to figure out what |
319 | * has been changed! | 321 | * has been changed! |
320 | */ | 322 | */ |
321 | #define ATTR_MODE 1 | 323 | #define ATTR_MODE (1 << 0) |
322 | #define ATTR_UID 2 | 324 | #define ATTR_UID (1 << 1) |
323 | #define ATTR_GID 4 | 325 | #define ATTR_GID (1 << 2) |
324 | #define ATTR_SIZE 8 | 326 | #define ATTR_SIZE (1 << 3) |
325 | #define ATTR_ATIME 16 | 327 | #define ATTR_ATIME (1 << 4) |
326 | #define ATTR_MTIME 32 | 328 | #define ATTR_MTIME (1 << 5) |
327 | #define ATTR_CTIME 64 | 329 | #define ATTR_CTIME (1 << 6) |
328 | #define ATTR_ATIME_SET 128 | 330 | #define ATTR_ATIME_SET (1 << 7) |
329 | #define ATTR_MTIME_SET 256 | 331 | #define ATTR_MTIME_SET (1 << 8) |
330 | #define ATTR_FORCE 512 /* Not a change, but a change it */ | 332 | #define ATTR_FORCE (1 << 9) /* Not a change, but a change it */ |
331 | #define ATTR_ATTR_FLAG 1024 | 333 | #define ATTR_ATTR_FLAG (1 << 10) |
332 | #define ATTR_KILL_SUID 2048 | 334 | #define ATTR_KILL_SUID (1 << 11) |
333 | #define ATTR_KILL_SGID 4096 | 335 | #define ATTR_KILL_SGID (1 << 12) |
334 | #define ATTR_FILE 8192 | 336 | #define ATTR_FILE (1 << 13) |
335 | #define ATTR_KILL_PRIV 16384 | 337 | #define ATTR_KILL_PRIV (1 << 14) |
336 | #define ATTR_OPEN 32768 /* Truncating from open(O_TRUNC) */ | 338 | #define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */ |
339 | #define ATTR_TIMES_SET (1 << 16) | ||
337 | 340 | ||
338 | /* | 341 | /* |
339 | * This is the Inode Attributes structure, used for notify_change(). It | 342 | * This is the Inode Attributes structure, used for notify_change(). It |
@@ -440,6 +443,27 @@ static inline size_t iov_iter_count(struct iov_iter *i) | |||
440 | return i->count; | 443 | return i->count; |
441 | } | 444 | } |
442 | 445 | ||
446 | /* | ||
447 | * "descriptor" for what we're up to with a read. | ||
448 | * This allows us to use the same read code yet | ||
449 | * have multiple different users of the data that | ||
450 | * we read from a file. | ||
451 | * | ||
452 | * The simplest case just copies the data to user | ||
453 | * mode. | ||
454 | */ | ||
455 | typedef struct { | ||
456 | size_t written; | ||
457 | size_t count; | ||
458 | union { | ||
459 | char __user *buf; | ||
460 | void *data; | ||
461 | } arg; | ||
462 | int error; | ||
463 | } read_descriptor_t; | ||
464 | |||
465 | typedef int (*read_actor_t)(read_descriptor_t *, struct page *, | ||
466 | unsigned long, unsigned long); | ||
443 | 467 | ||
444 | struct address_space_operations { | 468 | struct address_space_operations { |
445 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 469 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
@@ -481,6 +505,8 @@ struct address_space_operations { | |||
481 | int (*migratepage) (struct address_space *, | 505 | int (*migratepage) (struct address_space *, |
482 | struct page *, struct page *); | 506 | struct page *, struct page *); |
483 | int (*launder_page) (struct page *); | 507 | int (*launder_page) (struct page *); |
508 | int (*is_partially_uptodate) (struct page *, read_descriptor_t *, | ||
509 | unsigned long); | ||
484 | }; | 510 | }; |
485 | 511 | ||
486 | /* | 512 | /* |
@@ -499,7 +525,7 @@ struct backing_dev_info; | |||
499 | struct address_space { | 525 | struct address_space { |
500 | struct inode *host; /* owner: inode, block_device */ | 526 | struct inode *host; /* owner: inode, block_device */ |
501 | struct radix_tree_root page_tree; /* radix tree of all pages */ | 527 | struct radix_tree_root page_tree; /* radix tree of all pages */ |
502 | rwlock_t tree_lock; /* and rwlock protecting it */ | 528 | spinlock_t tree_lock; /* and lock protecting it */ |
503 | unsigned int i_mmap_writable;/* count VM_SHARED mappings */ | 529 | unsigned int i_mmap_writable;/* count VM_SHARED mappings */ |
504 | struct prio_tree_root i_mmap; /* tree of private and shared mappings */ | 530 | struct prio_tree_root i_mmap; /* tree of private and shared mappings */ |
505 | struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ | 531 | struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ |
@@ -792,7 +818,7 @@ struct file { | |||
792 | #define f_dentry f_path.dentry | 818 | #define f_dentry f_path.dentry |
793 | #define f_vfsmnt f_path.mnt | 819 | #define f_vfsmnt f_path.mnt |
794 | const struct file_operations *f_op; | 820 | const struct file_operations *f_op; |
795 | atomic_t f_count; | 821 | atomic_long_t f_count; |
796 | unsigned int f_flags; | 822 | unsigned int f_flags; |
797 | mode_t f_mode; | 823 | mode_t f_mode; |
798 | loff_t f_pos; | 824 | loff_t f_pos; |
@@ -821,8 +847,8 @@ extern spinlock_t files_lock; | |||
821 | #define file_list_lock() spin_lock(&files_lock); | 847 | #define file_list_lock() spin_lock(&files_lock); |
822 | #define file_list_unlock() spin_unlock(&files_lock); | 848 | #define file_list_unlock() spin_unlock(&files_lock); |
823 | 849 | ||
824 | #define get_file(x) atomic_inc(&(x)->f_count) | 850 | #define get_file(x) atomic_long_inc(&(x)->f_count) |
825 | #define file_count(x) atomic_read(&(x)->f_count) | 851 | #define file_count(x) atomic_long_read(&(x)->f_count) |
826 | 852 | ||
827 | #ifdef CONFIG_DEBUG_WRITECOUNT | 853 | #ifdef CONFIG_DEBUG_WRITECOUNT |
828 | static inline void file_take_write(struct file *f) | 854 | static inline void file_take_write(struct file *f) |
@@ -886,6 +912,12 @@ static inline int file_check_writeable(struct file *filp) | |||
886 | #define FL_SLEEP 128 /* A blocking lock */ | 912 | #define FL_SLEEP 128 /* A blocking lock */ |
887 | 913 | ||
888 | /* | 914 | /* |
915 | * Special return value from posix_lock_file() and vfs_lock_file() for | ||
916 | * asynchronous locking. | ||
917 | */ | ||
918 | #define FILE_LOCK_DEFERRED 1 | ||
919 | |||
920 | /* | ||
889 | * The POSIX file lock owner is determined by | 921 | * The POSIX file lock owner is determined by |
890 | * the "struct files_struct" in the thread group | 922 | * the "struct files_struct" in the thread group |
891 | * (or NULL for no owner - BSD locks). | 923 | * (or NULL for no owner - BSD locks). |
@@ -1025,6 +1057,7 @@ extern int send_sigurg(struct fown_struct *fown); | |||
1025 | extern struct list_head super_blocks; | 1057 | extern struct list_head super_blocks; |
1026 | extern spinlock_t sb_lock; | 1058 | extern spinlock_t sb_lock; |
1027 | 1059 | ||
1060 | #define sb_entry(list) list_entry((list), struct super_block, s_list) | ||
1028 | #define S_BIAS (1<<30) | 1061 | #define S_BIAS (1<<30) |
1029 | struct super_block { | 1062 | struct super_block { |
1030 | struct list_head s_list; /* Keep this first */ | 1063 | struct list_head s_list; /* Keep this first */ |
@@ -1058,6 +1091,9 @@ struct super_block { | |||
1058 | struct list_head s_more_io; /* parked for more writeback */ | 1091 | struct list_head s_more_io; /* parked for more writeback */ |
1059 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ | 1092 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ |
1060 | struct list_head s_files; | 1093 | struct list_head s_files; |
1094 | /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ | ||
1095 | struct list_head s_dentry_lru; /* unused dentry lru */ | ||
1096 | int s_nr_dentry_unused; /* # of dentry on lru */ | ||
1061 | 1097 | ||
1062 | struct block_device *s_bdev; | 1098 | struct block_device *s_bdev; |
1063 | struct mtd_info *s_mtd; | 1099 | struct mtd_info *s_mtd; |
@@ -1126,7 +1162,7 @@ extern int vfs_permission(struct nameidata *, int); | |||
1126 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); | 1162 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); |
1127 | extern int vfs_mkdir(struct inode *, struct dentry *, int); | 1163 | extern int vfs_mkdir(struct inode *, struct dentry *, int); |
1128 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); | 1164 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); |
1129 | extern int vfs_symlink(struct inode *, struct dentry *, const char *, int); | 1165 | extern int vfs_symlink(struct inode *, struct dentry *, const char *); |
1130 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); | 1166 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); |
1131 | extern int vfs_rmdir(struct inode *, struct dentry *); | 1167 | extern int vfs_rmdir(struct inode *, struct dentry *); |
1132 | extern int vfs_unlink(struct inode *, struct dentry *); | 1168 | extern int vfs_unlink(struct inode *, struct dentry *); |
@@ -1185,27 +1221,6 @@ struct block_device_operations { | |||
1185 | struct module *owner; | 1221 | struct module *owner; |
1186 | }; | 1222 | }; |
1187 | 1223 | ||
1188 | /* | ||
1189 | * "descriptor" for what we're up to with a read. | ||
1190 | * This allows us to use the same read code yet | ||
1191 | * have multiple different users of the data that | ||
1192 | * we read from a file. | ||
1193 | * | ||
1194 | * The simplest case just copies the data to user | ||
1195 | * mode. | ||
1196 | */ | ||
1197 | typedef struct { | ||
1198 | size_t written; | ||
1199 | size_t count; | ||
1200 | union { | ||
1201 | char __user * buf; | ||
1202 | void *data; | ||
1203 | } arg; | ||
1204 | int error; | ||
1205 | } read_descriptor_t; | ||
1206 | |||
1207 | typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long); | ||
1208 | |||
1209 | /* These macros are for out of kernel modules to test that | 1224 | /* These macros are for out of kernel modules to test that |
1210 | * the kernel supports the unlocked_ioctl and compat_ioctl | 1225 | * the kernel supports the unlocked_ioctl and compat_ioctl |
1211 | * fields in struct file_operations. */ | 1226 | * fields in struct file_operations. */ |
@@ -1262,7 +1277,7 @@ struct inode_operations { | |||
1262 | void * (*follow_link) (struct dentry *, struct nameidata *); | 1277 | void * (*follow_link) (struct dentry *, struct nameidata *); |
1263 | void (*put_link) (struct dentry *, struct nameidata *, void *); | 1278 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
1264 | void (*truncate) (struct inode *); | 1279 | void (*truncate) (struct inode *); |
1265 | int (*permission) (struct inode *, int, struct nameidata *); | 1280 | int (*permission) (struct inode *, int); |
1266 | int (*setattr) (struct dentry *, struct iattr *); | 1281 | int (*setattr) (struct dentry *, struct iattr *); |
1267 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); | 1282 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); |
1268 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); | 1283 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); |
@@ -1686,9 +1701,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t); | |||
1686 | extern void make_bad_inode(struct inode *); | 1701 | extern void make_bad_inode(struct inode *); |
1687 | extern int is_bad_inode(struct inode *); | 1702 | extern int is_bad_inode(struct inode *); |
1688 | 1703 | ||
1689 | extern const struct file_operations read_fifo_fops; | 1704 | extern const struct file_operations read_pipefifo_fops; |
1690 | extern const struct file_operations write_fifo_fops; | 1705 | extern const struct file_operations write_pipefifo_fops; |
1691 | extern const struct file_operations rdwr_fifo_fops; | 1706 | extern const struct file_operations rdwr_pipefifo_fops; |
1692 | 1707 | ||
1693 | extern int fs_may_remount_ro(struct super_block *); | 1708 | extern int fs_may_remount_ro(struct super_block *); |
1694 | 1709 | ||
@@ -1757,7 +1772,7 @@ extern int do_remount_sb(struct super_block *sb, int flags, | |||
1757 | extern sector_t bmap(struct inode *, sector_t); | 1772 | extern sector_t bmap(struct inode *, sector_t); |
1758 | #endif | 1773 | #endif |
1759 | extern int notify_change(struct dentry *, struct iattr *); | 1774 | extern int notify_change(struct dentry *, struct iattr *); |
1760 | extern int permission(struct inode *, int, struct nameidata *); | 1775 | extern int inode_permission(struct inode *, int); |
1761 | extern int generic_permission(struct inode *, int, | 1776 | extern int generic_permission(struct inode *, int, |
1762 | int (*check_acl)(struct inode *, int)); | 1777 | int (*check_acl)(struct inode *, int)); |
1763 | 1778 | ||
@@ -1773,8 +1788,9 @@ static inline void allow_write_access(struct file *file) | |||
1773 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 1788 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); |
1774 | } | 1789 | } |
1775 | extern int do_pipe(int *); | 1790 | extern int do_pipe(int *); |
1776 | extern struct file *create_read_pipe(struct file *f); | 1791 | extern int do_pipe_flags(int *, int); |
1777 | extern struct file *create_write_pipe(void); | 1792 | extern struct file *create_read_pipe(struct file *f, int flags); |
1793 | extern struct file *create_write_pipe(int flags); | ||
1778 | extern void free_write_pipe(struct file *); | 1794 | extern void free_write_pipe(struct file *); |
1779 | 1795 | ||
1780 | extern struct file *do_filp_open(int dfd, const char *pathname, | 1796 | extern struct file *do_filp_open(int dfd, const char *pathname, |
@@ -1820,7 +1836,7 @@ extern void clear_inode(struct inode *); | |||
1820 | extern void destroy_inode(struct inode *); | 1836 | extern void destroy_inode(struct inode *); |
1821 | extern struct inode *new_inode(struct super_block *); | 1837 | extern struct inode *new_inode(struct super_block *); |
1822 | extern int should_remove_suid(struct dentry *); | 1838 | extern int should_remove_suid(struct dentry *); |
1823 | extern int remove_suid(struct dentry *); | 1839 | extern int file_remove_suid(struct file *); |
1824 | 1840 | ||
1825 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 1841 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
1826 | extern void remove_inode_hash(struct inode *); | 1842 | extern void remove_inode_hash(struct inode *); |
@@ -2006,8 +2022,6 @@ extern void simple_release_fs(struct vfsmount **mount, int *count); | |||
2006 | 2022 | ||
2007 | extern ssize_t simple_read_from_buffer(void __user *to, size_t count, | 2023 | extern ssize_t simple_read_from_buffer(void __user *to, size_t count, |
2008 | loff_t *ppos, const void *from, size_t available); | 2024 | loff_t *ppos, const void *from, size_t available); |
2009 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | ||
2010 | const void *from, size_t available); | ||
2011 | 2025 | ||
2012 | #ifdef CONFIG_MIGRATION | 2026 | #ifdef CONFIG_MIGRATION |
2013 | extern int buffer_migrate_page(struct address_space *, | 2027 | extern int buffer_migrate_page(struct address_space *, |