From 461099d7a8a5b265a0c99c6f714be3716581bbdf Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 12 Nov 2007 15:44:35 -0200 Subject: [PATCH] [LIST]: Introduce list_del_range a <-> b <-> c <-> d <-> e <-> f <-> g list_del_range(b, d) turns the list into: a <-> e <-> f <-> g This one is not in the kernel list.h, have to look if there are uses and push it to linux if there are any. Signed-off-by: Arnaldo Carvalho de Melo --- list.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/list.h b/list.h index dc90d6c..783cf6e 100644 --- a/list.h +++ b/list.h @@ -115,6 +115,20 @@ static inline void list_del(struct list_head *entry) entry->prev = LIST_POISON2; } +/** + * list_del_range - deletes range of entries from list. + * @beging: first element in the range to delete from the list. + * @beging: first element in the range to delete from the list. + * Note: list_empty on the range of entries does not return true after this, + * the entries is in an undefined state. + */ +static inline void list_del_range(struct list_head *begin, + struct list_head *end) +{ + begin->prev->next = end->next; + end->next->prev = begin->prev; +} + /** * list_replace - replace old entry by new one * @old : the element to be replaced