^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* fs/ internal definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct super_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct file_system_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct iomap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct iomap_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct linux_binprm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct mount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct shrink_control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct fs_context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct user_namespace;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * block_dev.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #ifdef CONFIG_BLOCK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern void __init bdev_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) extern int __sync_blockdev(struct block_device *bdev, int wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) void iterate_bdevs(void (*)(struct block_device *, void *), void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) void emergency_thaw_bdev(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void bd_forget(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static inline void bdev_cache_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) static inline int __sync_blockdev(struct block_device *bdev, int wait)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static inline void iterate_bdevs(void (*f)(struct block_device *, void *),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static inline int emergency_thaw_bdev(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static inline void bd_forget(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #endif /* CONFIG_BLOCK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * buffer.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) extern int __block_write_begin_int(struct page *page, loff_t pos, unsigned len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) get_block_t *get_block, struct iomap *iomap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * char_dev.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern void __init chrdev_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * fs_context.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) extern const struct fs_context_operations legacy_fs_context_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) extern int parse_monolithic_mount_data(struct fs_context *, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) extern void vfs_clean_context(struct fs_context *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) extern int finish_clean_context(struct fs_context *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * namei.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) extern int filename_lookup(int dfd, struct filename *name, unsigned flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct path *path, struct path *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) const char *, unsigned int, struct path *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) long do_rmdir(int dfd, struct filename *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) long do_unlinkat(int dfd, struct filename *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) int may_linkat(struct path *link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * namespace.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) extern struct vfsmount *lookup_mnt(const struct path *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) extern int finish_automount(struct vfsmount *, struct path *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) extern int sb_prepare_remount_readonly(struct super_block *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) extern void __init mnt_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) extern int __mnt_want_write_file(struct file *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) extern void __mnt_drop_write_file(struct file *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) extern void dissolve_on_fput(struct vfsmount *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) int path_mount(const char *dev_name, struct path *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) const char *type_page, unsigned long flags, void *data_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) int path_umount(struct path *path, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * fs_struct.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) extern void chroot_fs_refs(const struct path *, const struct path *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * file_table.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) extern struct file *alloc_empty_file(int, const struct cred *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) extern struct file *alloc_empty_file_noaccount(int, const struct cred *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * super.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) extern int reconfigure_super(struct fs_context *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) extern bool trylock_super(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) extern struct super_block *user_get_super(dev_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) extern bool mount_capable(struct fs_context *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * open.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct open_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int open_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) umode_t mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int acc_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int intent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int lookup_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) extern struct file *do_filp_open(int dfd, struct filename *pathname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) const struct open_flags *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) extern struct file *do_file_open_root(struct dentry *, struct vfsmount *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) const char *, const struct open_flags *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) extern struct open_how build_open_how(int flags, umode_t mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) extern int build_open_flags(const struct open_how *how, struct open_flags *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) int chmod_common(const struct path *path, umode_t mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) int flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int chown_common(const struct path *path, uid_t user, gid_t group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) extern int vfs_open(const struct path *, struct file *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * inode.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) extern long prune_icache_sb(struct super_block *sb, struct shrink_control *sc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) extern void inode_add_lru(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) extern int dentry_needs_remove_privs(struct dentry *dentry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * fs-writeback.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) extern long get_nr_dirty_inodes(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) extern int invalidate_inodes(struct super_block *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * dcache.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) extern int d_set_mounted(struct dentry *dentry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) extern long prune_dcache_sb(struct super_block *sb, struct shrink_control *sc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) extern struct dentry *d_alloc_cursor(struct dentry *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) extern char *simple_dname(struct dentry *, char *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) extern void dput_to_list(struct dentry *, struct list_head *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) extern void shrink_dentry_list(struct list_head *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * read_write.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) extern int rw_verify_area(int, struct file *, const loff_t *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * pipe.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) extern const struct file_operations pipefifo_fops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * fs_pin.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) extern void group_pin_kill(struct hlist_head *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) extern void mnt_pin_kill(struct mount *m);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * fs/nsfs.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) extern const struct dentry_operations ns_dentry_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /* direct-io.c: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) int sb_init_dio_done_wq(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * fs/stat.c:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) int do_statx(int dfd, const char __user *filename, unsigned flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) unsigned int mask, struct statx __user *buffer);