diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 103 |
1 files changed, 54 insertions, 49 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 49d8eb7a71be..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) |
@@ -1136,7 +1162,7 @@ extern int vfs_permission(struct nameidata *, int); | |||
1136 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); | 1162 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); |
1137 | extern int vfs_mkdir(struct inode *, struct dentry *, int); | 1163 | extern int vfs_mkdir(struct inode *, struct dentry *, int); |
1138 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); | 1164 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); |
1139 | extern int vfs_symlink(struct inode *, struct dentry *, const char *, int); | 1165 | extern int vfs_symlink(struct inode *, struct dentry *, const char *); |
1140 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); | 1166 | extern int vfs_link(struct dentry *, struct inode *, struct dentry *); |
1141 | extern int vfs_rmdir(struct inode *, struct dentry *); | 1167 | extern int vfs_rmdir(struct inode *, struct dentry *); |
1142 | extern int vfs_unlink(struct inode *, struct dentry *); | 1168 | extern int vfs_unlink(struct inode *, struct dentry *); |
@@ -1195,27 +1221,6 @@ struct block_device_operations { | |||
1195 | struct module *owner; | 1221 | struct module *owner; |
1196 | }; | 1222 | }; |
1197 | 1223 | ||
1198 | /* | ||
1199 | * "descriptor" for what we're up to with a read. | ||
1200 | * This allows us to use the same read code yet | ||
1201 | * have multiple different users of the data that | ||
1202 | * we read from a file. | ||
1203 | * | ||
1204 | * The simplest case just copies the data to user | ||
1205 | * mode. | ||
1206 | */ | ||
1207 | typedef struct { | ||
1208 | size_t written; | ||
1209 | size_t count; | ||
1210 | union { | ||
1211 | char __user * buf; | ||
1212 | void *data; | ||
1213 | } arg; | ||
1214 | int error; | ||
1215 | } read_descriptor_t; | ||
1216 | |||
1217 | typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long); | ||
1218 | |||
1219 | /* These macros are for out of kernel modules to test that | 1224 | /* These macros are for out of kernel modules to test that |
1220 | * the kernel supports the unlocked_ioctl and compat_ioctl | 1225 | * the kernel supports the unlocked_ioctl and compat_ioctl |
1221 | * fields in struct file_operations. */ | 1226 | * fields in struct file_operations. */ |
@@ -1272,7 +1277,7 @@ struct inode_operations { | |||
1272 | void * (*follow_link) (struct dentry *, struct nameidata *); | 1277 | void * (*follow_link) (struct dentry *, struct nameidata *); |
1273 | void (*put_link) (struct dentry *, struct nameidata *, void *); | 1278 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
1274 | void (*truncate) (struct inode *); | 1279 | void (*truncate) (struct inode *); |
1275 | int (*permission) (struct inode *, int, struct nameidata *); | 1280 | int (*permission) (struct inode *, int); |
1276 | int (*setattr) (struct dentry *, struct iattr *); | 1281 | int (*setattr) (struct dentry *, struct iattr *); |
1277 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); | 1282 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); |
1278 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); | 1283 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); |
@@ -1696,9 +1701,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t); | |||
1696 | extern void make_bad_inode(struct inode *); | 1701 | extern void make_bad_inode(struct inode *); |
1697 | extern int is_bad_inode(struct inode *); | 1702 | extern int is_bad_inode(struct inode *); |
1698 | 1703 | ||
1699 | extern const struct file_operations read_fifo_fops; | 1704 | extern const struct file_operations read_pipefifo_fops; |
1700 | extern const struct file_operations write_fifo_fops; | 1705 | extern const struct file_operations write_pipefifo_fops; |
1701 | extern const struct file_operations rdwr_fifo_fops; | 1706 | extern const struct file_operations rdwr_pipefifo_fops; |
1702 | 1707 | ||
1703 | extern int fs_may_remount_ro(struct super_block *); | 1708 | extern int fs_may_remount_ro(struct super_block *); |
1704 | 1709 | ||
@@ -1767,7 +1772,7 @@ extern int do_remount_sb(struct super_block *sb, int flags, | |||
1767 | extern sector_t bmap(struct inode *, sector_t); | 1772 | extern sector_t bmap(struct inode *, sector_t); |
1768 | #endif | 1773 | #endif |
1769 | extern int notify_change(struct dentry *, struct iattr *); | 1774 | extern int notify_change(struct dentry *, struct iattr *); |
1770 | extern int permission(struct inode *, int, struct nameidata *); | 1775 | extern int inode_permission(struct inode *, int); |
1771 | extern int generic_permission(struct inode *, int, | 1776 | extern int generic_permission(struct inode *, int, |
1772 | int (*check_acl)(struct inode *, int)); | 1777 | int (*check_acl)(struct inode *, int)); |
1773 | 1778 | ||
@@ -1831,7 +1836,7 @@ extern void clear_inode(struct inode *); | |||
1831 | extern void destroy_inode(struct inode *); | 1836 | extern void destroy_inode(struct inode *); |
1832 | extern struct inode *new_inode(struct super_block *); | 1837 | extern struct inode *new_inode(struct super_block *); |
1833 | extern int should_remove_suid(struct dentry *); | 1838 | extern int should_remove_suid(struct dentry *); |
1834 | extern int remove_suid(struct dentry *); | 1839 | extern int file_remove_suid(struct file *); |
1835 | 1840 | ||
1836 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 1841 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
1837 | extern void remove_inode_hash(struct inode *); | 1842 | extern void remove_inode_hash(struct inode *); |