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