18#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
28#define container_of(ptr, type, member) ({ const typeof( ((type *)0)->member ) *__mptr = (ptr); (type *)( (char *)__mptr - offsetof(type,member) );})
40#define PSL_HD_INIT(name) { &(name), &(name) }
42#define PSL_HD(name) struct psl_hd name = PSL_HD_INIT(name)
57#define psl_entry(ptr, type, member) container_of(ptr, type, member)
65#define psl_for_each_entry(pos, head, member) \
66 for (pos = psl_entry((head)->next, typeof(*pos), member); \
67 &pos->member != (head); \
68 pos = psl_entry(pos->member.next, typeof(*pos), member))
77#define psl_for_each_entry_safe(pos, n, head, member) \
78 for (pos = psl_entry((head)->next, typeof(*pos), member), \
79 n = psl_entry(pos->member.next, typeof(*pos), member); \
80 &pos->member != (head); \
81 pos = n, n = psl_entry(n->member.next, typeof(*n), member))
91#define psl_count(TYPE, head, member, pcount) \
92{ *pcount = 0; TYPE *pos; \
93 for (pos = psl_entry((head)->next, typeof(*pos), member); \
94 &pos->member != (head); \
95 pos = psl_entry(pos->member.next, typeof(*pos), member)) { \
107 return head->
next == head;
163#define LIST_POISON1 ((void *) 0x00100100)
164#define LIST_POISON2 ((void *) 0x00200200)
192#define PSL_FIRST_ENTRY(ptr, type, member) psl_entry(ptr->next, type, member)
194#define PSL_SHOW_STRING(PSL_HD, TYPE, PSL_LINK, STRING_NAME) \
195{ int i = 0; TYPE *pos; \
196 psl_for_each_entry(pos, PSL_HD, PSL_LINK) { \
197 char *str = pos->STRING_NAME; \
198 MB_DBG("%i: '%s'\n", i, str); \
205 new_hd->next = old_hd->next;
206 new_hd->prev = old_hd->prev;
207 new_hd->next->prev = new_hd;
208 new_hd->prev->next = new_hd;
#define __END_DECLS
Definition: c_decls.h:10
#define __BEGIN_DECLS
Definition: c_decls.h:9
static void psl_move_head2head(psl_hd_t *new_hd, psl_hd_t *old_hd)
Definition: pslist.h:203
static int psl_empty(const struct psl_hd *head)
Definition: pslist.h:105
static void psl_add_tail(struct psl_hd *_new, struct psl_hd *head)
Definition: pslist.h:145
static void __psl_del(struct psl_hd *prev, struct psl_hd *next)
Definition: pslist.h:157
#define LIST_POISON2
Definition: pslist.h:164
static void psl_init(psl_hd_t *list)
init allocated list element. used for initialize dynamic allocated list.
Definition: pslist.h:45
static void __psl_add(struct psl_hd *_new, struct psl_hd *prev, struct psl_hd *next)
Definition: pslist.h:116
static int psl_is_head(const struct psl_hd *list, const struct psl_hd *head)
Definition: pslist.h:183
#define LIST_POISON1
Definition: pslist.h:163
static struct psl_hd * psl_first(const struct psl_hd *head)
Definition: pslist.h:188
static void psl_del(struct psl_hd *entry)
Definition: pslist.h:171
static void psl_add(struct psl_hd *_new, struct psl_hd *head)
Definition: pslist.h:132
struct psl_hd * next
Definition: pslist.h:35
struct psl_hd * prev
Definition: pslist.h:35