2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU GPL.
9 #include <linux/fuse.h>
11 #include <linux/wait.h>
12 #include <linux/list.h>
13 #include <linux/spinlock.h>
15 #include <linux/backing-dev.h>
16 #include <asm/semaphore.h>
23 /** Unique ID, which identifies the inode between userspace
27 /** Time in jiffies until the file attributes are valid */
34 * This structure is created, when the filesystem is mounted, and is
35 * destroyed, when the client device is closed and the filesystem is
39 /** The superblock of the mounted filesystem */
40 struct super_block *sb;
42 /** The user id for this mount */
45 /** Backing dev info */
46 struct backing_dev_info bdi;
49 static inline struct fuse_conn **get_fuse_conn_super_p(struct super_block *sb)
51 return (struct fuse_conn **) &sb->s_fs_info;
54 static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
56 return *get_fuse_conn_super_p(sb);
59 static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
61 return get_fuse_conn_super(inode->i_sb);
64 static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
66 return container_of(inode, struct fuse_inode, inode);
69 static inline u64 get_node_id(struct inode *inode)
71 return get_fuse_inode(inode)->nodeid;
75 * This is the single global spinlock which protects FUSE's structures
77 * The following data is protected by this lock:
79 * - the s_fs_info field of the super block
80 * - the sb (super_block) field in fuse_conn
82 extern spinlock_t fuse_lock;
85 * Check if the connection can be released, and if yes, then free the
86 * connection structure
88 void fuse_release_conn(struct fuse_conn *fc);