Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    2)   FUSE: Filesystem in Userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    3)   Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5)   This program can be distributed under the terms of the GNU GPL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6)   See the file COPYING.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9) #ifndef _FS_FUSE_I_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10) #define _FS_FUSE_I_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) #ifndef pr_fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) # define pr_fmt(fmt) "fuse: " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) #include <linux/fuse.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) #include <linux/mount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) #include <linux/wait.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23) #include <linux/backing-dev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25) #include <linux/rwsem.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) #include <linux/poll.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29) #include <linux/kref.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30) #include <linux/xattr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) #include <linux/pid_namespace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) #include <linux/refcount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) #include <linux/user_namespace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) /** Default max number of pages that can be used in a single read request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) /** Maximum of max_pages received in init_out */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) #define FUSE_MAX_MAX_PAGES 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) /** Bias for fi->writectr, meaning new writepages must not be sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) #define FUSE_NOWRITE INT_MIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) /** It could be as large as PATH_MAX, but would that have any uses? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) #define FUSE_NAME_MAX 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) /** Number of dentries for each connection in the control filesystem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) #define FUSE_CTL_NUM_DENTRIES 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) /** List of active connections */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) extern struct list_head fuse_conn_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) /** Global mutex protecting fuse_conn_list and the control filesystem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) extern struct mutex fuse_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) /** Module parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) extern unsigned max_user_bgreq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) extern unsigned max_user_congthresh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) /* One forget request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) struct fuse_forget_link {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) 	struct fuse_forget_one forget_one;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) 	struct fuse_forget_link *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) /** FUSE inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) struct fuse_inode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) 	/** Inode data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) 	struct inode inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) 	/** Unique ID, which identifies the inode between userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) 	 * and kernel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) 	u64 nodeid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) 	/** Number of lookups on this inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) 	u64 nlookup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) 	/** The request used for sending the FORGET message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) 	struct fuse_forget_link *forget;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) 	/** Time in jiffies until the file attributes are valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) 	u64 i_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) 	/* Which attributes are invalid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) 	u32 inval_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) 	/** The sticky bit in inode->i_mode may have been removed, so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) 	    preserve the original mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) 	umode_t orig_i_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) 	/** 64 bit inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) 	u64 orig_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) 	/** Version of last attribute change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) 	u64 attr_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98) 		/* Write related fields (regular file only) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) 			/* Files usable in writepage.  Protected by fi->lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) 			struct list_head write_files;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 			/* Writepages pending on truncate or fsync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) 			struct list_head queued_writes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) 			/* Number of sent writes, a negative bias
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) 			 * (FUSE_NOWRITE) means more writes are blocked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) 			int writectr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) 			/* Waitq for writepage completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) 			wait_queue_head_t page_waitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 			/* List of writepage requestst (pending or sent) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) 			struct rb_root writepages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) 		/* readdir cache (directory only) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) 			/* true if fully cached */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) 			bool cached;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) 			/* size of cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) 			loff_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) 			/* position at end of cache (position of next entry) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) 			loff_t pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) 			/* version of the cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) 			u64 version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) 			/* modification time of directory when cache was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) 			 * started */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) 			struct timespec64 mtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) 			/* iversion of directory when cache was started */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) 			u64 iversion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) 			/* protects above fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) 			spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) 		} rdc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 	/** Miscellaneous bits describing inode state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 	unsigned long state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) 	/** Lock for serializing lookup and readdir for back compatibility*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) 	struct mutex mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) 	/** Lock to protect write related fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	 * Can't take inode lock in fault path (leads to circular dependency).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 	 * Introduce another semaphore which can be taken in fault path and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) 	 * then other filesystem paths can take this to block faults.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) 	struct rw_semaphore i_mmap_sem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) #ifdef CONFIG_FUSE_DAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) 	 * Dax specific inode data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) 	struct fuse_inode_dax *dax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) /** FUSE inode state bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) 	/** Advise readdirplus  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) 	FUSE_I_ADVISE_RDPLUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) 	/** Initialized with readdirplus */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) 	FUSE_I_INIT_RDPLUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) 	/** An operation changing file size is in progress  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 	FUSE_I_SIZE_UNSTABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) 	/* Bad inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 	FUSE_I_BAD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) struct fuse_conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) struct fuse_mount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) struct fuse_release_args;
^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)  * Reference to lower filesystem file for read/write operations handled in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185)  * passthrough mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186)  * This struct also tracks the credentials to be used for handling read/write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187)  * operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) struct fuse_passthrough {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 	struct file *filp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) 	struct cred *cred;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) /** FUSE specific file data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) struct fuse_file {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 	/** Fuse connection for this file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	struct fuse_mount *fm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 	/* Argument space reserved for release */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 	struct fuse_release_args *release_args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 	/** Kernel file handle guaranteed to be unique */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) 	u64 kh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) 	/** File handle used by userspace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) 	u64 fh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) 	/** Node id of this file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 	u64 nodeid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 	/** Refcount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 	refcount_t count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 	/** FOPEN_* flags returned by open */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 	u32 open_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 	/** Entry on inode's write_files list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) 	struct list_head write_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) 	/* Readdir related */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) 		 * Protects below fields against (crazy) parallel readdir on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) 		 * same open file.  Uncontended in the normal case.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) 		struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) 		/* Dir stream position */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) 		loff_t pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) 		/* Offset in cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) 		loff_t cache_off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) 		/* Version of cache we are reading */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) 		u64 version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) 	} readdir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 	/** Container for data related to the passthrough functionality */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) 	struct fuse_passthrough passthrough;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) 	/** RB node to be linked on fuse_conn->polled_files */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) 	struct rb_node polled_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 	/** Wait queue head for poll */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) 	wait_queue_head_t poll_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) 	/** Has flock been performed on this file? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) 	bool flock:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) /** One input argument of a request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253) struct fuse_in_arg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) 	unsigned size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) 	const void *value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) /** One output argument of a request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) struct fuse_arg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) 	unsigned size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261) 	void *value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) /** FUSE page descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) struct fuse_page_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) 	unsigned int length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) 	unsigned int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) struct fuse_args {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 	uint64_t nodeid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	uint32_t opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 	unsigned short in_numargs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 	unsigned short out_numargs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 	bool force:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) 	bool noreply:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) 	bool nocreds:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) 	bool in_pages:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) 	bool out_pages:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 	bool user_pages:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 	bool out_argvar:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 	bool page_zeroing:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) 	bool page_replace:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 	bool may_block:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 	struct fuse_in_arg in_args[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 	struct fuse_arg out_args[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	void (*end)(struct fuse_mount *fm, struct fuse_args *args, int error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 	/* Path used for completing d_canonical_path */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) 	struct path *canonical_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) struct fuse_args_pages {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 	struct fuse_args args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 	struct page **pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 	struct fuse_page_desc *descs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 	unsigned int num_pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) #define FUSE_ARGS(args) struct fuse_args args = {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) /** The request IO state (for asynchronous processing) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) struct fuse_io_priv {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 	struct kref refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 	int async;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 	unsigned reqs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 	ssize_t bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 	size_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 	__u64 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) 	bool write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) 	bool should_dirty;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 	struct kiocb *iocb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 	struct completion *done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) 	bool blocking;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) #define FUSE_IO_PRIV_SYNC(i) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) {					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 	.refcnt = KREF_INIT(1),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 	.async = 0,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 	.iocb = i,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327)  * Request flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329)  * FR_ISREPLY:		set if the request has reply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330)  * FR_FORCE:		force sending of the request even if interrupted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331)  * FR_BACKGROUND:	request is sent in the background
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332)  * FR_WAITING:		request is counted as "waiting"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333)  * FR_ABORTED:		the request was aborted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334)  * FR_INTERRUPTED:	the request has been interrupted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335)  * FR_LOCKED:		data is being copied to/from the request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336)  * FR_PENDING:		request is not yet in userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337)  * FR_SENT:		request is in userspace, waiting for an answer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338)  * FR_FINISHED:		request is finished
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339)  * FR_PRIVATE:		request is on private list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340)  * FR_ASYNC:		request is asynchronous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) enum fuse_req_flag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 	FR_ISREPLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 	FR_FORCE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) 	FR_BACKGROUND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) 	FR_WAITING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) 	FR_ABORTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 	FR_INTERRUPTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) 	FR_LOCKED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 	FR_PENDING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 	FR_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) 	FR_FINISHED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 	FR_PRIVATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) 	FR_ASYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358)  * A request to the client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360)  * .waitq.lock protects the following fields:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361)  *   - FR_ABORTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362)  *   - FR_LOCKED (may also be modified under fc->lock, tested under both)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) struct fuse_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) 	/** This can be on either pending processing or io lists in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 	    fuse_conn */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 	/** Entry on the interrupts list  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 	struct list_head intr_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 	/* Input/output arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) 	struct fuse_args *args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 	/** refcount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) 	refcount_t count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) 	/* Request flags, updated with test/set/clear_bit() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) 	/* The request input header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) 		struct fuse_in_header h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) 	} in;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) 	/* The request output header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) 		struct fuse_out_header h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) 	} out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) 	/** Used to wake up the task waiting for completion of request*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) 	wait_queue_head_t waitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) 	/** virtio-fs's physically contiguous buffer for in and out args */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) 	void *argbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 	/** fuse_mount this request belongs to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 	struct fuse_mount *fm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) struct fuse_iqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404)  * Input queue callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406)  * Input queue signalling is device-specific.  For example, the /dev/fuse file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407)  * uses fiq->waitq and fasync to wake processes that are waiting on queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408)  * readiness.  These callbacks allow other device types to respond to input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409)  * queue activity.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) struct fuse_iqueue_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) 	 * Signal that a forget has been queued
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) 	void (*wake_forget_and_unlock)(struct fuse_iqueue *fiq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) 		__releases(fiq->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) 	 * Signal that an INTERRUPT request has been queued
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) 	void (*wake_interrupt_and_unlock)(struct fuse_iqueue *fiq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) 		__releases(fiq->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 	 * Signal that a request has been queued
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 	void (*wake_pending_and_unlock)(struct fuse_iqueue *fiq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 		__releases(fiq->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 	 * Clean up when fuse_iqueue is destroyed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 	void (*release)(struct fuse_iqueue *fiq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) /** /dev/fuse input queue operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) extern const struct fuse_iqueue_ops fuse_dev_fiq_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) struct fuse_iqueue {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 	/** Connection established */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 	unsigned connected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 	/** Lock protecting accesses to members of this structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 	/** Readers of the connection are waiting on this */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) 	wait_queue_head_t waitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) 	/** The next unique request id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 	u64 reqctr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) 	/** The list of pending requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) 	struct list_head pending;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) 	/** Pending interrupts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) 	struct list_head interrupts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) 	/** Queue of pending forgets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 	struct fuse_forget_link forget_list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 	struct fuse_forget_link *forget_list_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 	/** Batching of FORGET requests (positive indicates FORGET batch) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 	int forget_batch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 	/** O_ASYNC requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 	struct fasync_struct *fasync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 	/** Device-specific callbacks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 	const struct fuse_iqueue_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 	/** Device-specific state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 	void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) #define FUSE_PQ_HASH_BITS 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) #define FUSE_PQ_HASH_SIZE (1 << FUSE_PQ_HASH_BITS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) struct fuse_pqueue {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) 	/** Connection established */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 	unsigned connected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) 	/** Lock protecting accessess to  members of this structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 	/** Hash table of requests being processed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 	struct list_head *processing;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 	/** The list of requests under I/O */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) 	struct list_head io;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493)  * Fuse device instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) struct fuse_dev {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 	/** Fuse connection for this device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 	struct fuse_conn *fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 	/** Processing queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) 	struct fuse_pqueue pq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 	/** list entry on fc->devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) 	struct list_head entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) struct fuse_fs_context {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) 	int fd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) 	unsigned int rootmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 	kuid_t user_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) 	kgid_t group_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 	bool is_bdev:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) 	bool fd_present:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) 	bool rootmode_present:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) 	bool user_id_present:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) 	bool group_id_present:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 	bool default_permissions:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 	bool allow_other:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 	bool destroy:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 	bool no_control:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) 	bool no_force_umount:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 	bool legacy_opts_show:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) 	bool dax:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) 	unsigned int max_read;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 	unsigned int blksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 	const char *subtype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527) 	/* DAX device, may be NULL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528) 	struct dax_device *dax_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 	/* fuse_dev pointer to fill in, should contain NULL on entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) 	void **fudptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535)  * A Fuse connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537)  * This structure is created, when the root filesystem is mounted, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538)  * is destroyed, when the client device is closed and the last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539)  * fuse_mount is destroyed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) struct fuse_conn {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 	/** Lock protecting accessess to  members of this structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) 	/** Refcount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 	refcount_t count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) 	/** Number of fuse_dev's */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	atomic_t dev_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 	struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) 	/** The user id for this mount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) 	kuid_t user_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) 	/** The group id for this mount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	kgid_t group_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 	/** The pid namespace for this mount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) 	struct pid_namespace *pid_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 	/** The user namespace for this mount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) 	struct user_namespace *user_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 	/** Maximum read size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 	unsigned max_read;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 	/** Maximum write size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 	unsigned max_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 	/** Maxmum number of pages that can be used in a single request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 	unsigned int max_pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 	/** Input queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 	struct fuse_iqueue iq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 	/** The next unique kernel file handle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 	atomic64_t khctr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) 	/** rbtree of fuse_files waiting for poll events indexed by ph */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 	struct rb_root polled_files;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	/** Maximum number of outstanding background requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) 	unsigned max_background;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 	/** Number of background requests at which congestion starts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 	unsigned congestion_threshold;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 	/** Number of requests currently in the background */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 	unsigned num_background;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) 	/** Number of background requests currently queued for userspace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) 	unsigned active_background;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) 	/** The list of background requests set aside for later queuing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 	struct list_head bg_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) 	/** Protects: max_background, congestion_threshold, num_background,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) 	 * active_background, bg_queue, blocked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) 	spinlock_t bg_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 	/** Flag indicating that INIT reply has been received. Allocating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) 	 * any fuse request will be suspended until the flag is set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 	int initialized;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 	/** Flag indicating if connection is blocked.  This will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 	    the case before the INIT reply is received, and if there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 	    are too many outstading backgrounds requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) 	int blocked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) 	/** waitq for blocked connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) 	wait_queue_head_t blocked_waitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) 	/** Connection established, cleared on umount, connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 	    abort and device release */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 	unsigned connected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 	/** Connection aborted via sysfs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 	bool aborted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 	/** Connection failed (version mismatch).  Cannot race with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 	    setting other bitfields since it is only set once in INIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	    reply, before any other request, and never cleared */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 	unsigned conn_error:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 	/** Connection successful.  Only set in INIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 	unsigned conn_init:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 	/** Do readpages asynchronously?  Only set in INIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 	unsigned async_read:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) 	/** Return an unique read error after abort.  Only set in INIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) 	unsigned abort_err:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 	/** Do not send separate SETATTR request before open(O_TRUNC)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) 	unsigned atomic_o_trunc:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) 	/** Filesystem supports NFS exporting.  Only set in INIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 	unsigned export_support:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 	/** write-back cache policy (default is write-through) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 	unsigned writeback_cache:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 	/** allow parallel lookups and readdir (default is serialized) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 	unsigned parallel_dirops:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) 	/** handle fs handles killing suid/sgid/cap on write/chown/trunc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) 	unsigned handle_killpriv:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 	/** cache READLINK responses in page cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) 	unsigned cache_symlinks:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) 	/* show legacy mount options */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 	unsigned int legacy_opts_show:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 	 * The following bitfields are only for optimization purposes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 	 * and hence races in setting them will not cause malfunction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) 	/** Is open/release not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) 	unsigned no_open:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 	/** Is opendir/releasedir not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	unsigned no_opendir:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 	/** Is fsync not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 	unsigned no_fsync:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 	/** Is fsyncdir not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 	unsigned no_fsyncdir:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 	/** Is flush not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) 	unsigned no_flush:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 	/** Is setxattr not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 	unsigned no_setxattr:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 	/** Is getxattr not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 	unsigned no_getxattr:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	/** Is listxattr not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 	unsigned no_listxattr:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) 	/** Is removexattr not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 	unsigned no_removexattr:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 	/** Are posix file locking primitives not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 	unsigned no_lock:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 	/** Is access not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) 	unsigned no_access:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) 	/** Is create not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) 	unsigned no_create:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 	/** Is interrupt not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) 	unsigned no_interrupt:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 	/** Is bmap not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) 	unsigned no_bmap:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) 	/** Is poll not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 	unsigned no_poll:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 	/** Do multi-page cached writes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) 	unsigned big_writes:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 	/** Don't apply umask to creation modes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 	unsigned dont_mask:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 	/** Are BSD file locking primitives not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 	unsigned no_flock:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 	/** Is fallocate not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 	unsigned no_fallocate:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	/** Is rename with flags implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	unsigned no_rename2:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) 	/** Use enhanced/automatic page cache invalidation. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 	unsigned auto_inval_data:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) 	/** Filesystem is fully reponsible for page cache invalidation. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 	unsigned explicit_inval_data:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 	/** Does the filesystem support readdirplus? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 	unsigned do_readdirplus:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 	/** Does the filesystem want adaptive readdirplus? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) 	unsigned readdirplus_auto:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) 	/** Does the filesystem support asynchronous direct-IO submission? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) 	unsigned async_dio:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 	/** Is lseek not implemented by fs? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) 	unsigned no_lseek:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) 	/** Does the filesystem support posix acls? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) 	unsigned posix_acl:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) 	/** Check permissions based on the file mode or not? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 	unsigned default_permissions:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 	/** Allow other than the mounter user to access the filesystem ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 	unsigned allow_other:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) 	/** Does the filesystem support copy_file_range? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) 	unsigned no_copy_file_range:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 	/* Send DESTROY request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) 	unsigned int destroy:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) 	/* Delete dentries that have gone stale */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) 	unsigned int delete_stale:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) 	/** Do not create entry in fusectl fs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 	unsigned int no_control:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) 	/** Do not allow MNT_FORCE umount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 	unsigned int no_force_umount:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) 	/* Auto-mount submounts announced by the server */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 	unsigned int auto_submounts:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) 	/** Passthrough mode for read/write IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 	unsigned int passthrough:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) 	/** The number of requests waiting for completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	atomic_t num_waiting;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 	/** Negotiated minor version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	unsigned minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 	/** Entry on the fuse_mount_list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 	struct list_head entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 	/** Device ID from the root super block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 	dev_t dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 	/** Dentries in the control filesystem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 	struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 	/** number of dentries used in the above array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 	int ctl_ndents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 	/** Key for lock owner ID scrambling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 	u32 scramble_key[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 	/** Version counter for attribute changes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 	atomic64_t attr_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) 	/** Called on final put */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) 	void (*release)(struct fuse_conn *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) 	 * Read/write semaphore to hold when accessing the sb of any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 	 * fuse_mount belonging to this connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 	struct rw_semaphore killsb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 	/** List of device instances belonging to this connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 	struct list_head devices;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) #ifdef CONFIG_FUSE_DAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 	/* Dax specific conn data, non-NULL if DAX is enabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 	struct fuse_conn_dax *dax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) 	/** List of filesystems using this connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) 	struct list_head mounts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	/** IDR for passthrough requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 	struct idr passthrough_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 	/** Protects passthrough_req */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 	spinlock_t passthrough_req_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821)  * Represents a mounted filesystem, potentially a submount.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823)  * This object allows sharing a fuse_conn between separate mounts to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824)  * allow submounts with dedicated superblocks and thus separate device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825)  * IDs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) struct fuse_mount {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 	/* Underlying (potentially shared) connection to the FUSE server */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 	struct fuse_conn *fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	/* Refcount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 	refcount_t count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 	 * Super block for this connection (fc->killsb must be held when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	 * accessing this).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 	struct super_block *sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) 	/* Entry on fc->mounts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 	struct list_head fc_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) static inline struct fuse_mount *get_fuse_mount_super(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 	return sb->s_fs_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 	struct fuse_mount *fm = get_fuse_mount_super(sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 	return fm ? fm->fc : NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) static inline struct fuse_mount *get_fuse_mount(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) 	return get_fuse_mount_super(inode->i_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 	struct fuse_mount *fm = get_fuse_mount(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 	return fm ? fm->fc : NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 	return container_of(inode, struct fuse_inode, inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) static inline u64 get_node_id(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) 	return get_fuse_inode(inode)->nodeid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) static inline int invalid_nodeid(u64 nodeid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) 	return !nodeid || nodeid == FUSE_ROOT_ID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) static inline u64 fuse_get_attr_version(struct fuse_conn *fc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) 	return atomic64_read(&fc->attr_version);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) static inline bool fuse_stale_inode(const struct inode *inode, int generation,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 				    struct fuse_attr *attr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) 	return inode->i_generation != generation ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) 		inode_wrong_type(inode, attr->mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) static inline void fuse_make_bad(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) 	remove_inode_hash(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) 	set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) static inline bool fuse_is_bad(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 	return unlikely(test_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) /** Device operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) extern const struct file_operations fuse_dev_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) extern const struct dentry_operations fuse_dentry_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) extern const struct dentry_operations fuse_root_dentry_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913)  * Get a filled in inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 			int generation, struct fuse_attr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) 			u64 attr_valid, u64 attr_version);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 		     struct fuse_entry_out *outarg, struct inode **inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923)  * Send FORGET command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 		       u64 nodeid, u64 nlookup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) struct fuse_forget_link *fuse_alloc_forget(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 					     unsigned int max,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) 					     unsigned int *countp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935)  * Initialize READ or READDIR request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) struct fuse_io_args {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 			struct fuse_read_in in;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 			u64 attr_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) 		} read;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) 			struct fuse_write_in in;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 			struct fuse_write_out out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 			bool page_locked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) 		} write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 	struct fuse_args_pages ap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 	struct fuse_io_priv *io;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 	struct fuse_file *ff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) void fuse_read_args_fill(struct fuse_io_args *ia, struct file *file, loff_t pos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 			 size_t count, int opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959)  * Send OPEN or OPENDIR request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) int fuse_open_common(struct inode *inode, struct file *file, bool isdir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) struct fuse_file *fuse_file_alloc(struct fuse_mount *fm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) void fuse_file_free(struct fuse_file *ff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) void fuse_finish_open(struct inode *inode, struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970)  * Send RELEASE or RELEASEDIR request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) void fuse_release_common(struct file *file, bool isdir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975)  * Send FSYNC or FSYNCDIR request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 		      int datasync, int opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981)  * Notify poll wakeup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) int fuse_notify_poll_wakeup(struct fuse_conn *fc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) 			    struct fuse_notify_poll_wakeup_out *outarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987)  * Initialize file operations on a regular file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) void fuse_init_file_inode(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992)  * Initialize inode operations on regular files and special files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) void fuse_init_common(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997)  * Initialize inode and file operations on a directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) void fuse_init_dir(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002)  * Initialize inode operations on a symlink
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) void fuse_init_symlink(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007)  * Change attributes of an inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 			    u64 attr_valid, u64 attr_version);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 				   u64 attr_valid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016)  * Initialize the client device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) int fuse_dev_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021)  * Cleanup the client device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) void fuse_dev_cleanup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) int fuse_ctl_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) void __exit fuse_ctl_cleanup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029)  * Simple request sending that does request allocation and freeing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) 			   gfp_t gfp_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036)  * End a finished request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) void fuse_request_end(struct fuse_req *req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) /* Abort all requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) void fuse_abort_conn(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) void fuse_wait_aborted(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045)  * Invalidate inode attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) void fuse_invalidate_attr(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) void fuse_invalidate_entry_cache(struct dentry *entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) void fuse_invalidate_atime(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) u64 entry_attr_timeout(struct fuse_entry_out *o);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) void fuse_change_entry_timeout(struct dentry *entry, struct fuse_entry_out *o);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057)  * Acquire reference to fuse_conn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062)  * Initialize fuse_conn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) void fuse_conn_init(struct fuse_conn *fc, struct fuse_mount *fm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 		    struct user_namespace *user_ns,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 		    const struct fuse_iqueue_ops *fiq_ops, void *fiq_priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069)  * Release reference to fuse_conn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) void fuse_conn_put(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074)  * Acquire reference to fuse_mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) struct fuse_mount *fuse_mount_get(struct fuse_mount *fm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079)  * Release reference to fuse_mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) void fuse_mount_put(struct fuse_mount *fm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) struct fuse_dev *fuse_dev_alloc_install(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) struct fuse_dev *fuse_dev_alloc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) void fuse_dev_install(struct fuse_dev *fud, struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) void fuse_dev_free(struct fuse_dev *fud);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) void fuse_send_init(struct fuse_mount *fm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090)  * Fill in superblock and initialize fuse connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091)  * @sb: partially-initialized superblock to fill in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092)  * @ctx: mount context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097)  * Fill in superblock for submounts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098)  * @sb: partially-initialized superblock to fill in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099)  * @parent_fi: The fuse_inode of the parent filesystem where this submount is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100)  * 	       mounted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) int fuse_fill_super_submount(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 			     struct fuse_inode *parent_fi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106)  * Remove the mount from the connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108)  * Returns whether this was the last mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) bool fuse_mount_remove(struct fuse_mount *fm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113)  * Shut down the connection (possibly sending DESTROY request).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) void fuse_conn_destroy(struct fuse_mount *fm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118)  * Add connection to control filesystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) int fuse_ctl_add_conn(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123)  * Remove connection from control filesystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) void fuse_ctl_remove_conn(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128)  * Is file type valid?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) int fuse_valid_type(int m);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) bool fuse_invalid_attr(struct fuse_attr *attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135)  * Is current process allowed to perform filesystem operation?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) int fuse_allow_current_process(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) void fuse_flush_time_update(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) void fuse_update_ctime(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) int fuse_update_attributes(struct inode *inode, struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) void fuse_flush_writepages(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) void fuse_set_nowrite(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) void fuse_release_nowrite(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152)  * Scan all fuse_mounts belonging to fc to find the first where
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153)  * ilookup5() returns a result.  Return that result and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154)  * respective fuse_mount in *fm (unless fm is NULL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156)  * The caller must hold fc->killsb.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) struct inode *fuse_ilookup(struct fuse_conn *fc, u64 nodeid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) 			   struct fuse_mount **fm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162)  * File-system tells the kernel to invalidate cache for the given node id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) int fuse_reverse_inval_inode(struct fuse_conn *fc, u64 nodeid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 			     loff_t offset, loff_t len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168)  * File-system tells the kernel to invalidate parent attributes and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169)  * the dentry matching parent/name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171)  * If the child_nodeid is non-zero and:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172)  *    - matches the inode number for the dentry matching parent/name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173)  *    - is not a mount point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174)  *    - is a file or oan empty directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175)  * then the dentry is unhashed (d_delete()).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) int fuse_reverse_inval_entry(struct fuse_conn *fc, u64 parent_nodeid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) 			     u64 child_nodeid, struct qstr *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) int fuse_do_open(struct fuse_mount *fm, u64 nodeid, struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) 		 bool isdir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184)  * fuse_direct_io() flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) /** If set, it is WRITE; otherwise - READ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) #define FUSE_DIO_WRITE (1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) /** CUSE pass fuse_direct_io() a file which f_mapping->host is not from FUSE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) #define FUSE_DIO_CUSE  (1 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) 		       loff_t *ppos, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) 		   unsigned int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) long fuse_ioctl_common(struct file *file, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) 		       unsigned long arg, unsigned int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) __poll_t fuse_file_poll(struct file *file, poll_table *wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) int fuse_dev_release(struct inode *inode, struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) bool fuse_write_update_size(struct inode *inode, loff_t pos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) int fuse_flush_times(struct inode *inode, struct fuse_file *ff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) int fuse_write_inode(struct inode *inode, struct writeback_control *wbc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) 		    struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) void fuse_set_initialized(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) void fuse_unlock_inode(struct inode *inode, bool locked);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) bool fuse_lock_inode(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) int fuse_setxattr(struct inode *inode, const char *name, const void *value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) 		  size_t size, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) 		      size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) int fuse_removexattr(struct inode *inode, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) extern const struct xattr_handler *fuse_xattr_handlers[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) extern const struct xattr_handler *fuse_acl_xattr_handlers[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) extern const struct xattr_handler *fuse_no_acl_xattr_handlers[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) struct posix_acl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) struct posix_acl *fuse_get_acl(struct inode *inode, int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) /* readdir.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) int fuse_readdir(struct file *file, struct dir_context *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234)  * Return the number of bytes in an arguments list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239)  * Get the next unique ID for a request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) u64 fuse_get_unique(struct fuse_iqueue *fiq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) void fuse_free_conn(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) /* dax.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) #define FUSE_IS_DAX(inode) (IS_ENABLED(CONFIG_FUSE_DAX) && IS_DAX(inode))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) ssize_t fuse_dax_read_iter(struct kiocb *iocb, struct iov_iter *to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) ssize_t fuse_dax_write_iter(struct kiocb *iocb, struct iov_iter *from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) int fuse_dax_mmap(struct file *file, struct vm_area_struct *vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) int fuse_dax_break_layouts(struct inode *inode, u64 dmap_start, u64 dmap_end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) int fuse_dax_conn_alloc(struct fuse_conn *fc, struct dax_device *dax_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) void fuse_dax_conn_free(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) bool fuse_dax_inode_alloc(struct super_block *sb, struct fuse_inode *fi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) void fuse_dax_inode_init(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) void fuse_dax_inode_cleanup(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) bool fuse_dax_check_alignment(struct fuse_conn *fc, unsigned int map_alignment);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) void fuse_dax_cancel_work(struct fuse_conn *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) /* passthrough.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) int fuse_passthrough_open(struct fuse_dev *fud, u32 lower_fd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) int fuse_passthrough_setup(struct fuse_conn *fc, struct fuse_file *ff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) 			   struct fuse_open_out *openarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) void fuse_passthrough_release(struct fuse_passthrough *passthrough);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) ssize_t fuse_passthrough_read_iter(struct kiocb *iocb, struct iov_iter *to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) ssize_t fuse_passthrough_write_iter(struct kiocb *iocb, struct iov_iter *from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) ssize_t fuse_passthrough_mmap(struct file *file, struct vm_area_struct *vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) #endif /* _FS_FUSE_I_H */