[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 <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-11-12 15:44:35 -02:00
parent 7e6125add2
commit 461099d7a8
1 changed files with 14 additions and 0 deletions

14
list.h
View File

@ -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