diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 223 |
1 files changed, 187 insertions, 36 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 92734c0012e6..42436ae42f70 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -141,6 +141,7 @@ struct inodes_stat_t { | |||
141 | #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ | 141 | #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ |
142 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ | 142 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ |
143 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ | 143 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ |
144 | #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ | ||
144 | #define MS_ACTIVE (1<<30) | 145 | #define MS_ACTIVE (1<<30) |
145 | #define MS_NOUSER (1<<31) | 146 | #define MS_NOUSER (1<<31) |
146 | 147 | ||
@@ -848,6 +849,7 @@ struct file { | |||
848 | #define f_dentry f_path.dentry | 849 | #define f_dentry f_path.dentry |
849 | #define f_vfsmnt f_path.mnt | 850 | #define f_vfsmnt f_path.mnt |
850 | const struct file_operations *f_op; | 851 | const struct file_operations *f_op; |
852 | spinlock_t f_lock; /* f_ep_links, f_flags */ | ||
851 | atomic_long_t f_count; | 853 | atomic_long_t f_count; |
852 | unsigned int f_flags; | 854 | unsigned int f_flags; |
853 | fmode_t f_mode; | 855 | fmode_t f_mode; |
@@ -866,7 +868,6 @@ struct file { | |||
866 | #ifdef CONFIG_EPOLL | 868 | #ifdef CONFIG_EPOLL |
867 | /* Used by fs/eventpoll.c to link all the hooks to this file */ | 869 | /* Used by fs/eventpoll.c to link all the hooks to this file */ |
868 | struct list_head f_ep_links; | 870 | struct list_head f_ep_links; |
869 | spinlock_t f_ep_lock; | ||
870 | #endif /* #ifdef CONFIG_EPOLL */ | 871 | #endif /* #ifdef CONFIG_EPOLL */ |
871 | struct address_space *f_mapping; | 872 | struct address_space *f_mapping; |
872 | #ifdef CONFIG_DEBUG_WRITECOUNT | 873 | #ifdef CONFIG_DEBUG_WRITECOUNT |
@@ -1063,34 +1064,147 @@ extern int lease_modify(struct file_lock **, int); | |||
1063 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1064 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1064 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1065 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1065 | #else /* !CONFIG_FILE_LOCKING */ | 1066 | #else /* !CONFIG_FILE_LOCKING */ |
1066 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | 1067 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) |
1067 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | 1068 | { |
1069 | return -EINVAL; | ||
1070 | } | ||
1071 | |||
1072 | static inline int fcntl_setlk(unsigned int fd, struct file *file, | ||
1073 | unsigned int cmd, struct flock __user *user) | ||
1074 | { | ||
1075 | return -EACCES; | ||
1076 | } | ||
1077 | |||
1068 | #if BITS_PER_LONG == 32 | 1078 | #if BITS_PER_LONG == 32 |
1069 | #define fcntl_getlk64(a, b) ({ -EINVAL; }) | 1079 | static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user) |
1070 | #define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) | 1080 | { |
1081 | return -EINVAL; | ||
1082 | } | ||
1083 | |||
1084 | static inline int fcntl_setlk64(unsigned int fd, struct file *file, | ||
1085 | unsigned int cmd, struct flock64 __user *user) | ||
1086 | { | ||
1087 | return -EACCES; | ||
1088 | } | ||
1071 | #endif | 1089 | #endif |
1072 | #define fcntl_setlease(a, b, c) ({ 0; }) | 1090 | static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg) |
1073 | #define fcntl_getlease(a) ({ 0; }) | 1091 | { |
1074 | #define locks_init_lock(a) ({ }) | 1092 | return 0; |
1075 | #define __locks_copy_lock(a, b) ({ }) | 1093 | } |
1076 | #define locks_copy_lock(a, b) ({ }) | 1094 | |
1077 | #define locks_remove_posix(a, b) ({ }) | 1095 | static inline int fcntl_getlease(struct file *filp) |
1078 | #define locks_remove_flock(a) ({ }) | 1096 | { |
1079 | #define posix_test_lock(a, b) ({ 0; }) | 1097 | return 0; |
1080 | #define posix_lock_file(a, b, c) ({ -ENOLCK; }) | 1098 | } |
1081 | #define posix_lock_file_wait(a, b) ({ -ENOLCK; }) | 1099 | |
1082 | #define posix_unblock_lock(a, b) (-ENOENT) | 1100 | static inline void locks_init_lock(struct file_lock *fl) |
1083 | #define vfs_test_lock(a, b) ({ 0; }) | 1101 | { |
1084 | #define vfs_lock_file(a, b, c, d) (-ENOLCK) | 1102 | return; |
1085 | #define vfs_cancel_lock(a, b) ({ 0; }) | 1103 | } |
1086 | #define flock_lock_file_wait(a, b) ({ -ENOLCK; }) | 1104 | |
1087 | #define __break_lease(a, b) ({ 0; }) | 1105 | static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
1088 | #define lease_get_mtime(a, b) ({ }) | 1106 | { |
1089 | #define generic_setlease(a, b, c) ({ -EINVAL; }) | 1107 | return; |
1090 | #define vfs_setlease(a, b, c) ({ -EINVAL; }) | 1108 | } |
1091 | #define lease_modify(a, b) ({ -EINVAL; }) | 1109 | |
1092 | #define lock_may_read(a, b, c) ({ 1; }) | 1110 | static inline void locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
1093 | #define lock_may_write(a, b, c) ({ 1; }) | 1111 | { |
1112 | return; | ||
1113 | } | ||
1114 | |||
1115 | static inline void locks_remove_posix(struct file *filp, fl_owner_t owner) | ||
1116 | { | ||
1117 | return; | ||
1118 | } | ||
1119 | |||
1120 | static inline void locks_remove_flock(struct file *filp) | ||
1121 | { | ||
1122 | return; | ||
1123 | } | ||
1124 | |||
1125 | static inline void posix_test_lock(struct file *filp, struct file_lock *fl) | ||
1126 | { | ||
1127 | return; | ||
1128 | } | ||
1129 | |||
1130 | static inline int posix_lock_file(struct file *filp, struct file_lock *fl, | ||
1131 | struct file_lock *conflock) | ||
1132 | { | ||
1133 | return -ENOLCK; | ||
1134 | } | ||
1135 | |||
1136 | static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl) | ||
1137 | { | ||
1138 | return -ENOLCK; | ||
1139 | } | ||
1140 | |||
1141 | static inline int posix_unblock_lock(struct file *filp, | ||
1142 | struct file_lock *waiter) | ||
1143 | { | ||
1144 | return -ENOENT; | ||
1145 | } | ||
1146 | |||
1147 | static inline int vfs_test_lock(struct file *filp, struct file_lock *fl) | ||
1148 | { | ||
1149 | return 0; | ||
1150 | } | ||
1151 | |||
1152 | static inline int vfs_lock_file(struct file *filp, unsigned int cmd, | ||
1153 | struct file_lock *fl, struct file_lock *conf) | ||
1154 | { | ||
1155 | return -ENOLCK; | ||
1156 | } | ||
1157 | |||
1158 | static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl) | ||
1159 | { | ||
1160 | return 0; | ||
1161 | } | ||
1162 | |||
1163 | static inline int flock_lock_file_wait(struct file *filp, | ||
1164 | struct file_lock *request) | ||
1165 | { | ||
1166 | return -ENOLCK; | ||
1167 | } | ||
1168 | |||
1169 | static inline int __break_lease(struct inode *inode, unsigned int mode) | ||
1170 | { | ||
1171 | return 0; | ||
1172 | } | ||
1173 | |||
1174 | static inline void lease_get_mtime(struct inode *inode, struct timespec *time) | ||
1175 | { | ||
1176 | return; | ||
1177 | } | ||
1178 | |||
1179 | static inline int generic_setlease(struct file *filp, long arg, | ||
1180 | struct file_lock **flp) | ||
1181 | { | ||
1182 | return -EINVAL; | ||
1183 | } | ||
1184 | |||
1185 | static inline int vfs_setlease(struct file *filp, long arg, | ||
1186 | struct file_lock **lease) | ||
1187 | { | ||
1188 | return -EINVAL; | ||
1189 | } | ||
1190 | |||
1191 | static inline int lease_modify(struct file_lock **before, int arg) | ||
1192 | { | ||
1193 | return -EINVAL; | ||
1194 | } | ||
1195 | |||
1196 | static inline int lock_may_read(struct inode *inode, loff_t start, | ||
1197 | unsigned long len) | ||
1198 | { | ||
1199 | return 1; | ||
1200 | } | ||
1201 | |||
1202 | static inline int lock_may_write(struct inode *inode, loff_t start, | ||
1203 | unsigned long len) | ||
1204 | { | ||
1205 | return 1; | ||
1206 | } | ||
1207 | |||
1094 | #endif /* !CONFIG_FILE_LOCKING */ | 1208 | #endif /* !CONFIG_FILE_LOCKING */ |
1095 | 1209 | ||
1096 | 1210 | ||
@@ -1606,7 +1720,7 @@ struct super_block *sget(struct file_system_type *type, | |||
1606 | extern int get_sb_pseudo(struct file_system_type *, char *, | 1720 | extern int get_sb_pseudo(struct file_system_type *, char *, |
1607 | const struct super_operations *ops, unsigned long, | 1721 | const struct super_operations *ops, unsigned long, |
1608 | struct vfsmount *mnt); | 1722 | struct vfsmount *mnt); |
1609 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1723 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1610 | int __put_super_and_need_restart(struct super_block *sb); | 1724 | int __put_super_and_need_restart(struct super_block *sb); |
1611 | 1725 | ||
1612 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1726 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
@@ -1687,13 +1801,44 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1687 | return 0; | 1801 | return 0; |
1688 | } | 1802 | } |
1689 | #else /* !CONFIG_FILE_LOCKING */ | 1803 | #else /* !CONFIG_FILE_LOCKING */ |
1690 | #define locks_mandatory_locked(a) ({ 0; }) | 1804 | static inline int locks_mandatory_locked(struct inode *inode) |
1691 | #define locks_mandatory_area(a, b, c, d, e) ({ 0; }) | 1805 | { |
1692 | #define __mandatory_lock(a) ({ 0; }) | 1806 | return 0; |
1693 | #define mandatory_lock(a) ({ 0; }) | 1807 | } |
1694 | #define locks_verify_locked(a) ({ 0; }) | 1808 | |
1695 | #define locks_verify_truncate(a, b, c) ({ 0; }) | 1809 | static inline int locks_mandatory_area(int rw, struct inode *inode, |
1696 | #define break_lease(a, b) ({ 0; }) | 1810 | struct file *filp, loff_t offset, |
1811 | size_t count) | ||
1812 | { | ||
1813 | return 0; | ||
1814 | } | ||
1815 | |||
1816 | static inline int __mandatory_lock(struct inode *inode) | ||
1817 | { | ||
1818 | return 0; | ||
1819 | } | ||
1820 | |||
1821 | static inline int mandatory_lock(struct inode *inode) | ||
1822 | { | ||
1823 | return 0; | ||
1824 | } | ||
1825 | |||
1826 | static inline int locks_verify_locked(struct inode *inode) | ||
1827 | { | ||
1828 | return 0; | ||
1829 | } | ||
1830 | |||
1831 | static inline int locks_verify_truncate(struct inode *inode, struct file *filp, | ||
1832 | size_t size) | ||
1833 | { | ||
1834 | return 0; | ||
1835 | } | ||
1836 | |||
1837 | static inline int break_lease(struct inode *inode, unsigned int mode) | ||
1838 | { | ||
1839 | return 0; | ||
1840 | } | ||
1841 | |||
1697 | #endif /* CONFIG_FILE_LOCKING */ | 1842 | #endif /* CONFIG_FILE_LOCKING */ |
1698 | 1843 | ||
1699 | /* fs/open.c */ | 1844 | /* fs/open.c */ |
@@ -1730,6 +1875,13 @@ extern void bd_set_size(struct block_device *, loff_t size); | |||
1730 | extern void bd_forget(struct inode *inode); | 1875 | extern void bd_forget(struct inode *inode); |
1731 | extern void bdput(struct block_device *); | 1876 | extern void bdput(struct block_device *); |
1732 | extern struct block_device *open_by_devnum(dev_t, fmode_t); | 1877 | extern struct block_device *open_by_devnum(dev_t, fmode_t); |
1878 | extern void invalidate_bdev(struct block_device *); | ||
1879 | extern int sync_blockdev(struct block_device *bdev); | ||
1880 | extern struct super_block *freeze_bdev(struct block_device *); | ||
1881 | extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); | ||
1882 | extern int fsync_bdev(struct block_device *); | ||
1883 | extern int fsync_super(struct super_block *); | ||
1884 | extern int fsync_no_super(struct block_device *); | ||
1733 | #else | 1885 | #else |
1734 | static inline void bd_forget(struct inode *inode) {} | 1886 | static inline void bd_forget(struct inode *inode) {} |
1735 | #endif | 1887 | #endif |
@@ -1881,7 +2033,6 @@ static inline void allow_write_access(struct file *file) | |||
1881 | if (file) | 2033 | if (file) |
1882 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2034 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); |
1883 | } | 2035 | } |
1884 | extern int do_pipe(int *); | ||
1885 | extern int do_pipe_flags(int *, int); | 2036 | extern int do_pipe_flags(int *, int); |
1886 | extern struct file *create_read_pipe(struct file *f, int flags); | 2037 | extern struct file *create_read_pipe(struct file *f, int flags); |
1887 | extern struct file *create_write_pipe(int flags); | 2038 | extern struct file *create_write_pipe(int flags); |