mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] [Patch 1/6] statistics infrastructure - prerequisite: list operation
@ 2006-05-17 18:50 Martin Peschke
  2006-05-18  4:34 ` Randy.Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Peschke @ 2006-05-17 18:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Chase Venters, Nick Piggin, Keith Owens, Andrew Morton,
	Christoph Lameter, Frank Ch. Eigler, Peter Chubb, hch, arjan, ak

This patch adds another list_for_each_* derivate. I can't work around it
because there is a list that I need to search both ways.

Signed-off-by: Martin Peschke <mp3@de.ibm.com>
---

 list.h |   12 ++++++++++++
 1 files changed, 12 insertions(+)

diff -Nurp a/include/linux/list.h b/include/linux/list.h
--- a/include/linux/list.h	2006-05-17 19:02:03.000000000 +0200
+++ b/include/linux/list.h	2006-05-17 19:05:41.000000000 +0200
@@ -411,6 +411,18 @@ static inline void list_splice_init(stru
 	     pos = list_entry(pos->member.next, typeof(*pos), member))
 
 /**
+ * list_for_each_entry_continue_reverse -	iterate backwards over list
+ *			of given type continuing before existing point
+ * @pos:	the type * to use as a loop counter.
+ * @head:	the head for your list.
+ * @member:	the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_continue_reverse(pos, head, member) 	\
+	for (pos = list_entry(pos->member.prev, typeof(*pos), member);	\
+	     prefetch(pos->member.prev), &pos->member != (head);	\
+	     pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
  * list_for_each_entry_from -	iterate over list of given type
  *			continuing from existing point
  * @pos:	the type * to use as a loop counter.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] [Patch 1/6] statistics infrastructure - prerequisite: list operation
  2006-05-17 18:50 [RFC] [Patch 1/6] statistics infrastructure - prerequisite: list operation Martin Peschke
@ 2006-05-18  4:34 ` Randy.Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy.Dunlap @ 2006-05-18  4:34 UTC (permalink / raw)
  To: Martin Peschke
  Cc: linux-kernel, chase.venters, nickpiggin, kaos, akpm, clameter,
	fche, peterc, hch, arjan, ak

On Wed, 17 May 2006 20:50:44 +0200 Martin Peschke wrote:

> This patch adds another list_for_each_* derivate. I can't work around it
> because there is a list that I need to search both ways.
> 
> Signed-off-by: Martin Peschke <mp3@de.ibm.com>
> ---
> 
>  list.h |   12 ++++++++++++
>  1 files changed, 12 insertions(+)
> 
> diff -Nurp a/include/linux/list.h b/include/linux/list.h
> --- a/include/linux/list.h	2006-05-17 19:02:03.000000000 +0200
> +++ b/include/linux/list.h	2006-05-17 19:05:41.000000000 +0200
> @@ -411,6 +411,18 @@ static inline void list_splice_init(stru
>  	     pos = list_entry(pos->member.next, typeof(*pos), member))
>  
>  /**
> + * list_for_each_entry_continue_reverse -	iterate backwards over list
> + *			of given type continuing before existing point

kernel-doc function name and short description need to fit on one line.
(list.h has some other problems like that; I'll fix those up.)

> + * @pos:	the type * to use as a loop counter.
> + * @head:	the head for your list.
> + * @member:	the name of the list_struct within the struct.
> + */
> +#define list_for_each_entry_continue_reverse(pos, head, member) 	\
> +	for (pos = list_entry(pos->member.prev, typeof(*pos), member);	\
> +	     prefetch(pos->member.prev), &pos->member != (head);	\
> +	     pos = list_entry(pos->member.prev, typeof(*pos), member))
> +
> +/**
>   * list_for_each_entry_from -	iterate over list of given type
>   *			continuing from existing point
>   * @pos:	the type * to use as a loop counter.


---
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-18  4:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-17 18:50 [RFC] [Patch 1/6] statistics infrastructure - prerequisite: list operation Martin Peschke
2006-05-18  4:34 ` Randy.Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®