2 * Copied from linux kernel 3.1.0 include/linux/list.h and include/linux/types.h
3 * with some modifications and unused code removed
4 * License is GPLv2 only
8 struct list_head
*next
, *prev
;
11 static inline void init_list_head(struct list_head
*list
)
18 * Insert a new entry between two known consecutive entries.
20 * This is only for internal list manipulation where we know
21 * the prev/next entries already!
23 static inline void __list_add(struct list_head
*new,
24 struct list_head
*prev
,
25 struct list_head
*next
)
34 * list_add - add a new entry
35 * @new: new entry to be added
36 * @head: list head to add it after
38 * Insert a new entry after the specified head.
39 * This is good for implementing stacks.
41 static inline void list_add(struct list_head
*new, struct list_head
*head
)
43 __list_add(new, head
, head
->next
);
48 * list_add_tail - add a new entry
49 * @new: new entry to be added
50 * @head: list head to add it before
52 * Insert a new entry before the specified head.
53 * This is useful for implementing queues.
55 static inline void list_add_tail(struct list_head
*new, struct list_head
*head
)
57 __list_add(new, head
->prev
, head
);
61 * Delete a list entry by making the prev/next entries
62 * point to each other.
64 * This is only for internal list manipulation where we know
65 * the prev/next entries already!
67 static inline void __list_del(struct list_head
* prev
, struct list_head
* next
)
73 static inline void list_del(struct list_head
*entry
)
75 __list_del(entry
->prev
, entry
->next
);
81 * list_empty - tests whether a list is empty
82 * @head: the list to test.
84 static inline int list_empty(const struct list_head
*head
)
86 return head
->next
== head
;