Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* fs/ internal definitions
0003  *
0004  * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
0005  * Written by David Howells (dhowells@redhat.com)
0006  */
0007 
0008 struct super_block;
0009 struct file_system_type;
0010 struct iomap;
0011 struct iomap_ops;
0012 struct linux_binprm;
0013 struct path;
0014 struct mount;
0015 struct shrink_control;
0016 struct fs_context;
0017 struct user_namespace;
0018 struct pipe_inode_info;
0019 struct iov_iter;
0020 
0021 /*
0022  * block/bdev.c
0023  */
0024 #ifdef CONFIG_BLOCK
0025 extern void __init bdev_cache_init(void);
0026 
0027 void emergency_thaw_bdev(struct super_block *sb);
0028 #else
0029 static inline void bdev_cache_init(void)
0030 {
0031 }
0032 static inline int emergency_thaw_bdev(struct super_block *sb)
0033 {
0034     return 0;
0035 }
0036 #endif /* CONFIG_BLOCK */
0037 
0038 /*
0039  * buffer.c
0040  */
0041 int __block_write_begin_int(struct folio *folio, loff_t pos, unsigned len,
0042         get_block_t *get_block, const struct iomap *iomap);
0043 
0044 /*
0045  * char_dev.c
0046  */
0047 extern void __init chrdev_init(void);
0048 
0049 /*
0050  * fs_context.c
0051  */
0052 extern const struct fs_context_operations legacy_fs_context_ops;
0053 extern int parse_monolithic_mount_data(struct fs_context *, void *);
0054 extern void vfs_clean_context(struct fs_context *fc);
0055 extern int finish_clean_context(struct fs_context *fc);
0056 
0057 /*
0058  * namei.c
0059  */
0060 extern int filename_lookup(int dfd, struct filename *name, unsigned flags,
0061                struct path *path, struct path *root);
0062 extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
0063                const char *, unsigned int, struct path *);
0064 int do_rmdir(int dfd, struct filename *name);
0065 int do_unlinkat(int dfd, struct filename *name);
0066 int may_linkat(struct user_namespace *mnt_userns, struct path *link);
0067 int do_renameat2(int olddfd, struct filename *oldname, int newdfd,
0068          struct filename *newname, unsigned int flags);
0069 int do_mkdirat(int dfd, struct filename *name, umode_t mode);
0070 int do_symlinkat(struct filename *from, int newdfd, struct filename *to);
0071 int do_linkat(int olddfd, struct filename *old, int newdfd,
0072             struct filename *new, int flags);
0073 
0074 /*
0075  * namespace.c
0076  */
0077 extern struct vfsmount *lookup_mnt(const struct path *);
0078 extern int finish_automount(struct vfsmount *, const struct path *);
0079 
0080 extern int sb_prepare_remount_readonly(struct super_block *);
0081 
0082 extern void __init mnt_init(void);
0083 
0084 extern int __mnt_want_write_file(struct file *);
0085 extern void __mnt_drop_write_file(struct file *);
0086 
0087 extern void dissolve_on_fput(struct vfsmount *);
0088 extern bool may_mount(void);
0089 
0090 int path_mount(const char *dev_name, struct path *path,
0091         const char *type_page, unsigned long flags, void *data_page);
0092 int path_umount(struct path *path, int flags);
0093 
0094 /*
0095  * fs_struct.c
0096  */
0097 extern void chroot_fs_refs(const struct path *, const struct path *);
0098 
0099 /*
0100  * file_table.c
0101  */
0102 extern struct file *alloc_empty_file(int, const struct cred *);
0103 extern struct file *alloc_empty_file_noaccount(int, const struct cred *);
0104 
0105 /*
0106  * super.c
0107  */
0108 extern int reconfigure_super(struct fs_context *);
0109 extern bool trylock_super(struct super_block *sb);
0110 struct super_block *user_get_super(dev_t, bool excl);
0111 void put_super(struct super_block *sb);
0112 extern bool mount_capable(struct fs_context *);
0113 
0114 /*
0115  * open.c
0116  */
0117 struct open_flags {
0118     int open_flag;
0119     umode_t mode;
0120     int acc_mode;
0121     int intent;
0122     int lookup_flags;
0123 };
0124 extern struct file *do_filp_open(int dfd, struct filename *pathname,
0125         const struct open_flags *op);
0126 extern struct file *do_file_open_root(const struct path *,
0127         const char *, const struct open_flags *);
0128 extern struct open_how build_open_how(int flags, umode_t mode);
0129 extern int build_open_flags(const struct open_how *how, struct open_flags *op);
0130 extern struct file *__close_fd_get_file(unsigned int fd);
0131 
0132 long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
0133 int chmod_common(const struct path *path, umode_t mode);
0134 int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
0135         int flag);
0136 int chown_common(const struct path *path, uid_t user, gid_t group);
0137 extern int vfs_open(const struct path *, struct file *);
0138 
0139 /*
0140  * inode.c
0141  */
0142 extern long prune_icache_sb(struct super_block *sb, struct shrink_control *sc);
0143 extern int dentry_needs_remove_privs(struct dentry *dentry);
0144 
0145 /*
0146  * fs-writeback.c
0147  */
0148 extern long get_nr_dirty_inodes(void);
0149 extern int invalidate_inodes(struct super_block *, bool);
0150 
0151 /*
0152  * dcache.c
0153  */
0154 extern int d_set_mounted(struct dentry *dentry);
0155 extern long prune_dcache_sb(struct super_block *sb, struct shrink_control *sc);
0156 extern struct dentry *d_alloc_cursor(struct dentry *);
0157 extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
0158 extern char *simple_dname(struct dentry *, char *, int);
0159 extern void dput_to_list(struct dentry *, struct list_head *);
0160 extern void shrink_dentry_list(struct list_head *);
0161 
0162 /*
0163  * pipe.c
0164  */
0165 extern const struct file_operations pipefifo_fops;
0166 
0167 /*
0168  * fs_pin.c
0169  */
0170 extern void group_pin_kill(struct hlist_head *p);
0171 extern void mnt_pin_kill(struct mount *m);
0172 
0173 /*
0174  * fs/nsfs.c
0175  */
0176 extern const struct dentry_operations ns_dentry_operations;
0177 
0178 /* direct-io.c: */
0179 int sb_init_dio_done_wq(struct super_block *sb);
0180 
0181 /*
0182  * fs/stat.c:
0183  */
0184 
0185 int getname_statx_lookup_flags(int flags);
0186 int do_statx(int dfd, struct filename *filename, unsigned int flags,
0187          unsigned int mask, struct statx __user *buffer);
0188 
0189 /*
0190  * fs/splice.c:
0191  */
0192 long splice_file_to_pipe(struct file *in,
0193              struct pipe_inode_info *opipe,
0194              loff_t *offset,
0195              size_t len, unsigned int flags);
0196 
0197 /*
0198  * fs/xattr.c:
0199  */
0200 struct xattr_name {
0201     char name[XATTR_NAME_MAX + 1];
0202 };
0203 
0204 struct xattr_ctx {
0205     /* Value of attribute */
0206     union {
0207         const void __user *cvalue;
0208         void __user *value;
0209     };
0210     void *kvalue;
0211     size_t size;
0212     /* Attribute name */
0213     struct xattr_name *kname;
0214     unsigned int flags;
0215 };
0216 
0217 
0218 ssize_t do_getxattr(struct user_namespace *mnt_userns,
0219             struct dentry *d,
0220             struct xattr_ctx *ctx);
0221 
0222 int setxattr_copy(const char __user *name, struct xattr_ctx *ctx);
0223 int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry,
0224         struct xattr_ctx *ctx);
0225 
0226 ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff_t *pos);