VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

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