LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] [RSDL 1/6] lists: add list splice tail
@ 2007-03-04 7:02 Con Kolivas
2007-03-04 11:15 ` Balbir Singh
2007-03-04 17:33 ` Gerald Britton
0 siblings, 2 replies; 4+ messages in thread
From: Con Kolivas @ 2007-03-04 7:02 UTC (permalink / raw)
To: linux kernel mailing list, ck list; +Cc: Peter Zijlstra
Add a list_splice_tail variant of list_splice.
Patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Con Kolivas <kernel@kolivas.org>
---
include/linux/list.h | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
Index: linux-2.6.20-rsdl/include/linux/list.h
===================================================================
--- linux-2.6.20-rsdl.orig/include/linux/list.h 2007-03-04 17:30:25.000000000 +1100
+++ linux-2.6.20-rsdl/include/linux/list.h 2007-03-04 17:30:30.000000000 +1100
@@ -332,6 +332,20 @@ static inline void __list_splice(struct
at->prev = last;
}
+static inline void __list_splice_tail(struct list_head *list,
+ struct list_head *head)
+{
+ struct list_head *first = list->next;
+ struct list_head *last = list->prev;
+ struct list_head *at = head->prev;
+
+ first->prev = at;
+ at->next = first;
+
+ last->next = head;
+ head->prev = last;
+}
+
/**
* list_splice - join two lists
* @list: the new list to add.
@@ -344,6 +358,18 @@ static inline void list_splice(struct li
}
/**
+ * list_splice_tail - join two lists at one's tail
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice_tail(struct list_head *list,
+ struct list_head *head)
+{
+ if (!list_empty(list))
+ __list_splice_tail(list, head);
+}
+
+/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
@@ -360,6 +386,22 @@ static inline void list_splice_init(stru
}
/**
+ * list_splice_init - join two lists at one's tail and reinitialise emptied
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_tail_init(struct list_head *list,
+ struct list_head *head)
+{
+ if (!list_empty(list)) {
+ __list_splice_tail(list, head);
+ INIT_LIST_HEAD(list);
+ }
+}
+
+/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
--
-ck
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [RSDL 1/6] lists: add list splice tail
2007-03-04 7:02 [PATCH] [RSDL 1/6] lists: add list splice tail Con Kolivas
@ 2007-03-04 11:15 ` Balbir Singh
2007-03-04 17:33 ` Gerald Britton
1 sibling, 0 replies; 4+ messages in thread
From: Balbir Singh @ 2007-03-04 11:15 UTC (permalink / raw)
To: Con Kolivas; +Cc: linux kernel mailing list, ck list, Peter Zijlstra
Con Kolivas wrote:
> Add a list_splice_tail variant of list_splice.
>
> Patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Con Kolivas <kernel@kolivas.org>
>
Acked-by: Balbir Singh <balbir@in.ibm.com>
I had the same exact patch in my memcontrol at
http://lkml.org/lkml/2007/2/24/68 (see the last
two functions).
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [RSDL 1/6] lists: add list splice tail
2007-03-04 7:02 [PATCH] [RSDL 1/6] lists: add list splice tail Con Kolivas
2007-03-04 11:15 ` Balbir Singh
@ 2007-03-04 17:33 ` Gerald Britton
2007-03-04 22:29 ` Con Kolivas
1 sibling, 1 reply; 4+ messages in thread
From: Gerald Britton @ 2007-03-04 17:33 UTC (permalink / raw)
To: Con Kolivas; +Cc: linux kernel mailing list, ck list, Peter Zijlstra
On Sun, Mar 04, 2007 at 06:02:13PM +1100, Con Kolivas wrote:
> Add a list_splice_tail variant of list_splice.
>
> Patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Con Kolivas <kernel@kolivas.org>
...
> @@ -360,6 +386,22 @@ static inline void list_splice_init(stru
> }
>
> /**
> + * list_splice_init - join two lists at one's tail and reinitialise emptied
You should update the comment to match the function.
-- Gerald
> + * @list: the new list to add.
> + * @head: the place to add it in the first list.
> + *
> + * The list at @list is reinitialised
> + */
> +static inline void list_splice_tail_init(struct list_head *list,
> + struct list_head *head)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [RSDL 1/6] lists: add list splice tail
2007-03-04 17:33 ` Gerald Britton
@ 2007-03-04 22:29 ` Con Kolivas
0 siblings, 0 replies; 4+ messages in thread
From: Con Kolivas @ 2007-03-04 22:29 UTC (permalink / raw)
To: Gerald Britton; +Cc: linux kernel mailing list, ck list, Peter Zijlstra
On Monday 05 March 2007 04:33, Gerald Britton wrote:
> On Sun, Mar 04, 2007 at 06:02:13PM +1100, Con Kolivas wrote:
> > Add a list_splice_tail variant of list_splice.
> >
> > Patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Signed-off-by: Con Kolivas <kernel@kolivas.org>
>
> ...
>
> > @@ -360,6 +386,22 @@ static inline void list_splice_init(stru
> > }
> >
> > /**
> > + * list_splice_init - join two lists at one's tail and reinitialise
> > emptied
>
> You should update the comment to match the function.
Doh! Thanks. I'll fix it in the split out patches I have on my web site for
now.
--
-ck
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-03-04 22:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-04 7:02 [PATCH] [RSDL 1/6] lists: add list splice tail Con Kolivas
2007-03-04 11:15 ` Balbir Singh
2007-03-04 17:33 ` Gerald Britton
2007-03-04 22:29 ` Con Kolivas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).