Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/external/bsd/common/include/linux Pull up following r...



details:   https://anonhg.NetBSD.org/src/rev/2b9c3fce818f
branches:  netbsd-7
changeset: 798283:2b9c3fce818f
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Aug 22 10:38:07 2014 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #47):
        sys/external/bsd/common/include/linux/list.h: revision 1.5
Add some Linux list routines.

diffstat:

 sys/external/bsd/common/include/linux/list.h |  23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (60 lines):

diff -r c3573fd7c68a -r 2b9c3fce818f sys/external/bsd/common/include/linux/list.h
--- a/sys/external/bsd/common/include/linux/list.h      Fri Aug 22 10:35:59 2014 +0000
+++ b/sys/external/bsd/common/include/linux/list.h      Fri Aug 22 10:38:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: list.h,v 1.4 2014/07/16 20:59:57 riastradh Exp $       */
+/*     $NetBSD: list.h,v 1.4.2.1 2014/08/22 10:38:07 martin Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -74,6 +74,12 @@
 }
 
 static inline struct list_head *
+list_last(const struct list_head *head)
+{
+       return head->prev;
+}
+
+static inline struct list_head *
 list_next(const struct list_head *node)
 {
        return node->next;
@@ -192,8 +198,12 @@
 #define        list_entry(PTR, TYPE, FIELD)    container_of(PTR, TYPE, FIELD)
 #define        list_first_entry(PTR, TYPE, FIELD)                              \
        list_entry(list_first((PTR)), TYPE, FIELD)
+#define        list_last_entry(PTR, TYPE, FIELD)                               \
+       list_entry(list_last((PTR)), TYPE, FIELD)
 #define        list_next_entry(ENTRY, FIELD)                                   \
        list_entry(list_next(&(ENTRY)->FIELD), typeof(*(ENTRY)), FIELD)
+#define        list_prev_entry(ENTRY, FIELD)                                   \
+       list_entry(list_prev(&(ENTRY)->FIELD), typeof(*(ENTRY)), FIELD)
 
 #define        list_for_each(VAR, HEAD)                                        \
        for ((VAR) = list_first((HEAD));                                \
@@ -211,6 +221,12 @@
                (VAR) = list_entry(list_next(&(VAR)->FIELD), typeof(*(VAR)), \
                    FIELD))
 
+#define        list_for_each_entry_reverse(VAR, HEAD, FIELD)                   \
+       for ((VAR) = list_entry(list_last((HEAD)), typeof(*(VAR)), FIELD); \
+               &(VAR)->FIELD != (HEAD);                                \
+               (VAR) = list_entry(list_prev(&(VAR)->FIELD), typeof(*(VAR)), \
+                   FIELD))
+
 #define        list_for_each_entry_safe(VAR, NEXT, HEAD, FIELD)                \
        for ((VAR) = list_entry(list_first((HEAD)), typeof(*(VAR)), FIELD); \
                (&(VAR)->FIELD != (HEAD)) &&                            \
@@ -223,6 +239,11 @@
                &(VAR)->FIELD != (HEAD);                                \
                (VAR) = list_next_entry((VAR), FIELD))
 
+#define        list_for_each_entry_continue_reverse(VAR, HEAD, FIELD)          \
+       for ((VAR) = list_prev_entry((VAR), FIELD);                     \
+               &(VAR)->FIELD != (HEAD);                                \
+               (VAR) = list_prev_entry((VAR), FIELD))
+
 #define        list_for_each_entry_safe_from(VAR, NEXT, HEAD, FIELD)           \
        for (;                                                          \
                (&(VAR)->FIELD != (HEAD)) &&                            \



Home | Main Index | Thread Index | Old Index