aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h95
1 files changed, 87 insertions, 8 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 580b513668fe..a6a625be13fc 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -86,7 +86,9 @@ extern int dir_notify_enable;
86#define READ_META (READ | (1 << BIO_RW_META)) 86#define READ_META (READ | (1 << BIO_RW_META))
87#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 87#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
88#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) 88#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
89#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) 89#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
90#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
91#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
90 92
91#define SEL_IN 1 93#define SEL_IN 1
92#define SEL_OUT 2 94#define SEL_OUT 2
@@ -222,6 +224,7 @@ extern int dir_notify_enable;
222#define BLKTRACESTART _IO(0x12,116) 224#define BLKTRACESTART _IO(0x12,116)
223#define BLKTRACESTOP _IO(0x12,117) 225#define BLKTRACESTOP _IO(0x12,117)
224#define BLKTRACETEARDOWN _IO(0x12,118) 226#define BLKTRACETEARDOWN _IO(0x12,118)
227#define BLKDISCARD _IO(0x12,119)
225 228
226#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 229#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
227#define FIBMAP _IO(0x00,1) /* bmap access */ 230#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -231,6 +234,7 @@ extern int dir_notify_enable;
231#define FS_IOC_SETFLAGS _IOW('f', 2, long) 234#define FS_IOC_SETFLAGS _IOW('f', 2, long)
232#define FS_IOC_GETVERSION _IOR('v', 1, long) 235#define FS_IOC_GETVERSION _IOR('v', 1, long)
233#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)
234#define FS_IOC32_GETFLAGS _IOR('f', 1, int) 238#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
235#define FS_IOC32_SETFLAGS _IOW('f', 2, int) 239#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
236#define FS_IOC32_GETVERSION _IOR('v', 1, int) 240#define FS_IOC32_GETVERSION _IOR('v', 1, int)
@@ -291,6 +295,7 @@ extern int dir_notify_enable;
291#include <linux/mutex.h> 295#include <linux/mutex.h>
292#include <linux/capability.h> 296#include <linux/capability.h>
293#include <linux/semaphore.h> 297#include <linux/semaphore.h>
298#include <linux/fiemap.h>
294 299
295#include <asm/atomic.h> 300#include <asm/atomic.h>
296#include <asm/byteorder.h> 301#include <asm/byteorder.h>
@@ -942,6 +947,14 @@ struct lock_manager_operations {
942 int (*fl_change)(struct file_lock **, int); 947 int (*fl_change)(struct file_lock **, int);
943}; 948};
944 949
950struct lock_manager {
951 struct list_head list;
952};
953
954void locks_start_grace(struct lock_manager *);
955void locks_end_grace(struct lock_manager *);
956int locks_in_grace(void);
957
945/* that will die - we need it for nfs_lock_info */ 958/* that will die - we need it for nfs_lock_info */
946#include <linux/nfs_fs_i.h> 959#include <linux/nfs_fs_i.h>
947 960
@@ -983,6 +996,13 @@ struct file_lock {
983 996
984#include <linux/fcntl.h> 997#include <linux/fcntl.h>
985 998
999extern void send_sigio(struct fown_struct *fown, int fd, int band);
1000
1001/* fs/sync.c */
1002extern 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
986extern int fcntl_getlk(struct file *, struct flock __user *); 1006extern int fcntl_getlk(struct file *, struct flock __user *);
987extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 1007extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
988 struct flock __user *); 1008 struct flock __user *);
@@ -993,14 +1013,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
993 struct flock64 __user *); 1013 struct flock64 __user *);
994#endif 1014#endif
995 1015
996extern void send_sigio(struct fown_struct *fown, int fd, int band);
997extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); 1016extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
998extern int fcntl_getlease(struct file *filp); 1017extern int fcntl_getlease(struct file *filp);
999 1018
1000/* fs/sync.c */
1001extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1002 loff_t endbyte, unsigned int flags);
1003
1004/* fs/locks.c */ 1019/* fs/locks.c */
1005extern void locks_init_lock(struct file_lock *); 1020extern void locks_init_lock(struct file_lock *);
1006extern void locks_copy_lock(struct file_lock *, struct file_lock *); 1021extern void locks_copy_lock(struct file_lock *, struct file_lock *);
@@ -1023,6 +1038,37 @@ extern int lease_modify(struct file_lock **, int);
1023extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1038extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1024extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1039extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1025extern struct seq_operations locks_seq_operations; 1040extern 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
1026 1072
1027struct fasync_struct { 1073struct fasync_struct {
1028 int magic; 1074 int magic;
@@ -1179,6 +1225,20 @@ extern void dentry_unhash(struct dentry *dentry);
1179extern int file_permission(struct file *, int); 1225extern int file_permission(struct file *, int);
1180 1226
1181/* 1227/*
1228 * VFS FS_IOC_FIEMAP helper definitions.
1229 */
1230struct 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};
1237int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
1238 u64 phys, u64 len, u32 flags);
1239int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1240
1241/*
1182 * File types 1242 * File types
1183 * 1243 *
1184 * NOTE! These match bits 12..15 of stat.st_mode 1244 * NOTE! These match bits 12..15 of stat.st_mode
@@ -1287,6 +1347,8 @@ struct inode_operations {
1287 void (*truncate_range)(struct inode *, loff_t, loff_t); 1347 void (*truncate_range)(struct inode *, loff_t, loff_t);
1288 long (*fallocate)(struct inode *inode, int mode, loff_t offset, 1348 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
1289 loff_t len); 1349 loff_t len);
1350 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1351 u64 len);
1290}; 1352};
1291 1353
1292struct seq_file; 1354struct seq_file;
@@ -1554,9 +1616,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *);
1554/* /sys/fs */ 1616/* /sys/fs */
1555extern struct kobject *fs_kobj; 1617extern struct kobject *fs_kobj;
1556 1618
1619extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1620
1557#define FLOCK_VERIFY_READ 1 1621#define FLOCK_VERIFY_READ 1
1558#define FLOCK_VERIFY_WRITE 2 1622#define FLOCK_VERIFY_WRITE 2
1559 1623
1624#ifdef CONFIG_FILE_LOCKING
1560extern int locks_mandatory_locked(struct inode *); 1625extern int locks_mandatory_locked(struct inode *);
1561extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); 1626extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
1562 1627
@@ -1587,8 +1652,6 @@ static inline int locks_verify_locked(struct inode *inode)
1587 return 0; 1652 return 0;
1588} 1653}
1589 1654
1590extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1591
1592static inline int locks_verify_truncate(struct inode *inode, 1655static inline int locks_verify_truncate(struct inode *inode,
1593 struct file *filp, 1656 struct file *filp,
1594 loff_t size) 1657 loff_t size)
@@ -1609,6 +1672,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1609 return __break_lease(inode, mode); 1672 return __break_lease(inode, mode);
1610 return 0; 1673 return 0;
1611} 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 */
1612 1684
1613/* fs/open.c */ 1685/* fs/open.c */
1614 1686
@@ -1682,6 +1754,7 @@ extern void chrdev_show(struct seq_file *,off_t);
1682 1754
1683/* fs/block_dev.c */ 1755/* fs/block_dev.c */
1684#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1756#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1757#define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */
1685 1758
1686#ifdef CONFIG_BLOCK 1759#ifdef CONFIG_BLOCK
1687#define BLKDEV_MAJOR_HASH_SIZE 255 1760#define BLKDEV_MAJOR_HASH_SIZE 255
@@ -1718,6 +1791,9 @@ extern int fs_may_remount_ro(struct super_block *);
1718 */ 1791 */
1719#define bio_data_dir(bio) ((bio)->bi_rw & 1) 1792#define bio_data_dir(bio) ((bio)->bi_rw & 1)
1720 1793
1794extern void check_disk_size_change(struct gendisk *disk,
1795 struct block_device *bdev);
1796extern int revalidate_disk(struct gendisk *);
1721extern int check_disk_change(struct block_device *); 1797extern int check_disk_change(struct block_device *);
1722extern int __invalidate_device(struct block_device *); 1798extern int __invalidate_device(struct block_device *);
1723extern int invalidate_partition(struct gendisk *, int); 1799extern int invalidate_partition(struct gendisk *, int);
@@ -1980,6 +2056,9 @@ extern int vfs_fstat(unsigned int, struct kstat *);
1980 2056
1981extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2057extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
1982 unsigned long arg); 2058 unsigned long arg);
2059extern int generic_block_fiemap(struct inode *inode,
2060 struct fiemap_extent_info *fieinfo, u64 start,
2061 u64 len, get_block_t *get_block);
1983 2062
1984extern void get_filesystem(struct file_system_type *fs); 2063extern void get_filesystem(struct file_system_type *fs);
1985extern void put_filesystem(struct file_system_type *fs); 2064extern void put_filesystem(struct file_system_type *fs);