6 * Simple linked-list routines, based on functions of the same name from the Linux kernel.
10 struct list_head
*next
, *prev
;
13 static inline void INIT_LIST_HEAD(struct list_head
*list
)
19 static inline int list_empty(const struct list_head
*head
)
21 return head
->next
== head
;
24 static inline void __list_add(struct list_head
*new,
25 struct list_head
*prev
,
26 struct list_head
*next
)
34 static inline void list_add(struct list_head
*new, struct list_head
*head
)
36 __list_add(new, head
, head
->next
);
39 static inline void list_add_tail(struct list_head
*new, struct list_head
*head
)
41 __list_add(new, head
->prev
, head
);
44 static inline void __list_del(struct list_head
* prev
, struct list_head
* next
)
50 static inline void list_del(struct list_head
*entry
)
52 __list_del(entry
->prev
, entry
->next
);
53 entry
->next
= entry
->prev
= NULL
;
56 #define list_for_each(pos, head) \
57 for (pos = (head)->next; pos != (head); pos = pos->next)