Add BSD's LIST_PREV
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 9 May 2018 19:23:13 +0000 (15:23 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 22 May 2018 21:53:04 +0000 (17:53 -0400)
From commit aa34e24a277b ("Report TRAP_BRKPT for breakpoint traps on
sparc64.").

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/sys/queue.h

index d22e4ae..8524177 100644 (file)
@@ -420,6 +420,11 @@ struct {                                                           \
 
 #define        BSD_LIST_NEXT(elm, field)       ((elm)->field.le_next)
 
+#define        BSD_LIST_PREV(elm, head, type, field)                   \
+       ((elm)->field.le_prev == &BSD_LIST_FIRST((head)) ? NULL :       \
+           container_of((elm)->field.le_prev,                  \
+           struct type, field.le_next))
+
 #define        BSD_LIST_REMOVE(elm, field) do {                                        \
        QMD_SAVELINK(oldnext, (elm)->field.le_next);                    \
        QMD_SAVELINK(oldprev, (elm)->field.le_prev);                    \