svn commit: r345097 - head/sys/compat/linuxkpi/common/include/linux
Hans Petter Selasky
hselasky at FreeBSD.org
Wed Mar 13 18:47:19 UTC 2019
Author: hselasky
Date: Wed Mar 13 18:47:17 2019
New Revision: 345097
URL: https://svnweb.freebsd.org/changeset/base/345097
Log:
Implement list_for_each_entry_from_reverse() and
list_bulk_move_tail() in the LinuxKPI.
Submitted by: Johannes Lundberg <johalun0 at gmail.com>
MFC after: 1 week
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies
Modified:
head/sys/compat/linuxkpi/common/include/linux/list.h
Modified: head/sys/compat/linuxkpi/common/include/linux/list.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/list.h Wed Mar 13 18:44:06 2019 (r345096)
+++ head/sys/compat/linuxkpi/common/include/linux/list.h Wed Mar 13 18:47:17 2019 (r345097)
@@ -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)
{
@@ -256,6 +260,18 @@ list_move_tail(struct list_head *entry, struct list_he
list_del(entry);
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
More information about the svn-src-all
mailing list