From 43aa46378057e6c57f8e17621601b15869c520e4 Mon Sep 17 00:00:00 2001 From: Dave Wysochanski Date: Wed, 26 Mar 2008 16:20:54 +0000 Subject: [PATCH] Add list_move() support function for list manipulation. --- WHATS_NEW | 3 ++- lib/datastruct/list.h | 10 ++++++++++ libdm/datastruct/list.h | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 3726741c4..1075cd871 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,6 +1,7 @@ Version 2.02.34 - =================================== - Add 'is_reserved_lvname()' helper function. + Add list_move() for moving elements from one list to another. + Add 'is_reserved_lvname()' for identifying hidden LVs. Correct command name in lvmdiskscan man page. clvmd no longer crashes if it sees nodeids over 50. Fix potential deadlock in clvmd thread handling. diff --git a/lib/datastruct/list.h b/lib/datastruct/list.h index 7b4892df7..340e9f479 100644 --- a/lib/datastruct/list.h +++ b/lib/datastruct/list.h @@ -54,6 +54,16 @@ void list_add_h(struct list *head, struct list *elem); */ void list_del(struct list *elem); +/* + * Move an element from an existing list to list 'head'. + * Insert the element before 'head'. + */ +static inline void list_move(struct list *item, struct list *head) +{ + list_del(item); + list_add(head, item); +} + /* * Is the list empty? */ diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h index 7b4892df7..340e9f479 100644 --- a/libdm/datastruct/list.h +++ b/libdm/datastruct/list.h @@ -54,6 +54,16 @@ void list_add_h(struct list *head, struct list *elem); */ void list_del(struct list *elem); +/* + * Move an element from an existing list to list 'head'. + * Insert the element before 'head'. + */ +static inline void list_move(struct list *item, struct list *head) +{ + list_del(item); + list_add(head, item); +} + /* * Is the list empty? */