fuse: add fuse_conn->release()

Add fuse_conn->release() so that fuse_conn can be embedded in other
structures.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
This commit is contained in:
Tejun Heo 2008-11-26 12:03:56 +01:00 committed by Miklos Szeredi
parent 0d179aa592
commit 43901aabd7
2 changed files with 10 additions and 1 deletions

View File

@ -465,6 +465,9 @@ struct fuse_conn {
/** Version counter for attribute changes */ /** Version counter for attribute changes */
u64 attr_version; u64 attr_version;
/** Called on final put */
void (*release)(struct fuse_conn *);
}; };
static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)

View File

@ -533,7 +533,7 @@ void fuse_conn_put(struct fuse_conn *fc)
fuse_request_free(fc->destroy_req); fuse_request_free(fc->destroy_req);
mutex_destroy(&fc->inst_mutex); mutex_destroy(&fc->inst_mutex);
bdi_destroy(&fc->bdi); bdi_destroy(&fc->bdi);
kfree(fc); fc->release(fc);
} }
} }
@ -789,6 +789,11 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
fuse_request_send_background(fc, req); fuse_request_send_background(fc, req);
} }
static void fuse_free_conn(struct fuse_conn *fc)
{
kfree(fc);
}
static int fuse_fill_super(struct super_block *sb, void *data, int silent) static int fuse_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct fuse_conn *fc; struct fuse_conn *fc;
@ -837,6 +842,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
return err; return err;
} }
fc->release = fuse_free_conn;
fc->flags = d.flags; fc->flags = d.flags;
fc->user_id = d.user_id; fc->user_id = d.user_id;
fc->group_id = d.group_id; fc->group_id = d.group_id;