diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 86 |
1 files changed, 79 insertions, 7 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 32477e8872d5..a6a625be13fc 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -234,6 +234,7 @@ extern int dir_notify_enable; | |||
234 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) | 234 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) |
235 | #define FS_IOC_GETVERSION _IOR('v', 1, long) | 235 | #define FS_IOC_GETVERSION _IOR('v', 1, long) |
236 | #define FS_IOC_SETVERSION _IOW('v', 2, long) | 236 | #define FS_IOC_SETVERSION _IOW('v', 2, long) |
237 | #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) | ||
237 | #define FS_IOC32_GETFLAGS _IOR('f', 1, int) | 238 | #define FS_IOC32_GETFLAGS _IOR('f', 1, int) |
238 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) | 239 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) |
239 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) | 240 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) |
@@ -294,6 +295,7 @@ extern int dir_notify_enable; | |||
294 | #include <linux/mutex.h> | 295 | #include <linux/mutex.h> |
295 | #include <linux/capability.h> | 296 | #include <linux/capability.h> |
296 | #include <linux/semaphore.h> | 297 | #include <linux/semaphore.h> |
298 | #include <linux/fiemap.h> | ||
297 | 299 | ||
298 | #include <asm/atomic.h> | 300 | #include <asm/atomic.h> |
299 | #include <asm/byteorder.h> | 301 | #include <asm/byteorder.h> |
@@ -945,6 +947,14 @@ struct lock_manager_operations { | |||
945 | int (*fl_change)(struct file_lock **, int); | 947 | int (*fl_change)(struct file_lock **, int); |
946 | }; | 948 | }; |
947 | 949 | ||
950 | struct lock_manager { | ||
951 | struct list_head list; | ||
952 | }; | ||
953 | |||
954 | void locks_start_grace(struct lock_manager *); | ||
955 | void locks_end_grace(struct lock_manager *); | ||
956 | int locks_in_grace(void); | ||
957 | |||
948 | /* that will die - we need it for nfs_lock_info */ | 958 | /* that will die - we need it for nfs_lock_info */ |
949 | #include <linux/nfs_fs_i.h> | 959 | #include <linux/nfs_fs_i.h> |
950 | 960 | ||
@@ -986,6 +996,13 @@ struct file_lock { | |||
986 | 996 | ||
987 | #include <linux/fcntl.h> | 997 | #include <linux/fcntl.h> |
988 | 998 | ||
999 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
1000 | |||
1001 | /* fs/sync.c */ | ||
1002 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1003 | loff_t endbyte, unsigned int flags); | ||
1004 | |||
1005 | #ifdef CONFIG_FILE_LOCKING | ||
989 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1006 | extern int fcntl_getlk(struct file *, struct flock __user *); |
990 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1007 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
991 | struct flock __user *); | 1008 | struct flock __user *); |
@@ -996,14 +1013,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, | |||
996 | struct flock64 __user *); | 1013 | struct flock64 __user *); |
997 | #endif | 1014 | #endif |
998 | 1015 | ||
999 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
1000 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | 1016 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); |
1001 | extern int fcntl_getlease(struct file *filp); | 1017 | extern int fcntl_getlease(struct file *filp); |
1002 | 1018 | ||
1003 | /* fs/sync.c */ | ||
1004 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1005 | loff_t endbyte, unsigned int flags); | ||
1006 | |||
1007 | /* fs/locks.c */ | 1019 | /* fs/locks.c */ |
1008 | extern void locks_init_lock(struct file_lock *); | 1020 | extern void locks_init_lock(struct file_lock *); |
1009 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1021 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
@@ -1026,6 +1038,37 @@ extern int lease_modify(struct file_lock **, int); | |||
1026 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1038 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1027 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1039 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1028 | extern struct seq_operations locks_seq_operations; | 1040 | extern struct seq_operations locks_seq_operations; |
1041 | #else /* !CONFIG_FILE_LOCKING */ | ||
1042 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | ||
1043 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | ||
1044 | #if BITS_PER_LONG == 32 | ||
1045 | #define fcntl_getlk64(a, b) ({ -EINVAL; }) | ||
1046 | #define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) | ||
1047 | #endif | ||
1048 | #define fcntl_setlease(a, b, c) ({ 0; }) | ||
1049 | #define fcntl_getlease(a) ({ 0; }) | ||
1050 | #define locks_init_lock(a) ({ }) | ||
1051 | #define __locks_copy_lock(a, b) ({ }) | ||
1052 | #define locks_copy_lock(a, b) ({ }) | ||
1053 | #define locks_remove_posix(a, b) ({ }) | ||
1054 | #define locks_remove_flock(a) ({ }) | ||
1055 | #define posix_test_lock(a, b) ({ 0; }) | ||
1056 | #define posix_lock_file(a, b, c) ({ -ENOLCK; }) | ||
1057 | #define posix_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1058 | #define posix_unblock_lock(a, b) (-ENOENT) | ||
1059 | #define vfs_test_lock(a, b) ({ 0; }) | ||
1060 | #define vfs_lock_file(a, b, c, d) (-ENOLCK) | ||
1061 | #define vfs_cancel_lock(a, b) ({ 0; }) | ||
1062 | #define flock_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1063 | #define __break_lease(a, b) ({ 0; }) | ||
1064 | #define lease_get_mtime(a, b) ({ }) | ||
1065 | #define generic_setlease(a, b, c) ({ -EINVAL; }) | ||
1066 | #define vfs_setlease(a, b, c) ({ -EINVAL; }) | ||
1067 | #define lease_modify(a, b) ({ -EINVAL; }) | ||
1068 | #define lock_may_read(a, b, c) ({ 1; }) | ||
1069 | #define lock_may_write(a, b, c) ({ 1; }) | ||
1070 | #endif /* !CONFIG_FILE_LOCKING */ | ||
1071 | |||
1029 | 1072 | ||
1030 | struct fasync_struct { | 1073 | struct fasync_struct { |
1031 | int magic; | 1074 | int magic; |
@@ -1182,6 +1225,20 @@ extern void dentry_unhash(struct dentry *dentry); | |||
1182 | extern int file_permission(struct file *, int); | 1225 | extern int file_permission(struct file *, int); |
1183 | 1226 | ||
1184 | /* | 1227 | /* |
1228 | * VFS FS_IOC_FIEMAP helper definitions. | ||
1229 | */ | ||
1230 | struct fiemap_extent_info { | ||
1231 | unsigned int fi_flags; /* Flags as passed from user */ | ||
1232 | unsigned int fi_extents_mapped; /* Number of mapped extents */ | ||
1233 | unsigned int fi_extents_max; /* Size of fiemap_extent array */ | ||
1234 | struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent | ||
1235 | * array */ | ||
1236 | }; | ||
1237 | int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, | ||
1238 | u64 phys, u64 len, u32 flags); | ||
1239 | int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); | ||
1240 | |||
1241 | /* | ||
1185 | * File types | 1242 | * File types |
1186 | * | 1243 | * |
1187 | * NOTE! These match bits 12..15 of stat.st_mode | 1244 | * NOTE! These match bits 12..15 of stat.st_mode |
@@ -1290,6 +1347,8 @@ struct inode_operations { | |||
1290 | void (*truncate_range)(struct inode *, loff_t, loff_t); | 1347 | void (*truncate_range)(struct inode *, loff_t, loff_t); |
1291 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, | 1348 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, |
1292 | loff_t len); | 1349 | loff_t len); |
1350 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | ||
1351 | u64 len); | ||
1293 | }; | 1352 | }; |
1294 | 1353 | ||
1295 | struct seq_file; | 1354 | struct seq_file; |
@@ -1557,9 +1616,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *); | |||
1557 | /* /sys/fs */ | 1616 | /* /sys/fs */ |
1558 | extern struct kobject *fs_kobj; | 1617 | extern struct kobject *fs_kobj; |
1559 | 1618 | ||
1619 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1620 | |||
1560 | #define FLOCK_VERIFY_READ 1 | 1621 | #define FLOCK_VERIFY_READ 1 |
1561 | #define FLOCK_VERIFY_WRITE 2 | 1622 | #define FLOCK_VERIFY_WRITE 2 |
1562 | 1623 | ||
1624 | #ifdef CONFIG_FILE_LOCKING | ||
1563 | extern int locks_mandatory_locked(struct inode *); | 1625 | extern int locks_mandatory_locked(struct inode *); |
1564 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); | 1626 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); |
1565 | 1627 | ||
@@ -1590,8 +1652,6 @@ static inline int locks_verify_locked(struct inode *inode) | |||
1590 | return 0; | 1652 | return 0; |
1591 | } | 1653 | } |
1592 | 1654 | ||
1593 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1594 | |||
1595 | static inline int locks_verify_truncate(struct inode *inode, | 1655 | static inline int locks_verify_truncate(struct inode *inode, |
1596 | struct file *filp, | 1656 | struct file *filp, |
1597 | loff_t size) | 1657 | loff_t size) |
@@ -1612,6 +1672,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1612 | return __break_lease(inode, mode); | 1672 | return __break_lease(inode, mode); |
1613 | return 0; | 1673 | return 0; |
1614 | } | 1674 | } |
1675 | #else /* !CONFIG_FILE_LOCKING */ | ||
1676 | #define locks_mandatory_locked(a) ({ 0; }) | ||
1677 | #define locks_mandatory_area(a, b, c, d, e) ({ 0; }) | ||
1678 | #define __mandatory_lock(a) ({ 0; }) | ||
1679 | #define mandatory_lock(a) ({ 0; }) | ||
1680 | #define locks_verify_locked(a) ({ 0; }) | ||
1681 | #define locks_verify_truncate(a, b, c) ({ 0; }) | ||
1682 | #define break_lease(a, b) ({ 0; }) | ||
1683 | #endif /* CONFIG_FILE_LOCKING */ | ||
1615 | 1684 | ||
1616 | /* fs/open.c */ | 1685 | /* fs/open.c */ |
1617 | 1686 | ||
@@ -1987,6 +2056,9 @@ extern int vfs_fstat(unsigned int, struct kstat *); | |||
1987 | 2056 | ||
1988 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 2057 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
1989 | unsigned long arg); | 2058 | unsigned long arg); |
2059 | extern int generic_block_fiemap(struct inode *inode, | ||
2060 | struct fiemap_extent_info *fieinfo, u64 start, | ||
2061 | u64 len, get_block_t *get_block); | ||
1990 | 2062 | ||
1991 | extern void get_filesystem(struct file_system_type *fs); | 2063 | extern void get_filesystem(struct file_system_type *fs); |
1992 | extern void put_filesystem(struct file_system_type *fs); | 2064 | extern void put_filesystem(struct file_system_type *fs); |