5 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
15 #define container_of(ptr, type, member) ({ \
16 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
17 (type *)( (char *)__mptr - offsetof(type,member) );})
23 #define typecheck(type,x) \
26 (void)(&__dummy == &__dummy2); \
40 #define LIST_POISON1 ((void *) 0x00100100)
41 #define LIST_POISON2 ((void *) 0x00200200)
57 #define LIST_HEAD_INIT(name) { &(name), &(name) }
59 #define LIST_HEAD(name) \
60 struct list_head name = LIST_HEAD_INIT(name)
62 #define INIT_LIST_HEAD(ptr) do { \
63 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
262 return head->
next == head;
280 return (next == head) && (next == head->
prev);
330 #define list_entry(ptr, type, member) \
331 container_of(ptr, type, member)
338 #define list_for_each(pos, head) \
339 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
340 pos = pos->next, prefetch(pos->next))
352 #define __list_for_each(pos, head) \
353 for (pos = (head)->next; pos != (head); pos = pos->next)
360 #define list_for_each_prev(pos, head) \
361 for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
362 pos = pos->prev, prefetch(pos->prev))
370 #define list_for_each_safe(pos, n, head) \
371 for (pos = (head)->next, n = pos->next; pos != (head); \
372 pos = n, n = pos->next)
380 #define list_for_each_entry(pos, head, member) \
381 for (pos = list_entry((head)->next, typeof(*pos), member), \
382 prefetch(pos->member.next); \
383 &pos->member != (head); \
384 pos = list_entry(pos->member.next, typeof(*pos), member), \
385 prefetch(pos->member.next))
393 #define list_for_each_entry_reverse(pos, head, member) \
394 for (pos = list_entry((head)->prev, typeof(*pos), member), \
395 prefetch(pos->member.prev); \
396 &pos->member != (head); \
397 pos = list_entry(pos->member.prev, typeof(*pos), member), \
398 prefetch(pos->member.prev))
407 #define list_prepare_entry(pos, head, member) \
408 ((pos) ? : list_entry(head, typeof(*pos), member))
417 #define list_for_each_entry_continue(pos, head, member) \
418 for (pos = list_entry(pos->member.next, typeof(*pos), member), \
419 prefetch(pos->member.next); \
420 &pos->member != (head); \
421 pos = list_entry(pos->member.next, typeof(*pos), member), \
422 prefetch(pos->member.next))
431 #define list_for_each_entry_safe(pos, n, head, member) \
432 for (pos = list_entry((head)->next, typeof(*pos), member), \
433 n = list_entry(pos->member.next, typeof(*pos), member); \
434 &pos->member != (head); \
435 pos = n, n = list_entry(n->member.next, typeof(*n), member))
446 #define list_for_each_rcu(pos, head) \
447 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
448 pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next))
450 #define __list_for_each_rcu(pos, head) \
451 for (pos = (head)->next; pos != (head); \
452 pos = pos->next, ({ smp_read_barrier_depends(); 0;}))
465 #define list_for_each_safe_rcu(pos, n, head) \
466 for (pos = (head)->next, n = pos->next; pos != (head); \
467 pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next)
479 #define list_for_each_entry_rcu(pos, head, member) \
480 for (pos = list_entry((head)->next, typeof(*pos), member), \
481 prefetch(pos->member.next); \
482 &pos->member != (head); \
483 pos = list_entry(pos->member.next, typeof(*pos), member), \
484 ({ smp_read_barrier_depends(); 0;}), \
485 prefetch(pos->member.next))
498 #define list_for_each_continue_rcu(pos, head) \
499 for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \
500 (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next))
517 #define HLIST_HEAD_INIT { .first = NULL }
518 #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
519 #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
520 #define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL)
581 #define hlist_del_rcu_init hlist_del_init
646 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
648 #define hlist_for_each(pos, head) \
649 for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
652 #define hlist_for_each_safe(pos, n, head) \
653 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
663 #define hlist_for_each_entry(tpos, pos, head, member) \
664 for (pos = (head)->first; \
665 pos && ({ prefetch(pos->next); 1;}) && \
666 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
675 #define hlist_for_each_entry_continue(tpos, pos, member) \
676 for (pos = (pos)->next; \
677 pos && ({ prefetch(pos->next); 1;}) && \
678 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
687 #define hlist_for_each_entry_from(tpos, pos, member) \
688 for (; pos && ({ prefetch(pos->next); 1;}) && \
689 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
700 #define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
701 for (pos = (head)->first; \
702 pos && ({ n = pos->next; 1; }) && \
703 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
717 #define hlist_for_each_entry_rcu(tpos, pos, head, member) \
718 for (pos = (head)->first; \
719 pos && ({ prefetch(pos->next); 1;}) && \
720 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
721 pos = pos->next, ({ smp_read_barrier_depends(); 0; }) )
struct hlist_node * next
Definition: linux_list.h:514
Definition: linux_list.h:509
static void list_add_tail_rcu(struct list_head *new, struct list_head *head)
Definition: linux_list.h:161
#define INIT_LIST_HEAD(ptr)
Definition: linux_list.h:62
struct list_head * next
Definition: linux_list.h:54
#define INIT_HLIST_NODE(ptr)
Definition: linux_list.h:520
static void list_add_rcu(struct list_head *new, struct list_head *head)
Definition: linux_list.h:140
static void __list_splice(struct list_head *list, struct list_head *head)
Definition: linux_list.h:283
static void list_del_rcu(struct list_head *entry)
Definition: linux_list.h:217
static void list_del(struct list_head *entry)
Definition: linux_list.h:186
static int hlist_empty(const struct hlist_head *h)
Definition: linux_list.h:527
static void list_splice_init(struct list_head *list, struct list_head *head)
Definition: linux_list.h:315
static void __list_add_rcu(struct list_head *new, struct list_head *prev, struct list_head *next)
Definition: linux_list.h:114
struct list_head * prev
Definition: linux_list.h:54
static void __hlist_del(struct hlist_node *n)
Definition: linux_list.h:532
static void list_add_tail(struct list_head *new, struct list_head *head)
Definition: linux_list.h:103
Definition: linux_list.h:53
static void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
Definition: linux_list.h:583
#define smp_wmb()
Definition: linux_list.h:33
#define LIST_POISON1
Definition: linux_list.h:40
static void hlist_add_before(struct hlist_node *n, struct hlist_node *next)
Definition: linux_list.h:626
static void list_move(struct list_head *list, struct list_head *head)
Definition: linux_list.h:238
static void hlist_del_init(struct hlist_node *n)
Definition: linux_list.h:573
static void hlist_del_rcu(struct hlist_node *n)
Definition: linux_list.h:567
struct hlist_node * first
Definition: linux_list.h:510
static void hlist_del(struct hlist_node *n)
Definition: linux_list.h:541
static void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next)
Definition: linux_list.h:72
static void list_move_tail(struct list_head *list, struct list_head *head)
Definition: linux_list.h:249
#define LIST_POISON2
Definition: linux_list.h:41
static void hlist_add_after(struct hlist_node *n, struct hlist_node *next)
Definition: linux_list.h:635
static void list_splice(struct list_head *list, struct list_head *head)
Definition: linux_list.h:302
static int list_empty(const struct list_head *head)
Definition: linux_list.h:260
static void hlist_add_head_rcu(struct hlist_node *n, struct hlist_head *h)
Definition: linux_list.h:613
struct hlist_node ** pprev
Definition: linux_list.h:514
static int hlist_unhashed(const struct hlist_node *h)
Definition: linux_list.h:522
static void list_add(struct list_head *new, struct list_head *head)
Definition: linux_list.h:90
static void list_del_init(struct list_head *entry)
Definition: linux_list.h:227
Definition: linux_list.h:513
static void __list_del(struct list_head *prev, struct list_head *next)
Definition: linux_list.h:174
static int list_empty_careful(const struct list_head *head)
Definition: linux_list.h:277