public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: fuse-devel@lists.sourceforge.net, miklos@szeredi.hu,
	greg@kroah.com, linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 4/5] FUSE: add fuse_conn->release()
Date: Fri, 29 Aug 2008 03:19:03 +0900	[thread overview]
Message-ID: <1219947544-666-5-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1219947544-666-1-git-send-email-tj@kernel.org>

Add fuse_conn->release() so that fuse_conn can be embedded in other
structures.  If unspecified, the original action - kfree() - is done.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 fs/fuse/fuse_i.h |    3 +++
 fs/fuse/inode.c  |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 4795264..67f33e8 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -465,6 +465,9 @@ struct fuse_conn {
 
 	/** Version counter for attribute changes */
 	u64 attr_version;
+
+	/** Called on final put.  If implemented, should free the connection */
+	void (*release)(struct fuse_conn *);
 };
 
 static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 8d092ea..b99bb95 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -543,7 +543,11 @@ void fuse_conn_put(struct fuse_conn *fc)
 			fuse_request_free(fc->destroy_req);
 		mutex_destroy(&fc->inst_mutex);
 		bdi_destroy(&fc->bdi);
-		kfree(fc);
+
+		if (fc->release)
+			fc->release(fc);
+		else
+			kfree(fc);
 	}
 }
 EXPORT_SYMBOL_GPL(fuse_conn_put);
-- 
1.5.4.5


  parent reply	other threads:[~2008-08-28 18:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-28 18:18 [PATCHSET] CUSE: implement CUSE Tejun Heo
2008-08-28 18:19 ` [PATCH 1/5] FUSE: add fuse_ prefix to several functions Tejun Heo
2008-08-28 18:19 ` [PATCH 2/5] FUSE: export symbols to be used by CUSE Tejun Heo
2008-08-28 18:19 ` [PATCH 3/5] FUSE: separate out fuse_conn_init() from new_conn() Tejun Heo
2008-08-28 18:19 ` Tejun Heo [this message]
2008-08-28 18:19 ` [PATCH 5/5] CUSE: implement CUSE - Character device in Userspace Tejun Heo
2008-08-28 20:07   ` Andrew Morton
2008-08-28 22:15     ` Greg KH
2008-08-28 22:32       ` Andrew Morton
2008-08-29  2:09     ` Tejun Heo
2008-08-29  2:20       ` Andrew Morton
2008-08-29 15:27       ` Nick Bowler
2008-08-29  5:50 ` [fuse-devel] [PATCHSET] CUSE: implement CUSE Mike Hommey
2008-08-29  5:52   ` Tejun Heo
2008-08-29 18:50     ` Archie Cobbs
2008-08-30 12:30       ` Tejun Heo
2008-08-30 18:56         ` Mike Hommey
2008-09-01  7:20           ` Goswin von Brederlow
2008-09-01  7:38             ` Mike Hommey
2008-08-30 22:39         ` Archie Cobbs
2008-08-31  4:52   ` hooanon05
2008-08-30 16:35 ` Goswin von Brederlow
  -- strict thread matches above, loose matches on Subject: below --
2008-11-20 14:22 [PATCHSET] CUSE: implement CUSE, take #2 Tejun Heo
2008-11-20 14:23 ` [PATCH 4/5] FUSE: add fuse_conn->release() Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1219947544-666-5-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox