[sheepdog] [PATCH v4 1/8] sheep: port list_splice_tail_init() from linux kernel

levin li levin108 at gmail.com
Fri May 25 04:30:53 CEST 2012


From: levin li <xingke.lwp at taobao.com>


Signed-off-by: levin li <xingke.lwp at taobao.com>
---
 include/list.h |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/list.h b/include/list.h
index 38870e6..f0b25e5 100644
--- a/include/list.h
+++ b/include/list.h
@@ -115,6 +115,15 @@ static inline void list_splice_init(struct list_head *list,
 	}
 }
 
+static inline void list_splice_tail_init(struct list_head *list,
+					 struct list_head *head)
+{
+	if (!list_empty(list)) {
+		__list_splice(list, head->prev, head);
+		INIT_LIST_HEAD(list);
+	}
+}
+
 /* hlist, mostly useful for hash tables */
 
 #define LIST_POISON1 ((void *) 0x00100100)
-- 
1.7.10




More information about the sheepdog mailing list