diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 1238 |
1 files changed, 638 insertions, 600 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 1ab6c6913040..0deda9e00b5c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1,7 +1,6 @@ #ifndef _LINUX_FS_H #define _LINUX_FS_H - #include <linux/linkage.h> #include <linux/wait.h> #include <linux/kdev_t.h> @@ -50,12 +49,12 @@ struct seq_file; struct workqueue_struct; struct iov_iter; -extern void __init inode_init(void); -extern void __init inode_init_early(void); -extern void __init files_init(unsigned long); +void __init inode_init(void); +void __init inode_init_early(void); +void __init files_init(unsigned long); extern struct files_stat_struct files_stat; -extern unsigned long get_max_files(void); +unsigned long get_max_files(void); extern int sysctl_nr_open; extern struct inodes_stat_t inodes_stat; extern int leases_enable, lease_break_time; @@ -64,9 +63,9 @@ extern int sysctl_protected_hardlinks; struct buffer_head; typedef int (get_block_t)(struct inode *inode, sector_t iblock, - struct buffer_head *bh_result, int create); + struct buffer_head *bh_result, int create); typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, - ssize_t bytes, void *private); + ssize_t bytes, void *private); #define MAY_EXEC 0x00000001 #define MAY_WRITE 0x00000002 @@ -192,8 +191,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, #define READ 0 #define WRITE RW_MASK #define READA RWA_MASK -#define KERNEL_READ (READ|REQ_KERNEL) -#define KERNEL_WRITE (WRITE|REQ_KERNEL) +#define KERNEL_READ (READ | REQ_KERNEL) +#define KERNEL_WRITE (WRITE | REQ_KERNEL) #define READ_SYNC (READ | REQ_SYNC) #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) @@ -256,25 +255,25 @@ struct iattr { */ #include <linux/quota.h> -/** +/** * enum positive_aop_returns - aop return codes with specific semantics * * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has - * completed, that the page is still locked, and - * should be considered active. The VM uses this hint - * to return the page to the active list -- it won't - * be a candidate for writeback again in the near - * future. Other callers must be careful to unlock - * the page if they get this return. Returned by - * writepage(); + * completed, that the page is still locked, and + * should be considered active. The VM uses this hint + * to return the page to the active list -- it won't + * be a candidate for writeback again in the near + * future. Other callers must be careful to unlock + * the page if they get this return. Returned by + * writepage(); * * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has - * unlocked it and the page might have been truncated. - * The caller should back up to acquiring a new page and - * trying again. The aop will be taking reasonable - * precautions not to livelock. If the caller held a page - * reference, it should drop it before retrying. Returned - * by readpage(). + * unlocked it and the page might have been truncated. + * The caller should back up to acquiring a new page and + * trying again. The aop will be taking reasonable + * precautions not to livelock. If the caller held a page + * reference, it should drop it before retrying. Returned + * by readpage(). * * address_space_operation functions return these large constants to indicate * special semantics to the caller. These are much larger than the bytes in a @@ -320,7 +319,7 @@ typedef struct { } read_descriptor_t; typedef int (*read_actor_t)(read_descriptor_t *, struct page *, - unsigned long, unsigned long); + unsigned long, unsigned long); struct address_space_operations { int (*writepage)(struct page *page, struct writeback_control *wbc); @@ -333,38 +332,38 @@ struct address_space_operations { int (*set_page_dirty)(struct page *page); int (*readpages)(struct file *filp, struct address_space *mapping, - struct list_head *pages, unsigned nr_pages); + struct list_head *pages, unsigned nr_pages); int (*write_begin)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata); + loff_t pos, unsigned len, unsigned flags, + struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct page *page, void *fsdata); + loff_t pos, unsigned len, unsigned copied, + struct page *page, void *fsdata); /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ sector_t (*bmap)(struct address_space *, sector_t); - void (*invalidatepage) (struct page *, unsigned int, unsigned int); - int (*releasepage) (struct page *, gfp_t); + void (*invalidatepage)(struct page *, unsigned int, unsigned int); + int (*releasepage)(struct page *, gfp_t); void (*freepage)(struct page *); ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *iter, loff_t offset); int (*get_xip_mem)(struct address_space *, pgoff_t, int, - void **, unsigned long *); + void **, unsigned long *); /* * migrate the contents of a page to the specified target. If * migrate_mode is MIGRATE_ASYNC, it must not block. */ - int (*migratepage) (struct address_space *, - struct page *, struct page *, enum migrate_mode); - int (*launder_page) (struct page *); - int (*is_partially_uptodate) (struct page *, unsigned long, - unsigned long); - void (*is_dirty_writeback) (struct page *, bool *, bool *); + int (*migratepage)(struct address_space *, + struct page *, struct page *, enum migrate_mode); + int (*launder_page)(struct page *); + int (*is_partially_uptodate)(struct page *, unsigned long, + unsigned long); + void (*is_dirty_writeback)(struct page *, bool *, bool *); int (*error_remove_page)(struct address_space *, struct page *); /* swapfile support */ int (*swap_activate)(struct swap_info_struct *sis, struct file *file, - sector_t *span); + sector_t *span); void (*swap_deactivate)(struct file *file); }; @@ -375,19 +374,19 @@ extern const struct address_space_operations empty_aops; * to write into the pagecache. */ int pagecache_write_begin(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata); + loff_t pos, unsigned len, unsigned flags, + struct page **pagep, void **fsdata); int pagecache_write_end(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct page *page, void *fsdata); + loff_t pos, unsigned len, unsigned copied, + struct page *page, void *fsdata); struct backing_dev_info; struct address_space { struct inode *host; /* owner: inode, block_device */ struct radix_tree_root page_tree; /* radix tree of all pages */ spinlock_t tree_lock; /* and lock protecting it */ - unsigned int i_mmap_writable;/* count VM_SHARED mappings */ + atomic_t i_mmap_writable;/* count VM_SHARED mappings */ struct rb_root i_mmap; /* tree of private and shared mappings */ struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ struct mutex i_mmap_mutex; /* protect tree, count, list */ @@ -402,35 +401,35 @@ struct address_space { struct list_head private_list; /* ditto */ void *private_data; /* ditto */ } __attribute__((aligned(sizeof(long)))); - /* - * On most architectures that alignment is already the case; but - * must be enforced here for CRIS, to let the least significant bit - * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. - */ +/* + * On most architectures that alignment is already the case; but + * must be enforced here for CRIS, to let the least significant bit + * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. + */ struct request_queue; struct block_device { dev_t bd_dev; /* not a kdev_t - it's a search key */ int bd_openers; - struct inode * bd_inode; /* will die */ - struct super_block * bd_super; + struct inode *bd_inode; /* will die */ + struct super_block *bd_super; struct mutex bd_mutex; /* open/close mutex */ struct list_head bd_inodes; - void * bd_claiming; - void * bd_holder; + void *bd_claiming; + void *bd_holder; int bd_holders; bool bd_write_holder; #ifdef CONFIG_SYSFS struct list_head bd_holder_disks; #endif - struct block_device * bd_contains; + struct block_device *bd_contains; unsigned bd_block_size; - struct hd_struct * bd_part; + struct hd_struct *bd_part; /* number of times partitions within this device have been opened. */ unsigned bd_part_count; int bd_invalidated; - struct gendisk * bd_disk; - struct request_queue * bd_queue; + struct gendisk *bd_disk; + struct request_queue *bd_queue; struct list_head bd_list; /* * Private data. You must have bd_claim'ed the block_device @@ -461,8 +460,8 @@ int mapping_tagged(struct address_space *mapping, int tag); */ static inline int mapping_mapped(struct address_space *mapping) { - return !RB_EMPTY_ROOT(&mapping->i_mmap) || - !list_empty(&mapping->i_mmap_nonlinear); + return !RB_EMPTY_ROOT(&mapping->i_mmap) || + !list_empty(&mapping->i_mmap_nonlinear); } /* @@ -470,16 +469,41 @@ static inline int mapping_mapped(struct address_space *mapping) * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff * marks vma as VM_SHARED if it is shared, and the file was opened for * writing i.e. vma may be mprotected writable even if now readonly. + * + * If i_mmap_writable is negative, no new writable mappings are allowed. You + * can only deny writable mappings, if none exists right now. */ static inline int mapping_writably_mapped(struct address_space *mapping) { - return mapping->i_mmap_writable != 0; + return atomic_read(&mapping->i_mmap_writable) > 0; +} + +static inline int mapping_map_writable(struct address_space *mapping) +{ + return atomic_inc_unless_negative(&mapping->i_mmap_writable) ? + 0 : -EPERM; +} + +static inline void mapping_unmap_writable(struct address_space *mapping) +{ + atomic_dec(&mapping->i_mmap_writable); +} + +static inline int mapping_deny_writable(struct address_space *mapping) +{ + return atomic_dec_unless_positive(&mapping->i_mmap_writable) ? + 0 : -EBUSY; +} + +static inline void mapping_allow_writable(struct address_space *mapping) +{ + atomic_inc(&mapping->i_mmap_writable); } /* * Use sequence counter to get consistent i_size on 32-bit processors. */ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP) #include <linux/seqlock.h> #define __NEED_I_SIZE_ORDERED #define i_size_ordered_init(inode) seqcount_init(&inode->i_size_seqcount) @@ -609,8 +633,7 @@ static inline int inode_unhashed(struct inode *inode) * The locking order between these classes is * parent -> child -> normal -> xattr -> second non-directory */ -enum inode_i_mutex_lock_class -{ +enum inode_i_mutex_lock_class { I_MUTEX_NORMAL, I_MUTEX_PARENT, I_MUTEX_CHILD, @@ -633,7 +656,7 @@ void unlock_two_nondirectories(struct inode *, struct inode*); */ static inline loff_t i_size_read(const struct inode *inode) { -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP) loff_t i_size; unsigned int seq; @@ -642,7 +665,7 @@ static inline loff_t i_size_read(const struct inode *inode) i_size = inode->i_size; } while (read_seqcount_retry(&inode->i_size_seqcount, seq)); return i_size; -#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) +#elif BITS_PER_LONG == 32 && defined(CONFIG_PREEMPT) loff_t i_size; preempt_disable(); @@ -661,13 +684,13 @@ static inline loff_t i_size_read(const struct inode *inode) */ static inline void i_size_write(struct inode *inode, loff_t i_size) { -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP) preempt_disable(); write_seqcount_begin(&inode->i_size_seqcount); inode->i_size = i_size; write_seqcount_end(&inode->i_size_seqcount); preempt_enable(); -#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) +#elif BITS_PER_LONG == 32 && defined(CONFIG_PREEMPT) preempt_disable(); inode->i_size = i_size; preempt_enable(); @@ -711,7 +734,7 @@ static inline unsigned imajor(const struct inode *inode) return MAJOR(inode->i_rdev); } -extern struct block_device *I_BDEV(struct inode *inode); +struct block_device *I_BDEV(struct inode *inode); struct fown_struct { rwlock_t lock; /* protects pid, uid, euid fields */ @@ -747,7 +770,7 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) struct file { union { struct llist_node fu_llist; - struct rcu_head fu_rcuhead; + struct rcu_head fu_rcuhead; } f_u; struct path f_path; #define f_dentry f_path.dentry @@ -760,7 +783,7 @@ struct file { */ spinlock_t f_lock; atomic_long_t f_count; - unsigned int f_flags; + unsigned int f_flags; fmode_t f_mode; struct mutex f_pos_lock; loff_t f_pos; @@ -800,12 +823,12 @@ static inline struct file *get_file(struct file *f) #define MAX_NON_LFS ((1UL<<31) - 1) -/* Page cache limit. The filesystems should put that into their s_maxbytes - limits, otherwise bad things can happen in VM. */ -#if BITS_PER_LONG==32 -#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) -#elif BITS_PER_LONG==64 -#define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffffLL) +/* Page cache limit. The filesystems should put that into their s_maxbytes + limits, otherwise bad things can happen in VM. */ +#if BITS_PER_LONG == 32 +#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG - 1)) - 1) +#elif BITS_PER_LONG == 64 +#define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffffLL) #endif #define FL_POSIX 1 @@ -836,17 +859,17 @@ static inline struct file *get_file(struct file *f) typedef void *fl_owner_t; struct file_lock_operations { - void (*fl_copy_lock)(struct file_lock *, struct file_lock *); - void (*fl_release_private)(struct file_lock *); + void (*fl_copy_lock)(struct file_lock *dst, struct file_lock *fl); + void (*fl_release_private)(struct file_lock *fl); }; struct lock_manager_operations { - int (*lm_compare_owner)(struct file_lock *, struct file_lock *); - unsigned long (*lm_owner_key)(struct file_lock *); - void (*lm_notify)(struct file_lock *); /* unblock callback */ - int (*lm_grant)(struct file_lock *, struct file_lock *, int); - void (*lm_break)(struct file_lock *); - int (*lm_change)(struct file_lock **, int); + int (*lm_compare_owner)(struct file_lock *fl1, struct file_lock *fl2); + unsigned long (*lm_owner_key)(struct file_lock *fl); + void (*lm_notify)(struct file_lock *fl); /* unblock callback */ + int (*lm_grant)(struct file_lock *fl, int result); + void (*lm_break)(struct file_lock *fl); + int (*lm_change)(struct file_lock **fl, int type); }; struct lock_manager { @@ -894,7 +917,7 @@ struct file_lock { loff_t fl_start; loff_t fl_end; - struct fasync_struct * fl_fasync; /* for lease break notifications */ + struct fasync_struct *fl_fasync; /* for lease break notifications */ /* for lease breaks: */ unsigned long fl_break_time; unsigned long fl_downgrade_time; @@ -920,46 +943,47 @@ struct file_lock { #include <linux/fcntl.h> -extern void send_sigio(struct fown_struct *fown, int fd, int band); +void send_sigio(struct fown_struct *fown, int fd, int band); #ifdef CONFIG_FILE_LOCKING -extern int fcntl_getlk(struct file *, unsigned int, struct flock __user *); -extern int fcntl_setlk(unsigned int, struct file *, unsigned int, - struct flock __user *); +int fcntl_getlk(struct file *, unsigned int, struct flock __user *); +int fcntl_setlk(unsigned int, struct file *, unsigned int, + struct flock __user *); #if BITS_PER_LONG == 32 -extern int fcntl_getlk64(struct file *, unsigned int, struct flock64 __user *); -extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, - struct flock64 __user *); +int fcntl_getlk64(struct file *, unsigned int, struct flock64 __user *); +int fcntl_setlk64(unsigned int, struct file *, unsigned int, + struct flock64 __user *); #endif -extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); -extern int fcntl_getlease(struct file *filp); +int fcntl_setlease(unsigned int fd, struct file *filp, long arg); +int fcntl_getlease(struct file *filp); /* fs/locks.c */ void locks_free_lock(struct file_lock *fl); -extern void locks_init_lock(struct file_lock *); -extern struct file_lock * locks_alloc_lock(void); -extern void locks_copy_lock(struct file_lock *, struct file_lock *); -extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); -extern void locks_remove_posix(struct file *, fl_owner_t); -extern void locks_remove_file(struct file *); -extern void locks_release_private(struct file_lock *); -extern void posix_test_lock(struct file *, struct file_lock *); -extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); -extern int posix_lock_file_wait(struct file *, struct file_lock *); -extern int posix_unblock_lock(struct file_lock *); -extern int vfs_test_lock(struct file *, struct file_lock *); -extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); -extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); -extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); -extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); -extern void lease_get_mtime(struct inode *, struct timespec *time); -extern int generic_setlease(struct file *, long, struct file_lock **); -extern int vfs_setlease(struct file *, long, struct file_lock **); -extern int lease_modify(struct file_lock **, int); -extern int lock_may_read(struct inode *, loff_t start, unsigned long count); -extern int lock_may_write(struct inode *, loff_t start, unsigned long count); +void locks_init_lock(struct file_lock *); +struct file_lock *locks_alloc_lock(void); +void locks_copy_lock(struct file_lock *, struct file_lock *); +void __locks_copy_lock(struct file_lock *, const struct file_lock *); +void locks_remove_posix(struct file *, fl_owner_t); +void locks_remove_file(struct file *); +void locks_release_private(struct file_lock *); +void posix_test_lock(struct file *, struct file_lock *); +int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); +int posix_lock_file_wait(struct file *, struct file_lock *); +int posix_unblock_lock(struct file_lock *); +int vfs_test_lock(struct file *, struct file_lock *); +int vfs_lock_file(struct file *, unsigned int, struct file_lock *, + struct file_lock *); +int vfs_cancel_lock(struct file *filp, struct file_lock *fl); +int flock_lock_file_wait(struct file *filp, struct file_lock *fl); +int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); +void lease_get_mtime(struct inode *, struct timespec *time); +int generic_setlease(struct file *, long, struct file_lock **); +int vfs_setlease(struct file *, long, struct file_lock **); +int lease_modify(struct file_lock **, int); +int lock_may_read(struct inode *, loff_t start, unsigned long count); +int lock_may_write(struct inode *, loff_t start, unsigned long count); #else /* !CONFIG_FILE_LOCKING */ static inline int fcntl_getlk(struct file *file, unsigned int cmd, struct flock __user *user) @@ -998,32 +1022,26 @@ static inline int fcntl_getlease(struct file *filp) static inline void locks_init_lock(struct file_lock *fl) { - return; } static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) { - return; } static inline void locks_copy_lock(struct file_lock *new, struct file_lock *fl) { - return; } static inline void locks_remove_posix(struct file *filp, fl_owner_t owner) { - return; } static inline void locks_remove_file(struct file *filp) { - return; } static inline void posix_test_lock(struct file *filp, struct file_lock *fl) { - return; } static inline int posix_lock_file(struct file *filp, struct file_lock *fl, @@ -1064,18 +1082,18 @@ static inline int flock_lock_file_wait(struct file *filp, return -ENOLCK; } -static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type) +static inline int __break_lease(struct inode *inode, unsigned int mode, + unsigned int type) { return 0; } static inline void lease_get_mtime(struct inode *inode, struct timespec *time) { - return; } static inline int generic_setlease(struct file *filp, long arg, - struct file_lock **flp) + struct file_lock **flp) { return -EINVAL; } @@ -1104,7 +1122,6 @@ static inline int lock_may_write(struct inode *inode, loff_t start, } #endif /* !CONFIG_FILE_LOCKING */ - struct fasync_struct { spinlock_t fa_lock; int magic; @@ -1117,20 +1134,22 @@ struct fasync_struct { #define FASYNC_MAGIC 0x4601 /* SMP safe fasync helpers: */ -extern int fasync_helper(int, struct file *, int, struct fasync_struct **); -extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *); -extern int fasync_remove_entry(struct file *, struct fasync_struct **); -extern struct fasync_struct *fasync_alloc(void); -extern void fasync_free(struct fasync_struct *); +int fasync_helper(int, struct file *, int, struct fasync_struct **); +struct fasync_struct *fasync_insert_entry(int, struct file *, + struct fasync_struct **, + struct fasync_struct *); +int fasync_remove_entry(struct file *, struct fasync_struct **); +struct fasync_struct *fasync_alloc(void); +void fasync_free(struct fasync_struct *); /* can be called from interrupts */ -extern void kill_fasync(struct fasync_struct **, int, int); +void kill_fasync(struct fasync_struct **, int, int); -extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); -extern int f_setown(struct file *filp, unsigned long arg, int force); -extern void f_delown(struct file *filp); -extern pid_t f_getown(struct file *filp); -extern int send_sigurg(struct fown_struct *fown); +int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); +int f_setown(struct file *filp, unsigned long arg, int force); +void f_delown(struct file *filp); +pid_t f_getown(struct file *filp); +int send_sigurg(struct fown_struct *fown); struct mm_struct; @@ -1208,7 +1227,7 @@ struct super_block { char s_id[32]; /* Informational name */ u8 s_uuid[16]; /* UUID */ - void *s_fs_info; /* Filesystem private info */ + void *s_fs_info; /* Filesystem private info */ unsigned int s_max_links; fmode_t s_mode; @@ -1260,7 +1279,7 @@ struct super_block { struct rcu_head rcu; }; -extern struct timespec current_fs_time(struct super_block *sb); +struct timespec current_fs_time(struct super_block *sb); /* * Snapshotting support. @@ -1376,31 +1395,31 @@ static inline void sb_start_intwrite(struct super_block *sb) __sb_start_write(sb, SB_FREEZE_FS, true); } - -extern bool inode_owner_or_capable(const struct inode *inode); +bool inode_owner_or_capable(const struct inode *inode); /* * VFS helper functions.. */ -extern int vfs_create(struct inode *, struct dentry *, umode_t, bool); -extern int vfs_mkdir(struct inode *, struct dentry *, umode_t); -extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); -extern int vfs_symlink(struct inode *, struct dentry *, const char *); -extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **); -extern int vfs_rmdir(struct inode *, struct dentry *); -extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int); +int vfs_create(struct inode *, struct dentry *, umode_t, bool); +int vfs_mkdir(struct inode *, struct dentry *, umode_t); +int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); +int vfs_symlink(struct inode *, struct dentry *, const char *); +int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **); +int vfs_rmdir(struct inode *, struct dentry *); +int vfs_unlink(struct inode *, struct dentry *, struct inode **); +int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, + struct inode **, unsigned int); /* * VFS dentry helper functions. */ -extern void dentry_unhash(struct dentry *dentry); +void dentry_unhash(struct dentry *dentry); /* * VFS file helper functions. */ -extern void inode_init_owner(struct inode *inode, const struct inode *dir, - umode_t mode); +void inode_init_owner(struct inode *inode, const struct inode *dir, + umode_t mode); /* * VFS FS_IOC_FIEMAP helper definitions. */ @@ -1409,7 +1428,7 @@ struct fiemap_extent_info { unsigned int fi_extents_mapped; /* Number of mapped extents */ unsigned int fi_extents_max; /* Size of fiemap_extent array */ struct fiemap_extent __user *fi_extents_start; /* Start of - fiemap_extent array */ + fiemap_extent array */ }; int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, u64 phys, u64 len, u32 flags); @@ -1455,31 +1474,38 @@ struct iov_iter; struct file_operations { struct module *owner; - loff_t (*llseek) (struct file *, loff_t, int); - ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); - ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); - ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); - ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); - ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); - ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); - int (*iterate) (struct file *, struct dir_context *); - unsigned int (*poll) (struct file *, struct poll_table_struct *); - long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); - long (*compat_ioctl) (struct file *, unsigned int, unsigned long); - int (*mmap) (struct file *, struct vm_area_struct *); - int (*open) (struct inode *, struct file *); - int (*flush) (struct file *, fl_owner_t id); - int (*release) (struct inode *, struct file *); - int (*fsync) (struct file *, loff_t, loff_t, int datasync); - int (*aio_fsync) (struct kiocb *, int datasync); - int (*fasync) (int, struct file *, int); - int (*lock) (struct file *, int, struct file_lock *); - ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); - unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); + loff_t (*llseek)(struct file *, loff_t, int); + ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); + ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); + ssize_t (*aio_read)(struct kiocb *, const struct iovec *, + unsigned long, loff_t); + ssize_t (*aio_write)(struct kiocb *, const struct iovec *, + unsigned long, loff_t); + ssize_t (*read_iter)(struct kiocb *, struct iov_iter *); + ssize_t (*write_iter)(struct kiocb *, struct iov_iter *); + int (*iterate)(struct file *, struct dir_context *); + unsigned int (*poll)(struct file *, struct poll_table_struct *); + long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); + long (*compat_ioctl)(struct file *, unsigned int, unsigned long); + int (*mmap)(struct file *, struct vm_area_struct *); + int (*open)(struct inode *, struct file *); + int (*flush)(struct file *, fl_owner_t id); + int (*release)(struct inode *, struct file *); + int (*fsync)(struct file *, loff_t, loff_t, int datasync); + int (*aio_fsync)(struct kiocb *, int datasync); + int (*fasync)(int, struct file *, int); + int (*lock)(struct file *, int, struct file_lock *); + ssize_t (*sendpage)(struct file *, struct page *, int, size_t, + loff_t *, int); + unsigned long (*get_unmapped_area)(struct file *, unsigned long, + unsigned long, unsigned long, + unsigned long); int (*check_flags)(int); - int (*flock) (struct file *, int, struct file_lock *); - ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); - ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); + int (*flock)(struct file *, int, struct file_lock *); + ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, + loff_t *, size_t, unsigned int); + ssize_t (*splice_read)(struct file *, loff_t *, + struct pipe_inode_info *, size_t, unsigned int); int (*setlease)(struct file *, long, struct file_lock **); long (*fallocate)(struct file *file, int mode, loff_t offset, loff_t len); @@ -1487,76 +1513,79 @@ struct file_operations { }; struct inode_operations { - struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); - void * (*follow_link) (struct dentry *, struct nameidata *); - int (*permission) (struct inode *, int); + struct dentry *(*lookup)(struct inode *, struct dentry *, unsigned int); + void *(*follow_link)(struct dentry *, struct nameidata *); + int (*permission)(struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); - int (*readlink) (struct dentry *, char __user *,int); - void (*put_link) (struct dentry *, struct nameidata *, void *); - - int (*create) (struct inode *,struct dentry *, umode_t, bool); - int (*link) (struct dentry *,struct inode *,struct dentry *); - int (*unlink) (struct inode *,struct dentry *); - int (*symlink) (struct inode *,struct dentry *,const char *); - int (*mkdir) (struct inode *,struct dentry *,umode_t); - int (*rmdir) (struct inode *,struct dentry *); - int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename) (struct inode *, struct dentry *, - struct inode *, struct dentry *); - int (*rename2) (struct inode *, struct dentry *, - struct inode *, struct dentry *, unsigned int); - int (*setattr) (struct dentry *, struct iattr *); - int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); - int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); - ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); - ssize_t (*listxattr) (struct dentry *, char *, size_t); - int (*removexattr) (struct dentry *, const char *); + int (*readlink)(struct dentry *, char __user *, int); + void (*put_link)(struct dentry *, struct nameidata *, void *); + + int (*create)(struct inode *, struct dentry *, umode_t, bool); + int (*link)(struct dentry *, struct inode *, struct dentry *); + int (*unlink)(struct inode *, struct dentry *); + int (*symlink)(struct inode *, struct dentry *, const char *); + int (*mkdir)(struct inode *, struct dentry *, umode_t); + int (*rmdir)(struct inode *, struct dentry *); + int (*mknod)(struct inode *, struct dentry *, umode_t, dev_t); + int (*rename)(struct inode *, struct dentry *, + struct inode *, struct dentry *); + int (*rename2)(struct inode *, struct dentry *, + struct inode *, struct dentry *, unsigned int); + int (*setattr)(struct dentry *, struct iattr *); + int (*getattr)(struct vfsmount *mnt, struct dentry *, struct kstat *); + int (*setxattr)(struct dentry *, const char *, const void *, size_t, + int); + ssize_t (*getxattr)(struct dentry *, const char *, void *, size_t); + ssize_t (*listxattr)(struct dentry *, char *, size_t); + int (*removexattr)(struct dentry *, const char *); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); int (*update_time)(struct inode *, struct timespec *, int); int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned open_flag, umode_t create_mode, int *opened); - int (*tmpfile) (struct inode *, struct dentry *, umode_t); + int (*tmpfile)(struct inode *, struct dentry *, umode_t); int (*set_acl)(struct inode *, struct posix_acl *, int); } ____cacheline_aligned; -ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, +ssize_t rw_copy_check_uvector(int type, const struct iovec __user *uvector, unsigned long nr_segs, unsigned long fast_segs, struct iovec *fast_pointer, struct iovec **ret_pointer); -extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); -extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); -extern ssize_t vfs_readv(struct file *, const struct iovec __user *, - unsigned long, loff_t *); -extern ssize_t vfs_writev(struct file *, const struct iovec __user *, - unsigned long, loff_t *); +ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); +ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); +ssize_t vfs_readv(struct file *, const struct iovec __user *, unsigned long, + loff_t *); +ssize_t vfs_writev(struct file *, const struct iovec __user *, unsigned long, + loff_t *); struct super_operations { - struct inode *(*alloc_inode)(struct super_block *sb); + struct inode *(*alloc_inode)(struct super_block *sb); void (*destroy_inode)(struct inode *); - void (*dirty_inode) (struct inode *, int flags); - int (*write_inode) (struct inode *, struct writeback_control *wbc); - int (*drop_inode) (struct inode *); - void (*evict_inode) (struct inode *); - void (*put_super) (struct super_block *); + void (*dirty_inode)(struct inode *, int flags); + int (*write_inode)(struct inode *, struct writeback_control *wbc); + int (*drop_inode)(struct inode *); + void (*evict_inode)(struct inode *); + void (*put_super)(struct super_block *); int (*sync_fs)(struct super_block *sb, int wait); - int (*freeze_fs) (struct super_block *); - int (*unfreeze_fs) (struct super_block *); - int (*statfs) (struct dentry *, struct kstatfs *); - int (*remount_fs) (struct super_block *, int *, char *); - void (*umount_begin) (struct super_block *); + int (*freeze_fs)(struct super_block *); + int (*unfreeze_fs)(struct super_block *); + int (*statfs)(struct dentry *, struct kstatfs *); + int (*remount_fs)(struct super_block *, int *, char *); + void (*umount_begin)(struct super_block *); int (*show_options)(struct seq_file *, struct dentry *); int (*show_devname)(struct seq_file *, struct dentry *); int (*show_path)(struct seq_file *, struct dentry *); int (*show_stats)(struct seq_file *, struct dentry *); #ifdef CONFIG_QUOTA - ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); - ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); + ssize_t (*quota_read)(struct super_block *, int, char *, size_t, + loff_t); + ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, + loff_t); #endif int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); long (*nr_cached_objects)(struct super_block *, int); @@ -1596,12 +1625,12 @@ struct super_operations { #define __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg)) #define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) -#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ - ((inode)->i_flags & S_SYNC)) -#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ - ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) +#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ + ((inode)->i_flags & S_SYNC)) +#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS | MS_DIRSYNC) || \ + ((inode)->i_flags & (S_SYNC | S_DIRSYNC))) #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) -#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY | MS_NOATIME) #define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) @@ -1687,7 +1716,7 @@ struct super_operations { #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) -extern void __mark_inode_dirty(struct inode *, int); +void __mark_inode_dirty(struct inode *, int); static inline void mark_inode_dirty(struct inode *inode) { __mark_inode_dirty(inode, I_DIRTY); @@ -1698,10 +1727,10 @@ static inline void mark_inode_dirty_sync(struct inode *inode) __mark_inode_dirty(inode, I_DIRTY_SYNC); } -extern void inc_nlink(struct inode *inode); -extern void drop_nlink(struct inode *inode); -extern void clear_nlink(struct inode *inode); -extern void set_nlink(struct inode *inode, unsigned int nlink); +void inc_nlink(struct inode *inode); +void drop_nlink(struct inode *inode); +void clear_nlink(struct inode *inode); +void set_nlink(struct inode *inode, unsigned int nlink); static inline void inode_inc_link_count(struct inode *inode) { @@ -1725,9 +1754,9 @@ static inline void inode_dec_link_count(struct inode *inode) static inline void inode_inc_iversion(struct inode *inode) { - spin_lock(&inode->i_lock); - inode->i_version++; - spin_unlock(&inode->i_lock); + spin_lock(&inode->i_lock); + inode->i_version++; + spin_unlock(&inode->i_lock); } enum file_time_flags { @@ -1737,7 +1766,7 @@ enum file_time_flags { S_VERSION = 8, }; -extern void touch_atime(const struct path *); +void touch_atime(const struct path *); static inline void file_accessed(struct file *file) { if (!(file->f_flags & O_NOATIME)) @@ -1750,17 +1779,17 @@ int sync_inode_metadata(struct inode *inode, int wait); struct file_system_type { const char *name; int fs_flags; -#define FS_REQUIRES_DEV 1 +#define FS_REQUIRES_DEV 1 #define FS_BINARY_MOUNTDATA 2 #define FS_HAS_SUBTYPE 4 #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ #define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ - struct dentry *(*mount) (struct file_system_type *, int, - const char *, void *); - void (*kill_sb) (struct super_block *); + struct dentry *(*mount)(struct file_system_type *, int, + const char *, void *); + void (*kill_sb)(struct super_block *); struct module *owner; - struct file_system_type * next; + struct file_system_type *next; struct hlist_head fs_supers; struct lock_class_key s_lock_key; @@ -1775,18 +1804,19 @@ struct file_system_type { #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) -extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, - void *data, int (*fill_super)(struct super_block *, void *, int)); -extern struct dentry *mount_bdev(struct file_system_type *fs_type, - int flags, const char *dev_name, void *data, - int (*fill_super)(struct super_block *, void *, int)); -extern struct dentry *mount_single(struct file_system_type *fs_type, - int flags, void *data, - int (*fill_super)(struct super_block *, void *, int)); -extern struct dentry *mount_nodev(struct file_system_type *fs_type, - int flags, void *data, - int (*fill_super)(struct super_block *, void *, int)); -extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path); +struct dentry *mount_ns(struct file_system_type *fs_type, int flags, + void *data, + int (*fill_super)(struct super_block *, void *, int)); +struct dentry *mount_bdev(struct file_system_type *fs_type, + int flags, const char *dev_name, void *data, + int (*fill_super)(struct super_block *, void *, int)); +struct dentry *mount_single(struct file_system_type *fs_type, + int flags, void *data, + int (*fill_super)(struct super_block *, void *, int)); +struct dentry *mount_nodev(struct file_system_type *fs_type, + int flags, void *data, + int (*fill_super)(struct super_block *, void *, int)); +struct dentry *mount_subtree(struct vfsmount *mnt, const char *path); void generic_shutdown_super(struct super_block *sb); void kill_block_super(struct super_block *sb); void kill_anon_super(struct super_block *sb); @@ -1797,56 +1827,56 @@ int set_anon_super(struct super_block *s, void *data); int get_anon_bdev(dev_t *); void free_anon_bdev(dev_t); struct super_block *sget(struct file_system_type *type, - int (*test)(struct super_block *,void *), - int (*set)(struct super_block *,void *), - int flags, void *data); -extern struct dentry *mount_pseudo(struct file_system_type *, char *, - const struct super_operations *ops, - const struct dentry_operations *dops, - unsigned long); + int (*test)(struct super_block *, void *), + int (*set)(struct super_block *, void *), + int flags, void *data); +struct dentry *mount_pseudo(struct file_system_type *, char *, + const struct super_operations *ops, + const struct dentry_operations *dops, + unsigned long); /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ -#define fops_get(fops) \ +#define fops_get(fops) \ (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) -#define fops_put(fops) \ - do { if (fops) module_put((fops)->owner); } while(0) +#define fops_put(fops) \ + do { if (fops) module_put((fops)->owner); } while (0) /* * This one is to be used *ONLY* from ->open() instances. * fops must be non-NULL, pinned down *and* module dependencies * should be sufficient to pin the caller down as well. */ -#define replace_fops(f, fops) \ - do { \ - struct file *__file = (f); \ - fops_put(__file->f_op); \ - BUG_ON(!(__file->f_op = (fops))); \ - } while(0) - -extern int register_filesystem(struct file_system_type *); -extern int unregister_filesystem(struct file_system_type *); -extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); +#define replace_fops(f, fops) \ + do { \ + struct file *__file = (f); \ + fops_put(__file->f_op); \ + BUG_ON(!(__file->f_op = (fops))); \ + } while (0) + +int register_filesystem(struct file_system_type *); +int unregister_filesystem(struct file_system_type *); +struct vfsmount *kern_mount_data(struct file_system_type *, void *data); #define kern_mount(type) kern_mount_data(type, NULL) -extern void kern_unmount(struct vfsmount *mnt); -extern int may_umount_tree(struct vfsmount *); -extern int may_umount(struct vfsmount *); -extern long do_mount(const char *, const char *, const char *, unsigned long, void *); -extern struct vfsmount *collect_mounts(struct path *); -extern void drop_collected_mounts(struct vfsmount *); -extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, - struct vfsmount *); -extern int vfs_statfs(struct path *, struct kstatfs *); -extern int user_statfs(const char __user *, struct kstatfs *); -extern int fd_statfs(int, struct kstatfs *); -extern int vfs_ustat(dev_t, struct kstatfs *); -extern int freeze_super(struct super_block *super); -extern int thaw_super(struct super_block *super); -extern bool our_mnt(struct vfsmount *mnt); -extern bool fs_fully_visible(struct file_system_type *); - -extern int current_umask(void); - -extern void ihold(struct inode * inode); -extern void iput(struct inode *); +void kern_unmount(struct vfsmount *mnt); +int may_umount_tree(struct vfsmount *); +int may_umount(struct vfsmount *); +long do_mount(const char *, const char *, const char *, unsigned long, void *); +struct vfsmount *collect_mounts(struct path *); +void drop_collected_mounts(struct vfsmount *); +int iterate_mounts(int (*)(struct vfsmount *, void *), void *, + struct vfsmount *); +int vfs_statfs(struct path *, struct kstatfs *); +int user_statfs(const char __user *, struct kstatfs *); +int fd_statfs(int, struct kstatfs *); +int vfs_ustat(dev_t, struct kstatfs *); +int freeze_super(struct super_block *super); +int thaw_super(struct super_block *super); +bool our_mnt(struct vfsmount *mnt); +bool fs_fully_visible(struct file_system_type *); + +int current_umask(void); + +void ihold(struct inode *inode); +void iput(struct inode *); static inline struct inode *file_inode(struct file *f) { @@ -1862,8 +1892,8 @@ extern struct kobject *fs_kobj; #define FLOCK_VERIFY_WRITE 2 #ifdef CONFIG_FILE_LOCKING -extern int locks_mandatory_locked(struct file *); -extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); +int locks_mandatory_locked(struct file *); +int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); /* * Candidates for mandatory locking have the setgid bit set @@ -1893,8 +1923,8 @@ static inline int locks_verify_locked(struct file *file) } static inline int locks_verify_truncate(struct inode *inode, - struct file *filp, - loff_t size) + struct file *filp, + loff_t size) { if (inode->i_flock && mandatory_lock(inode)) return locks_mandatory_area( @@ -1902,7 +1932,7 @@ static inline int locks_verify_truncate(struct inode *inode, size < inode->i_size ? size : inode->i_size, (size < inode->i_size ? inode->i_size - size : size - inode->i_size) - ); + ); return 0; } @@ -1932,11 +1962,12 @@ static inline int break_deleg(struct inode *inode, unsigned int mode) return 0; } -static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode) +static inline int try_break_deleg(struct inode *inode, + struct inode **delegated_inode) { int ret; - ret = break_deleg(inode, O_WRONLY|O_NONBLOCK); + ret = break_deleg(inode, O_WRONLY | O_NONBLOCK); if (ret == -EWOULDBLOCK && delegated_inode) { *delegated_inode = inode; ihold(inode); @@ -1998,7 +2029,8 @@ static inline int break_deleg(struct inode *inode, unsigned int mode) return 0; } -static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode) +static inline int try_break_deleg(struct inode *inode, + struct inode **delegated_inode) { return 0; } @@ -2020,69 +2052,66 @@ struct filename { bool separate; /* should "name" be freed? */ }; -extern long vfs_truncate(struct path *, loff_t); -extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, - struct file *filp); -extern int do_fallocate(struct file *file, int mode, loff_t offset, - loff_t len); -extern long do_sys_open(int dfd, const char __user *filename, int flags, - umode_t mode); -extern struct file *file_open_name(struct filename *, int, umode_t); -extern struct file *filp_open(const char *, int, umode_t); -extern struct file *file_open_root(struct dentry *, struct vfsmount *, - const char *, int); -extern struct file * dentry_open(const struct path *, int, const struct cred *); -extern int filp_close(struct file *, fl_owner_t id); - -extern struct filename *getname(const char __user *); -extern struct filename *getname_kernel(const char *); +long vfs_truncate(struct path *, loff_t); +int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, + struct file *filp); +int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len); +long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode); +struct file *file_open_name(struct filename *, int, umode_t); +struct file *filp_open(const char *, int, umode_t); +struct file *file_open_root(struct dentry *, struct vfsmount *, + const char *, int); +struct file *dentry_open(const struct path *, int, const struct cred *); +int filp_close(struct file *, fl_owner_t id); + +struct filename *getname(const char __user *); +struct filename *getname_kernel(const char *); enum { FILE_CREATED = 1, FILE_OPENED = 2 }; -extern int finish_open(struct file *file, struct dentry *dentry, - int (*open)(struct inode *, struct file *), - int *opened); -extern int finish_no_open(struct file *file, struct dentry *dentry); +int finish_open(struct file *file, struct dentry *dentry, + int (*open)(struct inode *, struct file *), int *opened); +int finish_no_open(struct file *file, struct dentry *dentry); /* fs/ioctl.c */ -extern int ioctl_preallocate(struct file *filp, void __user *argp); +int ioctl_preallocate(struct file *filp, void __user *argp); /* fs/dcache.c */ -extern void __init vfs_caches_init_early(void); -extern void __init vfs_caches_init(unsigned long); +void __init vfs_caches_init_early(void); +void __init vfs_caches_init(unsigned long); extern struct kmem_cache *names_cachep; -extern void final_putname(struct filename *name); +void final_putname(struct filename *name); #define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) #define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) #ifndef CONFIG_AUDITSYSCALL #define putname(name) final_putname(name) #else -extern void putname(struct filename *name); +void putname(struct filename *name); #endif #ifdef CONFIG_BLOCK -extern int register_blkdev(unsigned int, const char *); -extern void unregister_blkdev(unsigned int, const char *); -extern struct block_device *bdget(dev_t); -extern struct block_device *bdgrab(struct block_device *bdev); -extern void bd_set_size(struct block_device *, loff_t size); -extern void bd_forget(struct inode *inode); -extern void bdput(struct block_device *); -extern void invalidate_bdev(struct block_device *); -extern void iterate_bdevs(void (*)(struct block_device *, void *), void *); -extern int sync_blockdev(struct block_device *bdev); -extern void kill_bdev(struct block_device *); -extern struct super_block *freeze_bdev(struct block_device *); -extern void emergency_thaw_all(void); -extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); -extern int fsync_bdev(struct block_device *); -extern int sb_is_blkdev_sb(struct super_block *sb); +int register_blkdev(unsigned int, const char *); +void unregister_blkdev(unsigned int, const char *); +struct block_device *bdget(dev_t); +struct block_device *bdgrab(struct block_device *bdev); +void bd_set_size(struct block_device *, loff_t size); +void bd_forget(struct inode *inode); +void bdput(struct block_device *); +void invalidate_bdev(struct block_device *); +void iterate_bdevs(void (*)(struct block_device *, void *), void *); +int sync_blockdev(struct block_device *bdev); +void kill_bdev(struct block_device *); +struct super_block *freeze_bdev(struct block_device *); +void emergency_thaw_all(void); +int thaw_bdev(struct block_device *bdev, struct super_block *sb); +int fsync_bdev(struct block_device *); +int sb_is_blkdev_sb(struct super_block *sb); #else static inline void bd_forget(struct inode *inode) {} static inline int sync_blockdev(struct block_device *bdev) { return 0; } @@ -2108,24 +2137,23 @@ static inline int sb_is_blkdev_sb(struct super_block *sb) return 0; } #endif -extern int sync_filesystem(struct super_block *); +int sync_filesystem(struct super_block *); extern const struct file_operations def_blk_fops; extern const struct file_operations def_chr_fops; extern const struct file_operations bad_sock_fops; #ifdef CONFIG_BLOCK -extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); -extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); -extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); -extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder); -extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, - void *holder); -extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, - void *holder); -extern void blkdev_put(struct block_device *bdev, fmode_t mode); +int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); +int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); +long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); +int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder); +struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, + void *holder); +struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, + void *holder); +void blkdev_put(struct block_device *bdev, fmode_t mode); #ifdef CONFIG_SYSFS -extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); -extern void bd_unlink_disk_holder(struct block_device *bdev, - struct gendisk *disk); +int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); +void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk); #else static inline int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk) @@ -2141,15 +2169,15 @@ static inline void bd_unlink_disk_holder(struct block_device *bdev, /* fs/char_dev.c */ #define CHRDEV_MAJOR_HASH_SIZE 255 -extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); -extern int register_chrdev_region(dev_t, unsigned, const char *); -extern int __register_chrdev(unsigned int major, unsigned int baseminor, - unsigned int count, const char *name, - const struct file_operations *fops); -extern void __unregister_chrdev(unsigned int major, unsigned int baseminor, - unsigned int count, const char *name); -extern void unregister_chrdev_region(dev_t, unsigned); -extern void chrdev_show(struct seq_file *,off_t); +int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); +int register_chrdev_region(dev_t, unsigned, const char *); +int __register_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name, + const struct file_operations *fops); +void __unregister_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name); +void unregister_chrdev_region(dev_t, unsigned); +void chrdev_show(struct seq_file *, off_t); static inline int register_chrdev(unsigned int major, const char *name, const struct file_operations *fops) @@ -2168,20 +2196,20 @@ static inline void unregister_chrdev(unsigned int major, const char *name) #ifdef CONFIG_BLOCK #define BLKDEV_MAJOR_HASH_SIZE 255 -extern const char *__bdevname(dev_t, char *buffer); -extern const char *bdevname(struct block_device *bdev, char *buffer); -extern struct block_device *lookup_bdev(const char *); -extern void blkdev_show(struct seq_file *,off_t); +const char *__bdevname(dev_t, char *buffer); +const char *bdevname(struct block_device *bdev, char *buffer); +struct block_device *lookup_bdev(const char *); +void blkdev_show(struct seq_file *, off_t); #else #define BLKDEV_MAJOR_HASH_SIZE 0 #endif -extern void init_special_inode(struct inode *, umode_t, dev_t); +void init_special_inode(struct inode *, umode_t, dev_t); /* Invalid inode operations -- fs/bad_inode.c */ -extern void make_bad_inode(struct inode *); -extern int is_bad_inode(struct inode *); +void make_bad_inode(struct inode *); +int is_bad_inode(struct inode *); #ifdef CONFIG_BLOCK /* @@ -2194,15 +2222,14 @@ extern int is_bad_inode(struct inode *); */ #define bio_data_dir(bio) ((bio)->bi_rw & 1) -extern void check_disk_size_change(struct gendisk *disk, - struct block_device *bdev); -extern int revalidate_disk(struct gendisk *); -extern int check_disk_change(struct block_device *); -extern int __invalidate_device(struct block_device *, bool); -extern int invalidate_partition(struct gendisk *, int); +void check_disk_size_change(struct gendisk *disk, struct block_device *bdev); +int revalidate_disk(struct gendisk *); +int check_disk_change(struct block_device *); +int __invalidate_device(struct block_device *, bool); +int invalidate_partition(struct gendisk *, int); #endif unsigned long invalidate_mapping_pages(struct address_space *mapping, - pgoff_t start, pgoff_t end); + pgoff_t start, pgoff_t end); static inline void invalidate_remote_inode(struct inode *inode) { @@ -2210,26 +2237,24 @@ static inline void invalidate_remote_inode(struct inode *inode) S_ISLNK(inode->i_mode)) invalidate_mapping_pages(inode->i_mapping, 0, -1); } -extern int invalidate_inode_pages2(struct address_space *mapping); -extern int invalidate_inode_pages2_range(struct address_space *mapping, - pgoff_t start, pgoff_t end); -extern int write_inode_now(struct inode *, int); -extern int filemap_fdatawrite(struct address_space *); -extern int filemap_flush(struct address_space *); -extern int filemap_fdatawait(struct address_space *); -extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, - loff_t lend); -extern int filemap_write_and_wait(struct address_space *mapping); -extern int filemap_write_and_wait_range(struct address_space *mapping, - loff_t lstart, loff_t lend); -extern int __filemap_fdatawrite_range(struct address_space *mapping, - loff_t start, loff_t end, int sync_mode); -extern int filemap_fdatawrite_range(struct address_space *mapping, - loff_t start, loff_t end); - -extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end, - int datasync); -extern int vfs_fsync(struct file *file, int datasync); +int invalidate_inode_pages2(struct address_space *mapping); +int invalidate_inode_pages2_range(struct address_space *mapping, + pgoff_t start, pgoff_t end); +int write_inode_now(struct inode *, int); +int filemap_fdatawrite(struct address_space *); +int filemap_flush(struct address_space *); +int filemap_fdatawait(struct address_space *); +int filemap_fdatawait_range(struct address_space *, loff_t lstart, loff_t lend); +int filemap_write_and_wait(struct address_space *mapping); +int filemap_write_and_wait_range(struct address_space *mapping, + loff_t lstart, loff_t lend); +int __filemap_fdatawrite_range(struct address_space *mapping, + loff_t start, loff_t end, int sync_mode); +int filemap_fdatawrite_range(struct address_space *mapping, + loff_t start, loff_t end); + +int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync); +int vfs_fsync(struct file *file, int datasync); static inline int generic_write_sync(struct file *file, loff_t pos, loff_t count) { if (!(file->f_flags & O_DSYNC) && !IS_SYNC(file->f_mapping->host)) @@ -2237,14 +2262,14 @@ static inline int generic_write_sync(struct file *file, loff_t pos, loff_t count return vfs_fsync_range(file, pos, pos + count - 1, (file->f_flags & __O_SYNC) ? 0 : 1); } -extern void emergency_sync(void); -extern void emergency_remount(void); +void emergency_sync(void); +void emergency_remount(void); #ifdef CONFIG_BLOCK -extern sector_t bmap(struct inode *, sector_t); +sector_t bmap(struct inode *, sector_t); #endif -extern int notify_change(struct dentry *, struct iattr *, struct inode **); -extern int inode_permission(struct inode *, int); -extern int generic_permission(struct inode *, int); +int notify_change(struct dentry *, struct iattr *, struct inode **); +int inode_permission(struct inode *, int); +int generic_permission(struct inode *, int); static inline bool execute_ok(struct inode *inode) { @@ -2297,7 +2322,7 @@ static inline int deny_write_access(struct file *file) struct inode *inode = file_inode(file); return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; } -static inline void put_write_access(struct inode * inode) +static inline void put_write_access(struct inode *inode) { atomic_dec(&inode->i_writecount); } @@ -2324,145 +2349,156 @@ static inline void i_readcount_inc(struct inode *inode) #else static inline void i_readcount_dec(struct inode *inode) { - return; } static inline void i_readcount_inc(struct inode *inode) { - return; } #endif -extern int do_pipe_flags(int *, int); +int do_pipe_flags(int *, int); + +int kernel_read(struct file *, loff_t, char *, unsigned long); +ssize_t kernel_write(struct file *, const char *, size_t, loff_t); +struct file *open_exec(const char *); -extern int kernel_read(struct file *, loff_t, char *, unsigned long); -extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t); -extern struct file * open_exec(const char *); - /* fs/dcache.c -- generic fs support functions */ -extern int is_subdir(struct dentry *, struct dentry *); -extern int path_is_under(struct path *, struct path *); +int is_subdir(struct dentry *, struct dentry *); +int path_is_under(struct path *, struct path *); #include <linux/err.h> /* needed for stackable file system support */ -extern loff_t default_llseek(struct file *file, loff_t offset, int whence); +loff_t default_llseek(struct file *file, loff_t offset, int whence); -extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence); +loff_t vfs_llseek(struct file *file, loff_t offset, int whence); -extern int inode_init_always(struct super_block *, struct inode *); -extern void inode_init_once(struct inode *); -extern void address_space_init_once(struct address_space *mapping); -extern struct inode * igrab(struct inode *); -extern ino_t iunique(struct super_block *, ino_t); -extern int inode_needs_sync(struct inode *inode); -extern int generic_delete_inode(struct inode *inode); +int inode_init_always(struct super_block *, struct inode *); +void inode_init_once(struct inode *); +void address_space_init_once(struct address_space *mapping); +struct inode *igrab(struct inode *); +ino_t iunique(struct super_block *, ino_t); +int inode_needs_sync(struct inode *inode); +int generic_delete_inode(struct inode *inode); static inline int generic_drop_inode(struct inode *inode) { return !inode->i_nlink || inode_unhashed(inode); } -extern struct inode *ilookup5_nowait(struct super_block *sb, - unsigned long hashval, int (*test)(struct inode *, void *), - void *data); -extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, - int (*test)(struct inode *, void *), void *data); -extern struct inode *ilookup(struct super_block *sb, unsigned long ino); +struct inode *ilookup5_nowait(struct super_block *sb, unsigned long hashval, + int (*test)(struct inode *, void *), void *data); +struct inode *ilookup5(struct super_block *sb, unsigned long hashval, + int (*test)(struct inode *, void *), void *data); +struct inode *ilookup(struct super_block *sb, unsigned long ino); -extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *); -extern struct inode * iget_locked(struct super_block *, unsigned long); -extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); -extern int insert_inode_locked(struct inode *); +struct inode *iget5_locked(struct super_block *, unsigned long, + int (*test)(struct inode *, void *), + int (*set)(struct inode *, void *), void *); +struct inode *iget_locked(struct super_block *, unsigned long); +int insert_inode_locked4(struct inode *, unsigned long, + int (*test)(struct inode *, void *), void *); +int insert_inode_locked(struct inode *); #ifdef CONFIG_DEBUG_LOCK_ALLOC -extern void lockdep_annotate_inode_mutex_key(struct inode *inode); +void lockdep_annotate_inode_mutex_key(struct inode *inode); #else static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { }; #endif -extern void unlock_new_inode(struct inode *); -extern unsigned int get_next_ino(void); - -extern void __iget(struct inode * inode); -extern void iget_failed(struct inode *); -extern void clear_inode(struct inode *); -extern void __destroy_inode(struct inode *); -extern struct inode *new_inode_pseudo(struct super_block *sb); -extern struct inode *new_inode(struct super_block *sb); -extern void free_inode_nonrcu(struct inode *inode); -extern int should_remove_suid(struct dentry *); -extern int file_remove_suid(struct file *); - -extern void __insert_inode_hash(struct inode *, unsigned long hashval); +void unlock_new_inode(struct inode *); +unsigned int get_next_ino(void); + +void __iget(struct inode *inode); +void iget_failed(struct inode *); +void clear_inode(struct inode *); +void __destroy_inode(struct inode *); +struct inode *new_inode_pseudo(struct super_block *sb); +struct inode *new_inode(struct super_block *sb); +void free_inode_nonrcu(struct inode *inode); +int should_remove_suid(struct dentry *); +int file_remove_suid(struct file *); + +void __insert_inode_hash(struct inode *, unsigned long hashval); static inline void insert_inode_hash(struct inode *inode) { __insert_inode_hash(inode, inode->i_ino); } -extern void __remove_inode_hash(struct inode *); +void __remove_inode_hash(struct inode *); static inline void remove_inode_hash(struct inode *inode) { if (!inode_unhashed(inode)) __remove_inode_hash(inode); } -extern void inode_sb_list_add(struct inode *inode); +void inode_sb_list_add(struct inode *inode); #ifdef CONFIG_BLOCK -extern void submit_bio(int, struct bio *); -extern int bdev_read_only(struct block_device *); +void submit_bio(int, struct bio *); +int bdev_read_only(struct block_device *); #endif -extern int set_blocksize(struct block_device *, int); -extern int sb_set_blocksize(struct super_block *, int); -extern int sb_min_blocksize(struct super_block *, int); - -extern int generic_file_mmap(struct file *, struct vm_area_struct *); -extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); -extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr, - unsigned long size, pgoff_t pgoff); -int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); -extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); -extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); -extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); -extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t); -extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); -extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); -extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); -extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); -extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); +int set_blocksize(struct block_device *, int); +int sb_set_blocksize(struct super_block *, int); +int sb_min_blocksize(struct super_block *, int); + +int generic_file_mmap(struct file *, struct vm_area_struct *); +int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); +static inline int generic_file_remap_pages(struct vm_area_struct *vma, + unsigned long addr, unsigned long size, pgoff_t pgoff) +{ + BUG(); + return 0; +} +int generic_write_checks(struct file *file, loff_t *pos, size_t *count, + int isblk); +ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); +ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); +ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); +ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t); +ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); +ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, + loff_t *ppos); +ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, + loff_t *ppos); +ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, + loff_t *ppos); +ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, + loff_t *ppos); /* fs/block_dev.c */ -extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); -extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, - int datasync); -extern void block_sync_page(struct page *page); +ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); +int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync); +void block_sync_page(struct page *page); /* fs/splice.c */ -extern ssize_t generic_file_splice_read(struct file *, loff_t *, - struct pipe_inode_info *, size_t, unsigned int); -extern ssize_t default_file_splice_read(struct file *, loff_t *, - struct pipe_inode_info *, size_t, unsigned int); -extern ssize_t iter_file_splice_write(struct pipe_inode_info *, - struct file *, loff_t *, size_t, unsigned int); -extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, - struct file *out, loff_t *, size_t len, unsigned int flags); - -extern void +ssize_t generic_file_splice_read(struct file *, loff_t *, + struct pipe_inode_info *, size_t, + unsigned int); +ssize_t default_file_splice_read(struct file *, loff_t *, + struct pipe_inode_info *, size_t, + unsigned int); +ssize_t iter_file_splice_write(struct pipe_inode_info *, + struct file *, loff_t *, size_t, unsigned int); +ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, + struct file *out, loff_t *, size_t len, + unsigned int flags); + +void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); -extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); -extern loff_t no_llseek(struct file *file, loff_t offset, int whence); -extern loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize); -extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); -extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, - int whence, loff_t maxsize, loff_t eof); -extern loff_t fixed_size_llseek(struct file *file, loff_t offset, - int whence, loff_t size); -extern int generic_file_open(struct inode * inode, struct file * filp); -extern int nonseekable_open(struct inode * inode, struct file * filp); +loff_t noop_llseek(struct file *file, loff_t offset, int whence); +loff_t no_llseek(struct file *file, loff_t offset, int whence); +loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize); +loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); +loff_t generic_file_llseek_size(struct file *file, loff_t offset, + int whence, loff_t maxsize, loff_t eof); +loff_t fixed_size_llseek(struct file *file, loff_t offset, + int whence, loff_t size); +int generic_file_open(struct inode *inode, struct file *filp); +int nonseekable_open(struct inode *inode, struct file *filp); #ifdef CONFIG_FS_XIP -extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len, - loff_t *ppos); -extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma); -extern ssize_t xip_file_write(struct file *filp, const char __user *buf, - size_t len, loff_t *ppos); -extern int xip_truncate_page(struct address_space *mapping, loff_t from); +ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len, + loff_t *ppos); +int xip_file_mmap(struct file *file, struct vm_area_struct *vma); +ssize_t xip_file_write(struct file *filp, const char __user *buf, size_t len, + loff_t *ppos); +int xip_truncate_page(struct address_space *mapping, loff_t from); #else static inline int xip_truncate_page(struct address_space *mapping, loff_t from) { @@ -2488,13 +2524,15 @@ enum { void dio_end_io(struct bio *bio, int error); ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, - struct block_device *bdev, struct iov_iter *iter, loff_t offset, - get_block_t get_block, dio_iodone_t end_io, - dio_submit_t submit_io, int flags); + struct block_device *bdev, struct iov_iter *iter, + loff_t offset, get_block_t get_block, + dio_iodone_t end_io, dio_submit_t submit_io, + int flags); static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, - struct inode *inode, struct iov_iter *iter, loff_t offset, - get_block_t get_block) + struct inode *inode, + struct iov_iter *iter, loff_t offset, + get_block_t get_block) { return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iter, offset, get_block, NULL, NULL, @@ -2505,26 +2543,25 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, void inode_dio_wait(struct inode *inode); void inode_dio_done(struct inode *inode); -extern void inode_set_flags(struct inode *inode, unsigned int flags, - unsigned int mask); +void inode_set_flags(struct inode *inode, unsigned int flags, + unsigned int mask); extern const struct file_operations generic_ro_fops; -#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) +#define special_file(m) (S_ISCHR(m) || S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m)) -extern int readlink_copy(char __user *, int, const char *); -extern int page_readlink(struct dentry *, char __user *, int); -extern void *page_follow_link_light(struct dentry *, struct nameidata *); -extern void page_put_link(struct dentry *, struct nameidata *, void *); -extern int __page_symlink(struct inode *inode, const char *symname, int len, - int nofs); -extern int page_symlink(struct inode *inode, const char *symname, int len); +int readlink_copy(char __user *, int, const char *); +int page_readlink(struct dentry *, char __user *, int); +void *page_follow_link_light(struct dentry *, struct nameidata *); +void page_put_link(struct dentry *, struct nameidata *, void *); +int __page_symlink(struct inode *inode, const char *symname, int len, int nofs); +int page_symlink(struct inode *inode, const char *symname, int len); extern const struct inode_operations page_symlink_inode_operations; -extern void kfree_put_link(struct dentry *, struct nameidata *, void *); -extern int generic_readlink(struct dentry *, char __user *, int); -extern void generic_fillattr(struct inode *, struct kstat *); +void kfree_put_link(struct dentry *, struct nameidata *, void *); +int generic_readlink(struct dentry *, char __user *, int); +void generic_fillattr(struct inode *, struct kstat *); int vfs_getattr_nosec(struct path *path, struct kstat *stat); -extern int vfs_getattr(struct path *, struct kstat *); +int vfs_getattr(struct path *, struct kstat *); void __inode_add_bytes(struct inode *inode, loff_t bytes); void inode_add_bytes(struct inode *inode, loff_t bytes); void __inode_sub_bytes(struct inode *inode, loff_t bytes); @@ -2532,97 +2569,98 @@ void inode_sub_bytes(struct inode *inode, loff_t bytes); loff_t inode_get_bytes(struct inode *inode); void inode_set_bytes(struct inode *inode, loff_t bytes); -extern int vfs_readdir(struct file *, filldir_t, void *); -extern int iterate_dir(struct file *, struct dir_context *); - -extern int vfs_stat(const char __user *, struct kstat *); -extern int vfs_lstat(const char __user *, struct kstat *); -extern int vfs_fstat(unsigned int, struct kstat *); -extern int vfs_fstatat(int , const char __user *, struct kstat *, int); - -extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, - unsigned long arg); -extern int __generic_block_fiemap(struct inode *inode, - struct fiemap_extent_info *fieinfo, - loff_t start, loff_t len, - get_block_t *get_block); -extern int generic_block_fiemap(struct inode *inode, - struct fiemap_extent_info *fieinfo, u64 start, - u64 len, get_block_t *get_block); - -extern void get_filesystem(struct file_system_type *fs); -extern void put_filesystem(struct file_system_type *fs); -extern struct file_system_type *get_fs_type(const char *name); -extern struct super_block *get_super(struct block_device *); -extern struct super_block *get_super_thawed(struct block_device *); -extern struct super_block *get_active_super(struct block_device *bdev); -extern void drop_super(struct super_block *sb); -extern void iterate_supers(void (*)(struct super_block *, void *), void *); -extern void iterate_supers_type(struct file_system_type *, - void (*)(struct super_block *, void *), void *); - -extern int dcache_dir_open(struct inode *, struct file *); -extern int dcache_dir_close(struct inode *, struct file *); -extern loff_t dcache_dir_lseek(struct file *, loff_t, int); -extern int dcache_readdir(struct file *, struct dir_context *); -extern int simple_setattr(struct dentry *, struct iattr *); -extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); -extern int simple_statfs(struct dentry *, struct kstatfs *); -extern int simple_open(struct inode *inode, struct file *file); -extern int simple_link(struct dentry *, struct inode *, struct dentry *); -extern int simple_unlink(struct inode *, struct dentry *); -extern int simple_rmdir(struct inode *, struct dentry *); -extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); -extern int noop_fsync(struct file *, loff_t, loff_t, int); -extern int simple_empty(struct dentry *); -extern int simple_readpage(struct file *file, struct page *page); -extern int simple_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata); -extern int simple_write_end(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct page *page, void *fsdata); -extern int always_delete_dentry(const struct dentry *); -extern struct inode *alloc_anon_inode(struct super_block *); +int vfs_readdir(struct file *, filldir_t, void *); +int iterate_dir(struct file *, struct dir_context *); + +int vfs_stat(const char __user *, struct kstat *); +int vfs_lstat(const char __user *, struct kstat *); +int vfs_fstat(unsigned int, struct kstat *); +int vfs_fstatat(int , const char __user *, struct kstat *, int); + +int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, + unsigned long arg); +int __generic_block_fiemap(struct inode *inode, + struct fiemap_extent_info *fieinfo, + loff_t start, loff_t len, get_block_t *get_block); +int generic_block_fiemap(struct inode *inode, + struct fiemap_extent_info *fieinfo, + u64 start, u64 len, get_block_t *get_block); + +void get_filesystem(struct file_system_type *fs); +void put_filesystem(struct file_system_type *fs); +struct file_system_type *get_fs_type(const char *name); +struct super_block *get_super(struct block_device *); +struct super_block *get_super_thawed(struct block_device *); +struct super_block *get_active_super(struct block_device *bdev); +void drop_super(struct super_block *sb); +void iterate_supers(void (*)(struct super_block *, void *), void *); +void iterate_supers_type(struct file_system_type *, + void (*)(struct super_block *, void *), void *); + +int dcache_dir_open(struct inode *, struct file *); +int dcache_dir_close(struct inode *, struct file *); +loff_t dcache_dir_lseek(struct file *, loff_t, int); +int dcache_readdir(struct file *, struct dir_context *); +int simple_setattr(struct dentry *, struct iattr *); +int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); +int simple_statfs(struct dentry *, struct kstatfs *); +int simple_open(struct inode *inode, struct file *file); +int simple_link(struct dentry *, struct inode *, struct dentry *); +int simple_unlink(struct inode *, struct dentry *); +int simple_rmdir(struct inode *, struct dentry *); +int simple_rename(struct inode *, struct dentry *, struct inode *, + struct dentry *); +int noop_fsync(struct file *, loff_t, loff_t, int); +int simple_empty(struct dentry *); +int simple_readpage(struct file *file, struct page *page); +int simple_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, unsigned flags, + struct page **pagep, void **fsdata); +int simple_write_end(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, unsigned copied, + struct page *page, void *fsdata); +int always_delete_dentry(const struct dentry *); +struct inode *alloc_anon_inode(struct super_block *); extern const struct dentry_operations simple_dentry_operations; -extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); -extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); +struct dentry *simple_lookup(struct inode *, struct dentry *, + unsigned int flags); +ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); extern const struct file_operations simple_dir_operations; extern const struct inode_operations simple_dir_inode_operations; struct tree_descr { char *name; const struct file_operations *ops; int mode; }; struct dentry *d_alloc_name(struct dentry *, const char *); -extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *); -extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); -extern void simple_release_fs(struct vfsmount **mount, int *count); +int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *); +int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, + int *count); +void simple_release_fs(struct vfsmount **mount, int *count); -extern ssize_t simple_read_from_buffer(void __user *to, size_t count, - loff_t *ppos, const void *from, size_t available); -extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, - const void __user *from, size_t count); +ssize_t simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos, + const void *from, size_t available); +ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, + const void __user *from, size_t count); -extern int __generic_file_fsync(struct file *, loff_t, loff_t, int); -extern int generic_file_fsync(struct file *, loff_t, loff_t, int); +int __generic_file_fsync(struct file *, loff_t, loff_t, int); +int generic_file_fsync(struct file *, loff_t, loff_t, int); -extern int generic_check_addressable(unsigned, u64); +int generic_check_addressable(unsigned, u64); #ifdef CONFIG_MIGRATION -extern int buffer_migrate_page(struct address_space *, - struct page *, struct page *, - enum migrate_mode); +int buffer_migrate_page(struct address_space *, struct page *, struct page *, + enum migrate_mode); #else #define buffer_migrate_page NULL #endif -extern int inode_change_ok(const struct inode *, struct iattr *); -extern int inode_newsize_ok(const struct inode *, loff_t offset); -extern void setattr_copy(struct inode *inode, const struct iattr *attr); +int inode_change_ok(const struct inode *, struct iattr *); +int inode_newsize_ok(const struct inode *, loff_t offset); +void setattr_copy(struct inode *inode, const struct iattr *attr); -extern int file_update_time(struct file *file); +int file_update_time(struct file *file); -extern int generic_show_options(struct seq_file *m, struct dentry *root); -extern void save_mount_options(struct super_block *sb, char *options); -extern void replace_mount_options(struct super_block *sb, char *options); +int generic_show_options(struct seq_file *m, struct dentry *root); +void save_mount_options(struct super_block *sb, char *options); +void replace_mount_options(struct super_block *sb, char *options); static inline ino_t parent_ino(struct dentry *dentry) { @@ -2652,7 +2690,7 @@ struct simple_transaction_argresp { #define SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct simple_transaction_argresp)) char *simple_transaction_get(struct file *file, const char __user *buf, - size_t size); + size_t size); ssize_t simple_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos); int simple_transaction_release(struct inode *inode, struct file *file); @@ -2693,7 +2731,7 @@ static const struct file_operations __fops = { \ static inline __printf(1, 2) void __simple_attr_check_format(const char *fmt, ...) { - /* don't do anything, just let the compiler check the arguments; */ +/* don't do anything, just let the compiler check the arguments; */ } int simple_attr_open(struct inode *inode, struct file *file, @@ -2709,16 +2747,16 @@ struct ctl_table; int proc_nr_files(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); int proc_nr_dentry(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos); + void __user *buffer, size_t *lenp, loff_t *ppos); int proc_nr_inodes(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); int __init get_filesystem_list(char *buf); -#define __FMODE_EXEC ((__force int) FMODE_EXEC) -#define __FMODE_NONOTIFY ((__force int) FMODE_NONOTIFY) +#define __FMODE_EXEC ((__force int)FMODE_EXEC) +#define __FMODE_NONOTIFY ((__force int)FMODE_NONOTIFY) -#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) -#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ +#define ACC_MODE(x) ("\004\002\006\006"[(x) & O_ACCMODE]) +#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ (flag & __FMODE_NONOTIFY))) static inline int is_sxid(umode_t mode) |