public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Mike Galbraith" <efault@gmx.de>,
	"Paul Mackerras" <paulus@samba.org>
Subject: Re: [PATCH 1/3] rbtree: Introduce rb_for_each_entry
Date: Wed, 13 Jan 2010 14:16:09 +0100	[thread overview]
Message-ID: <1263388569.4244.215.camel@laptop> (raw)
In-Reply-To: <1263387673-15231-1-git-send-email-acme@infradead.org>

On Wed, 2010-01-13 at 11:01 -0200, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Similar to list_for_each_entry, helps reducing boilerplate in many
> places and makes rbtrees closer to list.h macros.
> 
> First conversion will be in the tools/perf.

I'm still not sure you really want to do this, it might give people the
impression its a sane thing to do ;-)

> Cc: Frédéric Weisbecker <fweisbec@gmail.com>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  include/linux/rbtree.h |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
> index 9c29541..044b150 100644
> --- a/include/linux/rbtree.h
> +++ b/include/linux/rbtree.h
> @@ -158,4 +158,16 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
>  	*rb_link = node;
>  }
>  
> +/**
> + * rb_for_each_entry - iterate over rbtree of given type
> + * @pos:	the type * to hold the current entry being traversed
> + * @node:	the rb_node to hold the current entry being traversed
> + * @root:	the root for your tree.
> + * @member:	the name of the rb_node within the struct.
> + */
> +#define rb_for_each_entry(pos, node, root, member)			\
> +	for (node = rb_first(root);					\
> +	     node && (pos = rb_entry(node, typeof(*pos), member));	\
> +	     node = rb_next(node))
> +
>  #endif	/* _LINUX_RBTREE_H */



  parent reply	other threads:[~2010-01-13 13:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 13:01 [PATCH 1/3] rbtree: Introduce rb_for_each_entry Arnaldo Carvalho de Melo
2010-01-13 13:01 ` [PATCH 2/3] perf tools: Use rb_for_each_entry Arnaldo Carvalho de Melo
2010-01-13 13:01 ` [PATCH 3/3] perf tools: Encode kernel module mappings in perf.data Arnaldo Carvalho de Melo
2010-01-13 13:16 ` Peter Zijlstra [this message]
2010-01-13 13:34   ` [PATCH 1/3] rbtree: Introduce rb_for_each_entry Frederic Weisbecker
2010-01-13 13:36     ` Peter Zijlstra
2010-01-13 13:52     ` Arnaldo Carvalho de Melo
2010-01-13 13:58       ` Peter Zijlstra
2010-01-13 14:13         ` Arnaldo Carvalho de Melo
2010-01-13 14:18           ` Peter Zijlstra
2010-01-13 14:22             ` Arnaldo Carvalho de Melo
2010-01-13 14:28             ` Frederic Weisbecker
2010-01-13 15:26             ` Arnaldo Carvalho de Melo

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=1263388569.4244.215.camel@laptop \
    --to=peterz@infradead.org \
    --cc=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /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