Source-Changes-HG archive

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

[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Add INIT_LIST_H...



details:   https://anonhg.NetBSD.org/src/rev/d7ba7f5e9882
branches:  riastradh-drm2
changeset: 788046:d7ba7f5e9882
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jul 24 01:59:19 2013 +0000

description:
Add INIT_LIST_HEAD, list_add, list_add_tail, and list_del.

diffstat:

 sys/external/bsd/drm2/include/linux/list.h |  38 +++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diffs (59 lines):

diff -r 98e29c3dc7c9 -r d7ba7f5e9882 sys/external/bsd/drm2/include/linux/list.h
--- a/sys/external/bsd/drm2/include/linux/list.h        Wed Jul 24 01:59:05 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/list.h        Wed Jul 24 01:59:19 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: list.h,v 1.1.2.3 2013/07/24 01:55:44 riastradh Exp $   */
+/*     $NetBSD: list.h,v 1.1.2.4 2013/07/24 01:59:19 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -46,6 +46,13 @@
        struct list_head *lh_next;
 };
 
+static inline void
+INIT_LIST_HEAD(struct list_head *head)
+{
+       head->lh_prev = head;
+       head->lh_next = head;
+}
+
 static inline struct list_head *
 list_first(struct list_head *head)
 {
@@ -58,6 +65,35 @@
        return node->lh_next;
 }
 
+static inline void
+list_add(struct list_head *new, struct list_head *head)
+{
+       struct list_head *const next = head->lh_next;
+
+       head->lh_next = new;
+       new->lh_prev = head;
+       new->lh_next = next;
+       next->lh_prev = new;
+}
+
+static inline void
+list_add_tail(struct list_head *new, struct list_head *head)
+{
+       struct list_head *const prev = head->lh_prev;
+
+       head->lh_prev = new;
+       new->lh_prev = prev;
+       new->lh_next = head;
+       prev->lh_next = new;
+}
+
+static inline void
+list_del(struct list_head *entry)
+{
+       entry->lh_prev->lh_next = entry->lh_next;
+       entry->lh_next->lh_prev = entry->lh_prev;
+}
+
 #define        list_entry(PTR, TYPE, FIELD)    container_of(PTR, TYPE, FIELD)
 
 #define        list_for_each(VAR, HEAD)                                        \



Home | Main Index | Thread Index | Old Index