1d8a5ba45SMiklos Szeredi /* 2d8a5ba45SMiklos Szeredi FUSE: Filesystem in Userspace 31729a16cSMiklos Szeredi Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> 4d8a5ba45SMiklos Szeredi 5d8a5ba45SMiklos Szeredi This program can be distributed under the terms of the GNU GPL. 6d8a5ba45SMiklos Szeredi See the file COPYING. 7d8a5ba45SMiklos Szeredi */ 8d8a5ba45SMiklos Szeredi 929d434b3STejun Heo #ifndef _FS_FUSE_I_H 1029d434b3STejun Heo #define _FS_FUSE_I_H 1129d434b3STejun Heo 12d8a5ba45SMiklos Szeredi #include <linux/fuse.h> 13d8a5ba45SMiklos Szeredi #include <linux/fs.h> 1451eb01e7SMiklos Szeredi #include <linux/mount.h> 15d8a5ba45SMiklos Szeredi #include <linux/wait.h> 16d8a5ba45SMiklos Szeredi #include <linux/list.h> 17d8a5ba45SMiklos Szeredi #include <linux/spinlock.h> 18d8a5ba45SMiklos Szeredi #include <linux/mm.h> 19d8a5ba45SMiklos Szeredi #include <linux/backing-dev.h> 20bafa9654SMiklos Szeredi #include <linux/mutex.h> 213be5a52bSMiklos Szeredi #include <linux/rwsem.h> 2295668a69STejun Heo #include <linux/rbtree.h> 2395668a69STejun Heo #include <linux/poll.h> 245a18ec17SMiklos Szeredi #include <linux/workqueue.h> 25d8a5ba45SMiklos Szeredi 26334f485dSMiklos Szeredi /** Max number of pages that can be used in a single read request */ 27334f485dSMiklos Szeredi #define FUSE_MAX_PAGES_PER_REQ 32 28334f485dSMiklos Szeredi 293be5a52bSMiklos Szeredi /** Bias for fi->writectr, meaning new writepages must not be sent */ 303be5a52bSMiklos Szeredi #define FUSE_NOWRITE INT_MIN 313be5a52bSMiklos Szeredi 321d3d752bSMiklos Szeredi /** It could be as large as PATH_MAX, but would that have any uses? */ 331d3d752bSMiklos Szeredi #define FUSE_NAME_MAX 1024 341d3d752bSMiklos Szeredi 35bafa9654SMiklos Szeredi /** Number of dentries for each connection in the control filesystem */ 3679a9d994SCsaba Henk #define FUSE_CTL_NUM_DENTRIES 5 37bafa9654SMiklos Szeredi 381e9a4ed9SMiklos Szeredi /** If the FUSE_DEFAULT_PERMISSIONS flag is given, the filesystem 391e9a4ed9SMiklos Szeredi module will check permissions based on the file mode. Otherwise no 401e9a4ed9SMiklos Szeredi permission checking is done in the kernel */ 411e9a4ed9SMiklos Szeredi #define FUSE_DEFAULT_PERMISSIONS (1 << 0) 421e9a4ed9SMiklos Szeredi 431e9a4ed9SMiklos Szeredi /** If the FUSE_ALLOW_OTHER flag is given, then not only the user 441e9a4ed9SMiklos Szeredi doing the mount will be allowed to access the filesystem */ 451e9a4ed9SMiklos Szeredi #define FUSE_ALLOW_OTHER (1 << 1) 461e9a4ed9SMiklos Szeredi 474250c066SMaxim Patlasov /** Number of page pointers embedded in fuse_req */ 484250c066SMaxim Patlasov #define FUSE_REQ_INLINE_PAGES 1 494250c066SMaxim Patlasov 50bafa9654SMiklos Szeredi /** List of active connections */ 51bafa9654SMiklos Szeredi extern struct list_head fuse_conn_list; 52bafa9654SMiklos Szeredi 53bafa9654SMiklos Szeredi /** Global mutex protecting fuse_conn_list and the control filesystem */ 54bafa9654SMiklos Szeredi extern struct mutex fuse_mutex; 55413ef8cbSMiklos Szeredi 5679a9d994SCsaba Henk /** Module parameters */ 5779a9d994SCsaba Henk extern unsigned max_user_bgreq; 5879a9d994SCsaba Henk extern unsigned max_user_congthresh; 5979a9d994SCsaba Henk 6007e77dcaSMiklos Szeredi /* One forget request */ 6107e77dcaSMiklos Szeredi struct fuse_forget_link { 6202c048b9SMiklos Szeredi struct fuse_forget_one forget_one; 6307e77dcaSMiklos Szeredi struct fuse_forget_link *next; 6407e77dcaSMiklos Szeredi }; 6507e77dcaSMiklos Szeredi 66d8a5ba45SMiklos Szeredi /** FUSE inode */ 67d8a5ba45SMiklos Szeredi struct fuse_inode { 68d8a5ba45SMiklos Szeredi /** Inode data */ 69d8a5ba45SMiklos Szeredi struct inode inode; 70d8a5ba45SMiklos Szeredi 71d8a5ba45SMiklos Szeredi /** Unique ID, which identifies the inode between userspace 72d8a5ba45SMiklos Szeredi * and kernel */ 73d8a5ba45SMiklos Szeredi u64 nodeid; 74d8a5ba45SMiklos Szeredi 759e6268dbSMiklos Szeredi /** Number of lookups on this inode */ 769e6268dbSMiklos Szeredi u64 nlookup; 779e6268dbSMiklos Szeredi 78e5e5558eSMiklos Szeredi /** The request used for sending the FORGET message */ 7907e77dcaSMiklos Szeredi struct fuse_forget_link *forget; 80e5e5558eSMiklos Szeredi 81d8a5ba45SMiklos Szeredi /** Time in jiffies until the file attributes are valid */ 820a0898cfSMiklos Szeredi u64 i_time; 83ebc14c4dSMiklos Szeredi 84ebc14c4dSMiklos Szeredi /** The sticky bit in inode->i_mode may have been removed, so 85ebc14c4dSMiklos Szeredi preserve the original mode */ 86541af6a0SAl Viro umode_t orig_i_mode; 871fb69e78SMiklos Szeredi 8845c72cd7SPavel Shilovsky /** 64 bit inode number */ 8945c72cd7SPavel Shilovsky u64 orig_ino; 9045c72cd7SPavel Shilovsky 911fb69e78SMiklos Szeredi /** Version of last attribute change */ 921fb69e78SMiklos Szeredi u64 attr_version; 9393a8c3cdSMiklos Szeredi 9493a8c3cdSMiklos Szeredi /** Files usable in writepage. Protected by fc->lock */ 9593a8c3cdSMiklos Szeredi struct list_head write_files; 963be5a52bSMiklos Szeredi 973be5a52bSMiklos Szeredi /** Writepages pending on truncate or fsync */ 983be5a52bSMiklos Szeredi struct list_head queued_writes; 993be5a52bSMiklos Szeredi 1003be5a52bSMiklos Szeredi /** Number of sent writes, a negative bias (FUSE_NOWRITE) 1013be5a52bSMiklos Szeredi * means more writes are blocked */ 1023be5a52bSMiklos Szeredi int writectr; 1033be5a52bSMiklos Szeredi 1043be5a52bSMiklos Szeredi /** Waitq for writepage completion */ 1053be5a52bSMiklos Szeredi wait_queue_head_t page_waitq; 1063be5a52bSMiklos Szeredi 1073be5a52bSMiklos Szeredi /** List of writepage requestst (pending or sent) */ 1083be5a52bSMiklos Szeredi struct list_head writepages; 1094582a4abSFeng Shuo 1104582a4abSFeng Shuo /** Miscellaneous bits describing inode state */ 1114582a4abSFeng Shuo unsigned long state; 1124582a4abSFeng Shuo }; 1134582a4abSFeng Shuo 1144582a4abSFeng Shuo /** FUSE inode state bits */ 1154582a4abSFeng Shuo enum { 1164582a4abSFeng Shuo /** Advise readdirplus */ 1174582a4abSFeng Shuo FUSE_I_ADVISE_RDPLUS, 118d8a5ba45SMiklos Szeredi }; 119d8a5ba45SMiklos Szeredi 120da5e4714SMiklos Szeredi struct fuse_conn; 121da5e4714SMiklos Szeredi 122b6aeadedSMiklos Szeredi /** FUSE specific file data */ 123b6aeadedSMiklos Szeredi struct fuse_file { 124da5e4714SMiklos Szeredi /** Fuse connection for this file */ 125da5e4714SMiklos Szeredi struct fuse_conn *fc; 126da5e4714SMiklos Szeredi 127b6aeadedSMiklos Szeredi /** Request reserved for flush and release */ 12833649c91SMiklos Szeredi struct fuse_req *reserved_req; 129b6aeadedSMiklos Szeredi 130acf99433STejun Heo /** Kernel file handle guaranteed to be unique */ 131acf99433STejun Heo u64 kh; 132acf99433STejun Heo 133b6aeadedSMiklos Szeredi /** File handle used by userspace */ 134b6aeadedSMiklos Szeredi u64 fh; 135c756e0a4SMiklos Szeredi 136da5e4714SMiklos Szeredi /** Node id of this file */ 137da5e4714SMiklos Szeredi u64 nodeid; 138da5e4714SMiklos Szeredi 139c756e0a4SMiklos Szeredi /** Refcount */ 140c756e0a4SMiklos Szeredi atomic_t count; 14193a8c3cdSMiklos Szeredi 142c7b7143cSMiklos Szeredi /** FOPEN_* flags returned by open */ 143c7b7143cSMiklos Szeredi u32 open_flags; 144c7b7143cSMiklos Szeredi 14593a8c3cdSMiklos Szeredi /** Entry on inode's write_files list */ 14693a8c3cdSMiklos Szeredi struct list_head write_entry; 14795668a69STejun Heo 14895668a69STejun Heo /** RB node to be linked on fuse_conn->polled_files */ 14995668a69STejun Heo struct rb_node polled_node; 15095668a69STejun Heo 15195668a69STejun Heo /** Wait queue head for poll */ 15295668a69STejun Heo wait_queue_head_t poll_wait; 15337fb3a30SMiklos Szeredi 15437fb3a30SMiklos Szeredi /** Has flock been performed on this file? */ 15537fb3a30SMiklos Szeredi bool flock:1; 156b6aeadedSMiklos Szeredi }; 157b6aeadedSMiklos Szeredi 158334f485dSMiklos Szeredi /** One input argument of a request */ 159334f485dSMiklos Szeredi struct fuse_in_arg { 160334f485dSMiklos Szeredi unsigned size; 161334f485dSMiklos Szeredi const void *value; 162334f485dSMiklos Szeredi }; 163334f485dSMiklos Szeredi 164334f485dSMiklos Szeredi /** The request input */ 165334f485dSMiklos Szeredi struct fuse_in { 166334f485dSMiklos Szeredi /** The request header */ 167334f485dSMiklos Szeredi struct fuse_in_header h; 168334f485dSMiklos Szeredi 169334f485dSMiklos Szeredi /** True if the data for the last argument is in req->pages */ 170334f485dSMiklos Szeredi unsigned argpages:1; 171334f485dSMiklos Szeredi 172334f485dSMiklos Szeredi /** Number of arguments */ 173334f485dSMiklos Szeredi unsigned numargs; 174334f485dSMiklos Szeredi 175334f485dSMiklos Szeredi /** Array of arguments */ 176334f485dSMiklos Szeredi struct fuse_in_arg args[3]; 177334f485dSMiklos Szeredi }; 178334f485dSMiklos Szeredi 179334f485dSMiklos Szeredi /** One output argument of a request */ 180334f485dSMiklos Szeredi struct fuse_arg { 181334f485dSMiklos Szeredi unsigned size; 182334f485dSMiklos Szeredi void *value; 183334f485dSMiklos Szeredi }; 184334f485dSMiklos Szeredi 185334f485dSMiklos Szeredi /** The request output */ 186334f485dSMiklos Szeredi struct fuse_out { 187334f485dSMiklos Szeredi /** Header returned from userspace */ 188334f485dSMiklos Szeredi struct fuse_out_header h; 189334f485dSMiklos Szeredi 190095da6cbSMiklos Szeredi /* 191095da6cbSMiklos Szeredi * The following bitfields are not changed during the request 192095da6cbSMiklos Szeredi * processing 193095da6cbSMiklos Szeredi */ 194095da6cbSMiklos Szeredi 195334f485dSMiklos Szeredi /** Last argument is variable length (can be shorter than 196334f485dSMiklos Szeredi arg->size) */ 197334f485dSMiklos Szeredi unsigned argvar:1; 198334f485dSMiklos Szeredi 199334f485dSMiklos Szeredi /** Last argument is a list of pages to copy data to */ 200334f485dSMiklos Szeredi unsigned argpages:1; 201334f485dSMiklos Szeredi 202334f485dSMiklos Szeredi /** Zero partially or not copied pages */ 203334f485dSMiklos Szeredi unsigned page_zeroing:1; 204334f485dSMiklos Szeredi 205ce534fb0SMiklos Szeredi /** Pages may be replaced with new ones */ 206ce534fb0SMiklos Szeredi unsigned page_replace:1; 207ce534fb0SMiklos Szeredi 208334f485dSMiklos Szeredi /** Number or arguments */ 209334f485dSMiklos Szeredi unsigned numargs; 210334f485dSMiklos Szeredi 211334f485dSMiklos Szeredi /** Array of arguments */ 212334f485dSMiklos Szeredi struct fuse_arg args[3]; 213334f485dSMiklos Szeredi }; 214334f485dSMiklos Szeredi 215b2430d75SMaxim Patlasov /** FUSE page descriptor */ 216b2430d75SMaxim Patlasov struct fuse_page_desc { 217b2430d75SMaxim Patlasov unsigned int length; 218b2430d75SMaxim Patlasov unsigned int offset; 219b2430d75SMaxim Patlasov }; 220b2430d75SMaxim Patlasov 22183cfd493SMiklos Szeredi /** The request state */ 22283cfd493SMiklos Szeredi enum fuse_req_state { 22383cfd493SMiklos Szeredi FUSE_REQ_INIT = 0, 22483cfd493SMiklos Szeredi FUSE_REQ_PENDING, 22583cfd493SMiklos Szeredi FUSE_REQ_READING, 22683cfd493SMiklos Szeredi FUSE_REQ_SENT, 227a4d27e75SMiklos Szeredi FUSE_REQ_WRITING, 22883cfd493SMiklos Szeredi FUSE_REQ_FINISHED 22983cfd493SMiklos Szeredi }; 23083cfd493SMiklos Szeredi 231334f485dSMiklos Szeredi /** 232334f485dSMiklos Szeredi * A request to the client 233334f485dSMiklos Szeredi */ 234334f485dSMiklos Szeredi struct fuse_req { 235ce1d5a49SMiklos Szeredi /** This can be on either pending processing or io lists in 236ce1d5a49SMiklos Szeredi fuse_conn */ 237334f485dSMiklos Szeredi struct list_head list; 238334f485dSMiklos Szeredi 239a4d27e75SMiklos Szeredi /** Entry on the interrupts list */ 240a4d27e75SMiklos Szeredi struct list_head intr_entry; 241a4d27e75SMiklos Szeredi 242334f485dSMiklos Szeredi /** refcount */ 243334f485dSMiklos Szeredi atomic_t count; 244334f485dSMiklos Szeredi 245a4d27e75SMiklos Szeredi /** Unique ID for the interrupt request */ 246a4d27e75SMiklos Szeredi u64 intr_unique; 247a4d27e75SMiklos Szeredi 248095da6cbSMiklos Szeredi /* 249095da6cbSMiklos Szeredi * The following bitfields are either set once before the 250095da6cbSMiklos Szeredi * request is queued or setting/clearing them is protected by 251d7133114SMiklos Szeredi * fuse_conn->lock 252095da6cbSMiklos Szeredi */ 253095da6cbSMiklos Szeredi 254334f485dSMiklos Szeredi /** True if the request has reply */ 255334f485dSMiklos Szeredi unsigned isreply:1; 256334f485dSMiklos Szeredi 25751eb01e7SMiklos Szeredi /** Force sending of the request even if interrupted */ 25851eb01e7SMiklos Szeredi unsigned force:1; 25951eb01e7SMiklos Szeredi 260f9a2842eSMiklos Szeredi /** The request was aborted */ 261f9a2842eSMiklos Szeredi unsigned aborted:1; 262334f485dSMiklos Szeredi 263334f485dSMiklos Szeredi /** Request is sent in the background */ 264334f485dSMiklos Szeredi unsigned background:1; 265334f485dSMiklos Szeredi 266a4d27e75SMiklos Szeredi /** The request has been interrupted */ 267a4d27e75SMiklos Szeredi unsigned interrupted:1; 268a4d27e75SMiklos Szeredi 269334f485dSMiklos Szeredi /** Data is being copied to/from the request */ 270334f485dSMiklos Szeredi unsigned locked:1; 271334f485dSMiklos Szeredi 2729bc5dddaSMiklos Szeredi /** Request is counted as "waiting" */ 2739bc5dddaSMiklos Szeredi unsigned waiting:1; 2749bc5dddaSMiklos Szeredi 27583cfd493SMiklos Szeredi /** State of the request */ 27683cfd493SMiklos Szeredi enum fuse_req_state state; 277334f485dSMiklos Szeredi 278334f485dSMiklos Szeredi /** The request input */ 279334f485dSMiklos Szeredi struct fuse_in in; 280334f485dSMiklos Szeredi 281334f485dSMiklos Szeredi /** The request output */ 282334f485dSMiklos Szeredi struct fuse_out out; 283334f485dSMiklos Szeredi 284334f485dSMiklos Szeredi /** Used to wake up the task waiting for completion of request*/ 285334f485dSMiklos Szeredi wait_queue_head_t waitq; 286334f485dSMiklos Szeredi 287334f485dSMiklos Szeredi /** Data for asynchronous requests */ 288334f485dSMiklos Szeredi union { 289b57d4264SMiklos Szeredi struct { 2905a18ec17SMiklos Szeredi union { 291b57d4264SMiklos Szeredi struct fuse_release_in in; 2925a18ec17SMiklos Szeredi struct work_struct work; 2935a18ec17SMiklos Szeredi }; 294b0be46ebSMiklos Szeredi struct path path; 295b57d4264SMiklos Szeredi } release; 2963ec870d5SMiklos Szeredi struct fuse_init_in init_in; 2973ec870d5SMiklos Szeredi struct fuse_init_out init_out; 29808cbf542STejun Heo struct cuse_init_in cuse_init_in; 2995c5c5e51SMiklos Szeredi struct { 3005c5c5e51SMiklos Szeredi struct fuse_read_in in; 3015c5c5e51SMiklos Szeredi u64 attr_ver; 3025c5c5e51SMiklos Szeredi } read; 303b25e82e5SMiklos Szeredi struct { 304b25e82e5SMiklos Szeredi struct fuse_write_in in; 305b25e82e5SMiklos Szeredi struct fuse_write_out out; 306b25e82e5SMiklos Szeredi } write; 3072d45ba38SMiklos Szeredi struct fuse_notify_retrieve_in retrieve_in; 30871421259SMiklos Szeredi struct fuse_lk_in lk_in; 309334f485dSMiklos Szeredi } misc; 310334f485dSMiklos Szeredi 311334f485dSMiklos Szeredi /** page vector */ 3124250c066SMaxim Patlasov struct page **pages; 3134250c066SMaxim Patlasov 314b2430d75SMaxim Patlasov /** page-descriptor vector */ 315b2430d75SMaxim Patlasov struct fuse_page_desc *page_descs; 316b2430d75SMaxim Patlasov 3174250c066SMaxim Patlasov /** size of the 'pages' array */ 3184250c066SMaxim Patlasov unsigned max_pages; 3194250c066SMaxim Patlasov 3204250c066SMaxim Patlasov /** inline page vector */ 3214250c066SMaxim Patlasov struct page *inline_pages[FUSE_REQ_INLINE_PAGES]; 322334f485dSMiklos Szeredi 323b2430d75SMaxim Patlasov /** inline page-descriptor vector */ 324b2430d75SMaxim Patlasov struct fuse_page_desc inline_page_descs[FUSE_REQ_INLINE_PAGES]; 325b2430d75SMaxim Patlasov 326334f485dSMiklos Szeredi /** number of pages in vector */ 327334f485dSMiklos Szeredi unsigned num_pages; 328334f485dSMiklos Szeredi 329334f485dSMiklos Szeredi /** File used in the request (or NULL) */ 330c756e0a4SMiklos Szeredi struct fuse_file *ff; 33164c6d8edSMiklos Szeredi 3323be5a52bSMiklos Szeredi /** Inode used in the request or NULL */ 3333be5a52bSMiklos Szeredi struct inode *inode; 3343be5a52bSMiklos Szeredi 3353be5a52bSMiklos Szeredi /** Link on fi->writepages */ 3363be5a52bSMiklos Szeredi struct list_head writepages_entry; 3373be5a52bSMiklos Szeredi 33864c6d8edSMiklos Szeredi /** Request completion callback */ 33964c6d8edSMiklos Szeredi void (*end)(struct fuse_conn *, struct fuse_req *); 34033649c91SMiklos Szeredi 34133649c91SMiklos Szeredi /** Request is stolen from fuse_file->reserved_req */ 34233649c91SMiklos Szeredi struct file *stolen_file; 343334f485dSMiklos Szeredi }; 344334f485dSMiklos Szeredi 345d8a5ba45SMiklos Szeredi /** 346d8a5ba45SMiklos Szeredi * A Fuse connection. 347d8a5ba45SMiklos Szeredi * 348d8a5ba45SMiklos Szeredi * This structure is created, when the filesystem is mounted, and is 349d8a5ba45SMiklos Szeredi * destroyed, when the client device is closed and the filesystem is 350d8a5ba45SMiklos Szeredi * unmounted. 351d8a5ba45SMiklos Szeredi */ 352d8a5ba45SMiklos Szeredi struct fuse_conn { 353d7133114SMiklos Szeredi /** Lock protecting accessess to members of this structure */ 354d7133114SMiklos Szeredi spinlock_t lock; 355d7133114SMiklos Szeredi 356d2a85164SMiklos Szeredi /** Mutex protecting against directory alias creation */ 357d2a85164SMiklos Szeredi struct mutex inst_mutex; 358d2a85164SMiklos Szeredi 359bafa9654SMiklos Szeredi /** Refcount */ 360bafa9654SMiklos Szeredi atomic_t count; 361bafa9654SMiklos Szeredi 362d8a5ba45SMiklos Szeredi /** The user id for this mount */ 363499dcf20SEric W. Biederman kuid_t user_id; 364d8a5ba45SMiklos Szeredi 36587729a55SMiklos Szeredi /** The group id for this mount */ 366499dcf20SEric W. Biederman kgid_t group_id; 36787729a55SMiklos Szeredi 3681e9a4ed9SMiklos Szeredi /** The fuse mount flags for this mount */ 3691e9a4ed9SMiklos Szeredi unsigned flags; 3701e9a4ed9SMiklos Szeredi 371db50b96cSMiklos Szeredi /** Maximum read size */ 372db50b96cSMiklos Szeredi unsigned max_read; 373db50b96cSMiklos Szeredi 374413ef8cbSMiklos Szeredi /** Maximum write size */ 375413ef8cbSMiklos Szeredi unsigned max_write; 376413ef8cbSMiklos Szeredi 377334f485dSMiklos Szeredi /** Readers of the connection are waiting on this */ 378334f485dSMiklos Szeredi wait_queue_head_t waitq; 379334f485dSMiklos Szeredi 380334f485dSMiklos Szeredi /** The list of pending requests */ 381334f485dSMiklos Szeredi struct list_head pending; 382334f485dSMiklos Szeredi 383334f485dSMiklos Szeredi /** The list of requests being processed */ 384334f485dSMiklos Szeredi struct list_head processing; 385334f485dSMiklos Szeredi 386d77a1d5bSMiklos Szeredi /** The list of requests under I/O */ 387d77a1d5bSMiklos Szeredi struct list_head io; 388d77a1d5bSMiklos Szeredi 389acf99433STejun Heo /** The next unique kernel file handle */ 390acf99433STejun Heo u64 khctr; 391acf99433STejun Heo 39295668a69STejun Heo /** rbtree of fuse_files waiting for poll events indexed by ph */ 39395668a69STejun Heo struct rb_root polled_files; 39495668a69STejun Heo 3957a6d3c8bSCsaba Henk /** Maximum number of outstanding background requests */ 3967a6d3c8bSCsaba Henk unsigned max_background; 3977a6d3c8bSCsaba Henk 3987a6d3c8bSCsaba Henk /** Number of background requests at which congestion starts */ 3997a6d3c8bSCsaba Henk unsigned congestion_threshold; 4007a6d3c8bSCsaba Henk 40108a53cdcSMiklos Szeredi /** Number of requests currently in the background */ 40208a53cdcSMiklos Szeredi unsigned num_background; 40308a53cdcSMiklos Szeredi 404d12def1bSMiklos Szeredi /** Number of background requests currently queued for userspace */ 405d12def1bSMiklos Szeredi unsigned active_background; 406d12def1bSMiklos Szeredi 407d12def1bSMiklos Szeredi /** The list of background requests set aside for later queuing */ 408d12def1bSMiklos Szeredi struct list_head bg_queue; 409d12def1bSMiklos Szeredi 410a4d27e75SMiklos Szeredi /** Pending interrupts */ 411a4d27e75SMiklos Szeredi struct list_head interrupts; 412a4d27e75SMiklos Szeredi 41307e77dcaSMiklos Szeredi /** Queue of pending forgets */ 41407e77dcaSMiklos Szeredi struct fuse_forget_link forget_list_head; 41507e77dcaSMiklos Szeredi struct fuse_forget_link *forget_list_tail; 41607e77dcaSMiklos Szeredi 41707e77dcaSMiklos Szeredi /** Batching of FORGET requests (positive indicates FORGET batch) */ 41807e77dcaSMiklos Szeredi int forget_batch; 41907e77dcaSMiklos Szeredi 42008a53cdcSMiklos Szeredi /** Flag indicating if connection is blocked. This will be 42108a53cdcSMiklos Szeredi the case before the INIT reply is received, and if there 42208a53cdcSMiklos Szeredi are too many outstading backgrounds requests */ 42308a53cdcSMiklos Szeredi int blocked; 42408a53cdcSMiklos Szeredi 42508a53cdcSMiklos Szeredi /** waitq for blocked connection */ 42608a53cdcSMiklos Szeredi wait_queue_head_t blocked_waitq; 42708a53cdcSMiklos Szeredi 428de5e3decSMiklos Szeredi /** waitq for reserved requests */ 429de5e3decSMiklos Szeredi wait_queue_head_t reserved_req_waitq; 430de5e3decSMiklos Szeredi 431334f485dSMiklos Szeredi /** The next unique request id */ 432334f485dSMiklos Szeredi u64 reqctr; 433334f485dSMiklos Szeredi 43469a53bf2SMiklos Szeredi /** Connection established, cleared on umount, connection 43569a53bf2SMiklos Szeredi abort and device release */ 436095da6cbSMiklos Szeredi unsigned connected; 4371e9a4ed9SMiklos Szeredi 438095da6cbSMiklos Szeredi /** Connection failed (version mismatch). Cannot race with 439095da6cbSMiklos Szeredi setting other bitfields since it is only set once in INIT 440095da6cbSMiklos Szeredi reply, before any other request, and never cleared */ 441334f485dSMiklos Szeredi unsigned conn_error:1; 442334f485dSMiklos Szeredi 4430ec7ca41SMiklos Szeredi /** Connection successful. Only set in INIT */ 4440ec7ca41SMiklos Szeredi unsigned conn_init:1; 4450ec7ca41SMiklos Szeredi 4469cd68455SMiklos Szeredi /** Do readpages asynchronously? Only set in INIT */ 4479cd68455SMiklos Szeredi unsigned async_read:1; 4489cd68455SMiklos Szeredi 4496ff958edSMiklos Szeredi /** Do not send separate SETATTR request before open(O_TRUNC) */ 4506ff958edSMiklos Szeredi unsigned atomic_o_trunc:1; 4516ff958edSMiklos Szeredi 45233670fa2SMiklos Szeredi /** Filesystem supports NFS exporting. Only set in INIT */ 45333670fa2SMiklos Szeredi unsigned export_support:1; 45433670fa2SMiklos Szeredi 455a325f9b9STejun Heo /** Set if bdi is valid */ 456a325f9b9STejun Heo unsigned bdi_initialized:1; 457a325f9b9STejun Heo 458095da6cbSMiklos Szeredi /* 459095da6cbSMiklos Szeredi * The following bitfields are only for optimization purposes 460095da6cbSMiklos Szeredi * and hence races in setting them will not cause malfunction 461095da6cbSMiklos Szeredi */ 462095da6cbSMiklos Szeredi 463b6aeadedSMiklos Szeredi /** Is fsync not implemented by fs? */ 464b6aeadedSMiklos Szeredi unsigned no_fsync:1; 465b6aeadedSMiklos Szeredi 46682547981SMiklos Szeredi /** Is fsyncdir not implemented by fs? */ 46782547981SMiklos Szeredi unsigned no_fsyncdir:1; 46882547981SMiklos Szeredi 469b6aeadedSMiklos Szeredi /** Is flush not implemented by fs? */ 470b6aeadedSMiklos Szeredi unsigned no_flush:1; 471b6aeadedSMiklos Szeredi 47292a8780eSMiklos Szeredi /** Is setxattr not implemented by fs? */ 47392a8780eSMiklos Szeredi unsigned no_setxattr:1; 47492a8780eSMiklos Szeredi 47592a8780eSMiklos Szeredi /** Is getxattr not implemented by fs? */ 47692a8780eSMiklos Szeredi unsigned no_getxattr:1; 47792a8780eSMiklos Szeredi 47892a8780eSMiklos Szeredi /** Is listxattr not implemented by fs? */ 47992a8780eSMiklos Szeredi unsigned no_listxattr:1; 48092a8780eSMiklos Szeredi 48192a8780eSMiklos Szeredi /** Is removexattr not implemented by fs? */ 48292a8780eSMiklos Szeredi unsigned no_removexattr:1; 48392a8780eSMiklos Szeredi 48437fb3a30SMiklos Szeredi /** Are posix file locking primitives not implemented by fs? */ 48571421259SMiklos Szeredi unsigned no_lock:1; 48671421259SMiklos Szeredi 48731d40d74SMiklos Szeredi /** Is access not implemented by fs? */ 48831d40d74SMiklos Szeredi unsigned no_access:1; 48931d40d74SMiklos Szeredi 490fd72faacSMiklos Szeredi /** Is create not implemented by fs? */ 491fd72faacSMiklos Szeredi unsigned no_create:1; 492fd72faacSMiklos Szeredi 493a4d27e75SMiklos Szeredi /** Is interrupt not implemented by fs? */ 494a4d27e75SMiklos Szeredi unsigned no_interrupt:1; 495a4d27e75SMiklos Szeredi 496b2d2272fSMiklos Szeredi /** Is bmap not implemented by fs? */ 497b2d2272fSMiklos Szeredi unsigned no_bmap:1; 498b2d2272fSMiklos Szeredi 49995668a69STejun Heo /** Is poll not implemented by fs? */ 50095668a69STejun Heo unsigned no_poll:1; 50195668a69STejun Heo 50278bb6cb9SMiklos Szeredi /** Do multi-page cached writes */ 50378bb6cb9SMiklos Szeredi unsigned big_writes:1; 50478bb6cb9SMiklos Szeredi 505e0a43ddcSMiklos Szeredi /** Don't apply umask to creation modes */ 506e0a43ddcSMiklos Szeredi unsigned dont_mask:1; 507e0a43ddcSMiklos Szeredi 50837fb3a30SMiklos Szeredi /** Are BSD file locking primitives not implemented by fs? */ 50937fb3a30SMiklos Szeredi unsigned no_flock:1; 51037fb3a30SMiklos Szeredi 511519c6040SMiklos Szeredi /** Is fallocate not implemented by fs? */ 512519c6040SMiklos Szeredi unsigned no_fallocate:1; 513519c6040SMiklos Szeredi 51472d0d248SBrian Foster /** Use enhanced/automatic page cache invalidation. */ 51572d0d248SBrian Foster unsigned auto_inval_data:1; 51672d0d248SBrian Foster 517634734b6SEric Wong /** Does the filesystem support readdirplus? */ 5180b05b183SAnand V. Avati unsigned do_readdirplus:1; 5190b05b183SAnand V. Avati 520634734b6SEric Wong /** Does the filesystem want adaptive readdirplus? */ 521634734b6SEric Wong unsigned readdirplus_auto:1; 522634734b6SEric Wong 5230cd5b885SMiklos Szeredi /** The number of requests waiting for completion */ 5240cd5b885SMiklos Szeredi atomic_t num_waiting; 5250cd5b885SMiklos Szeredi 52645714d65SMiklos Szeredi /** Negotiated minor version */ 52745714d65SMiklos Szeredi unsigned minor; 52845714d65SMiklos Szeredi 529d8a5ba45SMiklos Szeredi /** Backing dev info */ 530d8a5ba45SMiklos Szeredi struct backing_dev_info bdi; 531f543f253SMiklos Szeredi 532bafa9654SMiklos Szeredi /** Entry on the fuse_conn_list */ 533bafa9654SMiklos Szeredi struct list_head entry; 534bafa9654SMiklos Szeredi 535b6f2fcbcSMiklos Szeredi /** Device ID from super block */ 536b6f2fcbcSMiklos Szeredi dev_t dev; 537bafa9654SMiklos Szeredi 538bafa9654SMiklos Szeredi /** Dentries in the control filesystem */ 539bafa9654SMiklos Szeredi struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES]; 540bafa9654SMiklos Szeredi 541bafa9654SMiklos Szeredi /** number of dentries used in the above array */ 542bafa9654SMiklos Szeredi int ctl_ndents; 543385a17bfSJeff Dike 544385a17bfSJeff Dike /** O_ASYNC requests */ 545385a17bfSJeff Dike struct fasync_struct *fasync; 5469c8ef561SMiklos Szeredi 5479c8ef561SMiklos Szeredi /** Key for lock owner ID scrambling */ 5489c8ef561SMiklos Szeredi u32 scramble_key[4]; 5490ec7ca41SMiklos Szeredi 5500ec7ca41SMiklos Szeredi /** Reserved request for the DESTROY message */ 5510ec7ca41SMiklos Szeredi struct fuse_req *destroy_req; 5521fb69e78SMiklos Szeredi 5531fb69e78SMiklos Szeredi /** Version counter for attribute changes */ 5541fb69e78SMiklos Szeredi u64 attr_version; 55543901aabSTejun Heo 55643901aabSTejun Heo /** Called on final put */ 55743901aabSTejun Heo void (*release)(struct fuse_conn *); 5583b463ae0SJohn Muir 5593b463ae0SJohn Muir /** Super block for this connection. */ 5603b463ae0SJohn Muir struct super_block *sb; 5613b463ae0SJohn Muir 5623b463ae0SJohn Muir /** Read/write semaphore to hold when accessing sb. */ 5633b463ae0SJohn Muir struct rw_semaphore killsb; 564d8a5ba45SMiklos Szeredi }; 565d8a5ba45SMiklos Szeredi 566d8a5ba45SMiklos Szeredi static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) 567d8a5ba45SMiklos Szeredi { 5686383bdaaSMiklos Szeredi return sb->s_fs_info; 569d8a5ba45SMiklos Szeredi } 570d8a5ba45SMiklos Szeredi 571d8a5ba45SMiklos Szeredi static inline struct fuse_conn *get_fuse_conn(struct inode *inode) 572d8a5ba45SMiklos Szeredi { 573d8a5ba45SMiklos Szeredi return get_fuse_conn_super(inode->i_sb); 574d8a5ba45SMiklos Szeredi } 575d8a5ba45SMiklos Szeredi 576d8a5ba45SMiklos Szeredi static inline struct fuse_inode *get_fuse_inode(struct inode *inode) 577d8a5ba45SMiklos Szeredi { 578d8a5ba45SMiklos Szeredi return container_of(inode, struct fuse_inode, inode); 579d8a5ba45SMiklos Szeredi } 580d8a5ba45SMiklos Szeredi 581d8a5ba45SMiklos Szeredi static inline u64 get_node_id(struct inode *inode) 582d8a5ba45SMiklos Szeredi { 583d8a5ba45SMiklos Szeredi return get_fuse_inode(inode)->nodeid; 584d8a5ba45SMiklos Szeredi } 585d8a5ba45SMiklos Szeredi 586334f485dSMiklos Szeredi /** Device operations */ 5874b6f5d20SArjan van de Ven extern const struct file_operations fuse_dev_operations; 588334f485dSMiklos Szeredi 5894269590aSAl Viro extern const struct dentry_operations fuse_dentry_operations; 590dbd561d2SMiklos Szeredi 591d8a5ba45SMiklos Szeredi /** 5923b463ae0SJohn Muir * Inode to nodeid comparison. 5933b463ae0SJohn Muir */ 5943b463ae0SJohn Muir int fuse_inode_eq(struct inode *inode, void *_nodeidp); 5953b463ae0SJohn Muir 5963b463ae0SJohn Muir /** 597e5e5558eSMiklos Szeredi * Get a filled in inode 598e5e5558eSMiklos Szeredi */ 599b48badf0SMiklos Szeredi struct inode *fuse_iget(struct super_block *sb, u64 nodeid, 6001fb69e78SMiklos Szeredi int generation, struct fuse_attr *attr, 6011fb69e78SMiklos Szeredi u64 attr_valid, u64 attr_version); 602e5e5558eSMiklos Szeredi 60333670fa2SMiklos Szeredi int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name, 60433670fa2SMiklos Szeredi struct fuse_entry_out *outarg, struct inode **inode); 60533670fa2SMiklos Szeredi 606e5e5558eSMiklos Szeredi /** 607e5e5558eSMiklos Szeredi * Send FORGET command 608e5e5558eSMiklos Szeredi */ 60907e77dcaSMiklos Szeredi void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, 610b48badf0SMiklos Szeredi u64 nodeid, u64 nlookup); 611e5e5558eSMiklos Szeredi 61207e77dcaSMiklos Szeredi struct fuse_forget_link *fuse_alloc_forget(void); 61307e77dcaSMiklos Szeredi 6140b05b183SAnand V. Avati /* Used by READDIRPLUS */ 6150b05b183SAnand V. Avati void fuse_force_forget(struct file *file, u64 nodeid); 6160b05b183SAnand V. Avati 617e5e5558eSMiklos Szeredi /** 618361b1eb5SMiklos Szeredi * Initialize READ or READDIR request 61904730fefSMiklos Szeredi */ 620a6643094SMiklos Szeredi void fuse_read_fill(struct fuse_req *req, struct file *file, 6212106cb18SMiklos Szeredi loff_t pos, size_t count, int opcode); 62204730fefSMiklos Szeredi 62304730fefSMiklos Szeredi /** 62404730fefSMiklos Szeredi * Send OPEN or OPENDIR request 62504730fefSMiklos Szeredi */ 62691fe96b4SMiklos Szeredi int fuse_open_common(struct inode *inode, struct file *file, bool isdir); 62704730fefSMiklos Szeredi 628acf99433STejun Heo struct fuse_file *fuse_file_alloc(struct fuse_conn *fc); 629c7b7143cSMiklos Szeredi struct fuse_file *fuse_file_get(struct fuse_file *ff); 630fd72faacSMiklos Szeredi void fuse_file_free(struct fuse_file *ff); 631c7b7143cSMiklos Szeredi void fuse_finish_open(struct inode *inode, struct file *file); 632fd72faacSMiklos Szeredi 6338b0797a4SMiklos Szeredi void fuse_sync_release(struct fuse_file *ff, int flags); 634c756e0a4SMiklos Szeredi 63504730fefSMiklos Szeredi /** 63604730fefSMiklos Szeredi * Send RELEASE or RELEASEDIR request 63704730fefSMiklos Szeredi */ 6388b0797a4SMiklos Szeredi void fuse_release_common(struct file *file, int opcode); 63904730fefSMiklos Szeredi 64004730fefSMiklos Szeredi /** 64182547981SMiklos Szeredi * Send FSYNC or FSYNCDIR request 64282547981SMiklos Szeredi */ 64302c24a82SJosef Bacik int fuse_fsync_common(struct file *file, loff_t start, loff_t end, 64402c24a82SJosef Bacik int datasync, int isdir); 64582547981SMiklos Szeredi 64682547981SMiklos Szeredi /** 64795668a69STejun Heo * Notify poll wakeup 64895668a69STejun Heo */ 64995668a69STejun Heo int fuse_notify_poll_wakeup(struct fuse_conn *fc, 65095668a69STejun Heo struct fuse_notify_poll_wakeup_out *outarg); 65195668a69STejun Heo 65295668a69STejun Heo /** 6531779381dSMiklos Szeredi * Initialize file operations on a regular file 654b6aeadedSMiklos Szeredi */ 655b6aeadedSMiklos Szeredi void fuse_init_file_inode(struct inode *inode); 656b6aeadedSMiklos Szeredi 657b6aeadedSMiklos Szeredi /** 6581779381dSMiklos Szeredi * Initialize inode operations on regular files and special files 659e5e5558eSMiklos Szeredi */ 660e5e5558eSMiklos Szeredi void fuse_init_common(struct inode *inode); 661e5e5558eSMiklos Szeredi 662e5e5558eSMiklos Szeredi /** 6631779381dSMiklos Szeredi * Initialize inode and file operations on a directory 664e5e5558eSMiklos Szeredi */ 665e5e5558eSMiklos Szeredi void fuse_init_dir(struct inode *inode); 666e5e5558eSMiklos Szeredi 667e5e5558eSMiklos Szeredi /** 6681779381dSMiklos Szeredi * Initialize inode operations on a symlink 669e5e5558eSMiklos Szeredi */ 670e5e5558eSMiklos Szeredi void fuse_init_symlink(struct inode *inode); 671e5e5558eSMiklos Szeredi 672e5e5558eSMiklos Szeredi /** 673e5e5558eSMiklos Szeredi * Change attributes of an inode 674e5e5558eSMiklos Szeredi */ 6751fb69e78SMiklos Szeredi void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, 6761fb69e78SMiklos Szeredi u64 attr_valid, u64 attr_version); 677e5e5558eSMiklos Szeredi 6783be5a52bSMiklos Szeredi void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, 6793be5a52bSMiklos Szeredi u64 attr_valid); 6803be5a52bSMiklos Szeredi 681e5e5558eSMiklos Szeredi /** 682334f485dSMiklos Szeredi * Initialize the client device 683334f485dSMiklos Szeredi */ 684334f485dSMiklos Szeredi int fuse_dev_init(void); 685334f485dSMiklos Szeredi 686334f485dSMiklos Szeredi /** 687334f485dSMiklos Szeredi * Cleanup the client device 688334f485dSMiklos Szeredi */ 689334f485dSMiklos Szeredi void fuse_dev_cleanup(void); 690334f485dSMiklos Szeredi 691bafa9654SMiklos Szeredi int fuse_ctl_init(void); 692bafa9654SMiklos Szeredi void fuse_ctl_cleanup(void); 693bafa9654SMiklos Szeredi 694334f485dSMiklos Szeredi /** 695334f485dSMiklos Szeredi * Allocate a request 696334f485dSMiklos Szeredi */ 6974250c066SMaxim Patlasov struct fuse_req *fuse_request_alloc(unsigned npages); 698334f485dSMiklos Szeredi 6994250c066SMaxim Patlasov struct fuse_req *fuse_request_alloc_nofs(unsigned npages); 7003be5a52bSMiklos Szeredi 701334f485dSMiklos Szeredi /** 702334f485dSMiklos Szeredi * Free a request 703334f485dSMiklos Szeredi */ 704334f485dSMiklos Szeredi void fuse_request_free(struct fuse_req *req); 705334f485dSMiklos Szeredi 706334f485dSMiklos Szeredi /** 707b111c8c0SMaxim Patlasov * Get a request, may fail with -ENOMEM, 708b111c8c0SMaxim Patlasov * caller should specify # elements in req->pages[] explicitly 709334f485dSMiklos Szeredi */ 710b111c8c0SMaxim Patlasov struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages); 711*8b41e671SMaxim Patlasov struct fuse_req *fuse_get_req_for_background(struct fuse_conn *fc, 712*8b41e671SMaxim Patlasov unsigned npages); 713b111c8c0SMaxim Patlasov 714b111c8c0SMaxim Patlasov /** 715b111c8c0SMaxim Patlasov * Get a request, may fail with -ENOMEM, 716b111c8c0SMaxim Patlasov * useful for callers who doesn't use req->pages[] 717b111c8c0SMaxim Patlasov */ 718b111c8c0SMaxim Patlasov static inline struct fuse_req *fuse_get_req_nopages(struct fuse_conn *fc) 719b111c8c0SMaxim Patlasov { 720b111c8c0SMaxim Patlasov return fuse_get_req(fc, 0); 721b111c8c0SMaxim Patlasov } 722334f485dSMiklos Szeredi 723334f485dSMiklos Szeredi /** 72433649c91SMiklos Szeredi * Gets a requests for a file operation, always succeeds 72533649c91SMiklos Szeredi */ 726b111c8c0SMaxim Patlasov struct fuse_req *fuse_get_req_nofail_nopages(struct fuse_conn *fc, 727b111c8c0SMaxim Patlasov struct file *file); 72833649c91SMiklos Szeredi 72933649c91SMiklos Szeredi /** 730ce1d5a49SMiklos Szeredi * Decrement reference count of a request. If count goes to zero free 731ce1d5a49SMiklos Szeredi * the request. 732334f485dSMiklos Szeredi */ 733334f485dSMiklos Szeredi void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req); 734334f485dSMiklos Szeredi 735334f485dSMiklos Szeredi /** 7367c352bdfSMiklos Szeredi * Send a request (synchronous) 737334f485dSMiklos Szeredi */ 738b93f858aSTejun Heo void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req); 739334f485dSMiklos Szeredi 740334f485dSMiklos Szeredi /** 741334f485dSMiklos Szeredi * Send a request in the background 742334f485dSMiklos Szeredi */ 743b93f858aSTejun Heo void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req); 744334f485dSMiklos Szeredi 745b93f858aSTejun Heo void fuse_request_send_background_locked(struct fuse_conn *fc, 746b93f858aSTejun Heo struct fuse_req *req); 7473be5a52bSMiklos Szeredi 7485a5fb1eaSMiklos Szeredi /* Abort all requests */ 74969a53bf2SMiklos Szeredi void fuse_abort_conn(struct fuse_conn *fc); 75069a53bf2SMiklos Szeredi 7511e9a4ed9SMiklos Szeredi /** 752e5e5558eSMiklos Szeredi * Invalidate inode attributes 753e5e5558eSMiklos Szeredi */ 754e5e5558eSMiklos Szeredi void fuse_invalidate_attr(struct inode *inode); 755bafa9654SMiklos Szeredi 756dbd561d2SMiklos Szeredi void fuse_invalidate_entry_cache(struct dentry *entry); 757dbd561d2SMiklos Szeredi 758bafa9654SMiklos Szeredi /** 759bafa9654SMiklos Szeredi * Acquire reference to fuse_conn 760bafa9654SMiklos Szeredi */ 761bafa9654SMiklos Szeredi struct fuse_conn *fuse_conn_get(struct fuse_conn *fc); 762bafa9654SMiklos Szeredi 76308cbf542STejun Heo void fuse_conn_kill(struct fuse_conn *fc); 76408cbf542STejun Heo 765bafa9654SMiklos Szeredi /** 7660d179aa5STejun Heo * Initialize fuse_conn 7670d179aa5STejun Heo */ 768a325f9b9STejun Heo void fuse_conn_init(struct fuse_conn *fc); 7690d179aa5STejun Heo 7700d179aa5STejun Heo /** 771bafa9654SMiklos Szeredi * Release reference to fuse_conn 772bafa9654SMiklos Szeredi */ 773bafa9654SMiklos Szeredi void fuse_conn_put(struct fuse_conn *fc); 774bafa9654SMiklos Szeredi 775bafa9654SMiklos Szeredi /** 776bafa9654SMiklos Szeredi * Add connection to control filesystem 777bafa9654SMiklos Szeredi */ 778bafa9654SMiklos Szeredi int fuse_ctl_add_conn(struct fuse_conn *fc); 779bafa9654SMiklos Szeredi 780bafa9654SMiklos Szeredi /** 781bafa9654SMiklos Szeredi * Remove connection from control filesystem 782bafa9654SMiklos Szeredi */ 783bafa9654SMiklos Szeredi void fuse_ctl_remove_conn(struct fuse_conn *fc); 784a5bfffacSTimo Savola 785a5bfffacSTimo Savola /** 786a5bfffacSTimo Savola * Is file type valid? 787a5bfffacSTimo Savola */ 788a5bfffacSTimo Savola int fuse_valid_type(int m); 789e57ac683SMiklos Szeredi 790e57ac683SMiklos Szeredi /** 791c2132c1bSAnatol Pomozov * Is current process allowed to perform filesystem operation? 792e57ac683SMiklos Szeredi */ 793c2132c1bSAnatol Pomozov int fuse_allow_current_process(struct fuse_conn *fc); 794f3332114SMiklos Szeredi 795f3332114SMiklos Szeredi u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id); 796bcb4be80SMiklos Szeredi 797bcb4be80SMiklos Szeredi int fuse_update_attributes(struct inode *inode, struct kstat *stat, 798bcb4be80SMiklos Szeredi struct file *file, bool *refreshed); 7993be5a52bSMiklos Szeredi 8003be5a52bSMiklos Szeredi void fuse_flush_writepages(struct inode *inode); 8013be5a52bSMiklos Szeredi 8023be5a52bSMiklos Szeredi void fuse_set_nowrite(struct inode *inode); 8033be5a52bSMiklos Szeredi void fuse_release_nowrite(struct inode *inode); 8045c5c5e51SMiklos Szeredi 8055c5c5e51SMiklos Szeredi u64 fuse_get_attr_version(struct fuse_conn *fc); 80629d434b3STejun Heo 8073b463ae0SJohn Muir /** 8083b463ae0SJohn Muir * File-system tells the kernel to invalidate cache for the given node id. 8093b463ae0SJohn Muir */ 8103b463ae0SJohn Muir int fuse_reverse_inval_inode(struct super_block *sb, u64 nodeid, 8113b463ae0SJohn Muir loff_t offset, loff_t len); 8123b463ae0SJohn Muir 8133b463ae0SJohn Muir /** 8143b463ae0SJohn Muir * File-system tells the kernel to invalidate parent attributes and 8153b463ae0SJohn Muir * the dentry matching parent/name. 816451d0f59SJohn Muir * 817451d0f59SJohn Muir * If the child_nodeid is non-zero and: 818451d0f59SJohn Muir * - matches the inode number for the dentry matching parent/name, 819451d0f59SJohn Muir * - is not a mount point 820451d0f59SJohn Muir * - is a file or oan empty directory 821451d0f59SJohn Muir * then the dentry is unhashed (d_delete()). 8223b463ae0SJohn Muir */ 8233b463ae0SJohn Muir int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, 824451d0f59SJohn Muir u64 child_nodeid, struct qstr *name); 8253b463ae0SJohn Muir 82608cbf542STejun Heo int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, 82708cbf542STejun Heo bool isdir); 828fb05f41fSMiklos Szeredi ssize_t fuse_direct_io(struct file *file, const struct iovec *iov, 829fb05f41fSMiklos Szeredi unsigned long nr_segs, size_t count, loff_t *ppos, 830fb05f41fSMiklos Szeredi int write); 83108cbf542STejun Heo long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, 83208cbf542STejun Heo unsigned int flags); 833b18da0c5SMiklos Szeredi long fuse_ioctl_common(struct file *file, unsigned int cmd, 834b18da0c5SMiklos Szeredi unsigned long arg, unsigned int flags); 83508cbf542STejun Heo unsigned fuse_file_poll(struct file *file, poll_table *wait); 83608cbf542STejun Heo int fuse_dev_release(struct inode *inode, struct file *file); 83708cbf542STejun Heo 838a1d75f25SMiklos Szeredi void fuse_write_update_size(struct inode *inode, loff_t pos); 839a1d75f25SMiklos Szeredi 84029d434b3STejun Heo #endif /* _FS_FUSE_I_H */ 841