diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5adf32b90f36..408fe89498f4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -252,9 +252,6 @@ extern void __init files_init(unsigned long); | |||
252 | struct buffer_head; | 252 | struct buffer_head; |
253 | typedef int (get_block_t)(struct inode *inode, sector_t iblock, | 253 | typedef int (get_block_t)(struct inode *inode, sector_t iblock, |
254 | struct buffer_head *bh_result, int create); | 254 | struct buffer_head *bh_result, int create); |
255 | typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, | ||
256 | unsigned long max_blocks, | ||
257 | struct buffer_head *bh_result, int create); | ||
258 | typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | 255 | typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, |
259 | ssize_t bytes, void *private); | 256 | ssize_t bytes, void *private); |
260 | 257 | ||
@@ -350,7 +347,7 @@ struct writeback_control; | |||
350 | struct address_space_operations { | 347 | struct address_space_operations { |
351 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 348 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
352 | int (*readpage)(struct file *, struct page *); | 349 | int (*readpage)(struct file *, struct page *); |
353 | int (*sync_page)(struct page *); | 350 | void (*sync_page)(struct page *); |
354 | 351 | ||
355 | /* Write back some dirty pages from this mapping. */ | 352 | /* Write back some dirty pages from this mapping. */ |
356 | int (*writepages)(struct address_space *, struct writeback_control *); | 353 | int (*writepages)(struct address_space *, struct writeback_control *); |
@@ -369,7 +366,7 @@ struct address_space_operations { | |||
369 | int (*commit_write)(struct file *, struct page *, unsigned, unsigned); | 366 | int (*commit_write)(struct file *, struct page *, unsigned, unsigned); |
370 | /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ | 367 | /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ |
371 | sector_t (*bmap)(struct address_space *, sector_t); | 368 | sector_t (*bmap)(struct address_space *, sector_t); |
372 | int (*invalidatepage) (struct page *, unsigned long); | 369 | void (*invalidatepage) (struct page *, unsigned long); |
373 | int (*releasepage) (struct page *, gfp_t); | 370 | int (*releasepage) (struct page *, gfp_t); |
374 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 371 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
375 | loff_t offset, unsigned long nr_segs); | 372 | loff_t offset, unsigned long nr_segs); |
@@ -413,6 +410,9 @@ struct block_device { | |||
413 | struct list_head bd_inodes; | 410 | struct list_head bd_inodes; |
414 | void * bd_holder; | 411 | void * bd_holder; |
415 | int bd_holders; | 412 | int bd_holders; |
413 | #ifdef CONFIG_SYSFS | ||
414 | struct list_head bd_holder_list; | ||
415 | #endif | ||
416 | struct block_device * bd_contains; | 416 | struct block_device * bd_contains; |
417 | unsigned bd_block_size; | 417 | unsigned bd_block_size; |
418 | struct hd_struct * bd_part; | 418 | struct hd_struct * bd_part; |
@@ -490,13 +490,13 @@ struct inode { | |||
490 | unsigned int i_blkbits; | 490 | unsigned int i_blkbits; |
491 | unsigned long i_blksize; | 491 | unsigned long i_blksize; |
492 | unsigned long i_version; | 492 | unsigned long i_version; |
493 | unsigned long i_blocks; | 493 | blkcnt_t i_blocks; |
494 | unsigned short i_bytes; | 494 | unsigned short i_bytes; |
495 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 495 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ |
496 | struct mutex i_mutex; | 496 | struct mutex i_mutex; |
497 | struct rw_semaphore i_alloc_sem; | 497 | struct rw_semaphore i_alloc_sem; |
498 | struct inode_operations *i_op; | 498 | struct inode_operations *i_op; |
499 | struct file_operations *i_fop; /* former ->i_op->default_file_ops */ | 499 | const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ |
500 | struct super_block *i_sb; | 500 | struct super_block *i_sb; |
501 | struct file_lock *i_flock; | 501 | struct file_lock *i_flock; |
502 | struct address_space *i_mapping; | 502 | struct address_space *i_mapping; |
@@ -636,7 +636,7 @@ struct file { | |||
636 | } f_u; | 636 | } f_u; |
637 | struct dentry *f_dentry; | 637 | struct dentry *f_dentry; |
638 | struct vfsmount *f_vfsmnt; | 638 | struct vfsmount *f_vfsmnt; |
639 | struct file_operations *f_op; | 639 | const struct file_operations *f_op; |
640 | atomic_t f_count; | 640 | atomic_t f_count; |
641 | unsigned int f_flags; | 641 | unsigned int f_flags; |
642 | mode_t f_mode; | 642 | mode_t f_mode; |
@@ -763,6 +763,7 @@ extern void locks_copy_lock(struct file_lock *, struct file_lock *); | |||
763 | extern void locks_remove_posix(struct file *, fl_owner_t); | 763 | extern void locks_remove_posix(struct file *, fl_owner_t); |
764 | extern void locks_remove_flock(struct file *); | 764 | extern void locks_remove_flock(struct file *); |
765 | extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *); | 765 | extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *); |
766 | extern int posix_lock_file_conf(struct file *, struct file_lock *, struct file_lock *); | ||
766 | extern int posix_lock_file(struct file *, struct file_lock *); | 767 | extern int posix_lock_file(struct file *, struct file_lock *); |
767 | extern int posix_lock_file_wait(struct file *, struct file_lock *); | 768 | extern int posix_lock_file_wait(struct file *, struct file_lock *); |
768 | extern int posix_unblock_lock(struct file *, struct file_lock *); | 769 | extern int posix_unblock_lock(struct file *, struct file_lock *); |
@@ -1389,11 +1390,11 @@ extern void bd_set_size(struct block_device *, loff_t size); | |||
1389 | extern void bd_forget(struct inode *inode); | 1390 | extern void bd_forget(struct inode *inode); |
1390 | extern void bdput(struct block_device *); | 1391 | extern void bdput(struct block_device *); |
1391 | extern struct block_device *open_by_devnum(dev_t, unsigned); | 1392 | extern struct block_device *open_by_devnum(dev_t, unsigned); |
1392 | extern struct file_operations def_blk_fops; | 1393 | extern const struct file_operations def_blk_fops; |
1393 | extern struct address_space_operations def_blk_aops; | 1394 | extern struct address_space_operations def_blk_aops; |
1394 | extern struct file_operations def_chr_fops; | 1395 | extern const struct file_operations def_chr_fops; |
1395 | extern struct file_operations bad_sock_fops; | 1396 | extern const struct file_operations bad_sock_fops; |
1396 | extern struct file_operations def_fifo_fops; | 1397 | extern const struct file_operations def_fifo_fops; |
1397 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 1398 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
1398 | extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); | 1399 | extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); |
1399 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); | 1400 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
@@ -1401,12 +1402,19 @@ extern int blkdev_get(struct block_device *, mode_t, unsigned); | |||
1401 | extern int blkdev_put(struct block_device *); | 1402 | extern int blkdev_put(struct block_device *); |
1402 | extern int bd_claim(struct block_device *, void *); | 1403 | extern int bd_claim(struct block_device *, void *); |
1403 | extern void bd_release(struct block_device *); | 1404 | extern void bd_release(struct block_device *); |
1405 | #ifdef CONFIG_SYSFS | ||
1406 | extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *); | ||
1407 | extern void bd_release_from_disk(struct block_device *, struct gendisk *); | ||
1408 | #else | ||
1409 | #define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder) | ||
1410 | #define bd_release_from_disk(bdev, disk) bd_release(bdev) | ||
1411 | #endif | ||
1404 | 1412 | ||
1405 | /* fs/char_dev.c */ | 1413 | /* fs/char_dev.c */ |
1406 | extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); | 1414 | extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); |
1407 | extern int register_chrdev_region(dev_t, unsigned, const char *); | 1415 | extern int register_chrdev_region(dev_t, unsigned, const char *); |
1408 | extern int register_chrdev(unsigned int, const char *, | 1416 | extern int register_chrdev(unsigned int, const char *, |
1409 | struct file_operations *); | 1417 | const struct file_operations *); |
1410 | extern int unregister_chrdev(unsigned int, const char *); | 1418 | extern int unregister_chrdev(unsigned int, const char *); |
1411 | extern void unregister_chrdev_region(dev_t, unsigned); | 1419 | extern void unregister_chrdev_region(dev_t, unsigned); |
1412 | extern int chrdev_open(struct inode *, struct file *); | 1420 | extern int chrdev_open(struct inode *, struct file *); |
@@ -1436,9 +1444,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t); | |||
1436 | extern void make_bad_inode(struct inode *); | 1444 | extern void make_bad_inode(struct inode *); |
1437 | extern int is_bad_inode(struct inode *); | 1445 | extern int is_bad_inode(struct inode *); |
1438 | 1446 | ||
1439 | extern struct file_operations read_fifo_fops; | 1447 | extern const struct file_operations read_fifo_fops; |
1440 | extern struct file_operations write_fifo_fops; | 1448 | extern const struct file_operations write_fifo_fops; |
1441 | extern struct file_operations rdwr_fifo_fops; | 1449 | extern const struct file_operations rdwr_fifo_fops; |
1442 | 1450 | ||
1443 | extern int fs_may_remount_ro(struct super_block *); | 1451 | extern int fs_may_remount_ro(struct super_block *); |
1444 | 1452 | ||
@@ -1644,7 +1652,7 @@ static inline void do_generic_file_read(struct file * filp, loff_t *ppos, | |||
1644 | 1652 | ||
1645 | ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 1653 | ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, |
1646 | struct block_device *bdev, const struct iovec *iov, loff_t offset, | 1654 | struct block_device *bdev, const struct iovec *iov, loff_t offset, |
1647 | unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io, | 1655 | unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, |
1648 | int lock_type); | 1656 | int lock_type); |
1649 | 1657 | ||
1650 | enum { | 1658 | enum { |
@@ -1655,32 +1663,32 @@ enum { | |||
1655 | 1663 | ||
1656 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 1664 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, |
1657 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | 1665 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, |
1658 | loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, | 1666 | loff_t offset, unsigned long nr_segs, get_block_t get_block, |
1659 | dio_iodone_t end_io) | 1667 | dio_iodone_t end_io) |
1660 | { | 1668 | { |
1661 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 1669 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
1662 | nr_segs, get_blocks, end_io, DIO_LOCKING); | 1670 | nr_segs, get_block, end_io, DIO_LOCKING); |
1663 | } | 1671 | } |
1664 | 1672 | ||
1665 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | 1673 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, |
1666 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | 1674 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, |
1667 | loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, | 1675 | loff_t offset, unsigned long nr_segs, get_block_t get_block, |
1668 | dio_iodone_t end_io) | 1676 | dio_iodone_t end_io) |
1669 | { | 1677 | { |
1670 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 1678 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
1671 | nr_segs, get_blocks, end_io, DIO_NO_LOCKING); | 1679 | nr_segs, get_block, end_io, DIO_NO_LOCKING); |
1672 | } | 1680 | } |
1673 | 1681 | ||
1674 | static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, | 1682 | static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, |
1675 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | 1683 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, |
1676 | loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, | 1684 | loff_t offset, unsigned long nr_segs, get_block_t get_block, |
1677 | dio_iodone_t end_io) | 1685 | dio_iodone_t end_io) |
1678 | { | 1686 | { |
1679 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 1687 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
1680 | nr_segs, get_blocks, end_io, DIO_OWN_LOCKING); | 1688 | nr_segs, get_block, end_io, DIO_OWN_LOCKING); |
1681 | } | 1689 | } |
1682 | 1690 | ||
1683 | extern struct file_operations generic_ro_fops; | 1691 | extern const struct file_operations generic_ro_fops; |
1684 | 1692 | ||
1685 | #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) | 1693 | #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) |
1686 | 1694 | ||
@@ -1736,9 +1744,9 @@ extern int simple_commit_write(struct file *file, struct page *page, | |||
1736 | 1744 | ||
1737 | extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); | 1745 | extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); |
1738 | extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); | 1746 | extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); |
1739 | extern struct file_operations simple_dir_operations; | 1747 | extern const struct file_operations simple_dir_operations; |
1740 | extern struct inode_operations simple_dir_inode_operations; | 1748 | extern struct inode_operations simple_dir_inode_operations; |
1741 | struct tree_descr { char *name; struct file_operations *ops; int mode; }; | 1749 | struct tree_descr { char *name; const struct file_operations *ops; int mode; }; |
1742 | struct dentry *d_alloc_name(struct dentry *, const char *); | 1750 | struct dentry *d_alloc_name(struct dentry *, const char *); |
1743 | extern int simple_fill_super(struct super_block *, int, struct tree_descr *); | 1751 | extern int simple_fill_super(struct super_block *, int, struct tree_descr *); |
1744 | extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); | 1752 | extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); |