diff options
Diffstat (limited to 'include/linux/fs.h')
| -rw-r--r-- | include/linux/fs.h | 96 | 
1 files changed, 68 insertions, 28 deletions
| diff --git a/include/linux/fs.h b/include/linux/fs.h index cc35b6ac778d..84bb449b9b01 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #include <linux/config.h> | 9 | #include <linux/config.h> | 
| 10 | #include <linux/limits.h> | 10 | #include <linux/limits.h> | 
| 11 | #include <linux/ioctl.h> | 11 | #include <linux/ioctl.h> | 
| 12 | #include <linux/rcuref.h> | ||
| 13 | 12 | ||
| 14 | /* | 13 | /* | 
| 15 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change | 14 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change | 
| @@ -104,19 +103,18 @@ extern int dir_notify_enable; | |||
| 104 | #define MS_MOVE 8192 | 103 | #define MS_MOVE 8192 | 
| 105 | #define MS_REC 16384 | 104 | #define MS_REC 16384 | 
| 106 | #define MS_VERBOSE 32768 | 105 | #define MS_VERBOSE 32768 | 
| 106 | #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ | ||
| 107 | #define MS_UNBINDABLE (1<<17) /* change to unbindable */ | 107 | #define MS_UNBINDABLE (1<<17) /* change to unbindable */ | 
| 108 | #define MS_PRIVATE (1<<18) /* change to private */ | 108 | #define MS_PRIVATE (1<<18) /* change to private */ | 
| 109 | #define MS_SLAVE (1<<19) /* change to slave */ | 109 | #define MS_SLAVE (1<<19) /* change to slave */ | 
| 110 | #define MS_SHARED (1<<20) /* change to shared */ | 110 | #define MS_SHARED (1<<20) /* change to shared */ | 
| 111 | #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ | ||
| 112 | #define MS_ACTIVE (1<<30) | 111 | #define MS_ACTIVE (1<<30) | 
| 113 | #define MS_NOUSER (1<<31) | 112 | #define MS_NOUSER (1<<31) | 
| 114 | 113 | ||
| 115 | /* | 114 | /* | 
| 116 | * Superblock flags that can be altered by MS_REMOUNT | 115 | * Superblock flags that can be altered by MS_REMOUNT | 
| 117 | */ | 116 | */ | 
| 118 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\ | 117 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK) | 
| 119 | MS_NODIRATIME) | ||
| 120 | 118 | ||
| 121 | /* | 119 | /* | 
| 122 | * Old magic mount flag and mask | 120 | * Old magic mount flag and mask | 
| @@ -162,8 +160,6 @@ extern int dir_notify_enable; | |||
| 162 | #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) | 160 | #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) | 
| 163 | #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) | 161 | #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) | 
| 164 | #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) | 162 | #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) | 
| 165 | #define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME)) | ||
| 166 | #define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME) | ||
| 167 | #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) | 163 | #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) | 
| 168 | 164 | ||
| 169 | #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) | 165 | #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) | 
| @@ -220,11 +216,13 @@ extern int dir_notify_enable; | |||
| 220 | #include <linux/prio_tree.h> | 216 | #include <linux/prio_tree.h> | 
| 221 | #include <linux/init.h> | 217 | #include <linux/init.h> | 
| 222 | #include <linux/sched.h> | 218 | #include <linux/sched.h> | 
| 219 | #include <linux/mutex.h> | ||
| 223 | 220 | ||
| 224 | #include <asm/atomic.h> | 221 | #include <asm/atomic.h> | 
| 225 | #include <asm/semaphore.h> | 222 | #include <asm/semaphore.h> | 
| 226 | #include <asm/byteorder.h> | 223 | #include <asm/byteorder.h> | 
| 227 | 224 | ||
| 225 | struct hd_geometry; | ||
| 228 | struct iovec; | 226 | struct iovec; | 
| 229 | struct nameidata; | 227 | struct nameidata; | 
| 230 | struct kiocb; | 228 | struct kiocb; | 
| @@ -234,9 +232,6 @@ struct kstatfs; | |||
| 234 | struct vm_area_struct; | 232 | struct vm_area_struct; | 
| 235 | struct vfsmount; | 233 | struct vfsmount; | 
| 236 | 234 | ||
| 237 | /* Used to be a macro which just called the function, now just a function */ | ||
| 238 | extern void update_atime (struct inode *); | ||
| 239 | |||
| 240 | extern void __init inode_init(unsigned long); | 235 | extern void __init inode_init(unsigned long); | 
| 241 | extern void __init inode_init_early(void); | 236 | extern void __init inode_init_early(void); | 
| 242 | extern void __init mnt_init(unsigned long); | 237 | extern void __init mnt_init(unsigned long); | 
| @@ -302,6 +297,37 @@ struct iattr { | |||
| 302 | */ | 297 | */ | 
| 303 | #include <linux/quota.h> | 298 | #include <linux/quota.h> | 
| 304 | 299 | ||
| 300 | /** | ||
| 301 | * enum positive_aop_returns - aop return codes with specific semantics | ||
| 302 | * | ||
| 303 | * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has | ||
| 304 | * completed, that the page is still locked, and | ||
| 305 | * should be considered active. The VM uses this hint | ||
| 306 | * to return the page to the active list -- it won't | ||
| 307 | * be a candidate for writeback again in the near | ||
| 308 | * future. Other callers must be careful to unlock | ||
| 309 | * the page if they get this return. Returned by | ||
| 310 | * writepage(); | ||
| 311 | * | ||
| 312 | * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has | ||
| 313 | * unlocked it and the page might have been truncated. | ||
| 314 | * The caller should back up to acquiring a new page and | ||
| 315 | * trying again. The aop will be taking reasonable | ||
| 316 | * precautions not to livelock. If the caller held a page | ||
| 317 | * reference, it should drop it before retrying. Returned | ||
| 318 | * by readpage(), prepare_write(), and commit_write(). | ||
| 319 | * | ||
| 320 | * address_space_operation functions return these large constants to indicate | ||
| 321 | * special semantics to the caller. These are much larger than the bytes in a | ||
| 322 | * page to allow for functions that return the number of bytes operated on in a | ||
| 323 | * given page. | ||
| 324 | */ | ||
| 325 | |||
| 326 | enum positive_aop_returns { | ||
| 327 | AOP_WRITEPAGE_ACTIVATE = 0x80000, | ||
| 328 | AOP_TRUNCATED_PAGE = 0x80001, | ||
| 329 | }; | ||
| 330 | |||
| 305 | /* | 331 | /* | 
| 306 | * oh the beauties of C type declarations. | 332 | * oh the beauties of C type declarations. | 
| 307 | */ | 333 | */ | 
| @@ -453,7 +479,7 @@ struct inode { | |||
| 453 | unsigned long i_blocks; | 479 | unsigned long i_blocks; | 
| 454 | unsigned short i_bytes; | 480 | unsigned short i_bytes; | 
| 455 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 481 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 
| 456 | struct semaphore i_sem; | 482 | struct mutex i_mutex; | 
| 457 | struct rw_semaphore i_alloc_sem; | 483 | struct rw_semaphore i_alloc_sem; | 
| 458 | struct inode_operations *i_op; | 484 | struct inode_operations *i_op; | 
| 459 | struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | 485 | struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | 
| @@ -622,7 +648,7 @@ extern spinlock_t files_lock; | |||
| 622 | #define file_list_lock() spin_lock(&files_lock); | 648 | #define file_list_lock() spin_lock(&files_lock); | 
| 623 | #define file_list_unlock() spin_unlock(&files_lock); | 649 | #define file_list_unlock() spin_unlock(&files_lock); | 
| 624 | 650 | ||
| 625 | #define get_file(x) rcuref_inc(&(x)->f_count) | 651 | #define get_file(x) atomic_inc(&(x)->f_count) | 
| 626 | #define file_count(x) atomic_read(&(x)->f_count) | 652 | #define file_count(x) atomic_read(&(x)->f_count) | 
| 627 | 653 | ||
| 628 | #define MAX_NON_LFS ((1UL<<31) - 1) | 654 | #define MAX_NON_LFS ((1UL<<31) - 1) | 
| @@ -729,7 +755,7 @@ extern struct file_lock *posix_test_lock(struct file *, struct file_lock *); | |||
| 729 | extern int posix_lock_file(struct file *, struct file_lock *); | 755 | extern int posix_lock_file(struct file *, struct file_lock *); | 
| 730 | extern int posix_lock_file_wait(struct file *, struct file_lock *); | 756 | extern int posix_lock_file_wait(struct file *, struct file_lock *); | 
| 731 | extern void posix_block_lock(struct file_lock *, struct file_lock *); | 757 | extern void posix_block_lock(struct file_lock *, struct file_lock *); | 
| 732 | extern void posix_unblock_lock(struct file *, struct file_lock *); | 758 | extern int posix_unblock_lock(struct file *, struct file_lock *); | 
| 733 | extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); | 759 | extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); | 
| 734 | extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); | 760 | extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); | 
| 735 | extern int __break_lease(struct inode *inode, unsigned int flags); | 761 | extern int __break_lease(struct inode *inode, unsigned int flags); | 
| @@ -777,7 +803,6 @@ struct super_block { | |||
| 777 | struct list_head s_list; /* Keep this first */ | 803 | struct list_head s_list; /* Keep this first */ | 
| 778 | dev_t s_dev; /* search index; _not_ kdev_t */ | 804 | dev_t s_dev; /* search index; _not_ kdev_t */ | 
| 779 | unsigned long s_blocksize; | 805 | unsigned long s_blocksize; | 
| 780 | unsigned long s_old_blocksize; | ||
| 781 | unsigned char s_blocksize_bits; | 806 | unsigned char s_blocksize_bits; | 
| 782 | unsigned char s_dirt; | 807 | unsigned char s_dirt; | 
| 783 | unsigned long long s_maxbytes; /* Max file size */ | 808 | unsigned long long s_maxbytes; /* Max file size */ | 
| @@ -790,7 +815,7 @@ struct super_block { | |||
| 790 | unsigned long s_magic; | 815 | unsigned long s_magic; | 
| 791 | struct dentry *s_root; | 816 | struct dentry *s_root; | 
| 792 | struct rw_semaphore s_umount; | 817 | struct rw_semaphore s_umount; | 
| 793 | struct semaphore s_lock; | 818 | struct mutex s_lock; | 
| 794 | int s_count; | 819 | int s_count; | 
| 795 | int s_syncing; | 820 | int s_syncing; | 
| 796 | int s_need_sync_fs; | 821 | int s_need_sync_fs; | 
| @@ -862,13 +887,13 @@ static inline int has_fs_excl(void) | |||
| 862 | static inline void lock_super(struct super_block * sb) | 887 | static inline void lock_super(struct super_block * sb) | 
| 863 | { | 888 | { | 
| 864 | get_fs_excl(); | 889 | get_fs_excl(); | 
| 865 | down(&sb->s_lock); | 890 | mutex_lock(&sb->s_lock); | 
| 866 | } | 891 | } | 
| 867 | 892 | ||
| 868 | static inline void unlock_super(struct super_block * sb) | 893 | static inline void unlock_super(struct super_block * sb) | 
| 869 | { | 894 | { | 
| 870 | put_fs_excl(); | 895 | put_fs_excl(); | 
| 871 | up(&sb->s_lock); | 896 | mutex_unlock(&sb->s_lock); | 
| 872 | } | 897 | } | 
| 873 | 898 | ||
| 874 | /* | 899 | /* | 
| @@ -932,6 +957,7 @@ struct block_device_operations { | |||
| 932 | int (*direct_access) (struct block_device *, sector_t, unsigned long *); | 957 | int (*direct_access) (struct block_device *, sector_t, unsigned long *); | 
| 933 | int (*media_changed) (struct gendisk *); | 958 | int (*media_changed) (struct gendisk *); | 
| 934 | int (*revalidate_disk) (struct gendisk *); | 959 | int (*revalidate_disk) (struct gendisk *); | 
| 960 | int (*getgeo)(struct block_device *, struct hd_geometry *); | ||
| 935 | struct module *owner; | 961 | struct module *owner; | 
| 936 | }; | 962 | }; | 
| 937 | 963 | ||
| @@ -1019,6 +1045,7 @@ struct inode_operations { | |||
| 1019 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 1045 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 
| 1020 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 1046 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 
| 1021 | int (*removexattr) (struct dentry *, const char *); | 1047 | int (*removexattr) (struct dentry *, const char *); | 
| 1048 | void (*truncate_range)(struct inode *, loff_t, loff_t); | ||
| 1022 | }; | 1049 | }; | 
| 1023 | 1050 | ||
| 1024 | struct seq_file; | 1051 | struct seq_file; | 
| @@ -1085,12 +1112,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode) | |||
| 1085 | __mark_inode_dirty(inode, I_DIRTY_SYNC); | 1112 | __mark_inode_dirty(inode, I_DIRTY_SYNC); | 
| 1086 | } | 1113 | } | 
| 1087 | 1114 | ||
| 1088 | static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry) | 1115 | extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); | 
| 1089 | { | ||
| 1090 | /* per-mountpoint checks will go here */ | ||
| 1091 | update_atime(dentry->d_inode); | ||
| 1092 | } | ||
| 1093 | |||
| 1094 | static inline void file_accessed(struct file *file) | 1116 | static inline void file_accessed(struct file *file) | 
| 1095 | { | 1117 | { | 
| 1096 | if (!(file->f_flags & O_NOATIME)) | 1118 | if (!(file->f_flags & O_NOATIME)) | 
| @@ -1159,7 +1181,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc); | |||
| 1159 | * directory. The name should be stored in the @name (with the | 1181 | * directory. The name should be stored in the @name (with the | 
| 1160 | * understanding that it is already pointing to a a %NAME_MAX+1 sized | 1182 | * understanding that it is already pointing to a a %NAME_MAX+1 sized | 
| 1161 | * buffer. get_name() should return %0 on success, a negative error code | 1183 | * buffer. get_name() should return %0 on success, a negative error code | 
| 1162 | * or error. @get_name will be called without @parent->i_sem held. | 1184 | * or error. @get_name will be called without @parent->i_mutex held. | 
| 1163 | * | 1185 | * | 
| 1164 | * get_parent: | 1186 | * get_parent: | 
| 1165 | * @get_parent should find the parent directory for the given @child which | 1187 | * @get_parent should find the parent directory for the given @child which | 
| @@ -1181,7 +1203,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc); | |||
| 1181 | * nfsd_find_fh_dentry() in either the @obj or @parent parameters. | 1203 | * nfsd_find_fh_dentry() in either the @obj or @parent parameters. | 
| 1182 | * | 1204 | * | 
| 1183 | * Locking rules: | 1205 | * Locking rules: | 
| 1184 | * get_parent is called with child->d_inode->i_sem down | 1206 | * get_parent is called with child->d_inode->i_mutex down | 
| 1185 | * get_name is not (which is possibly inconsistent) | 1207 | * get_name is not (which is possibly inconsistent) | 
| 1186 | */ | 1208 | */ | 
| 1187 | 1209 | ||
| @@ -1268,6 +1290,9 @@ extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, | |||
| 1268 | 1290 | ||
| 1269 | extern int vfs_statfs(struct super_block *, struct kstatfs *); | 1291 | extern int vfs_statfs(struct super_block *, struct kstatfs *); | 
| 1270 | 1292 | ||
| 1293 | /* /sys/fs */ | ||
| 1294 | extern struct subsystem fs_subsys; | ||
| 1295 | |||
| 1271 | #define FLOCK_VERIFY_READ 1 | 1296 | #define FLOCK_VERIFY_READ 1 | 
| 1272 | #define FLOCK_VERIFY_WRITE 2 | 1297 | #define FLOCK_VERIFY_WRITE 2 | 
| 1273 | 1298 | ||
| @@ -1313,8 +1338,10 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
| 1313 | 1338 | ||
| 1314 | /* fs/open.c */ | 1339 | /* fs/open.c */ | 
| 1315 | 1340 | ||
| 1316 | extern int do_truncate(struct dentry *, loff_t start, struct file *filp); | 1341 | extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, | 
| 1317 | extern long do_sys_open(const char __user *filename, int flags, int mode); | 1342 | struct file *filp); | 
| 1343 | extern long do_sys_open(int fdf, const char __user *filename, int flags, | ||
| 1344 | int mode); | ||
| 1318 | extern struct file *filp_open(const char *, int, int); | 1345 | extern struct file *filp_open(const char *, int, int); | 
| 1319 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); | 1346 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); | 
| 1320 | extern int filp_close(struct file *, fl_owner_t id); | 1347 | extern int filp_close(struct file *, fl_owner_t id); | 
| @@ -1360,6 +1387,12 @@ extern int register_chrdev(unsigned int, const char *, | |||
| 1360 | extern int unregister_chrdev(unsigned int, const char *); | 1387 | extern int unregister_chrdev(unsigned int, const char *); | 
| 1361 | extern void unregister_chrdev_region(dev_t, unsigned); | 1388 | extern void unregister_chrdev_region(dev_t, unsigned); | 
| 1362 | extern int chrdev_open(struct inode *, struct file *); | 1389 | extern int chrdev_open(struct inode *, struct file *); | 
| 1390 | extern int get_chrdev_list(char *); | ||
| 1391 | extern void *acquire_chrdev_list(void); | ||
| 1392 | extern int count_chrdev_list(void); | ||
| 1393 | extern void *get_next_chrdev(void *); | ||
| 1394 | extern int get_chrdev_info(void *, int *, char **); | ||
| 1395 | extern void release_chrdev_list(void *); | ||
| 1363 | 1396 | ||
| 1364 | /* fs/block_dev.c */ | 1397 | /* fs/block_dev.c */ | 
| 1365 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ | 1398 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ | 
| @@ -1368,6 +1401,11 @@ extern const char *bdevname(struct block_device *bdev, char *buffer); | |||
| 1368 | extern struct block_device *lookup_bdev(const char *); | 1401 | extern struct block_device *lookup_bdev(const char *); | 
| 1369 | extern struct block_device *open_bdev_excl(const char *, int, void *); | 1402 | extern struct block_device *open_bdev_excl(const char *, int, void *); | 
| 1370 | extern void close_bdev_excl(struct block_device *); | 1403 | extern void close_bdev_excl(struct block_device *); | 
| 1404 | extern void *acquire_blkdev_list(void); | ||
| 1405 | extern int count_blkdev_list(void); | ||
| 1406 | extern void *get_next_blkdev(void *); | ||
| 1407 | extern int get_blkdev_info(void *, int *, char **); | ||
| 1408 | extern void release_blkdev_list(void *); | ||
| 1371 | 1409 | ||
| 1372 | extern void init_special_inode(struct inode *, umode_t, dev_t); | 1410 | extern void init_special_inode(struct inode *, umode_t, dev_t); | 
| 1373 | 1411 | ||
| @@ -1442,7 +1480,7 @@ static inline void allow_write_access(struct file *file) | |||
| 1442 | } | 1480 | } | 
| 1443 | extern int do_pipe(int *); | 1481 | extern int do_pipe(int *); | 
| 1444 | 1482 | ||
| 1445 | extern int open_namei(const char *, int, int, struct nameidata *); | 1483 | extern int open_namei(int dfd, const char *, int, int, struct nameidata *); | 
| 1446 | extern int may_open(struct nameidata *, int, int); | 1484 | extern int may_open(struct nameidata *, int, int); | 
| 1447 | 1485 | ||
| 1448 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 1486 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 
| @@ -1640,6 +1678,8 @@ extern int vfs_readdir(struct file *, filldir_t, void *); | |||
| 1640 | 1678 | ||
| 1641 | extern int vfs_stat(char __user *, struct kstat *); | 1679 | extern int vfs_stat(char __user *, struct kstat *); | 
| 1642 | extern int vfs_lstat(char __user *, struct kstat *); | 1680 | extern int vfs_lstat(char __user *, struct kstat *); | 
| 1681 | extern int vfs_stat_fd(int dfd, char __user *, struct kstat *); | ||
| 1682 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); | ||
| 1643 | extern int vfs_fstat(unsigned int, struct kstat *); | 1683 | extern int vfs_fstat(unsigned int, struct kstat *); | 
| 1644 | 1684 | ||
| 1645 | extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long); | 1685 | extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long); | 
| @@ -1682,7 +1722,7 @@ extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const vo | |||
| 1682 | extern int inode_change_ok(struct inode *, struct iattr *); | 1722 | extern int inode_change_ok(struct inode *, struct iattr *); | 
| 1683 | extern int __must_check inode_setattr(struct inode *, struct iattr *); | 1723 | extern int __must_check inode_setattr(struct inode *, struct iattr *); | 
| 1684 | 1724 | ||
| 1685 | extern void inode_update_time(struct inode *inode, int ctime_too); | 1725 | extern void file_update_time(struct file *file); | 
| 1686 | 1726 | ||
| 1687 | static inline ino_t parent_ino(struct dentry *dentry) | 1727 | static inline ino_t parent_ino(struct dentry *dentry) | 
| 1688 | { | 1728 | { | 
