diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 75 |
1 files changed, 58 insertions, 17 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index b84b848431f2..a1ba005d08e7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -287,9 +287,9 @@ extern int dir_notify_enable; | |||
287 | #include <linux/pid.h> | 287 | #include <linux/pid.h> |
288 | #include <linux/mutex.h> | 288 | #include <linux/mutex.h> |
289 | #include <linux/capability.h> | 289 | #include <linux/capability.h> |
290 | #include <linux/semaphore.h> | ||
290 | 291 | ||
291 | #include <asm/atomic.h> | 292 | #include <asm/atomic.h> |
292 | #include <asm/semaphore.h> | ||
293 | #include <asm/byteorder.h> | 293 | #include <asm/byteorder.h> |
294 | 294 | ||
295 | struct export_operations; | 295 | struct export_operations; |
@@ -305,7 +305,6 @@ struct vfsmount; | |||
305 | 305 | ||
306 | extern void __init inode_init(void); | 306 | extern void __init inode_init(void); |
307 | extern void __init inode_init_early(void); | 307 | extern void __init inode_init_early(void); |
308 | extern void __init mnt_init(void); | ||
309 | extern void __init files_init(unsigned long); | 308 | extern void __init files_init(unsigned long); |
310 | 309 | ||
311 | struct buffer_head; | 310 | struct buffer_head; |
@@ -475,8 +474,8 @@ struct address_space_operations { | |||
475 | int (*releasepage) (struct page *, gfp_t); | 474 | int (*releasepage) (struct page *, gfp_t); |
476 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 475 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
477 | loff_t offset, unsigned long nr_segs); | 476 | loff_t offset, unsigned long nr_segs); |
478 | struct page* (*get_xip_page)(struct address_space *, sector_t, | 477 | int (*get_xip_mem)(struct address_space *, pgoff_t, int, |
479 | int); | 478 | void **, unsigned long *); |
480 | /* migrate the contents of a page to the specified target */ | 479 | /* migrate the contents of a page to the specified target */ |
481 | int (*migratepage) (struct address_space *, | 480 | int (*migratepage) (struct address_space *, |
482 | struct page *, struct page *); | 481 | struct page *, struct page *); |
@@ -776,6 +775,9 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) | |||
776 | index < ra->start + ra->size); | 775 | index < ra->start + ra->size); |
777 | } | 776 | } |
778 | 777 | ||
778 | #define FILE_MNT_WRITE_TAKEN 1 | ||
779 | #define FILE_MNT_WRITE_RELEASED 2 | ||
780 | |||
779 | struct file { | 781 | struct file { |
780 | /* | 782 | /* |
781 | * fu_list becomes invalid after file_free is called and queued via | 783 | * fu_list becomes invalid after file_free is called and queued via |
@@ -810,6 +812,9 @@ struct file { | |||
810 | spinlock_t f_ep_lock; | 812 | spinlock_t f_ep_lock; |
811 | #endif /* #ifdef CONFIG_EPOLL */ | 813 | #endif /* #ifdef CONFIG_EPOLL */ |
812 | struct address_space *f_mapping; | 814 | struct address_space *f_mapping; |
815 | #ifdef CONFIG_DEBUG_WRITECOUNT | ||
816 | unsigned long f_mnt_write_state; | ||
817 | #endif | ||
813 | }; | 818 | }; |
814 | extern spinlock_t files_lock; | 819 | extern spinlock_t files_lock; |
815 | #define file_list_lock() spin_lock(&files_lock); | 820 | #define file_list_lock() spin_lock(&files_lock); |
@@ -818,6 +823,49 @@ extern spinlock_t files_lock; | |||
818 | #define get_file(x) atomic_inc(&(x)->f_count) | 823 | #define get_file(x) atomic_inc(&(x)->f_count) |
819 | #define file_count(x) atomic_read(&(x)->f_count) | 824 | #define file_count(x) atomic_read(&(x)->f_count) |
820 | 825 | ||
826 | #ifdef CONFIG_DEBUG_WRITECOUNT | ||
827 | static inline void file_take_write(struct file *f) | ||
828 | { | ||
829 | WARN_ON(f->f_mnt_write_state != 0); | ||
830 | f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN; | ||
831 | } | ||
832 | static inline void file_release_write(struct file *f) | ||
833 | { | ||
834 | f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED; | ||
835 | } | ||
836 | static inline void file_reset_write(struct file *f) | ||
837 | { | ||
838 | f->f_mnt_write_state = 0; | ||
839 | } | ||
840 | static inline void file_check_state(struct file *f) | ||
841 | { | ||
842 | /* | ||
843 | * At this point, either both or neither of these bits | ||
844 | * should be set. | ||
845 | */ | ||
846 | WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN); | ||
847 | WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED); | ||
848 | } | ||
849 | static inline int file_check_writeable(struct file *f) | ||
850 | { | ||
851 | if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN) | ||
852 | return 0; | ||
853 | printk(KERN_WARNING "writeable file with no " | ||
854 | "mnt_want_write()\n"); | ||
855 | WARN_ON(1); | ||
856 | return -EINVAL; | ||
857 | } | ||
858 | #else /* !CONFIG_DEBUG_WRITECOUNT */ | ||
859 | static inline void file_take_write(struct file *filp) {} | ||
860 | static inline void file_release_write(struct file *filp) {} | ||
861 | static inline void file_reset_write(struct file *filp) {} | ||
862 | static inline void file_check_state(struct file *filp) {} | ||
863 | static inline int file_check_writeable(struct file *filp) | ||
864 | { | ||
865 | return 0; | ||
866 | } | ||
867 | #endif /* CONFIG_DEBUG_WRITECOUNT */ | ||
868 | |||
821 | #define MAX_NON_LFS ((1UL<<31) - 1) | 869 | #define MAX_NON_LFS ((1UL<<31) - 1) |
822 | 870 | ||
823 | /* Page cache limit. The filesystems should put that into their s_maxbytes | 871 | /* Page cache limit. The filesystems should put that into their s_maxbytes |
@@ -925,6 +973,7 @@ extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | |||
925 | /* fs/locks.c */ | 973 | /* fs/locks.c */ |
926 | extern void locks_init_lock(struct file_lock *); | 974 | extern void locks_init_lock(struct file_lock *); |
927 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 975 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
976 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); | ||
928 | extern void locks_remove_posix(struct file *, fl_owner_t); | 977 | extern void locks_remove_posix(struct file *, fl_owner_t); |
929 | extern void locks_remove_flock(struct file *); | 978 | extern void locks_remove_flock(struct file *); |
930 | extern void posix_test_lock(struct file *, struct file_lock *); | 979 | extern void posix_test_lock(struct file *, struct file_lock *); |
@@ -1129,7 +1178,8 @@ struct block_device_operations { | |||
1129 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); | 1178 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); |
1130 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); | 1179 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); |
1131 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); | 1180 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); |
1132 | int (*direct_access) (struct block_device *, sector_t, unsigned long *); | 1181 | int (*direct_access) (struct block_device *, sector_t, |
1182 | void **, unsigned long *); | ||
1133 | int (*media_changed) (struct gendisk *); | 1183 | int (*media_changed) (struct gendisk *); |
1134 | int (*revalidate_disk) (struct gendisk *); | 1184 | int (*revalidate_disk) (struct gendisk *); |
1135 | int (*getgeo)(struct block_device *, struct hd_geometry *); | 1185 | int (*getgeo)(struct block_device *, struct hd_geometry *); |
@@ -1260,7 +1310,7 @@ struct super_operations { | |||
1260 | int (*statfs) (struct dentry *, struct kstatfs *); | 1310 | int (*statfs) (struct dentry *, struct kstatfs *); |
1261 | int (*remount_fs) (struct super_block *, int *, char *); | 1311 | int (*remount_fs) (struct super_block *, int *, char *); |
1262 | void (*clear_inode) (struct inode *); | 1312 | void (*clear_inode) (struct inode *); |
1263 | void (*umount_begin) (struct vfsmount *, int); | 1313 | void (*umount_begin) (struct super_block *); |
1264 | 1314 | ||
1265 | int (*show_options)(struct seq_file *, struct vfsmount *); | 1315 | int (*show_options)(struct seq_file *, struct vfsmount *); |
1266 | int (*show_stats)(struct seq_file *, struct vfsmount *); | 1316 | int (*show_stats)(struct seq_file *, struct vfsmount *); |
@@ -1471,7 +1521,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *, | |||
1471 | const struct super_operations *ops, unsigned long, | 1521 | const struct super_operations *ops, unsigned long, |
1472 | struct vfsmount *mnt); | 1522 | struct vfsmount *mnt); |
1473 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1523 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1474 | int __put_super(struct super_block *sb); | ||
1475 | int __put_super_and_need_restart(struct super_block *sb); | 1524 | int __put_super_and_need_restart(struct super_block *sb); |
1476 | void unnamed_dev_init(void); | 1525 | void unnamed_dev_init(void); |
1477 | 1526 | ||
@@ -1487,12 +1536,7 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); | |||
1487 | #define kern_mount(type) kern_mount_data(type, NULL) | 1536 | #define kern_mount(type) kern_mount_data(type, NULL) |
1488 | extern int may_umount_tree(struct vfsmount *); | 1537 | extern int may_umount_tree(struct vfsmount *); |
1489 | extern int may_umount(struct vfsmount *); | 1538 | extern int may_umount(struct vfsmount *); |
1490 | extern void umount_tree(struct vfsmount *, int, struct list_head *); | ||
1491 | extern void release_mounts(struct list_head *); | ||
1492 | extern long do_mount(char *, char *, char *, unsigned long, void *); | 1539 | extern long do_mount(char *, char *, char *, unsigned long, void *); |
1493 | extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int); | ||
1494 | extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, | ||
1495 | struct vfsmount *); | ||
1496 | extern struct vfsmount *collect_mounts(struct vfsmount *, struct dentry *); | 1540 | extern struct vfsmount *collect_mounts(struct vfsmount *, struct dentry *); |
1497 | extern void drop_collected_mounts(struct vfsmount *); | 1541 | extern void drop_collected_mounts(struct vfsmount *); |
1498 | 1542 | ||
@@ -1735,7 +1779,8 @@ extern struct file *create_read_pipe(struct file *f); | |||
1735 | extern struct file *create_write_pipe(void); | 1779 | extern struct file *create_write_pipe(void); |
1736 | extern void free_write_pipe(struct file *); | 1780 | extern void free_write_pipe(struct file *); |
1737 | 1781 | ||
1738 | extern int open_namei(int dfd, const char *, int, int, struct nameidata *); | 1782 | extern struct file *do_filp_open(int dfd, const char *pathname, |
1783 | int open_flag, int mode); | ||
1739 | extern int may_open(struct nameidata *, int, int); | 1784 | extern int may_open(struct nameidata *, int, int); |
1740 | 1785 | ||
1741 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 1786 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); |
@@ -1919,7 +1964,6 @@ extern int vfs_stat_fd(int dfd, char __user *, struct kstat *); | |||
1919 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); | 1964 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); |
1920 | extern int vfs_fstat(unsigned int, struct kstat *); | 1965 | extern int vfs_fstat(unsigned int, struct kstat *); |
1921 | 1966 | ||
1922 | extern long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | ||
1923 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 1967 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
1924 | unsigned long arg); | 1968 | unsigned long arg); |
1925 | 1969 | ||
@@ -1989,9 +2033,6 @@ static inline ino_t parent_ino(struct dentry *dentry) | |||
1989 | return res; | 2033 | return res; |
1990 | } | 2034 | } |
1991 | 2035 | ||
1992 | /* kernel/fork.c */ | ||
1993 | extern int unshare_files(void); | ||
1994 | |||
1995 | /* Transaction based IO helpers */ | 2036 | /* Transaction based IO helpers */ |
1996 | 2037 | ||
1997 | /* | 2038 | /* |