The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netpfil/ipfw/test/mylist.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * $FreeBSD$
    3  *
    4  * linux-like bidirectional lists
    5  */
    6 
    7 #ifndef _MYLIST_H
    8 #define _MYLIST_H
    9 /* not just a head, also the link field for a list entry */
   10 struct list_head {
   11         struct list_head *prev, *next;
   12 };
   13 
   14 #define INIT_LIST_HEAD(l) do {  (l)->prev = (l)->next = (l); } while (0)
   15 #define list_empty(l)   ( (l)->next == l )
   16 static inline void
   17 __list_add(struct list_head *o, struct list_head *prev,
   18         struct list_head *next)
   19 {
   20         next->prev = o;
   21         o->next = next;
   22         o->prev = prev;
   23         prev->next = o;
   24 }
   25 
   26 static inline void
   27 list_add_tail(struct list_head *o, struct list_head *head)
   28 {
   29         __list_add(o, head->prev, head);
   30 }
   31 
   32 #define list_first_entry(pL, ty, member)        \
   33         (ty *)((char *)((pL)->next) - offsetof(ty, member))
   34 
   35 static inline void
   36 __list_del(struct list_head *prev, struct list_head *next)
   37 {
   38         next->prev = prev;
   39         prev->next = next;
   40 }
   41 
   42 static inline void
   43 list_del(struct list_head *entry)
   44 {
   45         ND("called on %p", entry);
   46         __list_del(entry->prev, entry->next);
   47         entry->next = entry->prev = NULL;
   48 }
   49 
   50 #endif /* _MYLIST_H */

Cache object: 883f0d7f9dc8dac477a8757d30f2803e


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.