i2c: tegra: Add Dmitry as a reviewer
[linux-2.6/linux-2.6-arm.git] / fs / fuse / fuse_i.h
blob24dbca777775130536b97b984e4348e9068230d6
1 /*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7 */
9 #ifndef _FS_FUSE_I_H
10 #define _FS_FUSE_I_H
12 #ifndef pr_fmt
13 # define pr_fmt(fmt) "fuse: " fmt
14 #endif
16 #include <linux/fuse.h>
17 #include <linux/fs.h>
18 #include <linux/mount.h>
19 #include <linux/wait.h>
20 #include <linux/list.h>
21 #include <linux/spinlock.h>
22 #include <linux/mm.h>
23 #include <linux/backing-dev.h>
24 #include <linux/mutex.h>
25 #include <linux/rwsem.h>
26 #include <linux/rbtree.h>
27 #include <linux/poll.h>
28 #include <linux/workqueue.h>
29 #include <linux/kref.h>
30 #include <linux/xattr.h>
31 #include <linux/pid_namespace.h>
32 #include <linux/refcount.h>
33 #include <linux/user_namespace.h>
35 /** Default max number of pages that can be used in a single read request */
36 #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
38 /** Maximum of max_pages received in init_out */
39 #define FUSE_MAX_MAX_PAGES 256
41 /** Bias for fi->writectr, meaning new writepages must not be sent */
42 #define FUSE_NOWRITE INT_MIN
44 /** It could be as large as PATH_MAX, but would that have any uses? */
45 #define FUSE_NAME_MAX 1024
47 /** Number of dentries for each connection in the control filesystem */
48 #define FUSE_CTL_NUM_DENTRIES 5
50 /** Number of page pointers embedded in fuse_req */
51 #define FUSE_REQ_INLINE_PAGES 1
53 /** List of active connections */
54 extern struct list_head fuse_conn_list;
56 /** Global mutex protecting fuse_conn_list and the control filesystem */
57 extern struct mutex fuse_mutex;
59 /** Module parameters */
60 extern unsigned max_user_bgreq;
61 extern unsigned max_user_congthresh;
63 /* One forget request */
64 struct fuse_forget_link {
65 struct fuse_forget_one forget_one;
66 struct fuse_forget_link *next;
69 /** FUSE inode */
70 struct fuse_inode {
71 /** Inode data */
72 struct inode inode;
74 /** Unique ID, which identifies the inode between userspace
75 * and kernel */
76 u64 nodeid;
78 /** Number of lookups on this inode */
79 u64 nlookup;
81 /** The request used for sending the FORGET message */
82 struct fuse_forget_link *forget;
84 /** Time in jiffies until the file attributes are valid */
85 u64 i_time;
87 /* Which attributes are invalid */
88 u32 inval_mask;
90 /** The sticky bit in inode->i_mode may have been removed, so
91 preserve the original mode */
92 umode_t orig_i_mode;
94 /** 64 bit inode number */
95 u64 orig_ino;
97 /** Version of last attribute change */
98 u64 attr_version;
100 union {
101 /* Write related fields (regular file only) */
102 struct {
103 /* Files usable in writepage. Protected by fi->lock */
104 struct list_head write_files;
106 /* Writepages pending on truncate or fsync */
107 struct list_head queued_writes;
109 /* Number of sent writes, a negative bias
110 * (FUSE_NOWRITE) means more writes are blocked */
111 int writectr;
113 /* Waitq for writepage completion */
114 wait_queue_head_t page_waitq;
116 /* List of writepage requestst (pending or sent) */
117 struct list_head writepages;
120 /* readdir cache (directory only) */
121 struct {
122 /* true if fully cached */
123 bool cached;
125 /* size of cache */
126 loff_t size;
128 /* position at end of cache (position of next entry) */
129 loff_t pos;
131 /* version of the cache */
132 u64 version;
134 /* modification time of directory when cache was
135 * started */
136 struct timespec64 mtime;
138 /* iversion of directory when cache was started */
139 u64 iversion;
141 /* protects above fields */
142 spinlock_t lock;
143 } rdc;
146 /** Miscellaneous bits describing inode state */
147 unsigned long state;
149 /** Lock for serializing lookup and readdir for back compatibility*/
150 struct mutex mutex;
152 /** Lock to protect write related fields */
153 spinlock_t lock;
156 /** FUSE inode state bits */
157 enum {
158 /** Advise readdirplus */
159 FUSE_I_ADVISE_RDPLUS,
160 /** Initialized with readdirplus */
161 FUSE_I_INIT_RDPLUS,
162 /** An operation changing file size is in progress */
163 FUSE_I_SIZE_UNSTABLE,
166 struct fuse_conn;
168 /** FUSE specific file data */
169 struct fuse_file {
170 /** Fuse connection for this file */
171 struct fuse_conn *fc;
174 * Request reserved for flush and release.
175 * Modified under relative fuse_inode::lock.
177 struct fuse_req *reserved_req;
179 /** Kernel file handle guaranteed to be unique */
180 u64 kh;
182 /** File handle used by userspace */
183 u64 fh;
185 /** Node id of this file */
186 u64 nodeid;
188 /** Refcount */
189 refcount_t count;
191 /** FOPEN_* flags returned by open */
192 u32 open_flags;
194 /** Entry on inode's write_files list */
195 struct list_head write_entry;
197 /* Readdir related */
198 struct {
200 * Protects below fields against (crazy) parallel readdir on
201 * same open file. Uncontended in the normal case.
203 struct mutex lock;
205 /* Dir stream position */
206 loff_t pos;
208 /* Offset in cache */
209 loff_t cache_off;
211 /* Version of cache we are reading */
212 u64 version;
214 } readdir;
216 /** RB node to be linked on fuse_conn->polled_files */
217 struct rb_node polled_node;
219 /** Wait queue head for poll */
220 wait_queue_head_t poll_wait;
222 /** Has flock been performed on this file? */
223 bool flock:1;
226 /** One input argument of a request */
227 struct fuse_in_arg {
228 unsigned size;
229 const void *value;
232 /** The request input */
233 struct fuse_in {
234 /** The request header */
235 struct fuse_in_header h;
237 /** True if the data for the last argument is in req->pages */
238 unsigned argpages:1;
240 /** Number of arguments */
241 unsigned numargs;
243 /** Array of arguments */
244 struct fuse_in_arg args[3];
247 /** One output argument of a request */
248 struct fuse_arg {
249 unsigned size;
250 void *value;
253 /** The request output */
254 struct fuse_out {
255 /** Header returned from userspace */
256 struct fuse_out_header h;
259 * The following bitfields are not changed during the request
260 * processing
263 /** Last argument is variable length (can be shorter than
264 arg->size) */
265 unsigned argvar:1;
267 /** Last argument is a list of pages to copy data to */
268 unsigned argpages:1;
270 /** Zero partially or not copied pages */
271 unsigned page_zeroing:1;
273 /** Pages may be replaced with new ones */
274 unsigned page_replace:1;
276 /** Number or arguments */
277 unsigned numargs;
279 /** Array of arguments */
280 struct fuse_arg args[2];
283 /** FUSE page descriptor */
284 struct fuse_page_desc {
285 unsigned int length;
286 unsigned int offset;
289 struct fuse_args {
290 struct {
291 struct {
292 uint32_t opcode;
293 uint64_t nodeid;
294 } h;
295 unsigned numargs;
296 struct fuse_in_arg args[3];
298 } in;
299 struct {
300 unsigned argvar:1;
301 unsigned numargs;
302 struct fuse_arg args[2];
303 } out;
306 #define FUSE_ARGS(args) struct fuse_args args = {}
308 /** The request IO state (for asynchronous processing) */
309 struct fuse_io_priv {
310 struct kref refcnt;
311 int async;
312 spinlock_t lock;
313 unsigned reqs;
314 ssize_t bytes;
315 size_t size;
316 __u64 offset;
317 bool write;
318 bool should_dirty;
319 int err;
320 struct kiocb *iocb;
321 struct completion *done;
322 bool blocking;
325 #define FUSE_IO_PRIV_SYNC(i) \
327 .refcnt = KREF_INIT(1), \
328 .async = 0, \
329 .iocb = i, \
333 * Request flags
335 * FR_ISREPLY: set if the request has reply
336 * FR_FORCE: force sending of the request even if interrupted
337 * FR_BACKGROUND: request is sent in the background
338 * FR_WAITING: request is counted as "waiting"
339 * FR_ABORTED: the request was aborted
340 * FR_INTERRUPTED: the request has been interrupted
341 * FR_LOCKED: data is being copied to/from the request
342 * FR_PENDING: request is not yet in userspace
343 * FR_SENT: request is in userspace, waiting for an answer
344 * FR_FINISHED: request is finished
345 * FR_PRIVATE: request is on private list
347 enum fuse_req_flag {
348 FR_ISREPLY,
349 FR_FORCE,
350 FR_BACKGROUND,
351 FR_WAITING,
352 FR_ABORTED,
353 FR_INTERRUPTED,
354 FR_LOCKED,
355 FR_PENDING,
356 FR_SENT,
357 FR_FINISHED,
358 FR_PRIVATE,
362 * A request to the client
364 * .waitq.lock protects the following fields:
365 * - FR_ABORTED
366 * - FR_LOCKED (may also be modified under fc->lock, tested under both)
368 struct fuse_req {
369 /** This can be on either pending processing or io lists in
370 fuse_conn */
371 struct list_head list;
373 /** Entry on the interrupts list */
374 struct list_head intr_entry;
376 /** refcount */
377 refcount_t count;
379 /* Request flags, updated with test/set/clear_bit() */
380 unsigned long flags;
382 /** The request input */
383 struct fuse_in in;
385 /** The request output */
386 struct fuse_out out;
388 /** Used to wake up the task waiting for completion of request*/
389 wait_queue_head_t waitq;
391 /** Data for asynchronous requests */
392 union {
393 struct {
394 struct fuse_release_in in;
395 struct inode *inode;
396 } release;
397 struct fuse_init_in init_in;
398 struct fuse_init_out init_out;
399 struct cuse_init_in cuse_init_in;
400 struct {
401 struct fuse_read_in in;
402 u64 attr_ver;
403 } read;
404 struct {
405 struct fuse_write_in in;
406 struct fuse_write_out out;
407 struct fuse_req *next;
408 } write;
409 struct fuse_notify_retrieve_in retrieve_in;
410 } misc;
412 /** page vector */
413 struct page **pages;
415 /** page-descriptor vector */
416 struct fuse_page_desc *page_descs;
418 /** size of the 'pages' array */
419 unsigned max_pages;
421 /** inline page vector */
422 struct page *inline_pages[FUSE_REQ_INLINE_PAGES];
424 /** inline page-descriptor vector */
425 struct fuse_page_desc inline_page_descs[FUSE_REQ_INLINE_PAGES];
427 /** number of pages in vector */
428 unsigned num_pages;
430 /** File used in the request (or NULL) */
431 struct fuse_file *ff;
433 /** Inode used in the request or NULL */
434 struct inode *inode;
436 /** AIO control block */
437 struct fuse_io_priv *io;
439 /** Link on fi->writepages */
440 struct list_head writepages_entry;
442 /** Request completion callback */
443 void (*end)(struct fuse_conn *, struct fuse_req *);
445 /** Request is stolen from fuse_file->reserved_req */
446 struct file *stolen_file;
449 struct fuse_iqueue {
450 /** Connection established */
451 unsigned connected;
453 /** Readers of the connection are waiting on this */
454 wait_queue_head_t waitq;
456 /** The next unique request id */
457 u64 reqctr;
459 /** The list of pending requests */
460 struct list_head pending;
462 /** Pending interrupts */
463 struct list_head interrupts;
465 /** Queue of pending forgets */
466 struct fuse_forget_link forget_list_head;
467 struct fuse_forget_link *forget_list_tail;
469 /** Batching of FORGET requests (positive indicates FORGET batch) */
470 int forget_batch;
472 /** O_ASYNC requests */
473 struct fasync_struct *fasync;
476 #define FUSE_PQ_HASH_BITS 8
477 #define FUSE_PQ_HASH_SIZE (1 << FUSE_PQ_HASH_BITS)
479 struct fuse_pqueue {
480 /** Connection established */
481 unsigned connected;
483 /** Lock protecting accessess to members of this structure */
484 spinlock_t lock;
486 /** Hash table of requests being processed */
487 struct list_head *processing;
489 /** The list of requests under I/O */
490 struct list_head io;
494 * Fuse device instance
496 struct fuse_dev {
497 /** Fuse connection for this device */
498 struct fuse_conn *fc;
500 /** Processing queue */
501 struct fuse_pqueue pq;
503 /** list entry on fc->devices */
504 struct list_head entry;
508 * A Fuse connection.
510 * This structure is created, when the filesystem is mounted, and is
511 * destroyed, when the client device is closed and the filesystem is
512 * unmounted.
514 struct fuse_conn {
515 /** Lock protecting accessess to members of this structure */
516 spinlock_t lock;
518 /** Refcount */
519 refcount_t count;
521 /** Number of fuse_dev's */
522 atomic_t dev_count;
524 struct rcu_head rcu;
526 /** The user id for this mount */
527 kuid_t user_id;
529 /** The group id for this mount */
530 kgid_t group_id;
532 /** The pid namespace for this mount */
533 struct pid_namespace *pid_ns;
535 /** The user namespace for this mount */
536 struct user_namespace *user_ns;
538 /** Maximum read size */
539 unsigned max_read;
541 /** Maximum write size */
542 unsigned max_write;
544 /** Maxmum number of pages that can be used in a single request */
545 unsigned int max_pages;
547 /** Input queue */
548 struct fuse_iqueue iq;
550 /** The next unique kernel file handle */
551 atomic64_t khctr;
553 /** rbtree of fuse_files waiting for poll events indexed by ph */
554 struct rb_root polled_files;
556 /** Maximum number of outstanding background requests */
557 unsigned max_background;
559 /** Number of background requests at which congestion starts */
560 unsigned congestion_threshold;
562 /** Number of requests currently in the background */
563 unsigned num_background;
565 /** Number of background requests currently queued for userspace */
566 unsigned active_background;
568 /** The list of background requests set aside for later queuing */
569 struct list_head bg_queue;
571 /** Protects: max_background, congestion_threshold, num_background,
572 * active_background, bg_queue, blocked */
573 spinlock_t bg_lock;
575 /** Flag indicating that INIT reply has been received. Allocating
576 * any fuse request will be suspended until the flag is set */
577 int initialized;
579 /** Flag indicating if connection is blocked. This will be
580 the case before the INIT reply is received, and if there
581 are too many outstading backgrounds requests */
582 int blocked;
584 /** waitq for blocked connection */
585 wait_queue_head_t blocked_waitq;
587 /** waitq for reserved requests */
588 wait_queue_head_t reserved_req_waitq;
590 /** Connection established, cleared on umount, connection
591 abort and device release */
592 unsigned connected;
594 /** Connection aborted via sysfs */
595 bool aborted;
597 /** Connection failed (version mismatch). Cannot race with
598 setting other bitfields since it is only set once in INIT
599 reply, before any other request, and never cleared */
600 unsigned conn_error:1;
602 /** Connection successful. Only set in INIT */
603 unsigned conn_init:1;
605 /** Do readpages asynchronously? Only set in INIT */
606 unsigned async_read:1;
608 /** Return an unique read error after abort. Only set in INIT */
609 unsigned abort_err:1;
611 /** Do not send separate SETATTR request before open(O_TRUNC) */
612 unsigned atomic_o_trunc:1;
614 /** Filesystem supports NFS exporting. Only set in INIT */
615 unsigned export_support:1;
617 /** write-back cache policy (default is write-through) */
618 unsigned writeback_cache:1;
620 /** allow parallel lookups and readdir (default is serialized) */
621 unsigned parallel_dirops:1;
623 /** handle fs handles killing suid/sgid/cap on write/chown/trunc */
624 unsigned handle_killpriv:1;
626 /** cache READLINK responses in page cache */
627 unsigned cache_symlinks:1;
630 * The following bitfields are only for optimization purposes
631 * and hence races in setting them will not cause malfunction
634 /** Is open/release not implemented by fs? */
635 unsigned no_open:1;
637 /** Is opendir/releasedir not implemented by fs? */
638 unsigned no_opendir:1;
640 /** Is fsync not implemented by fs? */
641 unsigned no_fsync:1;
643 /** Is fsyncdir not implemented by fs? */
644 unsigned no_fsyncdir:1;
646 /** Is flush not implemented by fs? */
647 unsigned no_flush:1;
649 /** Is setxattr not implemented by fs? */
650 unsigned no_setxattr:1;
652 /** Is getxattr not implemented by fs? */
653 unsigned no_getxattr:1;
655 /** Is listxattr not implemented by fs? */
656 unsigned no_listxattr:1;
658 /** Is removexattr not implemented by fs? */
659 unsigned no_removexattr:1;
661 /** Are posix file locking primitives not implemented by fs? */
662 unsigned no_lock:1;
664 /** Is access not implemented by fs? */
665 unsigned no_access:1;
667 /** Is create not implemented by fs? */
668 unsigned no_create:1;
670 /** Is interrupt not implemented by fs? */
671 unsigned no_interrupt:1;
673 /** Is bmap not implemented by fs? */
674 unsigned no_bmap:1;
676 /** Is poll not implemented by fs? */
677 unsigned no_poll:1;
679 /** Do multi-page cached writes */
680 unsigned big_writes:1;
682 /** Don't apply umask to creation modes */
683 unsigned dont_mask:1;
685 /** Are BSD file locking primitives not implemented by fs? */
686 unsigned no_flock:1;
688 /** Is fallocate not implemented by fs? */
689 unsigned no_fallocate:1;
691 /** Is rename with flags implemented by fs? */
692 unsigned no_rename2:1;
694 /** Use enhanced/automatic page cache invalidation. */
695 unsigned auto_inval_data:1;
697 /** Filesystem is fully reponsible for page cache invalidation. */
698 unsigned explicit_inval_data:1;
700 /** Does the filesystem support readdirplus? */
701 unsigned do_readdirplus:1;
703 /** Does the filesystem want adaptive readdirplus? */
704 unsigned readdirplus_auto:1;
706 /** Does the filesystem support asynchronous direct-IO submission? */
707 unsigned async_dio:1;
709 /** Is lseek not implemented by fs? */
710 unsigned no_lseek:1;
712 /** Does the filesystem support posix acls? */
713 unsigned posix_acl:1;
715 /** Check permissions based on the file mode or not? */
716 unsigned default_permissions:1;
718 /** Allow other than the mounter user to access the filesystem ? */
719 unsigned allow_other:1;
721 /** Does the filesystem support copy_file_range? */
722 unsigned no_copy_file_range:1;
724 /** The number of requests waiting for completion */
725 atomic_t num_waiting;
727 /** Negotiated minor version */
728 unsigned minor;
730 /** Entry on the fuse_conn_list */
731 struct list_head entry;
733 /** Device ID from super block */
734 dev_t dev;
736 /** Dentries in the control filesystem */
737 struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
739 /** number of dentries used in the above array */
740 int ctl_ndents;
742 /** Key for lock owner ID scrambling */
743 u32 scramble_key[4];
745 /** Reserved request for the DESTROY message */
746 struct fuse_req *destroy_req;
748 /** Version counter for attribute changes */
749 atomic64_t attr_version;
751 /** Called on final put */
752 void (*release)(struct fuse_conn *);
754 /** Super block for this connection. */
755 struct super_block *sb;
757 /** Read/write semaphore to hold when accessing sb. */
758 struct rw_semaphore killsb;
760 /** List of device instances belonging to this connection */
761 struct list_head devices;
764 static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
766 return sb->s_fs_info;
769 static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
771 return get_fuse_conn_super(inode->i_sb);
774 static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
776 return container_of(inode, struct fuse_inode, inode);
779 static inline u64 get_node_id(struct inode *inode)
781 return get_fuse_inode(inode)->nodeid;
784 static inline int invalid_nodeid(u64 nodeid)
786 return !nodeid || nodeid == FUSE_ROOT_ID;
789 static inline u64 fuse_get_attr_version(struct fuse_conn *fc)
791 return atomic64_read(&fc->attr_version);
794 /** Device operations */
795 extern const struct file_operations fuse_dev_operations;
797 extern const struct dentry_operations fuse_dentry_operations;
798 extern const struct dentry_operations fuse_root_dentry_operations;
801 * Inode to nodeid comparison.
803 int fuse_inode_eq(struct inode *inode, void *_nodeidp);
806 * Get a filled in inode
808 struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
809 int generation, struct fuse_attr *attr,
810 u64 attr_valid, u64 attr_version);
812 int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name,
813 struct fuse_entry_out *outarg, struct inode **inode);
816 * Send FORGET command
818 void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
819 u64 nodeid, u64 nlookup);
821 struct fuse_forget_link *fuse_alloc_forget(void);
823 /* Used by READDIRPLUS */
824 void fuse_force_forget(struct file *file, u64 nodeid);
827 * Initialize READ or READDIR request
829 void fuse_read_fill(struct fuse_req *req, struct file *file,
830 loff_t pos, size_t count, int opcode);
833 * Send OPEN or OPENDIR request
835 int fuse_open_common(struct inode *inode, struct file *file, bool isdir);
837 struct fuse_file *fuse_file_alloc(struct fuse_conn *fc);
838 void fuse_file_free(struct fuse_file *ff);
839 void fuse_finish_open(struct inode *inode, struct file *file);
841 void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff, int flags);
844 * Send RELEASE or RELEASEDIR request
846 void fuse_release_common(struct file *file, bool isdir);
849 * Send FSYNC or FSYNCDIR request
851 int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
852 int datasync, int opcode);
855 * Notify poll wakeup
857 int fuse_notify_poll_wakeup(struct fuse_conn *fc,
858 struct fuse_notify_poll_wakeup_out *outarg);
861 * Initialize file operations on a regular file
863 void fuse_init_file_inode(struct inode *inode);
866 * Initialize inode operations on regular files and special files
868 void fuse_init_common(struct inode *inode);
871 * Initialize inode and file operations on a directory
873 void fuse_init_dir(struct inode *inode);
876 * Initialize inode operations on a symlink
878 void fuse_init_symlink(struct inode *inode);
881 * Change attributes of an inode
883 void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
884 u64 attr_valid, u64 attr_version);
886 void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
887 u64 attr_valid);
890 * Initialize the client device
892 int fuse_dev_init(void);
895 * Cleanup the client device
897 void fuse_dev_cleanup(void);
899 int fuse_ctl_init(void);
900 void __exit fuse_ctl_cleanup(void);
903 * Allocate a request
905 struct fuse_req *fuse_request_alloc(unsigned npages);
907 struct fuse_req *fuse_request_alloc_nofs(unsigned npages);
909 bool fuse_req_realloc_pages(struct fuse_conn *fc, struct fuse_req *req,
910 gfp_t flags);
914 * Free a request
916 void fuse_request_free(struct fuse_req *req);
919 * Get a request, may fail with -ENOMEM,
920 * caller should specify # elements in req->pages[] explicitly
922 struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages);
923 struct fuse_req *fuse_get_req_for_background(struct fuse_conn *fc,
924 unsigned npages);
927 * Increment reference count on request
929 void __fuse_get_request(struct fuse_req *req);
932 * Gets a requests for a file operation, always succeeds
934 struct fuse_req *fuse_get_req_nofail_nopages(struct fuse_conn *fc,
935 struct file *file);
938 * Decrement reference count of a request. If count goes to zero free
939 * the request.
941 void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
944 * Send a request (synchronous)
946 void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req);
949 * Simple request sending that does request allocation and freeing
951 ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args);
954 * Send a request in the background
956 void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req);
957 bool fuse_request_queue_background(struct fuse_conn *fc, struct fuse_req *req);
959 /* Abort all requests */
960 void fuse_abort_conn(struct fuse_conn *fc);
961 void fuse_wait_aborted(struct fuse_conn *fc);
964 * Invalidate inode attributes
966 void fuse_invalidate_attr(struct inode *inode);
968 void fuse_invalidate_entry_cache(struct dentry *entry);
970 void fuse_invalidate_atime(struct inode *inode);
972 u64 entry_attr_timeout(struct fuse_entry_out *o);
973 void fuse_change_entry_timeout(struct dentry *entry, struct fuse_entry_out *o);
976 * Acquire reference to fuse_conn
978 struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
981 * Initialize fuse_conn
983 void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns);
986 * Release reference to fuse_conn
988 void fuse_conn_put(struct fuse_conn *fc);
990 struct fuse_dev *fuse_dev_alloc(struct fuse_conn *fc);
991 void fuse_dev_free(struct fuse_dev *fud);
994 * Add connection to control filesystem
996 int fuse_ctl_add_conn(struct fuse_conn *fc);
999 * Remove connection from control filesystem
1001 void fuse_ctl_remove_conn(struct fuse_conn *fc);
1004 * Is file type valid?
1006 int fuse_valid_type(int m);
1009 * Is current process allowed to perform filesystem operation?
1011 int fuse_allow_current_process(struct fuse_conn *fc);
1013 u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
1015 void fuse_update_ctime(struct inode *inode);
1017 int fuse_update_attributes(struct inode *inode, struct file *file);
1019 void fuse_flush_writepages(struct inode *inode);
1021 void fuse_set_nowrite(struct inode *inode);
1022 void fuse_release_nowrite(struct inode *inode);
1025 * File-system tells the kernel to invalidate cache for the given node id.
1027 int fuse_reverse_inval_inode(struct super_block *sb, u64 nodeid,
1028 loff_t offset, loff_t len);
1031 * File-system tells the kernel to invalidate parent attributes and
1032 * the dentry matching parent/name.
1034 * If the child_nodeid is non-zero and:
1035 * - matches the inode number for the dentry matching parent/name,
1036 * - is not a mount point
1037 * - is a file or oan empty directory
1038 * then the dentry is unhashed (d_delete()).
1040 int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
1041 u64 child_nodeid, struct qstr *name);
1043 int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
1044 bool isdir);
1047 * fuse_direct_io() flags
1050 /** If set, it is WRITE; otherwise - READ */
1051 #define FUSE_DIO_WRITE (1 << 0)
1053 /** CUSE pass fuse_direct_io() a file which f_mapping->host is not from FUSE */
1054 #define FUSE_DIO_CUSE (1 << 1)
1056 ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
1057 loff_t *ppos, int flags);
1058 long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
1059 unsigned int flags);
1060 long fuse_ioctl_common(struct file *file, unsigned int cmd,
1061 unsigned long arg, unsigned int flags);
1062 __poll_t fuse_file_poll(struct file *file, poll_table *wait);
1063 int fuse_dev_release(struct inode *inode, struct file *file);
1065 bool fuse_write_update_size(struct inode *inode, loff_t pos);
1067 int fuse_flush_times(struct inode *inode, struct fuse_file *ff);
1068 int fuse_write_inode(struct inode *inode, struct writeback_control *wbc);
1070 int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
1071 struct file *file);
1073 void fuse_set_initialized(struct fuse_conn *fc);
1075 void fuse_unlock_inode(struct inode *inode, bool locked);
1076 bool fuse_lock_inode(struct inode *inode);
1078 int fuse_setxattr(struct inode *inode, const char *name, const void *value,
1079 size_t size, int flags);
1080 ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value,
1081 size_t size);
1082 ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size);
1083 int fuse_removexattr(struct inode *inode, const char *name);
1084 extern const struct xattr_handler *fuse_xattr_handlers[];
1085 extern const struct xattr_handler *fuse_acl_xattr_handlers[];
1086 extern const struct xattr_handler *fuse_no_acl_xattr_handlers[];
1088 struct posix_acl;
1089 struct posix_acl *fuse_get_acl(struct inode *inode, int type);
1090 int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type);
1093 /* readdir.c */
1094 int fuse_readdir(struct file *file, struct dir_context *ctx);
1096 #endif /* _FS_FUSE_I_H */