blob: b24fc9b386f826b10220f39136f4eda8def271f4 [file] [log] [blame]
Miklos Szeredid8a5ba42005-09-09 13:10:26 -07001/*
2 FUSE: Filesystem in Userspace
Miklos Szeredid7133112006-04-10 22:54:55 -07003 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
Miklos Szeredid8a5ba42005-09-09 13:10:26 -07004
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8
9#include <linux/fuse.h>
10#include <linux/fs.h>
Miklos Szeredi51eb01e2006-06-25 05:48:50 -070011#include <linux/mount.h>
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070012#include <linux/wait.h>
13#include <linux/list.h>
14#include <linux/spinlock.h>
15#include <linux/mm.h>
16#include <linux/backing-dev.h>
Miklos Szeredibafa9652006-06-25 05:48:51 -070017#include <linux/mutex.h>
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070018
Miklos Szeredi334f4852005-09-09 13:10:27 -070019/** Max number of pages that can be used in a single read request */
20#define FUSE_MAX_PAGES_PER_REQ 32
21
Miklos Szeredi08a53cd2006-04-10 22:54:59 -070022/** Maximum number of outstanding background requests */
Miklos Szeredif92b99b2007-10-16 23:30:59 -070023#define FUSE_MAX_BACKGROUND 12
24
25/** Congestion starts at 75% of maximum */
26#define FUSE_CONGESTION_THRESHOLD (FUSE_MAX_BACKGROUND * 75 / 100)
Miklos Szeredi08a53cd2006-04-10 22:54:59 -070027
Miklos Szeredi1d3d7522006-01-06 00:19:40 -080028/** It could be as large as PATH_MAX, but would that have any uses? */
29#define FUSE_NAME_MAX 1024
30
Miklos Szeredibafa9652006-06-25 05:48:51 -070031/** Number of dentries for each connection in the control filesystem */
32#define FUSE_CTL_NUM_DENTRIES 3
33
Miklos Szeredi1e9a4ed2005-09-09 13:10:31 -070034/** If the FUSE_DEFAULT_PERMISSIONS flag is given, the filesystem
35 module will check permissions based on the file mode. Otherwise no
36 permission checking is done in the kernel */
37#define FUSE_DEFAULT_PERMISSIONS (1 << 0)
38
39/** If the FUSE_ALLOW_OTHER flag is given, then not only the user
40 doing the mount will be allowed to access the filesystem */
41#define FUSE_ALLOW_OTHER (1 << 1)
42
Miklos Szeredibafa9652006-06-25 05:48:51 -070043/** List of active connections */
44extern struct list_head fuse_conn_list;
45
46/** Global mutex protecting fuse_conn_list and the control filesystem */
47extern struct mutex fuse_mutex;
Miklos Szeredi413ef8c2005-09-09 13:10:35 -070048
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070049/** FUSE inode */
50struct fuse_inode {
51 /** Inode data */
52 struct inode inode;
53
54 /** Unique ID, which identifies the inode between userspace
55 * and kernel */
56 u64 nodeid;
57
Miklos Szeredi9e6268d2005-09-09 13:10:29 -070058 /** Number of lookups on this inode */
59 u64 nlookup;
60
Miklos Szeredie5e55582005-09-09 13:10:28 -070061 /** The request used for sending the FORGET message */
62 struct fuse_req *forget_req;
63
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070064 /** Time in jiffies until the file attributes are valid */
Miklos Szeredi0a0898c2006-07-30 03:04:10 -070065 u64 i_time;
Miklos Szerediebc14c42007-10-16 23:31:03 -070066
67 /** The sticky bit in inode->i_mode may have been removed, so
68 preserve the original mode */
69 mode_t orig_i_mode;
Miklos Szeredi1fb69e72007-10-18 03:06:58 -070070
71 /** Version of last attribute change */
72 u64 attr_version;
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070073};
74
Miklos Szeredib6aeade2005-09-09 13:10:30 -070075/** FUSE specific file data */
76struct fuse_file {
77 /** Request reserved for flush and release */
Miklos Szeredi33649c92006-06-25 05:48:52 -070078 struct fuse_req *reserved_req;
Miklos Szeredib6aeade2005-09-09 13:10:30 -070079
80 /** File handle used by userspace */
81 u64 fh;
Miklos Szeredic756e0a2007-10-16 23:31:00 -070082
83 /** Refcount */
84 atomic_t count;
Miklos Szeredib6aeade2005-09-09 13:10:30 -070085};
86
Miklos Szeredi334f4852005-09-09 13:10:27 -070087/** One input argument of a request */
88struct fuse_in_arg {
89 unsigned size;
90 const void *value;
91};
92
93/** The request input */
94struct fuse_in {
95 /** The request header */
96 struct fuse_in_header h;
97
98 /** True if the data for the last argument is in req->pages */
99 unsigned argpages:1;
100
101 /** Number of arguments */
102 unsigned numargs;
103
104 /** Array of arguments */
105 struct fuse_in_arg args[3];
106};
107
108/** One output argument of a request */
109struct fuse_arg {
110 unsigned size;
111 void *value;
112};
113
114/** The request output */
115struct fuse_out {
116 /** Header returned from userspace */
117 struct fuse_out_header h;
118
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800119 /*
120 * The following bitfields are not changed during the request
121 * processing
122 */
123
Miklos Szeredi334f4852005-09-09 13:10:27 -0700124 /** Last argument is variable length (can be shorter than
125 arg->size) */
126 unsigned argvar:1;
127
128 /** Last argument is a list of pages to copy data to */
129 unsigned argpages:1;
130
131 /** Zero partially or not copied pages */
132 unsigned page_zeroing:1;
133
134 /** Number or arguments */
135 unsigned numargs;
136
137 /** Array of arguments */
138 struct fuse_arg args[3];
139};
140
Miklos Szeredi83cfd492006-01-16 22:14:31 -0800141/** The request state */
142enum fuse_req_state {
143 FUSE_REQ_INIT = 0,
144 FUSE_REQ_PENDING,
145 FUSE_REQ_READING,
146 FUSE_REQ_SENT,
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700147 FUSE_REQ_WRITING,
Miklos Szeredi83cfd492006-01-16 22:14:31 -0800148 FUSE_REQ_FINISHED
149};
150
Miklos Szeredi64c6d8e2006-01-16 22:14:42 -0800151struct fuse_conn;
152
Miklos Szeredi334f4852005-09-09 13:10:27 -0700153/**
154 * A request to the client
155 */
156struct fuse_req {
Miklos Szeredice1d5a42006-04-10 22:54:58 -0700157 /** This can be on either pending processing or io lists in
158 fuse_conn */
Miklos Szeredi334f4852005-09-09 13:10:27 -0700159 struct list_head list;
160
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700161 /** Entry on the interrupts list */
162 struct list_head intr_entry;
163
Miklos Szeredi334f4852005-09-09 13:10:27 -0700164 /** refcount */
165 atomic_t count;
166
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700167 /** Unique ID for the interrupt request */
168 u64 intr_unique;
169
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800170 /*
171 * The following bitfields are either set once before the
172 * request is queued or setting/clearing them is protected by
Miklos Szeredid7133112006-04-10 22:54:55 -0700173 * fuse_conn->lock
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800174 */
175
Miklos Szeredi334f4852005-09-09 13:10:27 -0700176 /** True if the request has reply */
177 unsigned isreply:1;
178
Miklos Szeredi51eb01e2006-06-25 05:48:50 -0700179 /** Force sending of the request even if interrupted */
180 unsigned force:1;
181
Miklos Szeredif9a28422006-06-25 05:48:53 -0700182 /** The request was aborted */
183 unsigned aborted:1;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700184
185 /** Request is sent in the background */
186 unsigned background:1;
187
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700188 /** The request has been interrupted */
189 unsigned interrupted:1;
190
Miklos Szeredi334f4852005-09-09 13:10:27 -0700191 /** Data is being copied to/from the request */
192 unsigned locked:1;
193
Miklos Szeredi9bc5ddd2006-04-11 21:16:09 +0200194 /** Request is counted as "waiting" */
195 unsigned waiting:1;
196
Miklos Szeredi83cfd492006-01-16 22:14:31 -0800197 /** State of the request */
198 enum fuse_req_state state;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700199
200 /** The request input */
201 struct fuse_in in;
202
203 /** The request output */
204 struct fuse_out out;
205
206 /** Used to wake up the task waiting for completion of request*/
207 wait_queue_head_t waitq;
208
209 /** Data for asynchronous requests */
210 union {
Miklos Szeredie5e55582005-09-09 13:10:28 -0700211 struct fuse_forget_in forget_in;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700212 struct fuse_release_in release_in;
Miklos Szeredi3ec870d2006-01-06 00:19:41 -0800213 struct fuse_init_in init_in;
214 struct fuse_init_out init_out;
Miklos Szeredi361b1eb52006-01-16 22:14:45 -0800215 struct fuse_read_in read_in;
Miklos Szeredi71421252006-06-25 05:48:52 -0700216 struct fuse_lk_in lk_in;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700217 } misc;
218
219 /** page vector */
220 struct page *pages[FUSE_MAX_PAGES_PER_REQ];
221
222 /** number of pages in vector */
223 unsigned num_pages;
224
225 /** offset of data on first page */
226 unsigned page_offset;
227
Miklos Szeredi334f4852005-09-09 13:10:27 -0700228 /** File used in the request (or NULL) */
Miklos Szeredic756e0a2007-10-16 23:31:00 -0700229 struct fuse_file *ff;
Miklos Szeredi64c6d8e2006-01-16 22:14:42 -0800230
Miklos Szeredi51eb01e2006-06-25 05:48:50 -0700231 /** vfsmount used in release */
232 struct vfsmount *vfsmount;
233
234 /** dentry used in release */
235 struct dentry *dentry;
236
Miklos Szeredi64c6d8e2006-01-16 22:14:42 -0800237 /** Request completion callback */
238 void (*end)(struct fuse_conn *, struct fuse_req *);
Miklos Szeredi33649c92006-06-25 05:48:52 -0700239
240 /** Request is stolen from fuse_file->reserved_req */
241 struct file *stolen_file;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700242};
243
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700244/**
245 * A Fuse connection.
246 *
247 * This structure is created, when the filesystem is mounted, and is
248 * destroyed, when the client device is closed and the filesystem is
249 * unmounted.
250 */
251struct fuse_conn {
Miklos Szeredid7133112006-04-10 22:54:55 -0700252 /** Lock protecting accessess to members of this structure */
253 spinlock_t lock;
254
Miklos Szeredid2a85162006-10-17 00:10:11 -0700255 /** Mutex protecting against directory alias creation */
256 struct mutex inst_mutex;
257
Miklos Szeredibafa9652006-06-25 05:48:51 -0700258 /** Refcount */
259 atomic_t count;
260
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700261 /** The user id for this mount */
262 uid_t user_id;
263
Miklos Szeredi87729a52005-09-09 13:10:34 -0700264 /** The group id for this mount */
265 gid_t group_id;
266
Miklos Szeredi1e9a4ed2005-09-09 13:10:31 -0700267 /** The fuse mount flags for this mount */
268 unsigned flags;
269
Miklos Szeredidb50b962005-09-09 13:10:33 -0700270 /** Maximum read size */
271 unsigned max_read;
272
Miklos Szeredi413ef8c2005-09-09 13:10:35 -0700273 /** Maximum write size */
274 unsigned max_write;
275
Miklos Szeredi334f4852005-09-09 13:10:27 -0700276 /** Readers of the connection are waiting on this */
277 wait_queue_head_t waitq;
278
279 /** The list of pending requests */
280 struct list_head pending;
281
282 /** The list of requests being processed */
283 struct list_head processing;
284
Miklos Szeredid77a1d52006-01-16 22:14:31 -0800285 /** The list of requests under I/O */
286 struct list_head io;
287
Miklos Szeredi08a53cd2006-04-10 22:54:59 -0700288 /** Number of requests currently in the background */
289 unsigned num_background;
290
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700291 /** Pending interrupts */
292 struct list_head interrupts;
293
Miklos Szeredi08a53cd2006-04-10 22:54:59 -0700294 /** Flag indicating if connection is blocked. This will be
295 the case before the INIT reply is received, and if there
296 are too many outstading backgrounds requests */
297 int blocked;
298
299 /** waitq for blocked connection */
300 wait_queue_head_t blocked_waitq;
301
Miklos Szeredide5e3de2007-10-16 23:31:00 -0700302 /** waitq for reserved requests */
303 wait_queue_head_t reserved_req_waitq;
304
Miklos Szeredi334f4852005-09-09 13:10:27 -0700305 /** The next unique request id */
306 u64 reqctr;
307
Miklos Szeredi69a53bf2006-01-16 22:14:41 -0800308 /** Connection established, cleared on umount, connection
309 abort and device release */
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800310 unsigned connected;
Miklos Szeredi1e9a4ed2005-09-09 13:10:31 -0700311
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800312 /** Connection failed (version mismatch). Cannot race with
313 setting other bitfields since it is only set once in INIT
314 reply, before any other request, and never cleared */
Miklos Szeredi334f4852005-09-09 13:10:27 -0700315 unsigned conn_error : 1;
316
Miklos Szeredi0ec7ca42006-12-06 20:35:52 -0800317 /** Connection successful. Only set in INIT */
318 unsigned conn_init : 1;
319
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800320 /** Do readpages asynchronously? Only set in INIT */
321 unsigned async_read : 1;
322
Miklos Szeredi6ff958e2007-10-18 03:07:02 -0700323 /** Do not send separate SETATTR request before open(O_TRUNC) */
324 unsigned atomic_o_trunc : 1;
325
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800326 /*
327 * The following bitfields are only for optimization purposes
328 * and hence races in setting them will not cause malfunction
329 */
330
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700331 /** Is fsync not implemented by fs? */
332 unsigned no_fsync : 1;
333
Miklos Szeredi82547982005-09-09 13:10:38 -0700334 /** Is fsyncdir not implemented by fs? */
335 unsigned no_fsyncdir : 1;
336
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700337 /** Is flush not implemented by fs? */
338 unsigned no_flush : 1;
339
Miklos Szeredi92a87802005-09-09 13:10:31 -0700340 /** Is setxattr not implemented by fs? */
341 unsigned no_setxattr : 1;
342
343 /** Is getxattr not implemented by fs? */
344 unsigned no_getxattr : 1;
345
346 /** Is listxattr not implemented by fs? */
347 unsigned no_listxattr : 1;
348
349 /** Is removexattr not implemented by fs? */
350 unsigned no_removexattr : 1;
351
Miklos Szeredi71421252006-06-25 05:48:52 -0700352 /** Are file locking primitives not implemented by fs? */
353 unsigned no_lock : 1;
354
Miklos Szeredi31d40d72005-11-07 00:59:50 -0800355 /** Is access not implemented by fs? */
356 unsigned no_access : 1;
357
Miklos Szeredifd72faa2005-11-07 00:59:51 -0800358 /** Is create not implemented by fs? */
359 unsigned no_create : 1;
360
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700361 /** Is interrupt not implemented by fs? */
362 unsigned no_interrupt : 1;
363
Miklos Szeredib2d22722006-12-06 20:35:51 -0800364 /** Is bmap not implemented by fs? */
365 unsigned no_bmap : 1;
366
Miklos Szeredi0cd5b882006-01-16 22:14:38 -0800367 /** The number of requests waiting for completion */
368 atomic_t num_waiting;
369
Miklos Szeredi45714d62006-01-06 00:19:36 -0800370 /** Negotiated minor version */
371 unsigned minor;
372
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700373 /** Backing dev info */
374 struct backing_dev_info bdi;
Miklos Szeredif543f252006-01-16 22:14:35 -0800375
Miklos Szeredibafa9652006-06-25 05:48:51 -0700376 /** Entry on the fuse_conn_list */
377 struct list_head entry;
378
379 /** Unique ID */
380 u64 id;
381
382 /** Dentries in the control filesystem */
383 struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
384
385 /** number of dentries used in the above array */
386 int ctl_ndents;
Jeff Dike385a17b2006-04-10 22:54:52 -0700387
388 /** O_ASYNC requests */
389 struct fasync_struct *fasync;
Miklos Szeredi9c8ef562006-06-25 05:48:55 -0700390
391 /** Key for lock owner ID scrambling */
392 u32 scramble_key[4];
Miklos Szeredi0ec7ca42006-12-06 20:35:52 -0800393
394 /** Reserved request for the DESTROY message */
395 struct fuse_req *destroy_req;
Miklos Szeredi1fb69e72007-10-18 03:06:58 -0700396
397 /** Version counter for attribute changes */
398 u64 attr_version;
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700399};
400
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700401static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
402{
Miklos Szeredi6383bda2006-01-16 22:14:29 -0800403 return sb->s_fs_info;
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700404}
405
406static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
407{
408 return get_fuse_conn_super(inode->i_sb);
409}
410
411static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
412{
413 return container_of(inode, struct fuse_inode, inode);
414}
415
416static inline u64 get_node_id(struct inode *inode)
417{
418 return get_fuse_inode(inode)->nodeid;
419}
420
Miklos Szeredi334f4852005-09-09 13:10:27 -0700421/** Device operations */
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -0800422extern const struct file_operations fuse_dev_operations;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700423
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700424/**
Miklos Szeredie5e55582005-09-09 13:10:28 -0700425 * Get a filled in inode
426 */
427struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
Miklos Szeredi1fb69e72007-10-18 03:06:58 -0700428 int generation, struct fuse_attr *attr,
429 u64 attr_valid, u64 attr_version);
Miklos Szeredie5e55582005-09-09 13:10:28 -0700430
431/**
432 * Send FORGET command
433 */
434void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700435 unsigned long nodeid, u64 nlookup);
Miklos Szeredie5e55582005-09-09 13:10:28 -0700436
437/**
Miklos Szeredi361b1eb52006-01-16 22:14:45 -0800438 * Initialize READ or READDIR request
Miklos Szeredi04730fe2005-09-09 13:10:36 -0700439 */
Miklos Szeredic756e0a2007-10-16 23:31:00 -0700440void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
Miklos Szeredi361b1eb52006-01-16 22:14:45 -0800441 struct inode *inode, loff_t pos, size_t count, int opcode);
Miklos Szeredi04730fe2005-09-09 13:10:36 -0700442
443/**
444 * Send OPEN or OPENDIR request
445 */
446int fuse_open_common(struct inode *inode, struct file *file, int isdir);
447
Miklos Szeredifd72faa2005-11-07 00:59:51 -0800448struct fuse_file *fuse_file_alloc(void);
449void fuse_file_free(struct fuse_file *ff);
450void fuse_finish_open(struct inode *inode, struct file *file,
451 struct fuse_file *ff, struct fuse_open_out *outarg);
452
Miklos Szeredic756e0a2007-10-16 23:31:00 -0700453/** Fill in ff->reserved_req with a RELEASE request */
454void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode);
455
Miklos Szeredi04730fe2005-09-09 13:10:36 -0700456/**
457 * Send RELEASE or RELEASEDIR request
458 */
459int fuse_release_common(struct inode *inode, struct file *file, int isdir);
460
461/**
Miklos Szeredi82547982005-09-09 13:10:38 -0700462 * Send FSYNC or FSYNCDIR request
463 */
464int fuse_fsync_common(struct file *file, struct dentry *de, int datasync,
465 int isdir);
466
467/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800468 * Initialize file operations on a regular file
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700469 */
470void fuse_init_file_inode(struct inode *inode);
471
472/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800473 * Initialize inode operations on regular files and special files
Miklos Szeredie5e55582005-09-09 13:10:28 -0700474 */
475void fuse_init_common(struct inode *inode);
476
477/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800478 * Initialize inode and file operations on a directory
Miklos Szeredie5e55582005-09-09 13:10:28 -0700479 */
480void fuse_init_dir(struct inode *inode);
481
482/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800483 * Initialize inode operations on a symlink
Miklos Szeredie5e55582005-09-09 13:10:28 -0700484 */
485void fuse_init_symlink(struct inode *inode);
486
487/**
488 * Change attributes of an inode
489 */
Miklos Szeredi1fb69e72007-10-18 03:06:58 -0700490void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
491 u64 attr_valid, u64 attr_version);
Miklos Szeredie5e55582005-09-09 13:10:28 -0700492
493/**
Miklos Szeredi334f4852005-09-09 13:10:27 -0700494 * Initialize the client device
495 */
496int fuse_dev_init(void);
497
498/**
499 * Cleanup the client device
500 */
501void fuse_dev_cleanup(void);
502
Miklos Szeredibafa9652006-06-25 05:48:51 -0700503int fuse_ctl_init(void);
504void fuse_ctl_cleanup(void);
505
Miklos Szeredi334f4852005-09-09 13:10:27 -0700506/**
507 * Allocate a request
508 */
509struct fuse_req *fuse_request_alloc(void);
510
511/**
512 * Free a request
513 */
514void fuse_request_free(struct fuse_req *req);
515
516/**
Miklos Szeredi33649c92006-06-25 05:48:52 -0700517 * Get a request, may fail with -ENOMEM
Miklos Szeredi334f4852005-09-09 13:10:27 -0700518 */
Miklos Szeredice1d5a42006-04-10 22:54:58 -0700519struct fuse_req *fuse_get_req(struct fuse_conn *fc);
Miklos Szeredi334f4852005-09-09 13:10:27 -0700520
521/**
Miklos Szeredi33649c92006-06-25 05:48:52 -0700522 * Gets a requests for a file operation, always succeeds
523 */
524struct fuse_req *fuse_get_req_nofail(struct fuse_conn *fc, struct file *file);
525
526/**
Miklos Szeredice1d5a42006-04-10 22:54:58 -0700527 * Decrement reference count of a request. If count goes to zero free
528 * the request.
Miklos Szeredi334f4852005-09-09 13:10:27 -0700529 */
530void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
531
532/**
Miklos Szeredi7c352bd2005-09-09 13:10:39 -0700533 * Send a request (synchronous)
Miklos Szeredi334f4852005-09-09 13:10:27 -0700534 */
535void request_send(struct fuse_conn *fc, struct fuse_req *req);
536
537/**
Miklos Szeredi334f4852005-09-09 13:10:27 -0700538 * Send a request with no reply
539 */
540void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req);
541
542/**
543 * Send a request in the background
544 */
545void request_send_background(struct fuse_conn *fc, struct fuse_req *req);
546
Miklos Szeredi5a5fb1e2006-04-26 10:48:55 +0200547/* Abort all requests */
Miklos Szeredi69a53bf2006-01-16 22:14:41 -0800548void fuse_abort_conn(struct fuse_conn *fc);
549
Miklos Szeredi1e9a4ed2005-09-09 13:10:31 -0700550/**
Miklos Szeredie5e55582005-09-09 13:10:28 -0700551 * Invalidate inode attributes
552 */
553void fuse_invalidate_attr(struct inode *inode);
Miklos Szeredibafa9652006-06-25 05:48:51 -0700554
555/**
556 * Acquire reference to fuse_conn
557 */
558struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
559
560/**
561 * Release reference to fuse_conn
562 */
563void fuse_conn_put(struct fuse_conn *fc);
564
565/**
566 * Add connection to control filesystem
567 */
568int fuse_ctl_add_conn(struct fuse_conn *fc);
569
570/**
571 * Remove connection from control filesystem
572 */
573void fuse_ctl_remove_conn(struct fuse_conn *fc);
Timo Savolaa5bfffac2007-04-08 16:04:00 -0700574
575/**
576 * Is file type valid?
577 */
578int fuse_valid_type(int m);
Miklos Szeredie57ac682007-10-18 03:06:58 -0700579
580/**
581 * Is task allowed to perform filesystem operation?
582 */
583int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);