aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/fuse_i.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r--fs/fuse/fuse_i.h53
1 files changed, 46 insertions, 7 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 25f8581a770c..ac12b01f4446 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -14,6 +14,7 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/backing-dev.h> 16#include <linux/backing-dev.h>
17#include <linux/mutex.h>
17 18
18/** Max number of pages that can be used in a single read request */ 19/** Max number of pages that can be used in a single read request */
19#define FUSE_MAX_PAGES_PER_REQ 32 20#define FUSE_MAX_PAGES_PER_REQ 32
@@ -24,6 +25,9 @@
24/** It could be as large as PATH_MAX, but would that have any uses? */ 25/** It could be as large as PATH_MAX, but would that have any uses? */
25#define FUSE_NAME_MAX 1024 26#define FUSE_NAME_MAX 1024
26 27
28/** Number of dentries for each connection in the control filesystem */
29#define FUSE_CTL_NUM_DENTRIES 3
30
27/** If the FUSE_DEFAULT_PERMISSIONS flag is given, the filesystem 31/** If the FUSE_DEFAULT_PERMISSIONS flag is given, the filesystem
28 module will check permissions based on the file mode. Otherwise no 32 module will check permissions based on the file mode. Otherwise no
29 permission checking is done in the kernel */ 33 permission checking is done in the kernel */
@@ -33,6 +37,11 @@
33 doing the mount will be allowed to access the filesystem */ 37 doing the mount will be allowed to access the filesystem */
34#define FUSE_ALLOW_OTHER (1 << 1) 38#define FUSE_ALLOW_OTHER (1 << 1)
35 39
40/** List of active connections */
41extern struct list_head fuse_conn_list;
42
43/** Global mutex protecting fuse_conn_list and the control filesystem */
44extern struct mutex fuse_mutex;
36 45
37/** FUSE inode */ 46/** FUSE inode */
38struct fuse_inode { 47struct fuse_inode {
@@ -216,6 +225,9 @@ struct fuse_conn {
216 /** Lock protecting accessess to members of this structure */ 225 /** Lock protecting accessess to members of this structure */
217 spinlock_t lock; 226 spinlock_t lock;
218 227
228 /** Refcount */
229 atomic_t count;
230
219 /** The user id for this mount */ 231 /** The user id for this mount */
220 uid_t user_id; 232 uid_t user_id;
221 233
@@ -310,8 +322,17 @@ struct fuse_conn {
310 /** Backing dev info */ 322 /** Backing dev info */
311 struct backing_dev_info bdi; 323 struct backing_dev_info bdi;
312 324
313 /** kobject */ 325 /** Entry on the fuse_conn_list */
314 struct kobject kobj; 326 struct list_head entry;
327
328 /** Unique ID */
329 u64 id;
330
331 /** Dentries in the control filesystem */
332 struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
333
334 /** number of dentries used in the above array */
335 int ctl_ndents;
315 336
316 /** O_ASYNC requests */ 337 /** O_ASYNC requests */
317 struct fasync_struct *fasync; 338 struct fasync_struct *fasync;
@@ -327,11 +348,6 @@ static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
327 return get_fuse_conn_super(inode->i_sb); 348 return get_fuse_conn_super(inode->i_sb);
328} 349}
329 350
330static inline struct fuse_conn *get_fuse_conn_kobj(struct kobject *obj)
331{
332 return container_of(obj, struct fuse_conn, kobj);
333}
334
335static inline struct fuse_inode *get_fuse_inode(struct inode *inode) 351static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
336{ 352{
337 return container_of(inode, struct fuse_inode, inode); 353 return container_of(inode, struct fuse_inode, inode);
@@ -422,6 +438,9 @@ int fuse_dev_init(void);
422 */ 438 */
423void fuse_dev_cleanup(void); 439void fuse_dev_cleanup(void);
424 440
441int fuse_ctl_init(void);
442void fuse_ctl_cleanup(void);
443
425/** 444/**
426 * Allocate a request 445 * Allocate a request
427 */ 446 */
@@ -470,3 +489,23 @@ int fuse_do_getattr(struct inode *inode);
470 * Invalidate inode attributes 489 * Invalidate inode attributes
471 */ 490 */
472void fuse_invalidate_attr(struct inode *inode); 491void fuse_invalidate_attr(struct inode *inode);
492
493/**
494 * Acquire reference to fuse_conn
495 */
496struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
497
498/**
499 * Release reference to fuse_conn
500 */
501void fuse_conn_put(struct fuse_conn *fc);
502
503/**
504 * Add connection to control filesystem
505 */
506int fuse_ctl_add_conn(struct fuse_conn *fc);
507
508/**
509 * Remove connection from control filesystem
510 */
511void fuse_ctl_remove_conn(struct fuse_conn *fc);