22#define inline __inline__
32#define container_of(ptr, type, member) ({ \
33 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
34 (type *)( (char *)__mptr - offsetof(type, member) );})
42#define LLIST_POISON1 ((void *) 0x00100100)
43#define LLIST_POISON2 ((void *) 0x00200200)
54#define LLIST_HEAD_INIT(name) { &(name), &(name) }
59#define LLIST_HEAD(name) \
60 struct llist_head name = LLIST_HEAD_INIT(name)
65#define INIT_LLIST_HEAD(ptr) do { \
66 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
171 return head->
next == head;
218#define llist_entry(ptr, type, member) \
219 container_of(ptr, type, member)
228#define llist_first_entry(ptr, type, member) \
229 llist_entry((ptr)->next, type, member)
238#define llist_last_entry(ptr, type, member) \
239 llist_entry((ptr)->prev, type, member)
245#define llist_last(head) (head)->prev
254#define llist_first_entry_or_null(ptr, type, member) \
255 (!llist_empty(ptr) ? llist_first_entry(ptr, type, member) : NULL)
261#define llist_for_each(pos, head) \
262 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
263 pos = pos->next, prefetch(pos->next))
274#define __llist_for_each(pos, head) \
275 for (pos = (head)->next; pos != (head); pos = pos->next)
281#define llist_for_each_prev(pos, head) \
282 for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
283 pos = pos->prev, prefetch(pos->prev))
290#define llist_for_each_safe(pos, n, head) \
291 for (pos = (head)->next, n = pos->next; pos != (head); \
292 pos = n, n = pos->next)
299#define llist_for_each_entry(pos, head, member) \
300 for (pos = llist_entry((head)->next, typeof(*pos), member), \
301 prefetch(pos->member.next); \
302 &pos->member != (head); \
303 pos = llist_entry(pos->member.next, typeof(*pos), member), \
304 prefetch(pos->member.next))
311#define llist_for_each_entry_reverse(pos, head, member) \
312 for (pos = llist_entry((head)->prev, typeof(*pos), member), \
313 prefetch(pos->member.prev); \
314 &pos->member != (head); \
315 pos = llist_entry(pos->member.prev, typeof(*pos), member), \
316 prefetch(pos->member.prev))
324#define llist_for_each_entry_continue(pos, head, member) \
325 for (pos = llist_entry(pos->member.next, typeof(*pos), member), \
326 prefetch(pos->member.next); \
327 &pos->member != (head); \
328 pos = llist_entry(pos->member.next, typeof(*pos), member), \
329 prefetch(pos->member.next))
337#define llist_for_each_entry_safe(pos, n, head, member) \
338 for (pos = llist_entry((head)->next, typeof(*pos), member), \
339 n = llist_entry(pos->member.next, typeof(*pos), member); \
340 &pos->member != (head); \
341 pos = n, n = llist_entry(n->member.next, typeof(*n), member))
347#define llist_for_each_rcu(pos, head) \
348 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
349 pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next))
351#define __llist_for_each_rcu(pos, head) \
352 for (pos = (head)->next; pos != (head); \
353 pos = pos->next, ({ smp_read_barrier_depends(); 0;}))
360#define llist_for_each_safe_rcu(pos, n, head) \
361 for (pos = (head)->next, n = pos->next; pos != (head); \
362 pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next)
369#define llist_for_each_entry_rcu(pos, head, member) \
370 for (pos = llist_entry((head)->next, typeof(*pos), member), \
371 prefetch(pos->member.next); \
372 &pos->member != (head); \
373 pos = llist_entry(pos->member.next, typeof(*pos), member), \
374 ({ smp_read_barrier_depends(); 0;}), \
375 prefetch(pos->member.next))
382#define llist_for_each_continue_rcu(pos, head) \
383 for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \
384 (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next))
418#define HLIST_HEAD_INIT { .first = NULL }
419#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
420#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
427#define READ_ONCE(x) x
428#define WRITE_ONCE(a, b) a = b
563 return h->pprev == &
h->next;
576 return !
n->next &&
n->pprev == &
h->first;
595#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
597#define hlist_for_each(pos, head) \
598 for (pos = (head)->first; pos ; pos = pos->next)
600#define hlist_for_each_safe(pos, n, head) \
601 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
604#define hlist_entry_safe(ptr, type, member) \
605 ({ typeof(ptr) ____ptr = (ptr); \
606 ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
614#define hlist_for_each_entry(pos, head, member) \
615 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
617 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
623#define hlist_for_each_entry_continue(pos, member) \
624 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
626 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
632#define hlist_for_each_entry_from(pos, member) \
634 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
642#define hlist_for_each_entry_safe(pos, n, head, member) \
643 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
644 pos && ({ n = pos->member.next; 1; }); \
645 pos = hlist_entry_safe(n, typeof(*pos), member))
write Write running configuration to or terminal n Write configuration to the copy running config startup Copy configuration n Copy running config to n Copy running config to startup write Write running configuration to or terminal n Write to terminal n
static unsigned int llist_count(const struct llist_head *head)
Count number of llist items by iterating.
Definition: linuxlist.h:393
#define LLIST_POISON1
These are non-NULL pointers that will result in page faults under normal circumstances,...
Definition: linuxlist.h:42
#define LLIST_POISON2
Definition: linuxlist.h:43
static void __hlist_del(struct hlist_node *n)
Definition: linuxlist.h:465
static void hlist_add_behind(struct hlist_node *n, struct hlist_node *prev)
add a new entry after the one specified
Definition: linuxlist.h:535
static void hlist_add_before(struct hlist_node *n, struct hlist_node *next)
add a new entry before the one specified.
Definition: linuxlist.h:522
static void __llist_add(struct llist_head *_new, struct llist_head *prev, struct llist_head *next)
Definition: linuxlist.h:75
static void llist_splice(struct llist_head *llist, struct llist_head *head)
Join two linked lists.
Definition: linuxlist.h:192
static void hlist_del_init(struct hlist_node *n)
Delete the specified hlist_node from its list and initialize.
Definition: linuxlist.h:493
static bool hlist_fake(struct hlist_node *h)
Is this node a fake hlist?.
Definition: linuxlist.h:561
static void llist_del_init(struct llist_head *entry)
Delete a single entry from a linked list and reinitialize it.
Definition: linuxlist.h:138
static void llist_move_tail(struct llist_head *llist, struct llist_head *head)
Delete from one llist and add as another's tail.
Definition: linuxlist.h:158
static void INIT_HLIST_NODE(struct hlist_node *h)
Definition: linuxlist.h:421
static void llist_splice_init(struct llist_head *llist, struct llist_head *head)
Join two llists and reinitialise the emptied llist.
Definition: linuxlist.h:204
static void llist_add(struct llist_head *_new, struct llist_head *head)
Add a new entry into a linked list (at head).
Definition: linuxlist.h:92
static bool hlist_is_singular_node(struct hlist_node *n, struct hlist_head *h)
is node the only element of the specified hlist?.
Definition: linuxlist.h:574
static void hlist_add_fake(struct hlist_node *n)
create a fake hlist consisting of a single headless node.
Definition: linuxlist.h:553
static int hlist_unhashed(const struct hlist_node *h)
Has node been removed from list and reinitialized?.
Definition: linuxlist.h:438
#define WRITE_ONCE(a, b)
Definition: linuxlist.h:428
static void __llist_splice(struct llist_head *llist, struct llist_head *head)
Definition: linuxlist.h:174
#define READ_ONCE(x)
Definition: linuxlist.h:427
static void hlist_del(struct hlist_node *n)
Delete the specified hlist_node from its list.
Definition: linuxlist.h:481
static int llist_empty(const struct llist_head *head)
Test whether a linked list is empty.
Definition: linuxlist.h:169
static void llist_move(struct llist_head *llist, struct llist_head *head)
Delete from one llist and add as another's head.
Definition: linuxlist.h:148
static void llist_del(struct llist_head *entry)
Delete a single entry from a linked list.
Definition: linuxlist.h:128
static void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
add a new entry at the beginning of the hlist.
Definition: linuxlist.h:508
#define llist_for_each(pos, head)
Iterate over a linked list.
Definition: linuxlist.h:261
static void prefetch(const void *x)
Definition: linuxlist.h:25
static int hlist_unhashed_lockless(const struct hlist_node *h)
Version of hlist_unhashed for lockless use.
Definition: linuxlist.h:451
static void hlist_move_list(struct hlist_head *old, struct hlist_head *_new)
Move an hlist.
Definition: linuxlist.h:586
static void llist_add_tail(struct llist_head *_new, struct llist_head *head)
Add a new entry into a linked list (at tail).
Definition: linuxlist.h:104
#define INIT_LLIST_HEAD(ptr)
Initialize a llist_head to point back to itself.
Definition: linuxlist.h:65
static int hlist_empty(const struct hlist_head *h)
Is the specified hlist_head structure an empty hlist?.
Definition: linuxlist.h:460
static void __llist_del(struct llist_head *prev, struct llist_head *next)
Definition: linuxlist.h:116
uint32_t x
Definition: jhash.h:0
Double linked lists with a single pointer list head.
Definition: linuxlist.h:410
struct hlist_node * first
Definition: linuxlist.h:411
Definition: linuxlist.h:414
struct hlist_node ** pprev
Definition: linuxlist.h:415
struct hlist_node * next
Definition: linuxlist.h:415
(double) linked list header structure
Definition: linuxlist.h:46
struct llist_head * next
Pointer to next and previous item.
Definition: linuxlist.h:48
struct llist_head * prev
Definition: linuxlist.h:48