From: laijs@cn.fujitsu.com (Lai Jiangshan)
Subject: [ltt-dev] [PATCH take2 08/13] get&put chan&chan_buf's reference
Date: Thu, 05 Feb 2009 11:31:42 +0800 [thread overview]
Message-ID: <498A5D9E.3070301@cn.fujitsu.com> (raw)
these 4 APIs is for get and put struct rchan or struct chan_buf's
reference.
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
diff --git a/include/linux/ltt-relay.h b/include/linux/ltt-relay.h
index 1225a6a..173b557 100644
--- a/include/linux/ltt-relay.h
+++ b/include/linux/ltt-relay.h
@@ -170,6 +173,18 @@ struct rchan *ltt_relay_open(const char *base_filename,
void *private_data);
extern void ltt_relay_close(struct rchan *chan);
+static inline void ltt_relay_get_chan(struct rchan *chan)
+{
+ kref_get(&chan->kref);
+}
+void ltt_relay_put_chan(struct rchan *chan);
+
+static inline void ltt_relay_get_chan_buf(struct rchan_buf *buf)
+{
+ kref_get(&buf->kref);
+}
+void ltt_relay_put_chan_buf(struct rchan_buf *buf);
+
/*
* exported ltt_relay file operations, ltt/ltt-relay-alloc.c
*/
diff --git a/ltt/ltt-relay-alloc.c b/ltt/ltt-relay-alloc.c
index 80e856c..4d9489d 100644
--- a/ltt/ltt-relay-alloc.c
+++ b/ltt/ltt-relay-alloc.c
@@ -116,6 +116,12 @@ static void relay_destroy_channel(struct kref *kref)
kfree(chan);
}
+void ltt_relay_put_chan(struct rchan *chan)
+{
+ kref_put(&chan->kref, relay_destroy_channel);
+}
+EXPORT_SYMBOL_GPL(ltt_relay_put_chan);
+
/**
* relay_destroy_buf - destroy an rchan_buf struct and associated buffer
* @buf: the buffer struct
@@ -150,6 +156,12 @@ static void relay_remove_buf(struct kref *kref)
relay_destroy_buf(buf);
}
+void ltt_relay_put_chan_buf(struct rchan_buf *buf)
+{
+ kref_put(&buf->kref, relay_remove_buf);
+}
+EXPORT_SYMBOL_GPL(ltt_relay_put_chan_buf);
+
/*
* High-level relay kernel API and associated functions.
*/
next reply other threads:[~2009-02-05 3:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 3:31 Lai Jiangshan [this message]
2009-02-23 19:14 ` Mathieu Desnoyers
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=498A5D9E.3070301@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
/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