Commit | Line | Data |
---|---|---|
d8a5ba45 MS |
1 | /* |
2 | FUSE: Filesystem in Userspace | |
d7133114 | 3 | Copyright (C) 2001-2006 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> |
d8a5ba45 | 22 | |
334f485d MS |
23 | /** Max number of pages that can be used in a single read request */ |
24 | #define FUSE_MAX_PAGES_PER_REQ 32 | |
25 | ||
08a53cdc | 26 | /** Maximum number of outstanding background requests */ |
f92b99b9 MS |
27 | #define FUSE_MAX_BACKGROUND 12 |
28 | ||
29 | /** Congestion starts at 75% of maximum */ | |
30 | #define FUSE_CONGESTION_THRESHOLD (FUSE_MAX_BACKGROUND * 75 / 100) | |
08a53cdc | 31 | |
3be5a52b MS |
32 | /** Bias for fi->writectr, meaning new writepages must not be sent */ |
33 | #define FUSE_NOWRITE INT_MIN | |
34 | ||
1d3d752b MS |
35 | /** It could be as large as PATH_MAX, but would that have any uses? */ |
36 | #define FUSE_NAME_MAX 1024 | |
37 | ||
bafa9654 MS |
38 | /** Number of dentries for each connection in the control filesystem */ |
39 | #define FUSE_CTL_NUM_DENTRIES 3 | |
40 | ||
1e9a4ed9 MS |
41 | /** If the FUSE_DEFAULT_PERMISSIONS flag is given, the filesystem |
42 | module will check permissions based on the file mode. Otherwise no | |
43 | permission checking is done in the kernel */ | |
44 | #define FUSE_DEFAULT_PERMISSIONS (1 << 0) | |
45 | ||
46 | /** If the FUSE_ALLOW_OTHER flag is given, then not only the user | |
47 | doing the mount will be allowed to access the filesystem */ | |
48 | #define FUSE_ALLOW_OTHER (1 << 1) | |
49 | ||
bafa9654 MS |
50 | /** List of active connections */ |
51 | extern struct list_head fuse_conn_list; | |
52 | ||
53 | /** Global mutex protecting fuse_conn_list and the control filesystem */ | |
54 | extern struct mutex fuse_mutex; | |
413ef8cb | 55 | |
d8a5ba45 MS |
56 | /** FUSE inode */ |
57 | struct fuse_inode { | |
58 | /** Inode data */ | |
59 | struct inode inode; | |
60 | ||
61 | /** Unique ID, which identifies the inode between userspace | |
62 | * and kernel */ | |
63 | u64 nodeid; | |
64 | ||
9e6268db MS |
65 | /** Number of lookups on this inode */ |
66 | u64 nlookup; | |
67 | ||
e5e5558e MS |
68 | /** The request used for sending the FORGET message */ |
69 | struct fuse_req *forget_req; | |
70 | ||
d8a5ba45 | 71 | /** Time in jiffies until the file attributes are valid */ |
0a0898cf | 72 | u64 i_time; |
ebc14c4d MS |
73 | |
74 | /** The sticky bit in inode->i_mode may have been removed, so | |
75 | preserve the original mode */ | |
76 | mode_t orig_i_mode; | |
1fb69e78 MS |
77 | |
78 | /** Version of last attribute change */ | |
79 | u64 attr_version; | |
93a8c3cd MS |
80 | |
81 | /** Files usable in writepage. Protected by fc->lock */ | |
82 | struct list_head write_files; | |
3be5a52b MS |
83 | |
84 | /** Writepages pending on truncate or fsync */ | |
85 | struct list_head queued_writes; | |
86 | ||
87 | /** Number of sent writes, a negative bias (FUSE_NOWRITE) | |
88 | * means more writes are blocked */ | |
89 | int writectr; | |
90 | ||
91 | /** Waitq for writepage completion */ | |
92 | wait_queue_head_t page_waitq; | |
93 | ||
94 | /** List of writepage requestst (pending or sent) */ | |
95 | struct list_head writepages; | |
d8a5ba45 MS |
96 | }; |
97 | ||
b6aeaded MS |
98 | /** FUSE specific file data */ |
99 | struct fuse_file { | |
100 | /** Request reserved for flush and release */ | |
33649c91 | 101 | struct fuse_req *reserved_req; |
b6aeaded MS |
102 | |
103 | /** File handle used by userspace */ | |
104 | u64 fh; | |
c756e0a4 MS |
105 | |
106 | /** Refcount */ | |
107 | atomic_t count; | |
93a8c3cd MS |
108 | |
109 | /** Entry on inode's write_files list */ | |
110 | struct list_head write_entry; | |
b6aeaded MS |
111 | }; |
112 | ||
334f485d MS |
113 | /** One input argument of a request */ |
114 | struct fuse_in_arg { | |
115 | unsigned size; | |
116 | const void *value; | |
117 | }; | |
118 | ||
119 | /** The request input */ | |
120 | struct fuse_in { | |
121 | /** The request header */ | |
122 | struct fuse_in_header h; | |
123 | ||
124 | /** True if the data for the last argument is in req->pages */ | |
125 | unsigned argpages:1; | |
126 | ||
127 | /** Number of arguments */ | |
128 | unsigned numargs; | |
129 | ||
130 | /** Array of arguments */ | |
131 | struct fuse_in_arg args[3]; | |
132 | }; | |
133 | ||
134 | /** One output argument of a request */ | |
135 | struct fuse_arg { | |
136 | unsigned size; | |
137 | void *value; | |
138 | }; | |
139 | ||
140 | /** The request output */ | |
141 | struct fuse_out { | |
142 | /** Header returned from userspace */ | |
143 | struct fuse_out_header h; | |
144 | ||
095da6cb MS |
145 | /* |
146 | * The following bitfields are not changed during the request | |
147 | * processing | |
148 | */ | |
149 | ||
334f485d MS |
150 | /** Last argument is variable length (can be shorter than |
151 | arg->size) */ | |
152 | unsigned argvar:1; | |
153 | ||
154 | /** Last argument is a list of pages to copy data to */ | |
155 | unsigned argpages:1; | |
156 | ||
157 | /** Zero partially or not copied pages */ | |
158 | unsigned page_zeroing:1; | |
159 | ||
160 | /** Number or arguments */ | |
161 | unsigned numargs; | |
162 | ||
163 | /** Array of arguments */ | |
164 | struct fuse_arg args[3]; | |
165 | }; | |
166 | ||
83cfd493 MS |
167 | /** The request state */ |
168 | enum fuse_req_state { | |
169 | FUSE_REQ_INIT = 0, | |
170 | FUSE_REQ_PENDING, | |
171 | FUSE_REQ_READING, | |
172 | FUSE_REQ_SENT, | |
a4d27e75 | 173 | FUSE_REQ_WRITING, |
83cfd493 MS |
174 | FUSE_REQ_FINISHED |
175 | }; | |
176 | ||
64c6d8ed MS |
177 | struct fuse_conn; |
178 | ||
334f485d MS |
179 | /** |
180 | * A request to the client | |
181 | */ | |
182 | struct fuse_req { | |
ce1d5a49 MS |
183 | /** This can be on either pending processing or io lists in |
184 | fuse_conn */ | |
334f485d MS |
185 | struct list_head list; |
186 | ||
a4d27e75 MS |
187 | /** Entry on the interrupts list */ |
188 | struct list_head intr_entry; | |
189 | ||
334f485d MS |
190 | /** refcount */ |
191 | atomic_t count; | |
192 | ||
a4d27e75 MS |
193 | /** Unique ID for the interrupt request */ |
194 | u64 intr_unique; | |
195 | ||
095da6cb MS |
196 | /* |
197 | * The following bitfields are either set once before the | |
198 | * request is queued or setting/clearing them is protected by | |
d7133114 | 199 | * fuse_conn->lock |
095da6cb MS |
200 | */ |
201 | ||
334f485d MS |
202 | /** True if the request has reply */ |
203 | unsigned isreply:1; | |
204 | ||
51eb01e7 MS |
205 | /** Force sending of the request even if interrupted */ |
206 | unsigned force:1; | |
207 | ||
f9a2842e MS |
208 | /** The request was aborted */ |
209 | unsigned aborted:1; | |
334f485d MS |
210 | |
211 | /** Request is sent in the background */ | |
212 | unsigned background:1; | |
213 | ||
a4d27e75 MS |
214 | /** The request has been interrupted */ |
215 | unsigned interrupted:1; | |
216 | ||
334f485d MS |
217 | /** Data is being copied to/from the request */ |
218 | unsigned locked:1; | |
219 | ||
9bc5ddda MS |
220 | /** Request is counted as "waiting" */ |
221 | unsigned waiting:1; | |
222 | ||
83cfd493 MS |
223 | /** State of the request */ |
224 | enum fuse_req_state state; | |
334f485d MS |
225 | |
226 | /** The request input */ | |
227 | struct fuse_in in; | |
228 | ||
229 | /** The request output */ | |
230 | struct fuse_out out; | |
231 | ||
232 | /** Used to wake up the task waiting for completion of request*/ | |
233 | wait_queue_head_t waitq; | |
234 | ||
235 | /** Data for asynchronous requests */ | |
236 | union { | |
e5e5558e | 237 | struct fuse_forget_in forget_in; |
b57d4264 MS |
238 | struct { |
239 | struct fuse_release_in in; | |
240 | struct vfsmount *vfsmount; | |
241 | struct dentry *dentry; | |
242 | } release; | |
3ec870d5 MS |
243 | struct fuse_init_in init_in; |
244 | struct fuse_init_out init_out; | |
5c5c5e51 MS |
245 | struct { |
246 | struct fuse_read_in in; | |
247 | u64 attr_ver; | |
248 | } read; | |
b25e82e5 MS |
249 | struct { |
250 | struct fuse_write_in in; | |
251 | struct fuse_write_out out; | |
252 | } write; | |
71421259 | 253 | struct fuse_lk_in lk_in; |
334f485d MS |
254 | } misc; |
255 | ||
256 | /** page vector */ | |
257 | struct page *pages[FUSE_MAX_PAGES_PER_REQ]; | |
258 | ||
259 | /** number of pages in vector */ | |
260 | unsigned num_pages; | |
261 | ||
262 | /** offset of data on first page */ | |
263 | unsigned page_offset; | |
264 | ||
334f485d | 265 | /** File used in the request (or NULL) */ |
c756e0a4 | 266 | struct fuse_file *ff; |
64c6d8ed | 267 | |
3be5a52b MS |
268 | /** Inode used in the request or NULL */ |
269 | struct inode *inode; | |
270 | ||
271 | /** Link on fi->writepages */ | |
272 | struct list_head writepages_entry; | |
273 | ||
64c6d8ed MS |
274 | /** Request completion callback */ |
275 | void (*end)(struct fuse_conn *, struct fuse_req *); | |
33649c91 MS |
276 | |
277 | /** Request is stolen from fuse_file->reserved_req */ | |
278 | struct file *stolen_file; | |
334f485d MS |
279 | }; |
280 | ||
d8a5ba45 MS |
281 | /** |
282 | * A Fuse connection. | |
283 | * | |
284 | * This structure is created, when the filesystem is mounted, and is | |
285 | * destroyed, when the client device is closed and the filesystem is | |
286 | * unmounted. | |
287 | */ | |
288 | struct fuse_conn { | |
d7133114 MS |
289 | /** Lock protecting accessess to members of this structure */ |
290 | spinlock_t lock; | |
291 | ||
d2a85164 MS |
292 | /** Mutex protecting against directory alias creation */ |
293 | struct mutex inst_mutex; | |
294 | ||
bafa9654 MS |
295 | /** Refcount */ |
296 | atomic_t count; | |
297 | ||
d8a5ba45 MS |
298 | /** The user id for this mount */ |
299 | uid_t user_id; | |
300 | ||
87729a55 MS |
301 | /** The group id for this mount */ |
302 | gid_t group_id; | |
303 | ||
1e9a4ed9 MS |
304 | /** The fuse mount flags for this mount */ |
305 | unsigned flags; | |
306 | ||
db50b96c MS |
307 | /** Maximum read size */ |
308 | unsigned max_read; | |
309 | ||
413ef8cb MS |
310 | /** Maximum write size */ |
311 | unsigned max_write; | |
312 | ||
334f485d MS |
313 | /** Readers of the connection are waiting on this */ |
314 | wait_queue_head_t waitq; | |
315 | ||
316 | /** The list of pending requests */ | |
317 | struct list_head pending; | |
318 | ||
319 | /** The list of requests being processed */ | |
320 | struct list_head processing; | |
321 | ||
d77a1d5b MS |
322 | /** The list of requests under I/O */ |
323 | struct list_head io; | |
324 | ||
08a53cdc MS |
325 | /** Number of requests currently in the background */ |
326 | unsigned num_background; | |
327 | ||
d12def1b MS |
328 | /** Number of background requests currently queued for userspace */ |
329 | unsigned active_background; | |
330 | ||
331 | /** The list of background requests set aside for later queuing */ | |
332 | struct list_head bg_queue; | |
333 | ||
a4d27e75 MS |
334 | /** Pending interrupts */ |
335 | struct list_head interrupts; | |
336 | ||
08a53cdc MS |
337 | /** Flag indicating if connection is blocked. This will be |
338 | the case before the INIT reply is received, and if there | |
339 | are too many outstading backgrounds requests */ | |
340 | int blocked; | |
341 | ||
342 | /** waitq for blocked connection */ | |
343 | wait_queue_head_t blocked_waitq; | |
de5e3dec MS |
344 | |
345 | /** waitq for reserved requests */ | |
346 | wait_queue_head_t reserved_req_waitq; | |
08a53cdc | 347 | |
334f485d MS |
348 | /** The next unique request id */ |
349 | u64 reqctr; | |
350 | ||
69a53bf2 MS |
351 | /** Connection established, cleared on umount, connection |
352 | abort and device release */ | |
095da6cb | 353 | unsigned connected; |
1e9a4ed9 | 354 | |
095da6cb MS |
355 | /** Connection failed (version mismatch). Cannot race with |
356 | setting other bitfields since it is only set once in INIT | |
357 | reply, before any other request, and never cleared */ | |
334f485d MS |
358 | unsigned conn_error : 1; |
359 | ||
0ec7ca41 MS |
360 | /** Connection successful. Only set in INIT */ |
361 | unsigned conn_init : 1; | |
362 | ||
9cd68455 MS |
363 | /** Do readpages asynchronously? Only set in INIT */ |
364 | unsigned async_read : 1; | |
365 | ||
6ff958ed MS |
366 | /** Do not send separate SETATTR request before open(O_TRUNC) */ |
367 | unsigned atomic_o_trunc : 1; | |
368 | ||
33670fa2 MS |
369 | /** Filesystem supports NFS exporting. Only set in INIT */ |
370 | unsigned export_support : 1; | |
371 | ||
095da6cb MS |
372 | /* |
373 | * The following bitfields are only for optimization purposes | |
374 | * and hence races in setting them will not cause malfunction | |
375 | */ | |
376 | ||
b6aeaded MS |
377 | /** Is fsync not implemented by fs? */ |
378 | unsigned no_fsync : 1; | |
379 | ||
82547981 MS |
380 | /** Is fsyncdir not implemented by fs? */ |
381 | unsigned no_fsyncdir : 1; | |
382 | ||
b6aeaded MS |
383 | /** Is flush not implemented by fs? */ |
384 | unsigned no_flush : 1; | |
385 | ||
92a8780e MS |
386 | /** Is setxattr not implemented by fs? */ |
387 | unsigned no_setxattr : 1; | |
388 | ||
389 | /** Is getxattr not implemented by fs? */ | |
390 | unsigned no_getxattr : 1; | |
391 | ||
392 | /** Is listxattr not implemented by fs? */ | |
393 | unsigned no_listxattr : 1; | |
394 | ||
395 | /** Is removexattr not implemented by fs? */ | |
396 | unsigned no_removexattr : 1; | |
397 | ||
71421259 MS |
398 | /** Are file locking primitives not implemented by fs? */ |
399 | unsigned no_lock : 1; | |
400 | ||
31d40d74 MS |
401 | /** Is access not implemented by fs? */ |
402 | unsigned no_access : 1; | |
403 | ||
fd72faac MS |
404 | /** Is create not implemented by fs? */ |
405 | unsigned no_create : 1; | |
406 | ||
a4d27e75 MS |
407 | /** Is interrupt not implemented by fs? */ |
408 | unsigned no_interrupt : 1; | |
409 | ||
b2d2272f MS |
410 | /** Is bmap not implemented by fs? */ |
411 | unsigned no_bmap : 1; | |
412 | ||
78bb6cb9 MS |
413 | /** Do multi-page cached writes */ |
414 | unsigned big_writes : 1; | |
415 | ||
0cd5b885 MS |
416 | /** The number of requests waiting for completion */ |
417 | atomic_t num_waiting; | |
418 | ||
45714d65 MS |
419 | /** Negotiated minor version */ |
420 | unsigned minor; | |
421 | ||
d8a5ba45 MS |
422 | /** Backing dev info */ |
423 | struct backing_dev_info bdi; | |
f543f253 | 424 | |
bafa9654 MS |
425 | /** Entry on the fuse_conn_list */ |
426 | struct list_head entry; | |
427 | ||
b6f2fcbc MS |
428 | /** Device ID from super block */ |
429 | dev_t dev; | |
bafa9654 MS |
430 | |
431 | /** Dentries in the control filesystem */ | |
432 | struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES]; | |
433 | ||
434 | /** number of dentries used in the above array */ | |
435 | int ctl_ndents; | |
385a17bf JD |
436 | |
437 | /** O_ASYNC requests */ | |
438 | struct fasync_struct *fasync; | |
9c8ef561 MS |
439 | |
440 | /** Key for lock owner ID scrambling */ | |
441 | u32 scramble_key[4]; | |
0ec7ca41 MS |
442 | |
443 | /** Reserved request for the DESTROY message */ | |
444 | struct fuse_req *destroy_req; | |
1fb69e78 MS |
445 | |
446 | /** Version counter for attribute changes */ | |
447 | u64 attr_version; | |
d8a5ba45 MS |
448 | }; |
449 | ||
d8a5ba45 MS |
450 | static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) |
451 | { | |
6383bdaa | 452 | return sb->s_fs_info; |
d8a5ba45 MS |
453 | } |
454 | ||
455 | static inline struct fuse_conn *get_fuse_conn(struct inode *inode) | |
456 | { | |
457 | return get_fuse_conn_super(inode->i_sb); | |
458 | } | |
459 | ||
460 | static inline struct fuse_inode *get_fuse_inode(struct inode *inode) | |
461 | { | |
462 | return container_of(inode, struct fuse_inode, inode); | |
463 | } | |
464 | ||
465 | static inline u64 get_node_id(struct inode *inode) | |
466 | { | |
467 | return get_fuse_inode(inode)->nodeid; | |
468 | } | |
469 | ||
334f485d | 470 | /** Device operations */ |
4b6f5d20 | 471 | extern const struct file_operations fuse_dev_operations; |
334f485d | 472 | |
dbd561d2 MS |
473 | extern struct dentry_operations fuse_dentry_operations; |
474 | ||
e5e5558e MS |
475 | /** |
476 | * Get a filled in inode | |
477 | */ | |
b48badf0 | 478 | struct inode *fuse_iget(struct super_block *sb, u64 nodeid, |
1fb69e78 MS |
479 | int generation, struct fuse_attr *attr, |
480 | u64 attr_valid, u64 attr_version); | |
e5e5558e | 481 | |
33670fa2 MS |
482 | int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name, |
483 | struct fuse_entry_out *outarg, struct inode **inode); | |
484 | ||
e5e5558e MS |
485 | /** |
486 | * Send FORGET command | |
487 | */ | |
488 | void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, | |
b48badf0 | 489 | u64 nodeid, u64 nlookup); |
e5e5558e | 490 | |
04730fef | 491 | /** |
361b1eb5 | 492 | * Initialize READ or READDIR request |
04730fef | 493 | */ |
a6643094 | 494 | void fuse_read_fill(struct fuse_req *req, struct file *file, |
361b1eb5 | 495 | struct inode *inode, loff_t pos, size_t count, int opcode); |
04730fef MS |
496 | |
497 | /** | |
498 | * Send OPEN or OPENDIR request | |
499 | */ | |
500 | int fuse_open_common(struct inode *inode, struct file *file, int isdir); | |
501 | ||
fd72faac MS |
502 | struct fuse_file *fuse_file_alloc(void); |
503 | void fuse_file_free(struct fuse_file *ff); | |
504 | void fuse_finish_open(struct inode *inode, struct file *file, | |
505 | struct fuse_file *ff, struct fuse_open_out *outarg); | |
506 | ||
c756e0a4 MS |
507 | /** Fill in ff->reserved_req with a RELEASE request */ |
508 | void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode); | |
509 | ||
04730fef MS |
510 | /** |
511 | * Send RELEASE or RELEASEDIR request | |
512 | */ | |
513 | int fuse_release_common(struct inode *inode, struct file *file, int isdir); | |
514 | ||
82547981 MS |
515 | /** |
516 | * Send FSYNC or FSYNCDIR request | |
517 | */ | |
518 | int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, | |
519 | int isdir); | |
520 | ||
b6aeaded | 521 | /** |
1779381d | 522 | * Initialize file operations on a regular file |
b6aeaded MS |
523 | */ |
524 | void fuse_init_file_inode(struct inode *inode); | |
525 | ||
e5e5558e | 526 | /** |
1779381d | 527 | * Initialize inode operations on regular files and special files |
e5e5558e MS |
528 | */ |
529 | void fuse_init_common(struct inode *inode); | |
530 | ||
531 | /** | |
1779381d | 532 | * Initialize inode and file operations on a directory |
e5e5558e MS |
533 | */ |
534 | void fuse_init_dir(struct inode *inode); | |
535 | ||
536 | /** | |
1779381d | 537 | * Initialize inode operations on a symlink |
e5e5558e MS |
538 | */ |
539 | void fuse_init_symlink(struct inode *inode); | |
540 | ||
541 | /** | |
542 | * Change attributes of an inode | |
543 | */ | |
1fb69e78 MS |
544 | void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, |
545 | u64 attr_valid, u64 attr_version); | |
e5e5558e | 546 | |
3be5a52b MS |
547 | void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, |
548 | u64 attr_valid); | |
549 | ||
550 | void fuse_truncate(struct address_space *mapping, loff_t offset); | |
551 | ||
334f485d MS |
552 | /** |
553 | * Initialize the client device | |
554 | */ | |
555 | int fuse_dev_init(void); | |
556 | ||
557 | /** | |
558 | * Cleanup the client device | |
559 | */ | |
560 | void fuse_dev_cleanup(void); | |
561 | ||
bafa9654 MS |
562 | int fuse_ctl_init(void); |
563 | void fuse_ctl_cleanup(void); | |
564 | ||
334f485d MS |
565 | /** |
566 | * Allocate a request | |
567 | */ | |
568 | struct fuse_req *fuse_request_alloc(void); | |
569 | ||
3be5a52b MS |
570 | struct fuse_req *fuse_request_alloc_nofs(void); |
571 | ||
334f485d MS |
572 | /** |
573 | * Free a request | |
574 | */ | |
575 | void fuse_request_free(struct fuse_req *req); | |
576 | ||
334f485d | 577 | /** |
33649c91 | 578 | * Get a request, may fail with -ENOMEM |
334f485d | 579 | */ |
ce1d5a49 | 580 | struct fuse_req *fuse_get_req(struct fuse_conn *fc); |
334f485d | 581 | |
33649c91 MS |
582 | /** |
583 | * Gets a requests for a file operation, always succeeds | |
584 | */ | |
585 | struct fuse_req *fuse_get_req_nofail(struct fuse_conn *fc, struct file *file); | |
586 | ||
334f485d | 587 | /** |
ce1d5a49 MS |
588 | * Decrement reference count of a request. If count goes to zero free |
589 | * the request. | |
334f485d MS |
590 | */ |
591 | void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req); | |
592 | ||
593 | /** | |
7c352bdf | 594 | * Send a request (synchronous) |
334f485d MS |
595 | */ |
596 | void request_send(struct fuse_conn *fc, struct fuse_req *req); | |
597 | ||
334f485d MS |
598 | /** |
599 | * Send a request with no reply | |
600 | */ | |
601 | void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req); | |
602 | ||
603 | /** | |
604 | * Send a request in the background | |
605 | */ | |
606 | void request_send_background(struct fuse_conn *fc, struct fuse_req *req); | |
607 | ||
3be5a52b MS |
608 | void request_send_background_locked(struct fuse_conn *fc, struct fuse_req *req); |
609 | ||
5a5fb1ea | 610 | /* Abort all requests */ |
69a53bf2 MS |
611 | void fuse_abort_conn(struct fuse_conn *fc); |
612 | ||
e5e5558e MS |
613 | /** |
614 | * Invalidate inode attributes | |
615 | */ | |
616 | void fuse_invalidate_attr(struct inode *inode); | |
bafa9654 | 617 | |
dbd561d2 MS |
618 | void fuse_invalidate_entry_cache(struct dentry *entry); |
619 | ||
bafa9654 MS |
620 | /** |
621 | * Acquire reference to fuse_conn | |
622 | */ | |
623 | struct fuse_conn *fuse_conn_get(struct fuse_conn *fc); | |
624 | ||
625 | /** | |
626 | * Release reference to fuse_conn | |
627 | */ | |
628 | void fuse_conn_put(struct fuse_conn *fc); | |
629 | ||
630 | /** | |
631 | * Add connection to control filesystem | |
632 | */ | |
633 | int fuse_ctl_add_conn(struct fuse_conn *fc); | |
634 | ||
635 | /** | |
636 | * Remove connection from control filesystem | |
637 | */ | |
638 | void fuse_ctl_remove_conn(struct fuse_conn *fc); | |
a5bfffac TS |
639 | |
640 | /** | |
641 | * Is file type valid? | |
642 | */ | |
643 | int fuse_valid_type(int m); | |
e57ac683 MS |
644 | |
645 | /** | |
646 | * Is task allowed to perform filesystem operation? | |
647 | */ | |
648 | int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task); | |
f3332114 MS |
649 | |
650 | u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id); | |
bcb4be80 MS |
651 | |
652 | int fuse_update_attributes(struct inode *inode, struct kstat *stat, | |
653 | struct file *file, bool *refreshed); | |
3be5a52b MS |
654 | |
655 | void fuse_flush_writepages(struct inode *inode); | |
656 | ||
657 | void fuse_set_nowrite(struct inode *inode); | |
658 | void fuse_release_nowrite(struct inode *inode); | |
5c5c5e51 MS |
659 | |
660 | u64 fuse_get_attr_version(struct fuse_conn *fc); | |
29d434b3 TH |
661 | |
662 | #endif /* _FS_FUSE_I_H */ |