Implement list_for_each_entry_from_reverse() and

list_bulk_move_tail() in the LinuxKPI.

Submitted by:		Johannes Lundberg <johalun0@gmail.com>
MFC after:		1 week
Sponsored by:		Limelight Networks
Sponsored by:		Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2019-03-13 18:47:17 +00:00
parent 4f081c4fc6
commit 845a91ce0b

View File

@ -228,6 +228,10 @@ list_del_init(struct list_head *entry)
#define list_for_each_prev(p, h) for (p = (h)->prev; p != (h); p = (p)->prev)
#define list_for_each_entry_from_reverse(p, h, field) \
for (; &p->field != (h); \
p = list_prev_entry(p, field))
static inline void
list_add(struct list_head *new, struct list_head *head)
{
@ -258,6 +262,18 @@ list_move_tail(struct list_head *entry, struct list_head *head)
list_add_tail(entry, head);
}
static inline void
list_bulk_move_tail(struct list_head *head, struct list_head *first,
struct list_head *last)
{
first->prev->next = last->next;
last->next->prev = first->prev;
head->prev->next = first;
first->prev = head->prev;
last->next = head;
head->prev = last;
}
static inline void
linux_list_splice(const struct list_head *list, struct list_head *prev,
struct list_head *next)