Blame view

fs/fuse/fuse_i.h 22.3 KB
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
1
2
  /*
    FUSE: Filesystem in Userspace
1729a16c2   Miklos Szeredi   fuse: style fixes
3
    Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu>
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
4
5
6
7
  
    This program can be distributed under the terms of the GNU GPL.
    See the file COPYING.
  */
29d434b39   Tejun Heo   fuse: add include...
8
9
  #ifndef _FS_FUSE_I_H
  #define _FS_FUSE_I_H
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
10
11
  #include <linux/fuse.h>
  #include <linux/fs.h>
51eb01e73   Miklos Szeredi   [PATCH] fuse: no ...
12
  #include <linux/mount.h>
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
13
14
15
16
17
  #include <linux/wait.h>
  #include <linux/list.h>
  #include <linux/spinlock.h>
  #include <linux/mm.h>
  #include <linux/backing-dev.h>
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
18
  #include <linux/mutex.h>
3be5a52b3   Miklos Szeredi   fuse: support wri...
19
  #include <linux/rwsem.h>
95668a69a   Tejun Heo   fuse: implement p...
20
21
  #include <linux/rbtree.h>
  #include <linux/poll.h>
5a18ec176   Miklos Szeredi   fuse: fix hang of...
22
  #include <linux/workqueue.h>
744742d69   Seth Forshee   fuse: Add referen...
23
  #include <linux/kref.h>
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
24

334f485df   Miklos Szeredi   [PATCH] FUSE - de...
25
26
  /** Max number of pages that can be used in a single read request */
  #define FUSE_MAX_PAGES_PER_REQ 32
3be5a52b3   Miklos Szeredi   fuse: support wri...
27
28
  /** Bias for fi->writectr, meaning new writepages must not be sent */
  #define FUSE_NOWRITE INT_MIN
1d3d752b4   Miklos Szeredi   [PATCH] fuse: cle...
29
30
  /** It could be as large as PATH_MAX, but would that have any uses? */
  #define FUSE_NAME_MAX 1024
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
31
  /** Number of dentries for each connection in the control filesystem */
79a9d9943   Csaba Henk   fuse: add fusectl...
32
  #define FUSE_CTL_NUM_DENTRIES 5
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
33

1e9a4ed93   Miklos Szeredi   [PATCH] FUSE - mo...
34
35
36
37
38
39
40
41
  /** If the FUSE_DEFAULT_PERMISSIONS flag is given, the filesystem
      module will check permissions based on the file mode.  Otherwise no
      permission checking is done in the kernel */
  #define FUSE_DEFAULT_PERMISSIONS (1 << 0)
  
  /** If the FUSE_ALLOW_OTHER flag is given, then not only the user
      doing the mount will be allowed to access the filesystem */
  #define FUSE_ALLOW_OTHER         (1 << 1)
4250c0668   Maxim Patlasov   fuse: general inf...
42
43
  /** Number of page pointers embedded in fuse_req */
  #define FUSE_REQ_INLINE_PAGES 1
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
44
45
46
47
48
  /** List of active connections */
  extern struct list_head fuse_conn_list;
  
  /** Global mutex protecting fuse_conn_list and the control filesystem */
  extern struct mutex fuse_mutex;
413ef8cb3   Miklos Szeredi   [PATCH] FUSE - di...
49

79a9d9943   Csaba Henk   fuse: add fusectl...
50
51
52
  /** Module parameters */
  extern unsigned max_user_bgreq;
  extern unsigned max_user_congthresh;
07e77dca8   Miklos Szeredi   fuse: separate qu...
53
54
  /* One forget request */
  struct fuse_forget_link {
02c048b91   Miklos Szeredi   fuse: allow batch...
55
  	struct fuse_forget_one forget_one;
07e77dca8   Miklos Szeredi   fuse: separate qu...
56
57
  	struct fuse_forget_link *next;
  };
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
58
59
60
61
62
63
64
65
  /** FUSE inode */
  struct fuse_inode {
  	/** Inode data */
  	struct inode inode;
  
  	/** Unique ID, which identifies the inode between userspace
  	 * and kernel */
  	u64 nodeid;
9e6268db4   Miklos Szeredi   [PATCH] FUSE - re...
66
67
  	/** Number of lookups on this inode */
  	u64 nlookup;
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
68
  	/** The request used for sending the FORGET message */
07e77dca8   Miklos Szeredi   fuse: separate qu...
69
  	struct fuse_forget_link *forget;
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
70

d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
71
  	/** Time in jiffies until the file attributes are valid */
0a0898cf4   Miklos Szeredi   [PATCH] fuse: use...
72
  	u64 i_time;
ebc14c4db   Miklos Szeredi   fuse: fix permiss...
73
74
75
  
  	/** The sticky bit in inode->i_mode may have been removed, so
  	    preserve the original mode */
541af6a07   Al Viro   fuse: propagate u...
76
  	umode_t orig_i_mode;
1fb69e781   Miklos Szeredi   fuse: fix race be...
77

45c72cd73   Pavel Shilovsky   fuse: fix stat ca...
78
79
  	/** 64 bit inode number */
  	u64 orig_ino;
1fb69e781   Miklos Szeredi   fuse: fix race be...
80
81
  	/** Version of last attribute change */
  	u64 attr_version;
93a8c3cd9   Miklos Szeredi   fuse: add list of...
82
83
84
  
  	/** Files usable in writepage.  Protected by fc->lock */
  	struct list_head write_files;
3be5a52b3   Miklos Szeredi   fuse: support wri...
85
86
87
88
89
90
91
92
93
94
95
96
97
  
  	/** Writepages pending on truncate or fsync */
  	struct list_head queued_writes;
  
  	/** Number of sent writes, a negative bias (FUSE_NOWRITE)
  	 * means more writes are blocked */
  	int writectr;
  
  	/** Waitq for writepage completion */
  	wait_queue_head_t page_waitq;
  
  	/** List of writepage requestst (pending or sent) */
  	struct list_head writepages;
4582a4ab2   Feng Shuo   FUSE: Adapt readd...
98
99
100
101
102
103
104
105
106
  
  	/** Miscellaneous bits describing inode state */
  	unsigned long state;
  };
  
  /** FUSE inode state bits */
  enum {
  	/** Advise readdirplus  */
  	FUSE_I_ADVISE_RDPLUS,
6314efee3   Miklos Szeredi   fuse: readdirplus...
107
108
  	/** Initialized with readdirplus */
  	FUSE_I_INIT_RDPLUS,
06a7c3c27   Maxim Patlasov   fuse: hotfix trun...
109
110
  	/** An operation changing file size is in progress  */
  	FUSE_I_SIZE_UNSTABLE,
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
111
  };
da5e47145   Miklos Szeredi   fuse: add members...
112
  struct fuse_conn;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
113
114
  /** FUSE specific file data */
  struct fuse_file {
da5e47145   Miklos Szeredi   fuse: add members...
115
116
  	/** Fuse connection for this file */
  	struct fuse_conn *fc;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
117
  	/** Request reserved for flush and release */
33649c91a   Miklos Szeredi   [PATCH] fuse: ens...
118
  	struct fuse_req *reserved_req;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
119

acf99433d   Tejun Heo   fuse: add file ke...
120
121
  	/** Kernel file handle guaranteed to be unique */
  	u64 kh;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
122
123
  	/** File handle used by userspace */
  	u64 fh;
c756e0a4d   Miklos Szeredi   fuse: add referen...
124

da5e47145   Miklos Szeredi   fuse: add members...
125
126
  	/** Node id of this file */
  	u64 nodeid;
c756e0a4d   Miklos Szeredi   fuse: add referen...
127
128
  	/** Refcount */
  	atomic_t count;
93a8c3cd9   Miklos Szeredi   fuse: add list of...
129

c7b7143c6   Miklos Szeredi   fuse: clean up ar...
130
131
  	/** FOPEN_* flags returned by open */
  	u32 open_flags;
93a8c3cd9   Miklos Szeredi   fuse: add list of...
132
133
  	/** Entry on inode's write_files list */
  	struct list_head write_entry;
95668a69a   Tejun Heo   fuse: implement p...
134
135
136
137
138
139
  
  	/** RB node to be linked on fuse_conn->polled_files */
  	struct rb_node polled_node;
  
  	/** Wait queue head for poll */
  	wait_queue_head_t poll_wait;
37fb3a30b   Miklos Szeredi   fuse: fix flock
140
141
142
  
  	/** Has flock been performed on this file? */
  	bool flock:1;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
143
  };
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
  /** One input argument of a request */
  struct fuse_in_arg {
  	unsigned size;
  	const void *value;
  };
  
  /** The request input */
  struct fuse_in {
  	/** The request header */
  	struct fuse_in_header h;
  
  	/** True if the data for the last argument is in req->pages */
  	unsigned argpages:1;
  
  	/** Number of arguments */
  	unsigned numargs;
  
  	/** Array of arguments */
  	struct fuse_in_arg args[3];
  };
  
  /** One output argument of a request */
  struct fuse_arg {
  	unsigned size;
  	void *value;
  };
  
  /** The request output */
  struct fuse_out {
  	/** Header returned from userspace */
  	struct fuse_out_header h;
095da6cbb   Miklos Szeredi   [PATCH] fuse: fix...
175
176
177
178
  	/*
  	 * The following bitfields are not changed during the request
  	 * processing
  	 */
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
179
180
181
182
183
184
185
186
187
  	/** Last argument is variable length (can be shorter than
  	    arg->size) */
  	unsigned argvar:1;
  
  	/** Last argument is a list of pages to copy data to */
  	unsigned argpages:1;
  
  	/** Zero partially or not copied pages */
  	unsigned page_zeroing:1;
ce534fb05   Miklos Szeredi   fuse: allow splic...
188
189
  	/** Pages may be replaced with new ones */
  	unsigned page_replace:1;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
190
191
192
193
  	/** Number or arguments */
  	unsigned numargs;
  
  	/** Array of arguments */
f704dcb53   Miklos Szeredi   fuse: reduce max ...
194
  	struct fuse_arg args[2];
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
195
  };
b2430d756   Maxim Patlasov   fuse: add per-pag...
196
197
198
199
200
  /** FUSE page descriptor */
  struct fuse_page_desc {
  	unsigned int length;
  	unsigned int offset;
  };
7078187a7   Miklos Szeredi   fuse: introduce f...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
  struct fuse_args {
  	struct {
  		struct {
  			uint32_t opcode;
  			uint64_t nodeid;
  		} h;
  		unsigned numargs;
  		struct fuse_in_arg args[3];
  
  	} in;
  	struct {
  		unsigned argvar:1;
  		unsigned numargs;
  		struct fuse_arg args[2];
  	} out;
  };
  
  #define FUSE_ARGS(args) struct fuse_args args = {}
01e9d11a3   Maxim Patlasov   fuse: add support...
219
220
  /** The request IO state (for asynchronous processing) */
  struct fuse_io_priv {
744742d69   Seth Forshee   fuse: Add referen...
221
  	struct kref refcnt;
01e9d11a3   Maxim Patlasov   fuse: add support...
222
223
224
225
226
227
228
229
230
231
  	int async;
  	spinlock_t lock;
  	unsigned reqs;
  	ssize_t bytes;
  	size_t size;
  	__u64 offset;
  	bool write;
  	int err;
  	struct kiocb *iocb;
  	struct file *file;
9d5722b77   Christoph Hellwig   fuse: handle sync...
232
  	struct completion *done;
01e9d11a3   Maxim Patlasov   fuse: add support...
233
  };
744742d69   Seth Forshee   fuse: Add referen...
234
235
236
237
238
239
  #define FUSE_IO_PRIV_SYNC(f) \
  {					\
  	.refcnt = { ATOMIC_INIT(1) },	\
  	.async = 0,			\
  	.file = f,			\
  }
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
240
  /**
825d6d339   Miklos Szeredi   fuse: req use bitops
241
242
243
244
245
246
247
248
249
   * Request flags
   *
   * FR_ISREPLY:		set if the request has reply
   * FR_FORCE:		force sending of the request even if interrupted
   * FR_BACKGROUND:	request is sent in the background
   * FR_WAITING:		request is counted as "waiting"
   * FR_ABORTED:		the request was aborted
   * FR_INTERRUPTED:	the request has been interrupted
   * FR_LOCKED:		data is being copied to/from the request
33e14b4df   Miklos Szeredi   fuse: req state u...
250
251
252
   * FR_PENDING:		request is not yet in userspace
   * FR_SENT:		request is in userspace, waiting for an answer
   * FR_FINISHED:		request is finished
77cd9d488   Miklos Szeredi   fuse: add req fla...
253
   * FR_PRIVATE:		request is on private list
825d6d339   Miklos Szeredi   fuse: req use bitops
254
255
256
257
258
259
260
261
262
   */
  enum fuse_req_flag {
  	FR_ISREPLY,
  	FR_FORCE,
  	FR_BACKGROUND,
  	FR_WAITING,
  	FR_ABORTED,
  	FR_INTERRUPTED,
  	FR_LOCKED,
33e14b4df   Miklos Szeredi   fuse: req state u...
263
264
265
  	FR_PENDING,
  	FR_SENT,
  	FR_FINISHED,
77cd9d488   Miklos Szeredi   fuse: add req fla...
266
  	FR_PRIVATE,
825d6d339   Miklos Szeredi   fuse: req use bitops
267
268
269
  };
  
  /**
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
270
   * A request to the client
dc00809a5   Miklos Szeredi   fuse: use per req...
271
272
273
274
   *
   * .waitq.lock protects the following fields:
   *   - FR_ABORTED
   *   - FR_LOCKED (may also be modified under fc->lock, tested under both)
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
275
276
   */
  struct fuse_req {
ce1d5a491   Miklos Szeredi   [PATCH] fuse: cle...
277
278
  	/** This can be on either pending processing or io lists in
  	    fuse_conn */
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
279
  	struct list_head list;
a4d27e75f   Miklos Szeredi   [PATCH] fuse: add...
280
281
  	/** Entry on the interrupts list  */
  	struct list_head intr_entry;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
282
283
  	/** refcount */
  	atomic_t count;
a4d27e75f   Miklos Szeredi   [PATCH] fuse: add...
284
285
  	/** Unique ID for the interrupt request */
  	u64 intr_unique;
825d6d339   Miklos Szeredi   fuse: req use bitops
286
287
  	/* Request flags, updated with test/set/clear_bit() */
  	unsigned long flags;
9bc5dddad   Miklos Szeredi   [fuse] Fix accoun...
288

334f485df   Miklos Szeredi   [PATCH] FUSE - de...
289
290
291
292
293
294
295
296
297
298
299
  	/** The request input */
  	struct fuse_in in;
  
  	/** The request output */
  	struct fuse_out out;
  
  	/** Used to wake up the task waiting for completion of request*/
  	wait_queue_head_t waitq;
  
  	/** Data for asynchronous requests */
  	union {
b57d42644   Miklos Szeredi   fuse: save space ...
300
  		struct {
baebccbe9   Miklos Szeredi   fuse: hold inode ...
301
302
  			struct fuse_release_in in;
  			struct inode *inode;
b57d42644   Miklos Szeredi   fuse: save space ...
303
  		} release;
3ec870d52   Miklos Szeredi   [PATCH] fuse: mak...
304
305
  		struct fuse_init_in init_in;
  		struct fuse_init_out init_out;
08cbf542b   Tejun Heo   fuse: export symb...
306
  		struct cuse_init_in cuse_init_in;
5c5c5e51b   Miklos Szeredi   fuse: update file...
307
308
309
310
  		struct {
  			struct fuse_read_in in;
  			u64 attr_ver;
  		} read;
b25e82e56   Miklos Szeredi   fuse: add helper ...
311
312
313
  		struct {
  			struct fuse_write_in in;
  			struct fuse_write_out out;
8b284dc47   Miklos Szeredi   fuse: writepages:...
314
  			struct fuse_req *next;
b25e82e56   Miklos Szeredi   fuse: add helper ...
315
  		} write;
2d45ba381   Miklos Szeredi   fuse: add retriev...
316
  		struct fuse_notify_retrieve_in retrieve_in;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
317
318
319
  	} misc;
  
  	/** page vector */
4250c0668   Maxim Patlasov   fuse: general inf...
320
  	struct page **pages;
b2430d756   Maxim Patlasov   fuse: add per-pag...
321
322
  	/** page-descriptor vector */
  	struct fuse_page_desc *page_descs;
4250c0668   Maxim Patlasov   fuse: general inf...
323
324
325
326
327
  	/** size of the 'pages' array */
  	unsigned max_pages;
  
  	/** inline page vector */
  	struct page *inline_pages[FUSE_REQ_INLINE_PAGES];
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
328

b2430d756   Maxim Patlasov   fuse: add per-pag...
329
330
  	/** inline page-descriptor vector */
  	struct fuse_page_desc inline_page_descs[FUSE_REQ_INLINE_PAGES];
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
331
332
  	/** number of pages in vector */
  	unsigned num_pages;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
333
  	/** File used in the request (or NULL) */
c756e0a4d   Miklos Szeredi   fuse: add referen...
334
  	struct fuse_file *ff;
64c6d8ed4   Miklos Szeredi   [PATCH] fuse: add...
335

3be5a52b3   Miklos Szeredi   fuse: support wri...
336
337
  	/** Inode used in the request or NULL */
  	struct inode *inode;
01e9d11a3   Maxim Patlasov   fuse: add support...
338
339
  	/** AIO control block */
  	struct fuse_io_priv *io;
3be5a52b3   Miklos Szeredi   fuse: support wri...
340
341
  	/** Link on fi->writepages */
  	struct list_head writepages_entry;
64c6d8ed4   Miklos Szeredi   [PATCH] fuse: add...
342
343
  	/** Request completion callback */
  	void (*end)(struct fuse_conn *, struct fuse_req *);
33649c91a   Miklos Szeredi   [PATCH] fuse: ens...
344
345
346
  
  	/** Request is stolen from fuse_file->reserved_req */
  	struct file *stolen_file;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
347
  };
f88996a93   Miklos Szeredi   fuse: separate ou...
348
  struct fuse_iqueue {
e16714d87   Miklos Szeredi   fuse: duplicate -...
349
350
  	/** Connection established */
  	unsigned connected;
f88996a93   Miklos Szeredi   fuse: separate ou...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
  	/** Readers of the connection are waiting on this */
  	wait_queue_head_t waitq;
  
  	/** The next unique request id */
  	u64 reqctr;
  
  	/** The list of pending requests */
  	struct list_head pending;
  
  	/** Pending interrupts */
  	struct list_head interrupts;
  
  	/** Queue of pending forgets */
  	struct fuse_forget_link forget_list_head;
  	struct fuse_forget_link *forget_list_tail;
  
  	/** Batching of FORGET requests (positive indicates FORGET batch) */
  	int forget_batch;
  
  	/** O_ASYNC requests */
  	struct fasync_struct *fasync;
  };
3a2b5b9cd   Miklos Szeredi   fuse: separate ou...
373
  struct fuse_pqueue {
e96edd94d   Miklos Szeredi   fuse: duplicate -...
374
375
  	/** Connection established */
  	unsigned connected;
45a91cb1a   Miklos Szeredi   fuse: pqueue locking
376
377
  	/** Lock protecting accessess to  members of this structure */
  	spinlock_t lock;
3a2b5b9cd   Miklos Szeredi   fuse: separate ou...
378
379
380
381
382
383
  	/** The list of requests being processed */
  	struct list_head processing;
  
  	/** The list of requests under I/O */
  	struct list_head io;
  };
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
384
  /**
cc080e9e9   Miklos Szeredi   fuse: introduce p...
385
386
387
388
389
   * Fuse device instance
   */
  struct fuse_dev {
  	/** Fuse connection for this device */
  	struct fuse_conn *fc;
c3696046b   Miklos Szeredi   fuse: separate pq...
390
391
  	/** Processing queue */
  	struct fuse_pqueue pq;
cc080e9e9   Miklos Szeredi   fuse: introduce p...
392
393
394
395
396
  	/** list entry on fc->devices */
  	struct list_head entry;
  };
  
  /**
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
397
398
399
400
401
402
403
   * A Fuse connection.
   *
   * This structure is created, when the filesystem is mounted, and is
   * destroyed, when the client device is closed and the filesystem is
   * unmounted.
   */
  struct fuse_conn {
d71331146   Miklos Szeredi   [PATCH] fuse: use...
404
405
  	/** Lock protecting accessess to  members of this structure */
  	spinlock_t lock;
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
406
407
  	/** Refcount */
  	atomic_t count;
c3696046b   Miklos Szeredi   fuse: separate pq...
408
409
  	/** Number of fuse_dev's */
  	atomic_t dev_count;
dd3e2c55a   Al Viro   fuse: rcu-delay f...
410
  	struct rcu_head rcu;
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
411
  	/** The user id for this mount */
499dcf202   Eric W. Biederman   userns: Support f...
412
  	kuid_t user_id;
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
413

87729a551   Miklos Szeredi   [PATCH] FUSE: tig...
414
  	/** The group id for this mount */
499dcf202   Eric W. Biederman   userns: Support f...
415
  	kgid_t group_id;
87729a551   Miklos Szeredi   [PATCH] FUSE: tig...
416

1e9a4ed93   Miklos Szeredi   [PATCH] FUSE - mo...
417
418
  	/** The fuse mount flags for this mount */
  	unsigned flags;
db50b96c0   Miklos Szeredi   [PATCH] FUSE - re...
419
420
  	/** Maximum read size */
  	unsigned max_read;
413ef8cb3   Miklos Szeredi   [PATCH] FUSE - di...
421
422
  	/** Maximum write size */
  	unsigned max_write;
f88996a93   Miklos Szeredi   fuse: separate ou...
423
424
  	/** Input queue */
  	struct fuse_iqueue iq;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
425

acf99433d   Tejun Heo   fuse: add file ke...
426
427
  	/** The next unique kernel file handle */
  	u64 khctr;
95668a69a   Tejun Heo   fuse: implement p...
428
429
  	/** rbtree of fuse_files waiting for poll events indexed by ph */
  	struct rb_root polled_files;
7a6d3c8b3   Csaba Henk   fuse: make the nu...
430
431
432
433
434
  	/** Maximum number of outstanding background requests */
  	unsigned max_background;
  
  	/** Number of background requests at which congestion starts */
  	unsigned congestion_threshold;
08a53cdce   Miklos Szeredi   [PATCH] fuse: acc...
435
436
  	/** Number of requests currently in the background */
  	unsigned num_background;
d12def1bc   Miklos Szeredi   fuse: limit queue...
437
438
439
440
441
  	/** Number of background requests currently queued for userspace */
  	unsigned active_background;
  
  	/** The list of background requests set aside for later queuing */
  	struct list_head bg_queue;
796523fb2   Maxim Patlasov   fuse: add flag fc...
442
443
444
  	/** Flag indicating that INIT reply has been received. Allocating
  	 * any fuse request will be suspended until the flag is set */
  	int initialized;
08a53cdce   Miklos Szeredi   [PATCH] fuse: acc...
445
446
447
448
449
450
451
  	/** Flag indicating if connection is blocked.  This will be
  	    the case before the INIT reply is received, and if there
  	    are too many outstading backgrounds requests */
  	int blocked;
  
  	/** waitq for blocked connection */
  	wait_queue_head_t blocked_waitq;
de5e3dec4   Miklos Szeredi   fuse: fix reserve...
452
453
454
  
  	/** waitq for reserved requests */
  	wait_queue_head_t reserved_req_waitq;
08a53cdce   Miklos Szeredi   [PATCH] fuse: acc...
455

69a53bf26   Miklos Szeredi   [PATCH] fuse: add...
456
457
  	/** Connection established, cleared on umount, connection
  	    abort and device release */
095da6cbb   Miklos Szeredi   [PATCH] fuse: fix...
458
  	unsigned connected;
1e9a4ed93   Miklos Szeredi   [PATCH] FUSE - mo...
459

095da6cbb   Miklos Szeredi   [PATCH] fuse: fix...
460
461
462
  	/** Connection failed (version mismatch).  Cannot race with
  	    setting other bitfields since it is only set once in INIT
  	    reply, before any other request, and never cleared */
1729a16c2   Miklos Szeredi   fuse: style fixes
463
  	unsigned conn_error:1;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
464

0ec7ca41f   Miklos Szeredi   [PATCH] fuse: add...
465
  	/** Connection successful.  Only set in INIT */
1729a16c2   Miklos Szeredi   fuse: style fixes
466
  	unsigned conn_init:1;
0ec7ca41f   Miklos Szeredi   [PATCH] fuse: add...
467

9cd684551   Miklos Szeredi   [PATCH] fuse: fix...
468
  	/** Do readpages asynchronously?  Only set in INIT */
1729a16c2   Miklos Szeredi   fuse: style fixes
469
  	unsigned async_read:1;
9cd684551   Miklos Szeredi   [PATCH] fuse: fix...
470

6ff958edb   Miklos Szeredi   fuse: add atomic ...
471
  	/** Do not send separate SETATTR request before open(O_TRUNC)  */
1729a16c2   Miklos Szeredi   fuse: style fixes
472
  	unsigned atomic_o_trunc:1;
6ff958edb   Miklos Szeredi   fuse: add atomic ...
473

33670fa29   Miklos Szeredi   fuse: nfs export ...
474
  	/** Filesystem supports NFS exporting.  Only set in INIT */
1729a16c2   Miklos Szeredi   fuse: style fixes
475
  	unsigned export_support:1;
33670fa29   Miklos Szeredi   fuse: nfs export ...
476

a325f9b92   Tejun Heo   fuse: update fuse...
477
478
  	/** Set if bdi is valid */
  	unsigned bdi_initialized:1;
d5cd66c58   Pavel Emelyanov   fuse: Connection ...
479
480
  	/** write-back cache policy (default is write-through) */
  	unsigned writeback_cache:1;
095da6cbb   Miklos Szeredi   [PATCH] fuse: fix...
481
482
483
484
  	/*
  	 * The following bitfields are only for optimization purposes
  	 * and hence races in setting them will not cause malfunction
  	 */
7678ac506   Andrew Gallagher   fuse: support cli...
485
486
  	/** Is open/release not implemented by fs? */
  	unsigned no_open:1;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
487
  	/** Is fsync not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
488
  	unsigned no_fsync:1;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
489

825479819   Miklos Szeredi   [PATCH] FUSE: add...
490
  	/** Is fsyncdir not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
491
  	unsigned no_fsyncdir:1;
825479819   Miklos Szeredi   [PATCH] FUSE: add...
492

b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
493
  	/** Is flush not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
494
  	unsigned no_flush:1;
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
495

92a8780e1   Miklos Szeredi   [PATCH] FUSE - ex...
496
  	/** Is setxattr not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
497
  	unsigned no_setxattr:1;
92a8780e1   Miklos Szeredi   [PATCH] FUSE - ex...
498
499
  
  	/** Is getxattr not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
500
  	unsigned no_getxattr:1;
92a8780e1   Miklos Szeredi   [PATCH] FUSE - ex...
501
502
  
  	/** Is listxattr not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
503
  	unsigned no_listxattr:1;
92a8780e1   Miklos Szeredi   [PATCH] FUSE - ex...
504
505
  
  	/** Is removexattr not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
506
  	unsigned no_removexattr:1;
92a8780e1   Miklos Szeredi   [PATCH] FUSE - ex...
507

37fb3a30b   Miklos Szeredi   fuse: fix flock
508
  	/** Are posix file locking primitives not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
509
  	unsigned no_lock:1;
714212593   Miklos Szeredi   [PATCH] fuse: add...
510

31d40d74b   Miklos Szeredi   [PATCH] FUSE: add...
511
  	/** Is access not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
512
  	unsigned no_access:1;
31d40d74b   Miklos Szeredi   [PATCH] FUSE: add...
513

fd72faac9   Miklos Szeredi   [PATCH] FUSE: ato...
514
  	/** Is create not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
515
  	unsigned no_create:1;
fd72faac9   Miklos Szeredi   [PATCH] FUSE: ato...
516

a4d27e75f   Miklos Szeredi   [PATCH] fuse: add...
517
  	/** Is interrupt not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
518
  	unsigned no_interrupt:1;
a4d27e75f   Miklos Szeredi   [PATCH] fuse: add...
519

b2d2272fa   Miklos Szeredi   [PATCH] fuse: add...
520
  	/** Is bmap not implemented by fs? */
1729a16c2   Miklos Szeredi   fuse: style fixes
521
  	unsigned no_bmap:1;
b2d2272fa   Miklos Szeredi   [PATCH] fuse: add...
522

95668a69a   Tejun Heo   fuse: implement p...
523
524
  	/** Is poll not implemented by fs? */
  	unsigned no_poll:1;
78bb6cb9a   Miklos Szeredi   fuse: add flag to...
525
  	/** Do multi-page cached writes */
1729a16c2   Miklos Szeredi   fuse: style fixes
526
  	unsigned big_writes:1;
78bb6cb9a   Miklos Szeredi   fuse: add flag to...
527

e0a43ddcc   Miklos Szeredi   fuse: allow umask...
528
529
  	/** Don't apply umask to creation modes */
  	unsigned dont_mask:1;
37fb3a30b   Miklos Szeredi   fuse: fix flock
530
531
  	/** Are BSD file locking primitives not implemented by fs? */
  	unsigned no_flock:1;
519c6040c   Miklos Szeredi   fuse: optimize fa...
532
533
  	/** Is fallocate not implemented by fs? */
  	unsigned no_fallocate:1;
1560c974d   Miklos Szeredi   fuse: add renamea...
534
535
  	/** Is rename with flags implemented by fs? */
  	unsigned no_rename2:1;
72d0d248c   Brian Foster   fuse: add FUSE_AU...
536
537
  	/** Use enhanced/automatic page cache invalidation. */
  	unsigned auto_inval_data:1;
634734b63   Eric Wong   fuse: allow contr...
538
  	/** Does the filesystem support readdirplus? */
0b05b1838   Anand V. Avati   fuse: implement N...
539
  	unsigned do_readdirplus:1;
634734b63   Eric Wong   fuse: allow contr...
540
541
  	/** Does the filesystem want adaptive readdirplus? */
  	unsigned readdirplus_auto:1;
60b9df7a5   Miklos Szeredi   fuse: add flag to...
542
543
  	/** Does the filesystem support asynchronous direct-IO submission? */
  	unsigned async_dio:1;
0b5da8db1   Ravishankar N   fuse: add support...
544
545
  	/** Is lseek not implemented by fs? */
  	unsigned no_lseek:1;
0cd5b8855   Miklos Szeredi   [PATCH] fuse: add...
546
547
  	/** The number of requests waiting for completion */
  	atomic_t num_waiting;
45714d656   Miklos Szeredi   [PATCH] fuse: bum...
548
549
  	/** Negotiated minor version */
  	unsigned minor;
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
550
551
  	/** Backing dev info */
  	struct backing_dev_info bdi;
f543f253f   Miklos Szeredi   [PATCH] fuse: mak...
552

bafa96541   Miklos Szeredi   [PATCH] fuse: add...
553
554
  	/** Entry on the fuse_conn_list */
  	struct list_head entry;
b6f2fcbcf   Miklos Szeredi   mm: bdi: expose t...
555
556
  	/** Device ID from super block */
  	dev_t dev;
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
557
558
559
560
561
562
  
  	/** Dentries in the control filesystem */
  	struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
  
  	/** number of dentries used in the above array */
  	int ctl_ndents;
385a17bfc   Jeff Dike   [PATCH] fuse: add...
563

9c8ef5614   Miklos Szeredi   [PATCH] fuse: scr...
564
565
  	/** Key for lock owner ID scrambling */
  	u32 scramble_key[4];
0ec7ca41f   Miklos Szeredi   [PATCH] fuse: add...
566
567
568
  
  	/** Reserved request for the DESTROY message */
  	struct fuse_req *destroy_req;
1fb69e781   Miklos Szeredi   fuse: fix race be...
569
570
571
  
  	/** Version counter for attribute changes */
  	u64 attr_version;
43901aabd   Tejun Heo   fuse: add fuse_co...
572
573
574
  
  	/** Called on final put */
  	void (*release)(struct fuse_conn *);
3b463ae0c   John Muir   fuse: invalidatio...
575
576
577
578
579
580
  
  	/** Super block for this connection. */
  	struct super_block *sb;
  
  	/** Read/write semaphore to hold when accessing sb. */
  	struct rw_semaphore killsb;
cc080e9e9   Miklos Szeredi   fuse: introduce p...
581
582
583
  
  	/** List of device instances belonging to this connection */
  	struct list_head devices;
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
584
  };
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
585
586
  static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
  {
6383bdaa2   Miklos Szeredi   [PATCH] fuse: mis...
587
  	return sb->s_fs_info;
d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
  }
  
  static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
  {
  	return get_fuse_conn_super(inode->i_sb);
  }
  
  static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
  {
  	return container_of(inode, struct fuse_inode, inode);
  }
  
  static inline u64 get_node_id(struct inode *inode)
  {
  	return get_fuse_inode(inode)->nodeid;
  }
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
604
  /** Device operations */
4b6f5d20b   Arjan van de Ven   [PATCH] Make most...
605
  extern const struct file_operations fuse_dev_operations;
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
606

4269590a7   Al Viro   constify dentry_o...
607
  extern const struct dentry_operations fuse_dentry_operations;
dbd561d23   Miklos Szeredi   fuse: add export ...
608

d8a5ba454   Miklos Szeredi   [PATCH] FUSE - core
609
  /**
3b463ae0c   John Muir   fuse: invalidatio...
610
611
612
613
614
   * Inode to nodeid comparison.
   */
  int fuse_inode_eq(struct inode *inode, void *_nodeidp);
  
  /**
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
615
616
   * Get a filled in inode
   */
b48badf01   Miklos Szeredi   fuse: fix node ID...
617
  struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
1fb69e781   Miklos Szeredi   fuse: fix race be...
618
619
  			int generation, struct fuse_attr *attr,
  			u64 attr_valid, u64 attr_version);
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
620

33670fa29   Miklos Szeredi   fuse: nfs export ...
621
622
  int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name,
  		     struct fuse_entry_out *outarg, struct inode **inode);
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
623
624
625
  /**
   * Send FORGET command
   */
07e77dca8   Miklos Szeredi   fuse: separate qu...
626
627
628
629
  void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
  		       u64 nodeid, u64 nlookup);
  
  struct fuse_forget_link *fuse_alloc_forget(void);
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
630

0b05b1838   Anand V. Avati   fuse: implement N...
631
632
  /* Used by READDIRPLUS */
  void fuse_force_forget(struct file *file, u64 nodeid);
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
633
  /**
361b1eb55   Miklos Szeredi   [PATCH] fuse: REA...
634
   * Initialize READ or READDIR request
04730fef1   Miklos Szeredi   [PATCH] fuse: tra...
635
   */
a6643094e   Miklos Szeredi   fuse: pass open f...
636
  void fuse_read_fill(struct fuse_req *req, struct file *file,
2106cb189   Miklos Szeredi   fuse: don't use i...
637
  		    loff_t pos, size_t count, int opcode);
04730fef1   Miklos Szeredi   [PATCH] fuse: tra...
638
639
640
641
  
  /**
   * Send OPEN or OPENDIR request
   */
91fe96b40   Miklos Szeredi   fuse: create fuse...
642
  int fuse_open_common(struct inode *inode, struct file *file, bool isdir);
04730fef1   Miklos Szeredi   [PATCH] fuse: tra...
643

acf99433d   Tejun Heo   fuse: add file ke...
644
  struct fuse_file *fuse_file_alloc(struct fuse_conn *fc);
c7b7143c6   Miklos Szeredi   fuse: clean up ar...
645
  struct fuse_file *fuse_file_get(struct fuse_file *ff);
fd72faac9   Miklos Szeredi   [PATCH] FUSE: ato...
646
  void fuse_file_free(struct fuse_file *ff);
c7b7143c6   Miklos Szeredi   fuse: clean up ar...
647
  void fuse_finish_open(struct inode *inode, struct file *file);
fd72faac9   Miklos Szeredi   [PATCH] FUSE: ato...
648

8b0797a49   Miklos Szeredi   fuse: don't use i...
649
  void fuse_sync_release(struct fuse_file *ff, int flags);
c756e0a4d   Miklos Szeredi   fuse: add referen...
650

04730fef1   Miklos Szeredi   [PATCH] fuse: tra...
651
652
653
  /**
   * Send RELEASE or RELEASEDIR request
   */
8b0797a49   Miklos Szeredi   fuse: don't use i...
654
  void fuse_release_common(struct file *file, int opcode);
04730fef1   Miklos Szeredi   [PATCH] fuse: tra...
655
656
  
  /**
825479819   Miklos Szeredi   [PATCH] FUSE: add...
657
658
   * Send FSYNC or FSYNCDIR request
   */
02c24a821   Josef Bacik   fs: push i_mutex ...
659
660
  int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
  		      int datasync, int isdir);
825479819   Miklos Szeredi   [PATCH] FUSE: add...
661
662
  
  /**
95668a69a   Tejun Heo   fuse: implement p...
663
664
665
666
667
668
   * Notify poll wakeup
   */
  int fuse_notify_poll_wakeup(struct fuse_conn *fc,
  			    struct fuse_notify_poll_wakeup_out *outarg);
  
  /**
1779381de   Miklos Szeredi   [PATCH] fuse: spe...
669
   * Initialize file operations on a regular file
b6aeadeda   Miklos Szeredi   [PATCH] FUSE - fi...
670
671
672
673
   */
  void fuse_init_file_inode(struct inode *inode);
  
  /**
1779381de   Miklos Szeredi   [PATCH] fuse: spe...
674
   * Initialize inode operations on regular files and special files
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
675
676
677
678
   */
  void fuse_init_common(struct inode *inode);
  
  /**
1779381de   Miklos Szeredi   [PATCH] fuse: spe...
679
   * Initialize inode and file operations on a directory
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
680
681
682
683
   */
  void fuse_init_dir(struct inode *inode);
  
  /**
1779381de   Miklos Szeredi   [PATCH] fuse: spe...
684
   * Initialize inode operations on a symlink
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
685
686
687
688
689
690
   */
  void fuse_init_symlink(struct inode *inode);
  
  /**
   * Change attributes of an inode
   */
1fb69e781   Miklos Szeredi   fuse: fix race be...
691
692
  void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
  			    u64 attr_valid, u64 attr_version);
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
693

3be5a52b3   Miklos Szeredi   fuse: support wri...
694
695
  void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
  				   u64 attr_valid);
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
696
  /**
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
697
698
699
700
701
702
703
704
   * Initialize the client device
   */
  int fuse_dev_init(void);
  
  /**
   * Cleanup the client device
   */
  void fuse_dev_cleanup(void);
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
705
  int fuse_ctl_init(void);
7736e8cc5   Fabian Frederick   fuse: add __exit ...
706
  void __exit fuse_ctl_cleanup(void);
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
707

334f485df   Miklos Szeredi   [PATCH] FUSE - de...
708
709
710
  /**
   * Allocate a request
   */
4250c0668   Maxim Patlasov   fuse: general inf...
711
  struct fuse_req *fuse_request_alloc(unsigned npages);
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
712

4250c0668   Maxim Patlasov   fuse: general inf...
713
  struct fuse_req *fuse_request_alloc_nofs(unsigned npages);
3be5a52b3   Miklos Szeredi   fuse: support wri...
714

334f485df   Miklos Szeredi   [PATCH] FUSE - de...
715
716
717
718
719
720
  /**
   * Free a request
   */
  void fuse_request_free(struct fuse_req *req);
  
  /**
b111c8c0e   Maxim Patlasov   fuse: categorize ...
721
722
   * Get a request, may fail with -ENOMEM,
   * caller should specify # elements in req->pages[] explicitly
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
723
   */
b111c8c0e   Maxim Patlasov   fuse: categorize ...
724
  struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages);
8b41e6715   Maxim Patlasov   fuse: make reques...
725
726
  struct fuse_req *fuse_get_req_for_background(struct fuse_conn *fc,
  					     unsigned npages);
b111c8c0e   Maxim Patlasov   fuse: categorize ...
727

36cf66ed9   Maxim Patlasov   fuse: make fuse_d...
728
729
730
731
  /*
   * Increment reference count on request
   */
  void __fuse_get_request(struct fuse_req *req);
b111c8c0e   Maxim Patlasov   fuse: categorize ...
732
  /**
33649c91a   Miklos Szeredi   [PATCH] fuse: ens...
733
734
   * Gets a requests for a file operation, always succeeds
   */
b111c8c0e   Maxim Patlasov   fuse: categorize ...
735
736
  struct fuse_req *fuse_get_req_nofail_nopages(struct fuse_conn *fc,
  					     struct file *file);
33649c91a   Miklos Szeredi   [PATCH] fuse: ens...
737
738
  
  /**
ce1d5a491   Miklos Szeredi   [PATCH] fuse: cle...
739
740
   * Decrement reference count of a request.  If count goes to zero free
   * the request.
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
741
742
743
744
   */
  void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
  
  /**
7c352bdf0   Miklos Szeredi   [PATCH] FUSE: don...
745
   * Send a request (synchronous)
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
746
   */
b93f858ab   Tejun Heo   fuse: add fuse_ p...
747
  void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req);
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
748
749
  
  /**
7078187a7   Miklos Szeredi   fuse: introduce f...
750
751
752
753
754
   * Simple request sending that does request allocation and freeing
   */
  ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args);
  
  /**
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
755
756
   * Send a request in the background
   */
b93f858ab   Tejun Heo   fuse: add fuse_ p...
757
  void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req);
334f485df   Miklos Szeredi   [PATCH] FUSE - de...
758

b93f858ab   Tejun Heo   fuse: add fuse_ p...
759
760
  void fuse_request_send_background_locked(struct fuse_conn *fc,
  					 struct fuse_req *req);
3be5a52b3   Miklos Szeredi   fuse: support wri...
761

5a5fb1ea7   Miklos Szeredi   Revert "[fuse] fi...
762
  /* Abort all requests */
69a53bf26   Miklos Szeredi   [PATCH] fuse: add...
763
  void fuse_abort_conn(struct fuse_conn *fc);
1e9a4ed93   Miklos Szeredi   [PATCH] FUSE - mo...
764
  /**
e5e5558e9   Miklos Szeredi   [PATCH] FUSE - re...
765
766
767
   * Invalidate inode attributes
   */
  void fuse_invalidate_attr(struct inode *inode);
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
768

dbd561d23   Miklos Szeredi   fuse: add export ...
769
  void fuse_invalidate_entry_cache(struct dentry *entry);
451418fc9   Andrew Gallagher   fuse: don't inval...
770
  void fuse_invalidate_atime(struct inode *inode);
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
771
772
773
774
775
776
  /**
   * Acquire reference to fuse_conn
   */
  struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
  
  /**
0d179aa59   Tejun Heo   fuse: separate ou...
777
778
   * Initialize fuse_conn
   */
a325f9b92   Tejun Heo   fuse: update fuse...
779
  void fuse_conn_init(struct fuse_conn *fc);
0d179aa59   Tejun Heo   fuse: separate ou...
780
781
  
  /**
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
782
783
784
   * Release reference to fuse_conn
   */
  void fuse_conn_put(struct fuse_conn *fc);
cc080e9e9   Miklos Szeredi   fuse: introduce p...
785
786
  struct fuse_dev *fuse_dev_alloc(struct fuse_conn *fc);
  void fuse_dev_free(struct fuse_dev *fud);
bafa96541   Miklos Szeredi   [PATCH] fuse: add...
787
788
789
790
791
792
793
794
795
  /**
   * Add connection to control filesystem
   */
  int fuse_ctl_add_conn(struct fuse_conn *fc);
  
  /**
   * Remove connection from control filesystem
   */
  void fuse_ctl_remove_conn(struct fuse_conn *fc);
a5bfffac6   Timo Savola   [PATCH] fuse: val...
796
797
798
799
800
  
  /**
   * Is file type valid?
   */
  int fuse_valid_type(int m);
e57ac6837   Miklos Szeredi   fuse: fix allowin...
801
802
  
  /**
c2132c1bc   Anatol Pomozov   Do not use RCU fo...
803
   * Is current process allowed to perform filesystem operation?
e57ac6837   Miklos Szeredi   fuse: fix allowin...
804
   */
c2132c1bc   Anatol Pomozov   Do not use RCU fo...
805
  int fuse_allow_current_process(struct fuse_conn *fc);
f33321141   Miklos Szeredi   fuse: add support...
806
807
  
  u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
bcb4be809   Miklos Szeredi   fuse: fix reading...
808
809
810
  
  int fuse_update_attributes(struct inode *inode, struct kstat *stat,
  			   struct file *file, bool *refreshed);
3be5a52b3   Miklos Szeredi   fuse: support wri...
811
812
813
814
815
  
  void fuse_flush_writepages(struct inode *inode);
  
  void fuse_set_nowrite(struct inode *inode);
  void fuse_release_nowrite(struct inode *inode);
5c5c5e51b   Miklos Szeredi   fuse: update file...
816
817
  
  u64 fuse_get_attr_version(struct fuse_conn *fc);
29d434b39   Tejun Heo   fuse: add include...
818

3b463ae0c   John Muir   fuse: invalidatio...
819
820
821
822
823
824
825
826
827
  /**
   * File-system tells the kernel to invalidate cache for the given node id.
   */
  int fuse_reverse_inval_inode(struct super_block *sb, u64 nodeid,
  			     loff_t offset, loff_t len);
  
  /**
   * File-system tells the kernel to invalidate parent attributes and
   * the dentry matching parent/name.
451d0f599   John Muir   FUSE: Notifying t...
828
829
830
831
832
833
   *
   * If the child_nodeid is non-zero and:
   *    - matches the inode number for the dentry matching parent/name,
   *    - is not a mount point
   *    - is a file or oan empty directory
   * then the dentry is unhashed (d_delete()).
3b463ae0c   John Muir   fuse: invalidatio...
834
835
   */
  int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
451d0f599   John Muir   FUSE: Notifying t...
836
  			     u64 child_nodeid, struct qstr *name);
3b463ae0c   John Muir   fuse: invalidatio...
837

08cbf542b   Tejun Heo   fuse: export symb...
838
839
  int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
  		 bool isdir);
ea8cd3339   Pavel Emelyanov   fuse: Fix O_DIREC...
840
841
842
843
844
845
846
847
848
849
  
  /**
   * fuse_direct_io() flags
   */
  
  /** If set, it is WRITE; otherwise - READ */
  #define FUSE_DIO_WRITE (1 << 0)
  
  /** CUSE pass fuse_direct_io() a file which f_mapping->host is not from FUSE */
  #define FUSE_DIO_CUSE  (1 << 1)
d22a943f4   Al Viro   fuse: pull iov_it...
850
851
  ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
  		       loff_t *ppos, int flags);
08cbf542b   Tejun Heo   fuse: export symb...
852
853
  long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
  		   unsigned int flags);
b18da0c56   Miklos Szeredi   fuse: support ioc...
854
855
  long fuse_ioctl_common(struct file *file, unsigned int cmd,
  		       unsigned long arg, unsigned int flags);
08cbf542b   Tejun Heo   fuse: export symb...
856
857
  unsigned fuse_file_poll(struct file *file, poll_table *wait);
  int fuse_dev_release(struct inode *inode, struct file *file);
b0aa76065   Maxim Patlasov   fuse: Trust kerne...
858
  bool fuse_write_update_size(struct inode *inode, loff_t pos);
ab9e13f7c   Maxim Patlasov   fuse: allow ctime...
859
  int fuse_flush_times(struct inode *inode, struct fuse_file *ff);
1e18bda86   Miklos Szeredi   fuse: add .write_...
860
  int fuse_write_inode(struct inode *inode, struct writeback_control *wbc);
a1d75f258   Miklos Szeredi   fuse: add store r...
861

efb9fa9e9   Maxim Patlasov   fuse: truncate fi...
862
863
  int fuse_do_setattr(struct inode *inode, struct iattr *attr,
  		    struct file *file);
9759bd518   Miklos Szeredi   fuse: add memory ...
864
  void fuse_set_initialized(struct fuse_conn *fc);
29d434b39   Tejun Heo   fuse: add include...
865
  #endif /* _FS_FUSE_I_H */