~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/firewire/list.h

Version: ~ [ linux-5.15-rc1 ] ~ [ linux-5.14.5 ] ~ [ linux-5.13.18 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.66 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.147 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.206 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.246 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.282 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.283 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 struct list {
  2         struct list *next, *prev;
  3 };
  4 
  5 static inline void
  6 list_init(struct list *list)
  7 {
  8         list->next = list;
  9         list->prev = list;
 10 }
 11 
 12 static inline int
 13 list_empty(struct list *list)
 14 {
 15         return list->next == list;
 16 }
 17 
 18 static inline void
 19 list_insert(struct list *link, struct list *new_link)
 20 {
 21         new_link->prev          = link->prev;
 22         new_link->next          = link;
 23         new_link->prev->next    = new_link;
 24         new_link->next->prev    = new_link;
 25 }
 26 
 27 static inline void
 28 list_append(struct list *list, struct list *new_link)
 29 {
 30         list_insert((struct list *)list, new_link);
 31 }
 32 
 33 static inline void
 34 list_prepend(struct list *list, struct list *new_link)
 35 {
 36         list_insert(list->next, new_link);
 37 }
 38 
 39 static inline void
 40 list_remove(struct list *link)
 41 {
 42         link->prev->next = link->next;
 43         link->next->prev = link->prev;
 44 }
 45 
 46 #define list_entry(link, type, member) \
 47         ((type *)((char *)(link)-(unsigned long)(&((type *)0)->member)))
 48 
 49 #define list_head(list, type, member)           \
 50         list_entry((list)->next, type, member)
 51 
 52 #define list_tail(list, type, member)           \
 53         list_entry((list)->prev, type, member)
 54 
 55 #define list_next(elm, member)                                  \
 56         list_entry((elm)->member.next, typeof(*elm), member)
 57 
 58 #define list_for_each_entry(pos, list, member)                  \
 59         for (pos = list_head(list, typeof(*pos), member);       \
 60              &pos->member != (list);                            \
 61              pos = list_next(pos, member))
 62 
 63 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp