blob: 5657cca0d0cb959a9ac8ff1a728b5f541682239f [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 Szeredi93a8c3c2007-10-18 03:07:03 -070073
74 /** Files usable in writepage. Protected by fc->lock */
75 struct list_head write_files;
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070076};
77
Miklos Szeredib6aeade2005-09-09 13:10:30 -070078/** FUSE specific file data */
79struct fuse_file {
80 /** Request reserved for flush and release */
Miklos Szeredi33649c92006-06-25 05:48:52 -070081 struct fuse_req *reserved_req;
Miklos Szeredib6aeade2005-09-09 13:10:30 -070082
83 /** File handle used by userspace */
84 u64 fh;
Miklos Szeredic756e0a2007-10-16 23:31:00 -070085
86 /** Refcount */
87 atomic_t count;
Miklos Szeredi93a8c3c2007-10-18 03:07:03 -070088
89 /** Entry on inode's write_files list */
90 struct list_head write_entry;
Miklos Szeredib6aeade2005-09-09 13:10:30 -070091};
92
Miklos Szeredi334f4852005-09-09 13:10:27 -070093/** One input argument of a request */
94struct fuse_in_arg {
95 unsigned size;
96 const void *value;
97};
98
99/** The request input */
100struct fuse_in {
101 /** The request header */
102 struct fuse_in_header h;
103
104 /** True if the data for the last argument is in req->pages */
105 unsigned argpages:1;
106
107 /** Number of arguments */
108 unsigned numargs;
109
110 /** Array of arguments */
111 struct fuse_in_arg args[3];
112};
113
114/** One output argument of a request */
115struct fuse_arg {
116 unsigned size;
117 void *value;
118};
119
120/** The request output */
121struct fuse_out {
122 /** Header returned from userspace */
123 struct fuse_out_header h;
124
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800125 /*
126 * The following bitfields are not changed during the request
127 * processing
128 */
129
Miklos Szeredi334f4852005-09-09 13:10:27 -0700130 /** Last argument is variable length (can be shorter than
131 arg->size) */
132 unsigned argvar:1;
133
134 /** Last argument is a list of pages to copy data to */
135 unsigned argpages:1;
136
137 /** Zero partially or not copied pages */
138 unsigned page_zeroing:1;
139
140 /** Number or arguments */
141 unsigned numargs;
142
143 /** Array of arguments */
144 struct fuse_arg args[3];
145};
146
Miklos Szeredi83cfd492006-01-16 22:14:31 -0800147/** The request state */
148enum fuse_req_state {
149 FUSE_REQ_INIT = 0,
150 FUSE_REQ_PENDING,
151 FUSE_REQ_READING,
152 FUSE_REQ_SENT,
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700153 FUSE_REQ_WRITING,
Miklos Szeredi83cfd492006-01-16 22:14:31 -0800154 FUSE_REQ_FINISHED
155};
156
Miklos Szeredi64c6d8e2006-01-16 22:14:42 -0800157struct fuse_conn;
158
Miklos Szeredi334f4852005-09-09 13:10:27 -0700159/**
160 * A request to the client
161 */
162struct fuse_req {
Miklos Szeredice1d5a42006-04-10 22:54:58 -0700163 /** This can be on either pending processing or io lists in
164 fuse_conn */
Miklos Szeredi334f4852005-09-09 13:10:27 -0700165 struct list_head list;
166
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700167 /** Entry on the interrupts list */
168 struct list_head intr_entry;
169
Miklos Szeredi334f4852005-09-09 13:10:27 -0700170 /** refcount */
171 atomic_t count;
172
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700173 /** Unique ID for the interrupt request */
174 u64 intr_unique;
175
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800176 /*
177 * The following bitfields are either set once before the
178 * request is queued or setting/clearing them is protected by
Miklos Szeredid7133112006-04-10 22:54:55 -0700179 * fuse_conn->lock
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800180 */
181
Miklos Szeredi334f4852005-09-09 13:10:27 -0700182 /** True if the request has reply */
183 unsigned isreply:1;
184
Miklos Szeredi51eb01e2006-06-25 05:48:50 -0700185 /** Force sending of the request even if interrupted */
186 unsigned force:1;
187
Miklos Szeredif9a28422006-06-25 05:48:53 -0700188 /** The request was aborted */
189 unsigned aborted:1;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700190
191 /** Request is sent in the background */
192 unsigned background:1;
193
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700194 /** The request has been interrupted */
195 unsigned interrupted:1;
196
Miklos Szeredi334f4852005-09-09 13:10:27 -0700197 /** Data is being copied to/from the request */
198 unsigned locked:1;
199
Miklos Szeredi9bc5ddd2006-04-11 21:16:09 +0200200 /** Request is counted as "waiting" */
201 unsigned waiting:1;
202
Miklos Szeredi83cfd492006-01-16 22:14:31 -0800203 /** State of the request */
204 enum fuse_req_state state;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700205
206 /** The request input */
207 struct fuse_in in;
208
209 /** The request output */
210 struct fuse_out out;
211
212 /** Used to wake up the task waiting for completion of request*/
213 wait_queue_head_t waitq;
214
215 /** Data for asynchronous requests */
216 union {
Miklos Szeredie5e55582005-09-09 13:10:28 -0700217 struct fuse_forget_in forget_in;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700218 struct fuse_release_in release_in;
Miklos Szeredi3ec870d2006-01-06 00:19:41 -0800219 struct fuse_init_in init_in;
220 struct fuse_init_out init_out;
Miklos Szeredi361b1eb2006-01-16 22:14:45 -0800221 struct fuse_read_in read_in;
Miklos Szeredi71421252006-06-25 05:48:52 -0700222 struct fuse_lk_in lk_in;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700223 } misc;
224
225 /** page vector */
226 struct page *pages[FUSE_MAX_PAGES_PER_REQ];
227
228 /** number of pages in vector */
229 unsigned num_pages;
230
231 /** offset of data on first page */
232 unsigned page_offset;
233
Miklos Szeredi334f4852005-09-09 13:10:27 -0700234 /** File used in the request (or NULL) */
Miklos Szeredic756e0a2007-10-16 23:31:00 -0700235 struct fuse_file *ff;
Miklos Szeredi64c6d8e2006-01-16 22:14:42 -0800236
Miklos Szeredi51eb01e2006-06-25 05:48:50 -0700237 /** vfsmount used in release */
238 struct vfsmount *vfsmount;
239
240 /** dentry used in release */
241 struct dentry *dentry;
242
Miklos Szeredi64c6d8e2006-01-16 22:14:42 -0800243 /** Request completion callback */
244 void (*end)(struct fuse_conn *, struct fuse_req *);
Miklos Szeredi33649c92006-06-25 05:48:52 -0700245
246 /** Request is stolen from fuse_file->reserved_req */
247 struct file *stolen_file;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700248};
249
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700250/**
251 * A Fuse connection.
252 *
253 * This structure is created, when the filesystem is mounted, and is
254 * destroyed, when the client device is closed and the filesystem is
255 * unmounted.
256 */
257struct fuse_conn {
Miklos Szeredid7133112006-04-10 22:54:55 -0700258 /** Lock protecting accessess to members of this structure */
259 spinlock_t lock;
260
Miklos Szeredid2a85162006-10-17 00:10:11 -0700261 /** Mutex protecting against directory alias creation */
262 struct mutex inst_mutex;
263
Miklos Szeredibafa9652006-06-25 05:48:51 -0700264 /** Refcount */
265 atomic_t count;
266
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700267 /** The user id for this mount */
268 uid_t user_id;
269
Miklos Szeredi87729a52005-09-09 13:10:34 -0700270 /** The group id for this mount */
271 gid_t group_id;
272
Miklos Szeredi1e9a4ed2005-09-09 13:10:31 -0700273 /** The fuse mount flags for this mount */
274 unsigned flags;
275
Miklos Szeredidb50b962005-09-09 13:10:33 -0700276 /** Maximum read size */
277 unsigned max_read;
278
Miklos Szeredi413ef8c2005-09-09 13:10:35 -0700279 /** Maximum write size */
280 unsigned max_write;
281
Miklos Szeredi334f4852005-09-09 13:10:27 -0700282 /** Readers of the connection are waiting on this */
283 wait_queue_head_t waitq;
284
285 /** The list of pending requests */
286 struct list_head pending;
287
288 /** The list of requests being processed */
289 struct list_head processing;
290
Miklos Szeredid77a1d52006-01-16 22:14:31 -0800291 /** The list of requests under I/O */
292 struct list_head io;
293
Miklos Szeredi08a53cd2006-04-10 22:54:59 -0700294 /** Number of requests currently in the background */
295 unsigned num_background;
296
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700297 /** Pending interrupts */
298 struct list_head interrupts;
299
Miklos Szeredi08a53cd2006-04-10 22:54:59 -0700300 /** Flag indicating if connection is blocked. This will be
301 the case before the INIT reply is received, and if there
302 are too many outstading backgrounds requests */
303 int blocked;
304
305 /** waitq for blocked connection */
306 wait_queue_head_t blocked_waitq;
307
Miklos Szeredide5e3de2007-10-16 23:31:00 -0700308 /** waitq for reserved requests */
309 wait_queue_head_t reserved_req_waitq;
310
Miklos Szeredi334f4852005-09-09 13:10:27 -0700311 /** The next unique request id */
312 u64 reqctr;
313
Miklos Szeredi69a53bf2006-01-16 22:14:41 -0800314 /** Connection established, cleared on umount, connection
315 abort and device release */
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800316 unsigned connected;
Miklos Szeredi1e9a4ed2005-09-09 13:10:31 -0700317
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800318 /** Connection failed (version mismatch). Cannot race with
319 setting other bitfields since it is only set once in INIT
320 reply, before any other request, and never cleared */
Miklos Szeredi334f4852005-09-09 13:10:27 -0700321 unsigned conn_error : 1;
322
Miklos Szeredi0ec7ca42006-12-06 20:35:52 -0800323 /** Connection successful. Only set in INIT */
324 unsigned conn_init : 1;
325
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800326 /** Do readpages asynchronously? Only set in INIT */
327 unsigned async_read : 1;
328
Miklos Szeredi6ff958e2007-10-18 03:07:02 -0700329 /** Do not send separate SETATTR request before open(O_TRUNC) */
330 unsigned atomic_o_trunc : 1;
331
Miklos Szeredi095da6c2006-01-16 22:14:52 -0800332 /*
333 * The following bitfields are only for optimization purposes
334 * and hence races in setting them will not cause malfunction
335 */
336
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700337 /** Is fsync not implemented by fs? */
338 unsigned no_fsync : 1;
339
Miklos Szeredi82547982005-09-09 13:10:38 -0700340 /** Is fsyncdir not implemented by fs? */
341 unsigned no_fsyncdir : 1;
342
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700343 /** Is flush not implemented by fs? */
344 unsigned no_flush : 1;
345
Miklos Szeredi92a87802005-09-09 13:10:31 -0700346 /** Is setxattr not implemented by fs? */
347 unsigned no_setxattr : 1;
348
349 /** Is getxattr not implemented by fs? */
350 unsigned no_getxattr : 1;
351
352 /** Is listxattr not implemented by fs? */
353 unsigned no_listxattr : 1;
354
355 /** Is removexattr not implemented by fs? */
356 unsigned no_removexattr : 1;
357
Miklos Szeredi71421252006-06-25 05:48:52 -0700358 /** Are file locking primitives not implemented by fs? */
359 unsigned no_lock : 1;
360
Miklos Szeredi31d40d72005-11-07 00:59:50 -0800361 /** Is access not implemented by fs? */
362 unsigned no_access : 1;
363
Miklos Szeredifd72faa2005-11-07 00:59:51 -0800364 /** Is create not implemented by fs? */
365 unsigned no_create : 1;
366
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700367 /** Is interrupt not implemented by fs? */
368 unsigned no_interrupt : 1;
369
Miklos Szeredib2d22722006-12-06 20:35:51 -0800370 /** Is bmap not implemented by fs? */
371 unsigned no_bmap : 1;
372
Miklos Szeredi0cd5b882006-01-16 22:14:38 -0800373 /** The number of requests waiting for completion */
374 atomic_t num_waiting;
375
Miklos Szeredi45714d62006-01-06 00:19:36 -0800376 /** Negotiated minor version */
377 unsigned minor;
378
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700379 /** Backing dev info */
380 struct backing_dev_info bdi;
Miklos Szeredif543f252006-01-16 22:14:35 -0800381
Miklos Szeredibafa9652006-06-25 05:48:51 -0700382 /** Entry on the fuse_conn_list */
383 struct list_head entry;
384
385 /** Unique ID */
386 u64 id;
387
388 /** Dentries in the control filesystem */
389 struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
390
391 /** number of dentries used in the above array */
392 int ctl_ndents;
Jeff Dike385a17b2006-04-10 22:54:52 -0700393
394 /** O_ASYNC requests */
395 struct fasync_struct *fasync;
Miklos Szeredi9c8ef562006-06-25 05:48:55 -0700396
397 /** Key for lock owner ID scrambling */
398 u32 scramble_key[4];
Miklos Szeredi0ec7ca42006-12-06 20:35:52 -0800399
400 /** Reserved request for the DESTROY message */
401 struct fuse_req *destroy_req;
Miklos Szeredi1fb69e72007-10-18 03:06:58 -0700402
403 /** Version counter for attribute changes */
404 u64 attr_version;
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700405};
406
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700407static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
408{
Miklos Szeredi6383bda2006-01-16 22:14:29 -0800409 return sb->s_fs_info;
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700410}
411
412static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
413{
414 return get_fuse_conn_super(inode->i_sb);
415}
416
417static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
418{
419 return container_of(inode, struct fuse_inode, inode);
420}
421
422static inline u64 get_node_id(struct inode *inode)
423{
424 return get_fuse_inode(inode)->nodeid;
425}
426
Miklos Szeredi334f4852005-09-09 13:10:27 -0700427/** Device operations */
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -0800428extern const struct file_operations fuse_dev_operations;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700429
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700430/**
Miklos Szeredie5e55582005-09-09 13:10:28 -0700431 * Get a filled in inode
432 */
433struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
Miklos Szeredi1fb69e72007-10-18 03:06:58 -0700434 int generation, struct fuse_attr *attr,
435 u64 attr_valid, u64 attr_version);
Miklos Szeredie5e55582005-09-09 13:10:28 -0700436
437/**
438 * Send FORGET command
439 */
440void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700441 unsigned long nodeid, u64 nlookup);
Miklos Szeredie5e55582005-09-09 13:10:28 -0700442
443/**
Miklos Szeredi361b1eb2006-01-16 22:14:45 -0800444 * Initialize READ or READDIR request
Miklos Szeredi04730fe2005-09-09 13:10:36 -0700445 */
Miklos Szeredic756e0a2007-10-16 23:31:00 -0700446void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
Miklos Szeredi361b1eb2006-01-16 22:14:45 -0800447 struct inode *inode, loff_t pos, size_t count, int opcode);
Miklos Szeredi04730fe2005-09-09 13:10:36 -0700448
449/**
450 * Send OPEN or OPENDIR request
451 */
452int fuse_open_common(struct inode *inode, struct file *file, int isdir);
453
Miklos Szeredifd72faa2005-11-07 00:59:51 -0800454struct fuse_file *fuse_file_alloc(void);
455void fuse_file_free(struct fuse_file *ff);
456void fuse_finish_open(struct inode *inode, struct file *file,
457 struct fuse_file *ff, struct fuse_open_out *outarg);
458
Miklos Szeredic756e0a2007-10-16 23:31:00 -0700459/** Fill in ff->reserved_req with a RELEASE request */
460void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode);
461
Miklos Szeredi04730fe2005-09-09 13:10:36 -0700462/**
463 * Send RELEASE or RELEASEDIR request
464 */
465int fuse_release_common(struct inode *inode, struct file *file, int isdir);
466
467/**
Miklos Szeredi82547982005-09-09 13:10:38 -0700468 * Send FSYNC or FSYNCDIR request
469 */
470int fuse_fsync_common(struct file *file, struct dentry *de, int datasync,
471 int isdir);
472
473/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800474 * Initialize file operations on a regular file
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700475 */
476void fuse_init_file_inode(struct inode *inode);
477
478/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800479 * Initialize inode operations on regular files and special files
Miklos Szeredie5e55582005-09-09 13:10:28 -0700480 */
481void fuse_init_common(struct inode *inode);
482
483/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800484 * Initialize inode and file operations on a directory
Miklos Szeredie5e55582005-09-09 13:10:28 -0700485 */
486void fuse_init_dir(struct inode *inode);
487
488/**
Miklos Szeredi17793812005-10-30 15:02:51 -0800489 * Initialize inode operations on a symlink
Miklos Szeredie5e55582005-09-09 13:10:28 -0700490 */
491void fuse_init_symlink(struct inode *inode);
492
493/**
494 * Change attributes of an inode
495 */
Miklos Szeredi1fb69e72007-10-18 03:06:58 -0700496void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
497 u64 attr_valid, u64 attr_version);
Miklos Szeredie5e55582005-09-09 13:10:28 -0700498
499/**
Miklos Szeredi334f4852005-09-09 13:10:27 -0700500 * Initialize the client device
501 */
502int fuse_dev_init(void);
503
504/**
505 * Cleanup the client device
506 */
507void fuse_dev_cleanup(void);
508
Miklos Szeredibafa9652006-06-25 05:48:51 -0700509int fuse_ctl_init(void);
510void fuse_ctl_cleanup(void);
511
Miklos Szeredi334f4852005-09-09 13:10:27 -0700512/**
513 * Allocate a request
514 */
515struct fuse_req *fuse_request_alloc(void);
516
517/**
518 * Free a request
519 */
520void fuse_request_free(struct fuse_req *req);
521
522/**
Miklos Szeredi33649c92006-06-25 05:48:52 -0700523 * Get a request, may fail with -ENOMEM
Miklos Szeredi334f4852005-09-09 13:10:27 -0700524 */
Miklos Szeredice1d5a42006-04-10 22:54:58 -0700525struct fuse_req *fuse_get_req(struct fuse_conn *fc);
Miklos Szeredi334f4852005-09-09 13:10:27 -0700526
527/**
Miklos Szeredi33649c92006-06-25 05:48:52 -0700528 * Gets a requests for a file operation, always succeeds
529 */
530struct fuse_req *fuse_get_req_nofail(struct fuse_conn *fc, struct file *file);
531
532/**
Miklos Szeredice1d5a42006-04-10 22:54:58 -0700533 * Decrement reference count of a request. If count goes to zero free
534 * the request.
Miklos Szeredi334f4852005-09-09 13:10:27 -0700535 */
536void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
537
538/**
Miklos Szeredi7c352bd2005-09-09 13:10:39 -0700539 * Send a request (synchronous)
Miklos Szeredi334f4852005-09-09 13:10:27 -0700540 */
541void request_send(struct fuse_conn *fc, struct fuse_req *req);
542
543/**
Miklos Szeredi334f4852005-09-09 13:10:27 -0700544 * Send a request with no reply
545 */
546void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req);
547
548/**
549 * Send a request in the background
550 */
551void request_send_background(struct fuse_conn *fc, struct fuse_req *req);
552
Miklos Szeredi5a5fb1e2006-04-26 10:48:55 +0200553/* Abort all requests */
Miklos Szeredi69a53bf2006-01-16 22:14:41 -0800554void fuse_abort_conn(struct fuse_conn *fc);
555
Miklos Szeredi1e9a4ed2005-09-09 13:10:31 -0700556/**
Miklos Szeredie5e55582005-09-09 13:10:28 -0700557 * Invalidate inode attributes
558 */
559void fuse_invalidate_attr(struct inode *inode);
Miklos Szeredibafa9652006-06-25 05:48:51 -0700560
561/**
562 * Acquire reference to fuse_conn
563 */
564struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
565
566/**
567 * Release reference to fuse_conn
568 */
569void fuse_conn_put(struct fuse_conn *fc);
570
571/**
572 * Add connection to control filesystem
573 */
574int fuse_ctl_add_conn(struct fuse_conn *fc);
575
576/**
577 * Remove connection from control filesystem
578 */
579void fuse_ctl_remove_conn(struct fuse_conn *fc);
Timo Savolaa5bfffa2007-04-08 16:04:00 -0700580
581/**
582 * Is file type valid?
583 */
584int fuse_valid_type(int m);
Miklos Szeredie57ac682007-10-18 03:06:58 -0700585
586/**
587 * Is task allowed to perform filesystem operation?
588 */
589int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);