svn commit: r345922 - stable/11/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Fri Apr 5 11:17:29 UTC 2019


Author: hselasky
Date: Fri Apr  5 11:17:27 2019
New Revision: 345922
URL: https://svnweb.freebsd.org/changeset/base/345922

Log:
  MFC r345097:
  Implement list_for_each_entry_from_reverse() and
  list_bulk_move_tail() in the LinuxKPI.
  
  Submitted by:		Johannes Lundberg <johalun0 at gmail.com>
  Sponsored by:		Limelight Networks
  Sponsored by:		Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/list.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/list.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/list.h	Fri Apr  5 11:17:12 2019	(r345921)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/list.h	Fri Apr  5 11:17:27 2019	(r345922)
@@ -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