]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/fuse/fuse_i.h
fuse: rework fuse_do_ioctl()
[mirror_ubuntu-bionic-kernel.git] / fs / fuse / fuse_i.h
CommitLineData
d8a5ba45
MS
1/*
2 FUSE: Filesystem in Userspace
1729a16c 3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
d8a5ba45
MS
4
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8
29d434b3
TH
9#ifndef _FS_FUSE_I_H
10#define _FS_FUSE_I_H
11
d8a5ba45
MS
12#include <linux/fuse.h>
13#include <linux/fs.h>
51eb01e7 14#include <linux/mount.h>
d8a5ba45
MS
15#include <linux/wait.h>
16#include <linux/list.h>
17#include <linux/spinlock.h>
18#include <linux/mm.h>
19#include <linux/backing-dev.h>
bafa9654 20#include <linux/mutex.h>
3be5a52b 21#include <linux/rwsem.h>
95668a69
TH
22#include <linux/rbtree.h>
23#include <linux/poll.h>
5a18ec17 24#include <linux/workqueue.h>
d8a5ba45 25
334f485d
MS
26/** Max number of pages that can be used in a single read request */
27#define FUSE_MAX_PAGES_PER_REQ 32
28
3be5a52b
MS
29/** Bias for fi->writectr, meaning new writepages must not be sent */
30#define FUSE_NOWRITE INT_MIN
31
1d3d752b
MS
32/** It could be as large as PATH_MAX, but would that have any uses? */
33#define FUSE_NAME_MAX 1024
34
bafa9654 35/** Number of dentries for each connection in the control filesystem */
79a9d994 36#define FUSE_CTL_NUM_DENTRIES 5
bafa9654 37
1e9a4ed9
MS
38/** If the FUSE_DEFAULT_PERMISSIONS flag is given, the filesystem
39 module will check permissions based on the file mode. Otherwise no
40 permission checking is done in the kernel */
41#define FUSE_DEFAULT_PERMISSIONS (1 << 0)
42
43/** If the FUSE_ALLOW_OTHER flag is given, then not only the user
44 doing the mount will be allowed to access the filesystem */
45#define FUSE_ALLOW_OTHER (1 << 1)
46
4250c066
MP
47/** Number of page pointers embedded in fuse_req */
48#define FUSE_REQ_INLINE_PAGES 1
49
bafa9654
MS
50/** List of active connections */
51extern struct list_head fuse_conn_list;
52
53/** Global mutex protecting fuse_conn_list and the control filesystem */
54extern struct mutex fuse_mutex;
413ef8cb 55
79a9d994
CH
56/** Module parameters */
57extern unsigned max_user_bgreq;
58extern unsigned max_user_congthresh;
59
07e77dca
MS
60/* One forget request */
61struct fuse_forget_link {
02c048b9 62 struct fuse_forget_one forget_one;
07e77dca
MS
63 struct fuse_forget_link *next;
64};
65
d8a5ba45
MS
66/** FUSE inode */
67struct fuse_inode {
68 /** Inode data */
69 struct inode inode;
70
71 /** Unique ID, which identifies the inode between userspace
72 * and kernel */
73 u64 nodeid;
74
9e6268db
MS
75 /** Number of lookups on this inode */
76 u64 nlookup;
77
e5e5558e 78 /** The request used for sending the FORGET message */
07e77dca 79 struct fuse_forget_link *forget;
e5e5558e 80
d8a5ba45 81 /** Time in jiffies until the file attributes are valid */
0a0898cf 82 u64 i_time;
ebc14c4d
MS
83
84 /** The sticky bit in inode->i_mode may have been removed, so
85 preserve the original mode */
541af6a0 86 umode_t orig_i_mode;
1fb69e78 87
45c72cd7
PS
88 /** 64 bit inode number */
89 u64 orig_ino;
90
1fb69e78
MS
91 /** Version of last attribute change */
92 u64 attr_version;
93a8c3cd
MS
93
94 /** Files usable in writepage. Protected by fc->lock */
95 struct list_head write_files;
3be5a52b
MS
96
97 /** Writepages pending on truncate or fsync */
98 struct list_head queued_writes;
99
100 /** Number of sent writes, a negative bias (FUSE_NOWRITE)
101 * means more writes are blocked */
102 int writectr;
103
104 /** Waitq for writepage completion */
105 wait_queue_head_t page_waitq;
106
107 /** List of writepage requestst (pending or sent) */
108 struct list_head writepages;
d8a5ba45
MS
109};
110
da5e4714
MS
111struct fuse_conn;
112
b6aeaded
MS
113/** FUSE specific file data */
114struct fuse_file {
da5e4714
MS
115 /** Fuse connection for this file */
116 struct fuse_conn *fc;
117
b6aeaded 118 /** Request reserved for flush and release */
33649c91 119 struct fuse_req *reserved_req;
b6aeaded 120
acf99433
TH
121 /** Kernel file handle guaranteed to be unique */
122 u64 kh;
123
b6aeaded
MS
124 /** File handle used by userspace */
125 u64 fh;
c756e0a4 126
da5e4714
MS
127 /** Node id of this file */
128 u64 nodeid;
129
c756e0a4
MS
130 /** Refcount */
131 atomic_t count;
93a8c3cd 132
c7b7143c
MS
133 /** FOPEN_* flags returned by open */
134 u32 open_flags;
135
93a8c3cd
MS
136 /** Entry on inode's write_files list */
137 struct list_head write_entry;
95668a69
TH
138
139 /** RB node to be linked on fuse_conn->polled_files */
140 struct rb_node polled_node;
141
142 /** Wait queue head for poll */
143 wait_queue_head_t poll_wait;
37fb3a30
MS
144
145 /** Has flock been performed on this file? */
146 bool flock:1;
b6aeaded
MS
147};
148
334f485d
MS
149/** One input argument of a request */
150struct fuse_in_arg {
151 unsigned size;
152 const void *value;
153};
154
155/** The request input */
156struct fuse_in {
157 /** The request header */
158 struct fuse_in_header h;
159
160 /** True if the data for the last argument is in req->pages */
161 unsigned argpages:1;
162
163 /** Number of arguments */
164 unsigned numargs;
165
166 /** Array of arguments */
167 struct fuse_in_arg args[3];
168};
169
170/** One output argument of a request */
171struct fuse_arg {
172 unsigned size;
173 void *value;
174};
175
176/** The request output */
177struct fuse_out {
178 /** Header returned from userspace */
179 struct fuse_out_header h;
180
095da6cb
MS
181 /*
182 * The following bitfields are not changed during the request
183 * processing
184 */
185
334f485d
MS
186 /** Last argument is variable length (can be shorter than
187 arg->size) */
188 unsigned argvar:1;
189
190 /** Last argument is a list of pages to copy data to */
191 unsigned argpages:1;
192
193 /** Zero partially or not copied pages */
194 unsigned page_zeroing:1;
195
ce534fb0
MS
196 /** Pages may be replaced with new ones */
197 unsigned page_replace:1;
198
334f485d
MS
199 /** Number or arguments */
200 unsigned numargs;
201
202 /** Array of arguments */
203 struct fuse_arg args[3];
204};
205
83cfd493
MS
206/** The request state */
207enum fuse_req_state {
208 FUSE_REQ_INIT = 0,
209 FUSE_REQ_PENDING,
210 FUSE_REQ_READING,
211 FUSE_REQ_SENT,
a4d27e75 212 FUSE_REQ_WRITING,
83cfd493
MS
213 FUSE_REQ_FINISHED
214};
215
334f485d
MS
216/**
217 * A request to the client
218 */
219struct fuse_req {
ce1d5a49
MS
220 /** This can be on either pending processing or io lists in
221 fuse_conn */
334f485d
MS
222 struct list_head list;
223
a4d27e75
MS
224 /** Entry on the interrupts list */
225 struct list_head intr_entry;
226
334f485d
MS
227 /** refcount */
228 atomic_t count;
229
a4d27e75
MS
230 /** Unique ID for the interrupt request */
231 u64 intr_unique;
232
095da6cb
MS
233 /*
234 * The following bitfields are either set once before the
235 * request is queued or setting/clearing them is protected by
d7133114 236 * fuse_conn->lock
095da6cb
MS
237 */
238
334f485d
MS
239 /** True if the request has reply */
240 unsigned isreply:1;
241
51eb01e7
MS
242 /** Force sending of the request even if interrupted */
243 unsigned force:1;
244
f9a2842e
MS
245 /** The request was aborted */
246 unsigned aborted:1;
334f485d
MS
247
248 /** Request is sent in the background */
249 unsigned background:1;
250
a4d27e75
MS
251 /** The request has been interrupted */
252 unsigned interrupted:1;
253
334f485d
MS
254 /** Data is being copied to/from the request */
255 unsigned locked:1;
256
9bc5ddda
MS
257 /** Request is counted as "waiting" */
258 unsigned waiting:1;
259
83cfd493
MS
260 /** State of the request */
261 enum fuse_req_state state;
334f485d
MS
262
263 /** The request input */
264 struct fuse_in in;
265
266 /** The request output */
267 struct fuse_out out;
268
269 /** Used to wake up the task waiting for completion of request*/
270 wait_queue_head_t waitq;
271
272 /** Data for asynchronous requests */
273 union {
b57d4264 274 struct {
5a18ec17
MS
275 union {
276 struct fuse_release_in in;
277 struct work_struct work;
278 };
b0be46eb 279 struct path path;
b57d4264 280 } release;
3ec870d5
MS
281 struct fuse_init_in init_in;
282 struct fuse_init_out init_out;
08cbf542 283 struct cuse_init_in cuse_init_in;
5c5c5e51
MS
284 struct {
285 struct fuse_read_in in;
286 u64 attr_ver;
287 } read;
b25e82e5
MS
288 struct {
289 struct fuse_write_in in;
290 struct fuse_write_out out;
291 } write;
2d45ba38 292 struct fuse_notify_retrieve_in retrieve_in;
71421259 293 struct fuse_lk_in lk_in;
334f485d
MS
294 } misc;
295
296 /** page vector */
4250c066
MP
297 struct page **pages;
298
299 /** size of the 'pages' array */
300 unsigned max_pages;
301
302 /** inline page vector */
303 struct page *inline_pages[FUSE_REQ_INLINE_PAGES];
334f485d
MS
304
305 /** number of pages in vector */
306 unsigned num_pages;
307
308 /** offset of data on first page */
309 unsigned page_offset;
310
334f485d 311 /** File used in the request (or NULL) */
c756e0a4 312 struct fuse_file *ff;
64c6d8ed 313
3be5a52b
MS
314 /** Inode used in the request or NULL */
315 struct inode *inode;
316
317 /** Link on fi->writepages */
318 struct list_head writepages_entry;
319
64c6d8ed
MS
320 /** Request completion callback */
321 void (*end)(struct fuse_conn *, struct fuse_req *);
33649c91
MS
322
323 /** Request is stolen from fuse_file->reserved_req */
324 struct file *stolen_file;
334f485d
MS
325};
326
d8a5ba45
MS
327/**
328 * A Fuse connection.
329 *
330 * This structure is created, when the filesystem is mounted, and is
331 * destroyed, when the client device is closed and the filesystem is
332 * unmounted.
333 */
334struct fuse_conn {
d7133114
MS
335 /** Lock protecting accessess to members of this structure */
336 spinlock_t lock;
337
d2a85164
MS
338 /** Mutex protecting against directory alias creation */
339 struct mutex inst_mutex;
340
bafa9654
MS
341 /** Refcount */
342 atomic_t count;
343
d8a5ba45 344 /** The user id for this mount */
499dcf20 345 kuid_t user_id;
d8a5ba45 346
87729a55 347 /** The group id for this mount */
499dcf20 348 kgid_t group_id;
87729a55 349
1e9a4ed9
MS
350 /** The fuse mount flags for this mount */
351 unsigned flags;
352
db50b96c
MS
353 /** Maximum read size */
354 unsigned max_read;
355
413ef8cb
MS
356 /** Maximum write size */
357 unsigned max_write;
358
334f485d
MS
359 /** Readers of the connection are waiting on this */
360 wait_queue_head_t waitq;
361
362 /** The list of pending requests */
363 struct list_head pending;
364
365 /** The list of requests being processed */
366 struct list_head processing;
367
d77a1d5b
MS
368 /** The list of requests under I/O */
369 struct list_head io;
370
acf99433
TH
371 /** The next unique kernel file handle */
372 u64 khctr;
373
95668a69
TH
374 /** rbtree of fuse_files waiting for poll events indexed by ph */
375 struct rb_root polled_files;
376
7a6d3c8b
CH
377 /** Maximum number of outstanding background requests */
378 unsigned max_background;
379
380 /** Number of background requests at which congestion starts */
381 unsigned congestion_threshold;
382
08a53cdc
MS
383 /** Number of requests currently in the background */
384 unsigned num_background;
385
d12def1b
MS
386 /** Number of background requests currently queued for userspace */
387 unsigned active_background;
388
389 /** The list of background requests set aside for later queuing */
390 struct list_head bg_queue;
391
a4d27e75
MS
392 /** Pending interrupts */
393 struct list_head interrupts;
394
07e77dca
MS
395 /** Queue of pending forgets */
396 struct fuse_forget_link forget_list_head;
397 struct fuse_forget_link *forget_list_tail;
398
399 /** Batching of FORGET requests (positive indicates FORGET batch) */
400 int forget_batch;
401
08a53cdc
MS
402 /** Flag indicating if connection is blocked. This will be
403 the case before the INIT reply is received, and if there
404 are too many outstading backgrounds requests */
405 int blocked;
406
407 /** waitq for blocked connection */
408 wait_queue_head_t blocked_waitq;
de5e3dec
MS
409
410 /** waitq for reserved requests */
411 wait_queue_head_t reserved_req_waitq;
08a53cdc 412
334f485d
MS
413 /** The next unique request id */
414 u64 reqctr;
415
69a53bf2
MS
416 /** Connection established, cleared on umount, connection
417 abort and device release */
095da6cb 418 unsigned connected;
1e9a4ed9 419
095da6cb
MS
420 /** Connection failed (version mismatch). Cannot race with
421 setting other bitfields since it is only set once in INIT
422 reply, before any other request, and never cleared */
1729a16c 423 unsigned conn_error:1;
334f485d 424
0ec7ca41 425 /** Connection successful. Only set in INIT */
1729a16c 426 unsigned conn_init:1;
0ec7ca41 427
9cd68455 428 /** Do readpages asynchronously? Only set in INIT */
1729a16c 429 unsigned async_read:1;
9cd68455 430
6ff958ed 431 /** Do not send separate SETATTR request before open(O_TRUNC) */
1729a16c 432 unsigned atomic_o_trunc:1;
6ff958ed 433
33670fa2 434 /** Filesystem supports NFS exporting. Only set in INIT */
1729a16c 435 unsigned export_support:1;
33670fa2 436
a325f9b9
TH
437 /** Set if bdi is valid */
438 unsigned bdi_initialized:1;
439
095da6cb
MS
440 /*
441 * The following bitfields are only for optimization purposes
442 * and hence races in setting them will not cause malfunction
443 */
444
b6aeaded 445 /** Is fsync not implemented by fs? */
1729a16c 446 unsigned no_fsync:1;
b6aeaded 447
82547981 448 /** Is fsyncdir not implemented by fs? */
1729a16c 449 unsigned no_fsyncdir:1;
82547981 450
b6aeaded 451 /** Is flush not implemented by fs? */
1729a16c 452 unsigned no_flush:1;
b6aeaded 453
92a8780e 454 /** Is setxattr not implemented by fs? */
1729a16c 455 unsigned no_setxattr:1;
92a8780e
MS
456
457 /** Is getxattr not implemented by fs? */
1729a16c 458 unsigned no_getxattr:1;
92a8780e
MS
459
460 /** Is listxattr not implemented by fs? */
1729a16c 461 unsigned no_listxattr:1;
92a8780e
MS
462
463 /** Is removexattr not implemented by fs? */
1729a16c 464 unsigned no_removexattr:1;
92a8780e 465
37fb3a30 466 /** Are posix file locking primitives not implemented by fs? */
1729a16c 467 unsigned no_lock:1;
71421259 468
31d40d74 469 /** Is access not implemented by fs? */
1729a16c 470 unsigned no_access:1;
31d40d74 471
fd72faac 472 /** Is create not implemented by fs? */
1729a16c 473 unsigned no_create:1;
fd72faac 474
a4d27e75 475 /** Is interrupt not implemented by fs? */
1729a16c 476 unsigned no_interrupt:1;
a4d27e75 477
b2d2272f 478 /** Is bmap not implemented by fs? */
1729a16c 479 unsigned no_bmap:1;
b2d2272f 480
95668a69
TH
481 /** Is poll not implemented by fs? */
482 unsigned no_poll:1;
483
78bb6cb9 484 /** Do multi-page cached writes */
1729a16c 485 unsigned big_writes:1;
78bb6cb9 486
e0a43ddc
MS
487 /** Don't apply umask to creation modes */
488 unsigned dont_mask:1;
489
37fb3a30
MS
490 /** Are BSD file locking primitives not implemented by fs? */
491 unsigned no_flock:1;
492
519c6040
MS
493 /** Is fallocate not implemented by fs? */
494 unsigned no_fallocate:1;
495
72d0d248
BF
496 /** Use enhanced/automatic page cache invalidation. */
497 unsigned auto_inval_data:1;
498
0b05b183
AA
499 /** Does the filesystem support readdir-plus? */
500 unsigned do_readdirplus:1;
501
0cd5b885
MS
502 /** The number of requests waiting for completion */
503 atomic_t num_waiting;
504
45714d65
MS
505 /** Negotiated minor version */
506 unsigned minor;
507
d8a5ba45
MS
508 /** Backing dev info */
509 struct backing_dev_info bdi;
f543f253 510
bafa9654
MS
511 /** Entry on the fuse_conn_list */
512 struct list_head entry;
513
b6f2fcbc
MS
514 /** Device ID from super block */
515 dev_t dev;
bafa9654
MS
516
517 /** Dentries in the control filesystem */
518 struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
519
520 /** number of dentries used in the above array */
521 int ctl_ndents;
385a17bf
JD
522
523 /** O_ASYNC requests */
524 struct fasync_struct *fasync;
9c8ef561
MS
525
526 /** Key for lock owner ID scrambling */
527 u32 scramble_key[4];
0ec7ca41
MS
528
529 /** Reserved request for the DESTROY message */
530 struct fuse_req *destroy_req;
1fb69e78
MS
531
532 /** Version counter for attribute changes */
533 u64 attr_version;
43901aab
TH
534
535 /** Called on final put */
536 void (*release)(struct fuse_conn *);
3b463ae0
JM
537
538 /** Super block for this connection. */
539 struct super_block *sb;
540
541 /** Read/write semaphore to hold when accessing sb. */
542 struct rw_semaphore killsb;
d8a5ba45
MS
543};
544
d8a5ba45
MS
545static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
546{
6383bdaa 547 return sb->s_fs_info;
d8a5ba45
MS
548}
549
550static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
551{
552 return get_fuse_conn_super(inode->i_sb);
553}
554
555static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
556{
557 return container_of(inode, struct fuse_inode, inode);
558}
559
560static inline u64 get_node_id(struct inode *inode)
561{
562 return get_fuse_inode(inode)->nodeid;
563}
564
334f485d 565/** Device operations */
4b6f5d20 566extern const struct file_operations fuse_dev_operations;
334f485d 567
4269590a 568extern const struct dentry_operations fuse_dentry_operations;
dbd561d2 569
3b463ae0
JM
570/**
571 * Inode to nodeid comparison.
572 */
573int fuse_inode_eq(struct inode *inode, void *_nodeidp);
574
e5e5558e
MS
575/**
576 * Get a filled in inode
577 */
b48badf0 578struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
1fb69e78
MS
579 int generation, struct fuse_attr *attr,
580 u64 attr_valid, u64 attr_version);
e5e5558e 581
33670fa2
MS
582int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name,
583 struct fuse_entry_out *outarg, struct inode **inode);
584
e5e5558e
MS
585/**
586 * Send FORGET command
587 */
07e77dca
MS
588void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
589 u64 nodeid, u64 nlookup);
590
591struct fuse_forget_link *fuse_alloc_forget(void);
e5e5558e 592
0b05b183
AA
593/* Used by READDIRPLUS */
594void fuse_force_forget(struct file *file, u64 nodeid);
595
04730fef 596/**
361b1eb5 597 * Initialize READ or READDIR request
04730fef 598 */
a6643094 599void fuse_read_fill(struct fuse_req *req, struct file *file,
2106cb18 600 loff_t pos, size_t count, int opcode);
04730fef
MS
601
602/**
603 * Send OPEN or OPENDIR request
604 */
91fe96b4 605int fuse_open_common(struct inode *inode, struct file *file, bool isdir);
04730fef 606
acf99433 607struct fuse_file *fuse_file_alloc(struct fuse_conn *fc);
c7b7143c 608struct fuse_file *fuse_file_get(struct fuse_file *ff);
fd72faac 609void fuse_file_free(struct fuse_file *ff);
c7b7143c 610void fuse_finish_open(struct inode *inode, struct file *file);
fd72faac 611
8b0797a4 612void fuse_sync_release(struct fuse_file *ff, int flags);
c756e0a4 613
04730fef
MS
614/**
615 * Send RELEASE or RELEASEDIR request
616 */
8b0797a4 617void fuse_release_common(struct file *file, int opcode);
04730fef 618
82547981
MS
619/**
620 * Send FSYNC or FSYNCDIR request
621 */
02c24a82
JB
622int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
623 int datasync, int isdir);
82547981 624
95668a69
TH
625/**
626 * Notify poll wakeup
627 */
628int fuse_notify_poll_wakeup(struct fuse_conn *fc,
629 struct fuse_notify_poll_wakeup_out *outarg);
630
b6aeaded 631/**
1779381d 632 * Initialize file operations on a regular file
b6aeaded
MS
633 */
634void fuse_init_file_inode(struct inode *inode);
635
e5e5558e 636/**
1779381d 637 * Initialize inode operations on regular files and special files
e5e5558e
MS
638 */
639void fuse_init_common(struct inode *inode);
640
641/**
1779381d 642 * Initialize inode and file operations on a directory
e5e5558e
MS
643 */
644void fuse_init_dir(struct inode *inode);
645
646/**
1779381d 647 * Initialize inode operations on a symlink
e5e5558e
MS
648 */
649void fuse_init_symlink(struct inode *inode);
650
651/**
652 * Change attributes of an inode
653 */
1fb69e78
MS
654void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
655 u64 attr_valid, u64 attr_version);
e5e5558e 656
3be5a52b
MS
657void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
658 u64 attr_valid);
659
334f485d
MS
660/**
661 * Initialize the client device
662 */
663int fuse_dev_init(void);
664
665/**
666 * Cleanup the client device
667 */
668void fuse_dev_cleanup(void);
669
bafa9654
MS
670int fuse_ctl_init(void);
671void fuse_ctl_cleanup(void);
672
334f485d
MS
673/**
674 * Allocate a request
675 */
4250c066 676struct fuse_req *fuse_request_alloc(unsigned npages);
334f485d 677
4250c066 678struct fuse_req *fuse_request_alloc_nofs(unsigned npages);
3be5a52b 679
334f485d
MS
680/**
681 * Free a request
682 */
683void fuse_request_free(struct fuse_req *req);
684
334f485d 685/**
b111c8c0
MP
686 * Get a request, may fail with -ENOMEM,
687 * caller should specify # elements in req->pages[] explicitly
334f485d 688 */
b111c8c0
MP
689struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages);
690
691/**
692 * Get a request, may fail with -ENOMEM,
693 * useful for callers who doesn't use req->pages[]
694 */
695static inline struct fuse_req *fuse_get_req_nopages(struct fuse_conn *fc)
696{
697 return fuse_get_req(fc, 0);
698}
334f485d 699
33649c91
MS
700/**
701 * Gets a requests for a file operation, always succeeds
702 */
b111c8c0
MP
703struct fuse_req *fuse_get_req_nofail_nopages(struct fuse_conn *fc,
704 struct file *file);
33649c91 705
334f485d 706/**
ce1d5a49
MS
707 * Decrement reference count of a request. If count goes to zero free
708 * the request.
334f485d
MS
709 */
710void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
711
712/**
7c352bdf 713 * Send a request (synchronous)
334f485d 714 */
b93f858a 715void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req);
334f485d 716
334f485d
MS
717/**
718 * Send a request in the background
719 */
b93f858a 720void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req);
334f485d 721
b93f858a
TH
722void fuse_request_send_background_locked(struct fuse_conn *fc,
723 struct fuse_req *req);
3be5a52b 724
5a5fb1ea 725/* Abort all requests */
69a53bf2
MS
726void fuse_abort_conn(struct fuse_conn *fc);
727
e5e5558e
MS
728/**
729 * Invalidate inode attributes
730 */
731void fuse_invalidate_attr(struct inode *inode);
bafa9654 732
dbd561d2
MS
733void fuse_invalidate_entry_cache(struct dentry *entry);
734
bafa9654
MS
735/**
736 * Acquire reference to fuse_conn
737 */
738struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
739
08cbf542
TH
740void fuse_conn_kill(struct fuse_conn *fc);
741
0d179aa5
TH
742/**
743 * Initialize fuse_conn
744 */
a325f9b9 745void fuse_conn_init(struct fuse_conn *fc);
0d179aa5 746
bafa9654
MS
747/**
748 * Release reference to fuse_conn
749 */
750void fuse_conn_put(struct fuse_conn *fc);
751
752/**
753 * Add connection to control filesystem
754 */
755int fuse_ctl_add_conn(struct fuse_conn *fc);
756
757/**
758 * Remove connection from control filesystem
759 */
760void fuse_ctl_remove_conn(struct fuse_conn *fc);
a5bfffac
TS
761
762/**
763 * Is file type valid?
764 */
765int fuse_valid_type(int m);
e57ac683
MS
766
767/**
768 * Is task allowed to perform filesystem operation?
769 */
770int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);
f3332114
MS
771
772u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
bcb4be80
MS
773
774int fuse_update_attributes(struct inode *inode, struct kstat *stat,
775 struct file *file, bool *refreshed);
3be5a52b
MS
776
777void fuse_flush_writepages(struct inode *inode);
778
779void fuse_set_nowrite(struct inode *inode);
780void fuse_release_nowrite(struct inode *inode);
5c5c5e51
MS
781
782u64 fuse_get_attr_version(struct fuse_conn *fc);
29d434b3 783
3b463ae0
JM
784/**
785 * File-system tells the kernel to invalidate cache for the given node id.
786 */
787int fuse_reverse_inval_inode(struct super_block *sb, u64 nodeid,
788 loff_t offset, loff_t len);
789
790/**
791 * File-system tells the kernel to invalidate parent attributes and
792 * the dentry matching parent/name.
451d0f59
JM
793 *
794 * If the child_nodeid is non-zero and:
795 * - matches the inode number for the dentry matching parent/name,
796 * - is not a mount point
797 * - is a file or oan empty directory
798 * then the dentry is unhashed (d_delete()).
3b463ae0
JM
799 */
800int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
451d0f59 801 u64 child_nodeid, struct qstr *name);
3b463ae0 802
08cbf542
TH
803int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
804 bool isdir);
805ssize_t fuse_direct_io(struct file *file, const char __user *buf,
806 size_t count, loff_t *ppos, int write);
807long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
808 unsigned int flags);
b18da0c5
MS
809long fuse_ioctl_common(struct file *file, unsigned int cmd,
810 unsigned long arg, unsigned int flags);
08cbf542
TH
811unsigned fuse_file_poll(struct file *file, poll_table *wait);
812int fuse_dev_release(struct inode *inode, struct file *file);
813
a1d75f25
MS
814void fuse_write_update_size(struct inode *inode, loff_t pos);
815
29d434b3 816#endif /* _FS_FUSE_I_H */