[ltt-dev] [PATCH 08/13] get&put chan&chan_buf's reference

Mathieu Desnoyers compudj at krystal.dyndns.org
Thu Jan 15 14:23:30 EST 2009


* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> 
> these 4 APIs is for get and put struct rchan or struct chan_buf's
> reference.
> 

Acked-by: Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>

> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
>  b/ltt/ltt-relay-alloc.c   |   12 ++++++++++++
>  include/linux/ltt-relay.h |   12 ++++++++++++
>  2 files changed, 24 insertions(+)
> 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.
>   */
> 
> 
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




More information about the lttng-dev mailing list