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