diff options
Diffstat (limited to 'include/linux/fs.h')
| -rw-r--r-- | include/linux/fs.h | 74 |
1 files changed, 71 insertions, 3 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 0180102dace1..3ae8e37bdfc8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -220,6 +220,7 @@ extern int dir_notify_enable; | |||
| 220 | 220 | ||
| 221 | struct iovec; | 221 | struct iovec; |
| 222 | struct nameidata; | 222 | struct nameidata; |
| 223 | struct kiocb; | ||
| 223 | struct pipe_inode_info; | 224 | struct pipe_inode_info; |
| 224 | struct poll_table_struct; | 225 | struct poll_table_struct; |
| 225 | struct kstatfs; | 226 | struct kstatfs; |
| @@ -240,7 +241,7 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock, | |||
| 240 | typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, | 241 | typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, |
| 241 | unsigned long max_blocks, | 242 | unsigned long max_blocks, |
| 242 | struct buffer_head *bh_result, int create); | 243 | struct buffer_head *bh_result, int create); |
| 243 | typedef void (dio_iodone_t)(struct inode *inode, loff_t offset, | 244 | typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, |
| 244 | ssize_t bytes, void *private); | 245 | ssize_t bytes, void *private); |
| 245 | 246 | ||
| 246 | /* | 247 | /* |
| @@ -302,7 +303,6 @@ struct iattr { | |||
| 302 | struct page; | 303 | struct page; |
| 303 | struct address_space; | 304 | struct address_space; |
| 304 | struct writeback_control; | 305 | struct writeback_control; |
| 305 | struct kiocb; | ||
| 306 | 306 | ||
| 307 | struct address_space_operations { | 307 | struct address_space_operations { |
| 308 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 308 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
| @@ -330,6 +330,8 @@ struct address_space_operations { | |||
| 330 | int (*releasepage) (struct page *, int); | 330 | int (*releasepage) (struct page *, int); |
| 331 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 331 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
| 332 | loff_t offset, unsigned long nr_segs); | 332 | loff_t offset, unsigned long nr_segs); |
| 333 | struct page* (*get_xip_page)(struct address_space *, sector_t, | ||
| 334 | int); | ||
| 333 | }; | 335 | }; |
| 334 | 336 | ||
| 335 | struct backing_dev_info; | 337 | struct backing_dev_info; |
| @@ -581,7 +583,6 @@ struct file { | |||
| 581 | atomic_t f_count; | 583 | atomic_t f_count; |
| 582 | unsigned int f_flags; | 584 | unsigned int f_flags; |
| 583 | mode_t f_mode; | 585 | mode_t f_mode; |
| 584 | int f_error; | ||
| 585 | loff_t f_pos; | 586 | loff_t f_pos; |
| 586 | struct fown_struct f_owner; | 587 | struct fown_struct f_owner; |
| 587 | unsigned int f_uid, f_gid; | 588 | unsigned int f_uid, f_gid; |
| @@ -674,6 +675,7 @@ struct file_lock { | |||
| 674 | struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ | 675 | struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ |
| 675 | union { | 676 | union { |
| 676 | struct nfs_lock_info nfs_fl; | 677 | struct nfs_lock_info nfs_fl; |
| 678 | struct nfs4_lock_info nfs4_fl; | ||
| 677 | } fl_u; | 679 | } fl_u; |
| 678 | }; | 680 | }; |
| 679 | 681 | ||
| @@ -883,7 +885,9 @@ struct block_device_operations { | |||
| 883 | int (*open) (struct inode *, struct file *); | 885 | int (*open) (struct inode *, struct file *); |
| 884 | int (*release) (struct inode *, struct file *); | 886 | int (*release) (struct inode *, struct file *); |
| 885 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); | 887 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); |
| 888 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); | ||
| 886 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); | 889 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); |
| 890 | int (*direct_access) (struct block_device *, sector_t, unsigned long *); | ||
| 887 | int (*media_changed) (struct gendisk *); | 891 | int (*media_changed) (struct gendisk *); |
| 888 | int (*revalidate_disk) (struct gendisk *); | 892 | int (*revalidate_disk) (struct gendisk *); |
| 889 | struct module *owner; | 893 | struct module *owner; |
| @@ -1024,6 +1028,7 @@ struct super_operations { | |||
| 1024 | #define I_FREEING 16 | 1028 | #define I_FREEING 16 |
| 1025 | #define I_CLEAR 32 | 1029 | #define I_CLEAR 32 |
| 1026 | #define I_NEW 64 | 1030 | #define I_NEW 64 |
| 1031 | #define I_WILL_FREE 128 | ||
| 1027 | 1032 | ||
| 1028 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1033 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
| 1029 | 1034 | ||
| @@ -1494,6 +1499,23 @@ extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); | |||
| 1494 | extern int generic_file_open(struct inode * inode, struct file * filp); | 1499 | extern int generic_file_open(struct inode * inode, struct file * filp); |
| 1495 | extern int nonseekable_open(struct inode * inode, struct file * filp); | 1500 | extern int nonseekable_open(struct inode * inode, struct file * filp); |
| 1496 | 1501 | ||
| 1502 | #ifdef CONFIG_FS_XIP | ||
| 1503 | extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len, | ||
| 1504 | loff_t *ppos); | ||
| 1505 | extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos, | ||
| 1506 | size_t count, read_actor_t actor, | ||
| 1507 | void *target); | ||
| 1508 | extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma); | ||
| 1509 | extern ssize_t xip_file_write(struct file *filp, const char __user *buf, | ||
| 1510 | size_t len, loff_t *ppos); | ||
| 1511 | extern int xip_truncate_page(struct address_space *mapping, loff_t from); | ||
| 1512 | #else | ||
| 1513 | static inline int xip_truncate_page(struct address_space *mapping, loff_t from) | ||
| 1514 | { | ||
| 1515 | return 0; | ||
| 1516 | } | ||
| 1517 | #endif | ||
| 1518 | |||
| 1497 | static inline void do_generic_file_read(struct file * filp, loff_t *ppos, | 1519 | static inline void do_generic_file_read(struct file * filp, loff_t *ppos, |
| 1498 | read_descriptor_t * desc, | 1520 | read_descriptor_t * desc, |
| 1499 | read_actor_t actor) | 1521 | read_actor_t actor) |
| @@ -1657,6 +1679,52 @@ static inline void simple_transaction_set(struct file *file, size_t n) | |||
| 1657 | ar->size = n; | 1679 | ar->size = n; |
| 1658 | } | 1680 | } |
| 1659 | 1681 | ||
| 1682 | /* | ||
| 1683 | * simple attribute files | ||
| 1684 | * | ||
| 1685 | * These attributes behave similar to those in sysfs: | ||
| 1686 | * | ||
| 1687 | * Writing to an attribute immediately sets a value, an open file can be | ||
| 1688 | * written to multiple times. | ||
| 1689 | * | ||
| 1690 | * Reading from an attribute creates a buffer from the value that might get | ||
| 1691 | * read with multiple read calls. When the attribute has been read | ||
| 1692 | * completely, no further read calls are possible until the file is opened | ||
| 1693 | * again. | ||
| 1694 | * | ||
| 1695 | * All attributes contain a text representation of a numeric value | ||
| 1696 | * that are accessed with the get() and set() functions. | ||
| 1697 | */ | ||
| 1698 | #define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \ | ||
| 1699 | static int __fops ## _open(struct inode *inode, struct file *file) \ | ||
| 1700 | { \ | ||
| 1701 | __simple_attr_check_format(__fmt, 0ull); \ | ||
| 1702 | return simple_attr_open(inode, file, __get, __set, __fmt); \ | ||
| 1703 | } \ | ||
| 1704 | static struct file_operations __fops = { \ | ||
| 1705 | .owner = THIS_MODULE, \ | ||
| 1706 | .open = __fops ## _open, \ | ||
| 1707 | .release = simple_attr_close, \ | ||
| 1708 | .read = simple_attr_read, \ | ||
| 1709 | .write = simple_attr_write, \ | ||
| 1710 | }; | ||
| 1711 | |||
| 1712 | static inline void __attribute__((format(printf, 1, 2))) | ||
| 1713 | __simple_attr_check_format(const char *fmt, ...) | ||
| 1714 | { | ||
| 1715 | /* don't do anything, just let the compiler check the arguments; */ | ||
| 1716 | } | ||
| 1717 | |||
| 1718 | int simple_attr_open(struct inode *inode, struct file *file, | ||
| 1719 | u64 (*get)(void *), void (*set)(void *, u64), | ||
| 1720 | const char *fmt); | ||
| 1721 | int simple_attr_close(struct inode *inode, struct file *file); | ||
| 1722 | ssize_t simple_attr_read(struct file *file, char __user *buf, | ||
| 1723 | size_t len, loff_t *ppos); | ||
| 1724 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | ||
| 1725 | size_t len, loff_t *ppos); | ||
| 1726 | |||
| 1727 | |||
| 1660 | #ifdef CONFIG_SECURITY | 1728 | #ifdef CONFIG_SECURITY |
| 1661 | static inline char *alloc_secdata(void) | 1729 | static inline char *alloc_secdata(void) |
| 1662 | { | 1730 | { |
