diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 406 |
1 files changed, 303 insertions, 103 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 92734c0012e6..0872372184fe 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -87,6 +87,60 @@ struct inodes_stat_t { | |||
87 | */ | 87 | */ |
88 | #define FMODE_NOCMTIME ((__force fmode_t)2048) | 88 | #define FMODE_NOCMTIME ((__force fmode_t)2048) |
89 | 89 | ||
90 | /* | ||
91 | * The below are the various read and write types that we support. Some of | ||
92 | * them include behavioral modifiers that send information down to the | ||
93 | * block layer and IO scheduler. Terminology: | ||
94 | * | ||
95 | * The block layer uses device plugging to defer IO a little bit, in | ||
96 | * the hope that we will see more IO very shortly. This increases | ||
97 | * coalescing of adjacent IO and thus reduces the number of IOs we | ||
98 | * have to send to the device. It also allows for better queuing, | ||
99 | * if the IO isn't mergeable. If the caller is going to be waiting | ||
100 | * for the IO, then he must ensure that the device is unplugged so | ||
101 | * that the IO is dispatched to the driver. | ||
102 | * | ||
103 | * All IO is handled async in Linux. This is fine for background | ||
104 | * writes, but for reads or writes that someone waits for completion | ||
105 | * on, we want to notify the block layer and IO scheduler so that they | ||
106 | * know about it. That allows them to make better scheduling | ||
107 | * decisions. So when the below references 'sync' and 'async', it | ||
108 | * is referencing this priority hint. | ||
109 | * | ||
110 | * With that in mind, the available types are: | ||
111 | * | ||
112 | * READ A normal read operation. Device will be plugged. | ||
113 | * READ_SYNC A synchronous read. Device is not plugged, caller can | ||
114 | * immediately wait on this read without caring about | ||
115 | * unplugging. | ||
116 | * READA Used for read-ahead operations. Lower priority, and the | ||
117 | * block layer could (in theory) choose to ignore this | ||
118 | * request if it runs into resource problems. | ||
119 | * WRITE A normal async write. Device will be plugged. | ||
120 | * SWRITE Like WRITE, but a special case for ll_rw_block() that | ||
121 | * tells it to lock the buffer first. Normally a buffer | ||
122 | * must be locked before doing IO. | ||
123 | * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down | ||
124 | * the hint that someone will be waiting on this IO | ||
125 | * shortly. The device must still be unplugged explicitly, | ||
126 | * WRITE_SYNC_PLUG does not do this as we could be | ||
127 | * submitting more writes before we actually wait on any | ||
128 | * of them. | ||
129 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device | ||
130 | * immediately after submission. The write equivalent | ||
131 | * of READ_SYNC. | ||
132 | * WRITE_ODIRECT Special case write for O_DIRECT only. | ||
133 | * SWRITE_SYNC | ||
134 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. | ||
135 | * See SWRITE. | ||
136 | * WRITE_BARRIER Like WRITE, but tells the block layer that all | ||
137 | * previously submitted writes must be safely on storage | ||
138 | * before this one is started. Also guarantees that when | ||
139 | * this write is complete, it itself is also safely on | ||
140 | * storage. Prevents reordering of writes on both sides | ||
141 | * of this IO. | ||
142 | * | ||
143 | */ | ||
90 | #define RW_MASK 1 | 144 | #define RW_MASK 1 |
91 | #define RWA_MASK 2 | 145 | #define RWA_MASK 2 |
92 | #define READ 0 | 146 | #define READ 0 |
@@ -95,9 +149,18 @@ struct inodes_stat_t { | |||
95 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ | 149 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ |
96 | #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 150 | #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
97 | #define READ_META (READ | (1 << BIO_RW_META)) | 151 | #define READ_META (READ | (1 << BIO_RW_META)) |
98 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
99 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 153 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
154 | #define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | ||
155 | #define SWRITE_SYNC_PLUG \ | ||
156 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | ||
157 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | ||
100 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) | 158 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) |
159 | |||
160 | /* | ||
161 | * These aren't really reads or writes, they pass down information about | ||
162 | * parts of device that are now unused by the file system. | ||
163 | */ | ||
101 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) | 164 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) |
102 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) | 165 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) |
103 | 166 | ||
@@ -141,6 +204,7 @@ struct inodes_stat_t { | |||
141 | #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ | 204 | #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ |
142 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ | 205 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ |
143 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ | 206 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ |
207 | #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ | ||
144 | #define MS_ACTIVE (1<<30) | 208 | #define MS_ACTIVE (1<<30) |
145 | #define MS_NOUSER (1<<31) | 209 | #define MS_NOUSER (1<<31) |
146 | 210 | ||
@@ -646,6 +710,9 @@ static inline int mapping_writably_mapped(struct address_space *mapping) | |||
646 | #define i_size_ordered_init(inode) do { } while (0) | 710 | #define i_size_ordered_init(inode) do { } while (0) |
647 | #endif | 711 | #endif |
648 | 712 | ||
713 | struct posix_acl; | ||
714 | #define ACL_NOT_CACHED ((void *)(-1)) | ||
715 | |||
649 | struct inode { | 716 | struct inode { |
650 | struct hlist_node i_hash; | 717 | struct hlist_node i_hash; |
651 | struct list_head i_list; | 718 | struct list_head i_list; |
@@ -665,8 +732,8 @@ struct inode { | |||
665 | struct timespec i_atime; | 732 | struct timespec i_atime; |
666 | struct timespec i_mtime; | 733 | struct timespec i_mtime; |
667 | struct timespec i_ctime; | 734 | struct timespec i_ctime; |
668 | unsigned int i_blkbits; | ||
669 | blkcnt_t i_blocks; | 735 | blkcnt_t i_blocks; |
736 | unsigned int i_blkbits; | ||
670 | unsigned short i_bytes; | 737 | unsigned short i_bytes; |
671 | umode_t i_mode; | 738 | umode_t i_mode; |
672 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 739 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ |
@@ -687,13 +754,12 @@ struct inode { | |||
687 | struct block_device *i_bdev; | 754 | struct block_device *i_bdev; |
688 | struct cdev *i_cdev; | 755 | struct cdev *i_cdev; |
689 | }; | 756 | }; |
690 | int i_cindex; | ||
691 | 757 | ||
692 | __u32 i_generation; | 758 | __u32 i_generation; |
693 | 759 | ||
694 | #ifdef CONFIG_DNOTIFY | 760 | #ifdef CONFIG_FSNOTIFY |
695 | unsigned long i_dnotify_mask; /* Directory notify events */ | 761 | __u32 i_fsnotify_mask; /* all events this inode cares about */ |
696 | struct dnotify_struct *i_dnotify; /* for directory notifications */ | 762 | struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ |
697 | #endif | 763 | #endif |
698 | 764 | ||
699 | #ifdef CONFIG_INOTIFY | 765 | #ifdef CONFIG_INOTIFY |
@@ -710,6 +776,10 @@ struct inode { | |||
710 | #ifdef CONFIG_SECURITY | 776 | #ifdef CONFIG_SECURITY |
711 | void *i_security; | 777 | void *i_security; |
712 | #endif | 778 | #endif |
779 | #ifdef CONFIG_FS_POSIX_ACL | ||
780 | struct posix_acl *i_acl; | ||
781 | struct posix_acl *i_default_acl; | ||
782 | #endif | ||
713 | void *i_private; /* fs or device private pointer */ | 783 | void *i_private; /* fs or device private pointer */ |
714 | }; | 784 | }; |
715 | 785 | ||
@@ -733,9 +803,6 @@ enum inode_i_mutex_lock_class | |||
733 | I_MUTEX_QUOTA | 803 | I_MUTEX_QUOTA |
734 | }; | 804 | }; |
735 | 805 | ||
736 | extern void inode_double_lock(struct inode *inode1, struct inode *inode2); | ||
737 | extern void inode_double_unlock(struct inode *inode1, struct inode *inode2); | ||
738 | |||
739 | /* | 806 | /* |
740 | * NOTE: in a 32bit arch with a preemptable kernel and | 807 | * NOTE: in a 32bit arch with a preemptable kernel and |
741 | * an UP compile the i_size_read/write must be atomic | 808 | * an UP compile the i_size_read/write must be atomic |
@@ -819,7 +886,7 @@ struct file_ra_state { | |||
819 | there are only # of pages ahead */ | 886 | there are only # of pages ahead */ |
820 | 887 | ||
821 | unsigned int ra_pages; /* Maximum readahead window */ | 888 | unsigned int ra_pages; /* Maximum readahead window */ |
822 | int mmap_miss; /* Cache miss stat for mmap accesses */ | 889 | unsigned int mmap_miss; /* Cache miss stat for mmap accesses */ |
823 | loff_t prev_pos; /* Cache last read() position */ | 890 | loff_t prev_pos; /* Cache last read() position */ |
824 | }; | 891 | }; |
825 | 892 | ||
@@ -848,6 +915,7 @@ struct file { | |||
848 | #define f_dentry f_path.dentry | 915 | #define f_dentry f_path.dentry |
849 | #define f_vfsmnt f_path.mnt | 916 | #define f_vfsmnt f_path.mnt |
850 | const struct file_operations *f_op; | 917 | const struct file_operations *f_op; |
918 | spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */ | ||
851 | atomic_long_t f_count; | 919 | atomic_long_t f_count; |
852 | unsigned int f_flags; | 920 | unsigned int f_flags; |
853 | fmode_t f_mode; | 921 | fmode_t f_mode; |
@@ -866,7 +934,6 @@ struct file { | |||
866 | #ifdef CONFIG_EPOLL | 934 | #ifdef CONFIG_EPOLL |
867 | /* Used by fs/eventpoll.c to link all the hooks to this file */ | 935 | /* Used by fs/eventpoll.c to link all the hooks to this file */ |
868 | struct list_head f_ep_links; | 936 | struct list_head f_ep_links; |
869 | spinlock_t f_ep_lock; | ||
870 | #endif /* #ifdef CONFIG_EPOLL */ | 937 | #endif /* #ifdef CONFIG_EPOLL */ |
871 | struct address_space *f_mapping; | 938 | struct address_space *f_mapping; |
872 | #ifdef CONFIG_DEBUG_WRITECOUNT | 939 | #ifdef CONFIG_DEBUG_WRITECOUNT |
@@ -1047,6 +1114,7 @@ extern void locks_copy_lock(struct file_lock *, struct file_lock *); | |||
1047 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); | 1114 | extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); |
1048 | extern void locks_remove_posix(struct file *, fl_owner_t); | 1115 | extern void locks_remove_posix(struct file *, fl_owner_t); |
1049 | extern void locks_remove_flock(struct file *); | 1116 | extern void locks_remove_flock(struct file *); |
1117 | extern void locks_release_private(struct file_lock *); | ||
1050 | extern void posix_test_lock(struct file *, struct file_lock *); | 1118 | extern void posix_test_lock(struct file *, struct file_lock *); |
1051 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); | 1119 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); |
1052 | extern int posix_lock_file_wait(struct file *, struct file_lock *); | 1120 | extern int posix_lock_file_wait(struct file *, struct file_lock *); |
@@ -1063,34 +1131,147 @@ extern int lease_modify(struct file_lock **, int); | |||
1063 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1131 | 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); | 1132 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1065 | #else /* !CONFIG_FILE_LOCKING */ | 1133 | #else /* !CONFIG_FILE_LOCKING */ |
1066 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | 1134 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) |
1067 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | 1135 | { |
1136 | return -EINVAL; | ||
1137 | } | ||
1138 | |||
1139 | static inline int fcntl_setlk(unsigned int fd, struct file *file, | ||
1140 | unsigned int cmd, struct flock __user *user) | ||
1141 | { | ||
1142 | return -EACCES; | ||
1143 | } | ||
1144 | |||
1068 | #if BITS_PER_LONG == 32 | 1145 | #if BITS_PER_LONG == 32 |
1069 | #define fcntl_getlk64(a, b) ({ -EINVAL; }) | 1146 | static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user) |
1070 | #define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) | 1147 | { |
1148 | return -EINVAL; | ||
1149 | } | ||
1150 | |||
1151 | static inline int fcntl_setlk64(unsigned int fd, struct file *file, | ||
1152 | unsigned int cmd, struct flock64 __user *user) | ||
1153 | { | ||
1154 | return -EACCES; | ||
1155 | } | ||
1071 | #endif | 1156 | #endif |
1072 | #define fcntl_setlease(a, b, c) ({ 0; }) | 1157 | static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg) |
1073 | #define fcntl_getlease(a) ({ 0; }) | 1158 | { |
1074 | #define locks_init_lock(a) ({ }) | 1159 | return 0; |
1075 | #define __locks_copy_lock(a, b) ({ }) | 1160 | } |
1076 | #define locks_copy_lock(a, b) ({ }) | 1161 | |
1077 | #define locks_remove_posix(a, b) ({ }) | 1162 | static inline int fcntl_getlease(struct file *filp) |
1078 | #define locks_remove_flock(a) ({ }) | 1163 | { |
1079 | #define posix_test_lock(a, b) ({ 0; }) | 1164 | return 0; |
1080 | #define posix_lock_file(a, b, c) ({ -ENOLCK; }) | 1165 | } |
1081 | #define posix_lock_file_wait(a, b) ({ -ENOLCK; }) | 1166 | |
1082 | #define posix_unblock_lock(a, b) (-ENOENT) | 1167 | static inline void locks_init_lock(struct file_lock *fl) |
1083 | #define vfs_test_lock(a, b) ({ 0; }) | 1168 | { |
1084 | #define vfs_lock_file(a, b, c, d) (-ENOLCK) | 1169 | return; |
1085 | #define vfs_cancel_lock(a, b) ({ 0; }) | 1170 | } |
1086 | #define flock_lock_file_wait(a, b) ({ -ENOLCK; }) | 1171 | |
1087 | #define __break_lease(a, b) ({ 0; }) | 1172 | static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
1088 | #define lease_get_mtime(a, b) ({ }) | 1173 | { |
1089 | #define generic_setlease(a, b, c) ({ -EINVAL; }) | 1174 | return; |
1090 | #define vfs_setlease(a, b, c) ({ -EINVAL; }) | 1175 | } |
1091 | #define lease_modify(a, b) ({ -EINVAL; }) | 1176 | |
1092 | #define lock_may_read(a, b, c) ({ 1; }) | 1177 | static inline void locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
1093 | #define lock_may_write(a, b, c) ({ 1; }) | 1178 | { |
1179 | return; | ||
1180 | } | ||
1181 | |||
1182 | static inline void locks_remove_posix(struct file *filp, fl_owner_t owner) | ||
1183 | { | ||
1184 | return; | ||
1185 | } | ||
1186 | |||
1187 | static inline void locks_remove_flock(struct file *filp) | ||
1188 | { | ||
1189 | return; | ||
1190 | } | ||
1191 | |||
1192 | static inline void posix_test_lock(struct file *filp, struct file_lock *fl) | ||
1193 | { | ||
1194 | return; | ||
1195 | } | ||
1196 | |||
1197 | static inline int posix_lock_file(struct file *filp, struct file_lock *fl, | ||
1198 | struct file_lock *conflock) | ||
1199 | { | ||
1200 | return -ENOLCK; | ||
1201 | } | ||
1202 | |||
1203 | static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl) | ||
1204 | { | ||
1205 | return -ENOLCK; | ||
1206 | } | ||
1207 | |||
1208 | static inline int posix_unblock_lock(struct file *filp, | ||
1209 | struct file_lock *waiter) | ||
1210 | { | ||
1211 | return -ENOENT; | ||
1212 | } | ||
1213 | |||
1214 | static inline int vfs_test_lock(struct file *filp, struct file_lock *fl) | ||
1215 | { | ||
1216 | return 0; | ||
1217 | } | ||
1218 | |||
1219 | static inline int vfs_lock_file(struct file *filp, unsigned int cmd, | ||
1220 | struct file_lock *fl, struct file_lock *conf) | ||
1221 | { | ||
1222 | return -ENOLCK; | ||
1223 | } | ||
1224 | |||
1225 | static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl) | ||
1226 | { | ||
1227 | return 0; | ||
1228 | } | ||
1229 | |||
1230 | static inline int flock_lock_file_wait(struct file *filp, | ||
1231 | struct file_lock *request) | ||
1232 | { | ||
1233 | return -ENOLCK; | ||
1234 | } | ||
1235 | |||
1236 | static inline int __break_lease(struct inode *inode, unsigned int mode) | ||
1237 | { | ||
1238 | return 0; | ||
1239 | } | ||
1240 | |||
1241 | static inline void lease_get_mtime(struct inode *inode, struct timespec *time) | ||
1242 | { | ||
1243 | return; | ||
1244 | } | ||
1245 | |||
1246 | static inline int generic_setlease(struct file *filp, long arg, | ||
1247 | struct file_lock **flp) | ||
1248 | { | ||
1249 | return -EINVAL; | ||
1250 | } | ||
1251 | |||
1252 | static inline int vfs_setlease(struct file *filp, long arg, | ||
1253 | struct file_lock **lease) | ||
1254 | { | ||
1255 | return -EINVAL; | ||
1256 | } | ||
1257 | |||
1258 | static inline int lease_modify(struct file_lock **before, int arg) | ||
1259 | { | ||
1260 | return -EINVAL; | ||
1261 | } | ||
1262 | |||
1263 | static inline int lock_may_read(struct inode *inode, loff_t start, | ||
1264 | unsigned long len) | ||
1265 | { | ||
1266 | return 1; | ||
1267 | } | ||
1268 | |||
1269 | static inline int lock_may_write(struct inode *inode, loff_t start, | ||
1270 | unsigned long len) | ||
1271 | { | ||
1272 | return 1; | ||
1273 | } | ||
1274 | |||
1094 | #endif /* !CONFIG_FILE_LOCKING */ | 1275 | #endif /* !CONFIG_FILE_LOCKING */ |
1095 | 1276 | ||
1096 | 1277 | ||
@@ -1147,7 +1328,7 @@ struct super_block { | |||
1147 | struct rw_semaphore s_umount; | 1328 | struct rw_semaphore s_umount; |
1148 | struct mutex s_lock; | 1329 | struct mutex s_lock; |
1149 | int s_count; | 1330 | int s_count; |
1150 | int s_need_sync_fs; | 1331 | int s_need_sync; |
1151 | atomic_t s_active; | 1332 | atomic_t s_active; |
1152 | #ifdef CONFIG_SECURITY | 1333 | #ifdef CONFIG_SECURITY |
1153 | void *s_security; | 1334 | void *s_security; |
@@ -1198,11 +1379,6 @@ struct super_block { | |||
1198 | * generic_show_options() | 1379 | * generic_show_options() |
1199 | */ | 1380 | */ |
1200 | char *s_options; | 1381 | char *s_options; |
1201 | |||
1202 | /* | ||
1203 | * storage for asynchronous operations | ||
1204 | */ | ||
1205 | struct list_head s_async_list; | ||
1206 | }; | 1382 | }; |
1207 | 1383 | ||
1208 | extern struct timespec current_fs_time(struct super_block *sb); | 1384 | extern struct timespec current_fs_time(struct super_block *sb); |
@@ -1581,6 +1757,9 @@ struct file_system_type { | |||
1581 | struct lock_class_key i_alloc_sem_key; | 1757 | struct lock_class_key i_alloc_sem_key; |
1582 | }; | 1758 | }; |
1583 | 1759 | ||
1760 | extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, | ||
1761 | int (*fill_super)(struct super_block *, void *, int), | ||
1762 | struct vfsmount *mnt); | ||
1584 | extern int get_sb_bdev(struct file_system_type *fs_type, | 1763 | extern int get_sb_bdev(struct file_system_type *fs_type, |
1585 | int flags, const char *dev_name, void *data, | 1764 | int flags, const char *dev_name, void *data, |
1586 | int (*fill_super)(struct super_block *, void *, int), | 1765 | int (*fill_super)(struct super_block *, void *, int), |
@@ -1598,6 +1777,7 @@ void kill_block_super(struct super_block *sb); | |||
1598 | void kill_anon_super(struct super_block *sb); | 1777 | void kill_anon_super(struct super_block *sb); |
1599 | void kill_litter_super(struct super_block *sb); | 1778 | void kill_litter_super(struct super_block *sb); |
1600 | void deactivate_super(struct super_block *sb); | 1779 | void deactivate_super(struct super_block *sb); |
1780 | void deactivate_locked_super(struct super_block *sb); | ||
1601 | int set_anon_super(struct super_block *s, void *data); | 1781 | int set_anon_super(struct super_block *s, void *data); |
1602 | struct super_block *sget(struct file_system_type *type, | 1782 | struct super_block *sget(struct file_system_type *type, |
1603 | int (*test)(struct super_block *,void *), | 1783 | int (*test)(struct super_block *,void *), |
@@ -1606,7 +1786,7 @@ struct super_block *sget(struct file_system_type *type, | |||
1606 | extern int get_sb_pseudo(struct file_system_type *, char *, | 1786 | extern int get_sb_pseudo(struct file_system_type *, char *, |
1607 | const struct super_operations *ops, unsigned long, | 1787 | const struct super_operations *ops, unsigned long, |
1608 | struct vfsmount *mnt); | 1788 | struct vfsmount *mnt); |
1609 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1789 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1610 | int __put_super_and_need_restart(struct super_block *sb); | 1790 | int __put_super_and_need_restart(struct super_block *sb); |
1611 | 1791 | ||
1612 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1792 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
@@ -1622,11 +1802,13 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); | |||
1622 | extern int may_umount_tree(struct vfsmount *); | 1802 | extern int may_umount_tree(struct vfsmount *); |
1623 | extern int may_umount(struct vfsmount *); | 1803 | extern int may_umount(struct vfsmount *); |
1624 | extern long do_mount(char *, char *, char *, unsigned long, void *); | 1804 | extern long do_mount(char *, char *, char *, unsigned long, void *); |
1625 | extern struct vfsmount *collect_mounts(struct vfsmount *, struct dentry *); | 1805 | extern struct vfsmount *collect_mounts(struct path *); |
1626 | extern void drop_collected_mounts(struct vfsmount *); | 1806 | extern void drop_collected_mounts(struct vfsmount *); |
1627 | 1807 | ||
1628 | extern int vfs_statfs(struct dentry *, struct kstatfs *); | 1808 | extern int vfs_statfs(struct dentry *, struct kstatfs *); |
1629 | 1809 | ||
1810 | extern int current_umask(void); | ||
1811 | |||
1630 | /* /sys/fs */ | 1812 | /* /sys/fs */ |
1631 | extern struct kobject *fs_kobj; | 1813 | extern struct kobject *fs_kobj; |
1632 | 1814 | ||
@@ -1687,19 +1869,52 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1687 | return 0; | 1869 | return 0; |
1688 | } | 1870 | } |
1689 | #else /* !CONFIG_FILE_LOCKING */ | 1871 | #else /* !CONFIG_FILE_LOCKING */ |
1690 | #define locks_mandatory_locked(a) ({ 0; }) | 1872 | static inline int locks_mandatory_locked(struct inode *inode) |
1691 | #define locks_mandatory_area(a, b, c, d, e) ({ 0; }) | 1873 | { |
1692 | #define __mandatory_lock(a) ({ 0; }) | 1874 | return 0; |
1693 | #define mandatory_lock(a) ({ 0; }) | 1875 | } |
1694 | #define locks_verify_locked(a) ({ 0; }) | 1876 | |
1695 | #define locks_verify_truncate(a, b, c) ({ 0; }) | 1877 | static inline int locks_mandatory_area(int rw, struct inode *inode, |
1696 | #define break_lease(a, b) ({ 0; }) | 1878 | struct file *filp, loff_t offset, |
1879 | size_t count) | ||
1880 | { | ||
1881 | return 0; | ||
1882 | } | ||
1883 | |||
1884 | static inline int __mandatory_lock(struct inode *inode) | ||
1885 | { | ||
1886 | return 0; | ||
1887 | } | ||
1888 | |||
1889 | static inline int mandatory_lock(struct inode *inode) | ||
1890 | { | ||
1891 | return 0; | ||
1892 | } | ||
1893 | |||
1894 | static inline int locks_verify_locked(struct inode *inode) | ||
1895 | { | ||
1896 | return 0; | ||
1897 | } | ||
1898 | |||
1899 | static inline int locks_verify_truncate(struct inode *inode, struct file *filp, | ||
1900 | size_t size) | ||
1901 | { | ||
1902 | return 0; | ||
1903 | } | ||
1904 | |||
1905 | static inline int break_lease(struct inode *inode, unsigned int mode) | ||
1906 | { | ||
1907 | return 0; | ||
1908 | } | ||
1909 | |||
1697 | #endif /* CONFIG_FILE_LOCKING */ | 1910 | #endif /* CONFIG_FILE_LOCKING */ |
1698 | 1911 | ||
1699 | /* fs/open.c */ | 1912 | /* fs/open.c */ |
1700 | 1913 | ||
1701 | extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, | 1914 | extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, |
1702 | struct file *filp); | 1915 | struct file *filp); |
1916 | extern int do_fallocate(struct file *file, int mode, loff_t offset, | ||
1917 | loff_t len); | ||
1703 | extern long do_sys_open(int dfd, const char __user *filename, int flags, | 1918 | extern long do_sys_open(int dfd, const char __user *filename, int flags, |
1704 | int mode); | 1919 | int mode); |
1705 | extern struct file *filp_open(const char *, int, int); | 1920 | extern struct file *filp_open(const char *, int, int); |
@@ -1708,14 +1923,19 @@ extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, | |||
1708 | extern int filp_close(struct file *, fl_owner_t id); | 1923 | extern int filp_close(struct file *, fl_owner_t id); |
1709 | extern char * getname(const char __user *); | 1924 | extern char * getname(const char __user *); |
1710 | 1925 | ||
1926 | /* fs/ioctl.c */ | ||
1927 | |||
1928 | extern int ioctl_preallocate(struct file *filp, void __user *argp); | ||
1929 | |||
1711 | /* fs/dcache.c */ | 1930 | /* fs/dcache.c */ |
1712 | extern void __init vfs_caches_init_early(void); | 1931 | extern void __init vfs_caches_init_early(void); |
1713 | extern void __init vfs_caches_init(unsigned long); | 1932 | extern void __init vfs_caches_init(unsigned long); |
1714 | 1933 | ||
1715 | extern struct kmem_cache *names_cachep; | 1934 | extern struct kmem_cache *names_cachep; |
1716 | 1935 | ||
1717 | #define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) | 1936 | #define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp)) |
1718 | #define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) | 1937 | #define __getname() __getname_gfp(GFP_KERNEL) |
1938 | #define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) | ||
1719 | #ifndef CONFIG_AUDITSYSCALL | 1939 | #ifndef CONFIG_AUDITSYSCALL |
1720 | #define putname(name) __putname(name) | 1940 | #define putname(name) __putname(name) |
1721 | #else | 1941 | #else |
@@ -1730,9 +1950,28 @@ extern void bd_set_size(struct block_device *, loff_t size); | |||
1730 | extern void bd_forget(struct inode *inode); | 1950 | extern void bd_forget(struct inode *inode); |
1731 | extern void bdput(struct block_device *); | 1951 | extern void bdput(struct block_device *); |
1732 | extern struct block_device *open_by_devnum(dev_t, fmode_t); | 1952 | extern struct block_device *open_by_devnum(dev_t, fmode_t); |
1953 | extern void invalidate_bdev(struct block_device *); | ||
1954 | extern int sync_blockdev(struct block_device *bdev); | ||
1955 | extern struct super_block *freeze_bdev(struct block_device *); | ||
1956 | extern void emergency_thaw_all(void); | ||
1957 | extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); | ||
1958 | extern int fsync_bdev(struct block_device *); | ||
1733 | #else | 1959 | #else |
1734 | static inline void bd_forget(struct inode *inode) {} | 1960 | static inline void bd_forget(struct inode *inode) {} |
1961 | static inline int sync_blockdev(struct block_device *bdev) { return 0; } | ||
1962 | static inline void invalidate_bdev(struct block_device *bdev) {} | ||
1963 | |||
1964 | static inline struct super_block *freeze_bdev(struct block_device *sb) | ||
1965 | { | ||
1966 | return NULL; | ||
1967 | } | ||
1968 | |||
1969 | static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb) | ||
1970 | { | ||
1971 | return 0; | ||
1972 | } | ||
1735 | #endif | 1973 | #endif |
1974 | extern int sync_filesystem(struct super_block *); | ||
1736 | extern const struct file_operations def_blk_fops; | 1975 | extern const struct file_operations def_blk_fops; |
1737 | extern const struct file_operations def_chr_fops; | 1976 | extern const struct file_operations def_chr_fops; |
1738 | extern const struct file_operations bad_sock_fops; | 1977 | extern const struct file_operations bad_sock_fops; |
@@ -1812,9 +2051,6 @@ extern int __invalidate_device(struct block_device *); | |||
1812 | extern int invalidate_partition(struct gendisk *, int); | 2051 | extern int invalidate_partition(struct gendisk *, int); |
1813 | #endif | 2052 | #endif |
1814 | extern int invalidate_inodes(struct super_block *); | 2053 | extern int invalidate_inodes(struct super_block *); |
1815 | unsigned long __invalidate_mapping_pages(struct address_space *mapping, | ||
1816 | pgoff_t start, pgoff_t end, | ||
1817 | bool be_atomic); | ||
1818 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2054 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
1819 | pgoff_t start, pgoff_t end); | 2055 | pgoff_t start, pgoff_t end); |
1820 | 2056 | ||
@@ -1851,12 +2087,8 @@ extern int filemap_fdatawrite_range(struct address_space *mapping, | |||
1851 | 2087 | ||
1852 | extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); | 2088 | extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); |
1853 | extern void sync_supers(void); | 2089 | extern void sync_supers(void); |
1854 | extern void sync_filesystems(int wait); | ||
1855 | extern void __fsync_super(struct super_block *sb); | ||
1856 | extern void emergency_sync(void); | 2090 | extern void emergency_sync(void); |
1857 | extern void emergency_remount(void); | 2091 | extern void emergency_remount(void); |
1858 | extern int do_remount_sb(struct super_block *sb, int flags, | ||
1859 | void *data, int force); | ||
1860 | #ifdef CONFIG_BLOCK | 2092 | #ifdef CONFIG_BLOCK |
1861 | extern sector_t bmap(struct inode *, sector_t); | 2093 | extern sector_t bmap(struct inode *, sector_t); |
1862 | #endif | 2094 | #endif |
@@ -1881,14 +2113,13 @@ static inline void allow_write_access(struct file *file) | |||
1881 | if (file) | 2113 | if (file) |
1882 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2114 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); |
1883 | } | 2115 | } |
1884 | extern int do_pipe(int *); | ||
1885 | extern int do_pipe_flags(int *, int); | 2116 | extern int do_pipe_flags(int *, int); |
1886 | extern struct file *create_read_pipe(struct file *f, int flags); | 2117 | extern struct file *create_read_pipe(struct file *f, int flags); |
1887 | extern struct file *create_write_pipe(int flags); | 2118 | extern struct file *create_write_pipe(int flags); |
1888 | extern void free_write_pipe(struct file *); | 2119 | extern void free_write_pipe(struct file *); |
1889 | 2120 | ||
1890 | extern struct file *do_filp_open(int dfd, const char *pathname, | 2121 | extern struct file *do_filp_open(int dfd, const char *pathname, |
1891 | int open_flag, int mode); | 2122 | int open_flag, int mode, int acc_mode); |
1892 | extern int may_open(struct path *, int, int); | 2123 | extern int may_open(struct path *, int, int); |
1893 | 2124 | ||
1894 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 2125 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); |
@@ -1975,10 +2206,10 @@ extern int generic_segment_checks(const struct iovec *iov, | |||
1975 | /* fs/splice.c */ | 2206 | /* fs/splice.c */ |
1976 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, | 2207 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, |
1977 | struct pipe_inode_info *, size_t, unsigned int); | 2208 | struct pipe_inode_info *, size_t, unsigned int); |
2209 | extern ssize_t default_file_splice_read(struct file *, loff_t *, | ||
2210 | struct pipe_inode_info *, size_t, unsigned int); | ||
1978 | extern ssize_t generic_file_splice_write(struct pipe_inode_info *, | 2211 | extern ssize_t generic_file_splice_write(struct pipe_inode_info *, |
1979 | struct file *, loff_t *, size_t, unsigned int); | 2212 | struct file *, loff_t *, size_t, unsigned int); |
1980 | extern ssize_t generic_file_splice_write_nolock(struct pipe_inode_info *, | ||
1981 | struct file *, loff_t *, size_t, unsigned int); | ||
1982 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, | 2213 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, |
1983 | struct file *out, loff_t *, size_t len, unsigned int flags); | 2214 | struct file *out, loff_t *, size_t len, unsigned int flags); |
1984 | extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | 2215 | extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, |
@@ -2072,9 +2303,8 @@ extern int vfs_readdir(struct file *, filldir_t, void *); | |||
2072 | 2303 | ||
2073 | extern int vfs_stat(char __user *, struct kstat *); | 2304 | extern int vfs_stat(char __user *, struct kstat *); |
2074 | extern int vfs_lstat(char __user *, struct kstat *); | 2305 | extern int vfs_lstat(char __user *, struct kstat *); |
2075 | extern int vfs_stat_fd(int dfd, char __user *, struct kstat *); | ||
2076 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); | ||
2077 | extern int vfs_fstat(unsigned int, struct kstat *); | 2306 | extern int vfs_fstat(unsigned int, struct kstat *); |
2307 | extern int vfs_fstatat(int , char __user *, struct kstat *, int); | ||
2078 | 2308 | ||
2079 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 2309 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
2080 | unsigned long arg); | 2310 | unsigned long arg); |
@@ -2127,6 +2357,8 @@ extern void simple_release_fs(struct vfsmount **mount, int *count); | |||
2127 | extern ssize_t simple_read_from_buffer(void __user *to, size_t count, | 2357 | extern ssize_t simple_read_from_buffer(void __user *to, size_t count, |
2128 | loff_t *ppos, const void *from, size_t available); | 2358 | loff_t *ppos, const void *from, size_t available); |
2129 | 2359 | ||
2360 | extern int simple_fsync(struct file *, struct dentry *, int); | ||
2361 | |||
2130 | #ifdef CONFIG_MIGRATION | 2362 | #ifdef CONFIG_MIGRATION |
2131 | extern int buffer_migrate_page(struct address_space *, | 2363 | extern int buffer_migrate_page(struct address_space *, |
2132 | struct page *, struct page *); | 2364 | struct page *, struct page *); |
@@ -2141,6 +2373,7 @@ extern void file_update_time(struct file *file); | |||
2141 | 2373 | ||
2142 | extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); | 2374 | extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); |
2143 | extern void save_mount_options(struct super_block *sb, char *options); | 2375 | extern void save_mount_options(struct super_block *sb, char *options); |
2376 | extern void replace_mount_options(struct super_block *sb, char *options); | ||
2144 | 2377 | ||
2145 | static inline ino_t parent_ino(struct dentry *dentry) | 2378 | static inline ino_t parent_ino(struct dentry *dentry) |
2146 | { | 2379 | { |
@@ -2171,19 +2404,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf, | |||
2171 | size_t size, loff_t *pos); | 2404 | size_t size, loff_t *pos); |
2172 | int simple_transaction_release(struct inode *inode, struct file *file); | 2405 | int simple_transaction_release(struct inode *inode, struct file *file); |
2173 | 2406 | ||
2174 | static inline void simple_transaction_set(struct file *file, size_t n) | 2407 | void simple_transaction_set(struct file *file, size_t n); |
2175 | { | ||
2176 | struct simple_transaction_argresp *ar = file->private_data; | ||
2177 | |||
2178 | BUG_ON(n > SIMPLE_TRANSACTION_LIMIT); | ||
2179 | |||
2180 | /* | ||
2181 | * The barrier ensures that ar->size will really remain zero until | ||
2182 | * ar->data is ready for reading. | ||
2183 | */ | ||
2184 | smp_mb(); | ||
2185 | ar->size = n; | ||
2186 | } | ||
2187 | 2408 | ||
2188 | /* | 2409 | /* |
2189 | * simple attribute files | 2410 | * simple attribute files |
@@ -2230,32 +2451,11 @@ ssize_t simple_attr_read(struct file *file, char __user *buf, | |||
2230 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | 2451 | ssize_t simple_attr_write(struct file *file, const char __user *buf, |
2231 | size_t len, loff_t *ppos); | 2452 | size_t len, loff_t *ppos); |
2232 | 2453 | ||
2233 | |||
2234 | #ifdef CONFIG_SECURITY | ||
2235 | static inline char *alloc_secdata(void) | ||
2236 | { | ||
2237 | return (char *)get_zeroed_page(GFP_KERNEL); | ||
2238 | } | ||
2239 | |||
2240 | static inline void free_secdata(void *secdata) | ||
2241 | { | ||
2242 | free_page((unsigned long)secdata); | ||
2243 | } | ||
2244 | #else | ||
2245 | static inline char *alloc_secdata(void) | ||
2246 | { | ||
2247 | return (char *)1; | ||
2248 | } | ||
2249 | |||
2250 | static inline void free_secdata(void *secdata) | ||
2251 | { } | ||
2252 | #endif /* CONFIG_SECURITY */ | ||
2253 | |||
2254 | struct ctl_table; | 2454 | struct ctl_table; |
2255 | int proc_nr_files(struct ctl_table *table, int write, struct file *filp, | 2455 | int proc_nr_files(struct ctl_table *table, int write, struct file *filp, |
2256 | void __user *buffer, size_t *lenp, loff_t *ppos); | 2456 | void __user *buffer, size_t *lenp, loff_t *ppos); |
2257 | 2457 | ||
2258 | int get_filesystem_list(char * buf); | 2458 | int __init get_filesystem_list(char *buf); |
2259 | 2459 | ||
2260 | #endif /* __KERNEL__ */ | 2460 | #endif /* __KERNEL__ */ |
2261 | #endif /* _LINUX_FS_H */ | 2461 | #endif /* _LINUX_FS_H */ |