libosmocore
1.5.1
Osmocom core library
|
Go to the documentation of this file.
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)
248 #define llist_first_entry_or_null(ptr, type, member) \
249 (!llist_empty(ptr) ? llist_first_entry(ptr, type, member) : NULL)
255 #define llist_for_each(pos, head) \
256 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
257 pos = pos->next, prefetch(pos->next))
268 #define __llist_for_each(pos, head) \
269 for (pos = (head)->next; pos != (head); pos = pos->next)
275 #define llist_for_each_prev(pos, head) \
276 for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
277 pos = pos->prev, prefetch(pos->prev))
284 #define llist_for_each_safe(pos, n, head) \
285 for (pos = (head)->next, n = pos->next; pos != (head); \
286 pos = n, n = pos->next)
293 #define llist_for_each_entry(pos, head, member) \
294 for (pos = llist_entry((head)->next, typeof(*pos), member), \
295 prefetch(pos->member.next); \
296 &pos->member != (head); \
297 pos = llist_entry(pos->member.next, typeof(*pos), member), \
298 prefetch(pos->member.next))
305 #define llist_for_each_entry_reverse(pos, head, member) \
306 for (pos = llist_entry((head)->prev, typeof(*pos), member), \
307 prefetch(pos->member.prev); \
308 &pos->member != (head); \
309 pos = llist_entry(pos->member.prev, typeof(*pos), member), \
310 prefetch(pos->member.prev))
318 #define llist_for_each_entry_continue(pos, head, member) \
319 for (pos = llist_entry(pos->member.next, typeof(*pos), member), \
320 prefetch(pos->member.next); \
321 &pos->member != (head); \
322 pos = llist_entry(pos->member.next, typeof(*pos), member), \
323 prefetch(pos->member.next))
332 #define llist_for_each_entry_safe(pos, n, head, member) \
333 for (pos = llist_entry((head)->next, typeof(*pos), member), \
334 n = llist_entry(pos->member.next, typeof(*pos), member); \
335 &pos->member != (head); \
336 pos = n, n = llist_entry(n->member.next, typeof(*n), member))
342 #define llist_for_each_rcu(pos, head) \
343 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
344 pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next))
346 #define __llist_for_each_rcu(pos, head) \
347 for (pos = (head)->next; pos != (head); \
348 pos = pos->next, ({ smp_read_barrier_depends(); 0;}))
355 #define llist_for_each_safe_rcu(pos, n, head) \
356 for (pos = (head)->next, n = pos->next; pos != (head); \
357 pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next)
364 #define llist_for_each_entry_rcu(pos, head, member) \
365 for (pos = llist_entry((head)->next, typeof(*pos), member), \
366 prefetch(pos->member.next); \
367 &pos->member != (head); \
368 pos = llist_entry(pos->member.next, typeof(*pos), member), \
369 ({ smp_read_barrier_depends(); 0;}), \
370 prefetch(pos->member.next))
377 #define llist_for_each_continue_rcu(pos, head) \
378 for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \
379 (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next))
413 #define HLIST_HEAD_INIT { .first = NULL }
414 #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
415 #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
422 #define READ_ONCE(x) x
423 #define WRITE_ONCE(a, b) a = b
558 return h->pprev == &
h->next;
571 return !
n->next &&
n->pprev == &
h->first;
590 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
592 #define hlist_for_each(pos, head) \
593 for (pos = (head)->first; pos ; pos = pos->next)
595 #define hlist_for_each_safe(pos, n, head) \
596 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
599 #define hlist_entry_safe(ptr, type, member) \
600 ({ typeof(ptr) ____ptr = (ptr); \
601 ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
609 #define hlist_for_each_entry(pos, head, member) \
610 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
612 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
618 #define hlist_for_each_entry_continue(pos, member) \
619 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
621 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
627 #define hlist_for_each_entry_from(pos, member) \
629 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
637 #define hlist_for_each_entry_safe(pos, n, head, member) \
638 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
639 pos && ({ n = pos->member.next; 1; }); \
640 pos = hlist_entry_safe(n, typeof(*pos), member))
static int hlist_unhashed_lockless(const struct hlist_node *h)
Version of hlist_unhashed for lockless use.
Definition: linuxlist.h:446
#define LLIST_POISON1
These are non-NULL pointers that will result in page faults under normal circumstances,...
Definition: linuxlist.h:42
static int hlist_unhashed(const struct hlist_node *h)
Has node been removed from list and reinitialized?.
Definition: linuxlist.h:433
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 void llist_splice(struct llist_head *llist, struct llist_head *head)
Join two linked lists.
Definition: linuxlist.h:192
#define llist_for_each(pos, head)
Iterate over a linked list.
Definition: linuxlist.h:255
struct llist_head * next
Pointer to next and previous item.
Definition: linuxlist.h:48
Definition: linuxlist.h:409
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:569
static void hlist_del(struct hlist_node *n)
Delete the specified hlist_node from its list.
Definition: linuxlist.h:476
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 INIT_HLIST_NODE(struct hlist_node *h)
Definition: linuxlist.h:416
#define INIT_LLIST_HEAD(ptr)
Initialize a llist_head to point back to itself.
Definition: linuxlist.h:65
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:503
static void llist_del(struct llist_head *entry)
Delete a single entry from a linked list.
Definition: linuxlist.h:128
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
struct hlist_node ** pprev
Definition: linuxlist.h:410
static void __llist_del(struct llist_head *prev, struct llist_head *next)
Definition: linuxlist.h:116
static void __llist_add(struct llist_head *_new, struct llist_head *prev, struct llist_head *next)
Definition: linuxlist.h:75
static void hlist_del_init(struct hlist_node *n)
Delete the specified hlist_node from its list and initialize.
Definition: linuxlist.h:488
Double linked lists with a single pointer list head.
Definition: linuxlist.h:405
static void hlist_move_list(struct hlist_head *old, struct hlist_head *_new)
Move an hlist.
Definition: linuxlist.h:581
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
#define LLIST_POISON2
Definition: linuxlist.h:43
(double) linked list header structure
Definition: linuxlist.h:46
static unsigned int llist_count(const struct llist_head *head)
Count number of llist items by iterating.
Definition: linuxlist.h:388
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
struct hlist_node * next
Definition: linuxlist.h:410
static void hlist_add_fake(struct hlist_node *n)
create a fake hlist consisting of a single headless node.
Definition: linuxlist.h:548
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
static void __llist_splice(struct llist_head *llist, struct llist_head *head)
Definition: linuxlist.h:174
static void __hlist_del(struct hlist_node *n)
Definition: linuxlist.h:460
#define READ_ONCE(x)
Definition: linuxlist.h:422
#define WRITE_ONCE(a, b)
Definition: linuxlist.h:423
static int llist_empty(const struct llist_head *head)
Test whether a linked list is empty.
Definition: linuxlist.h:169
static void hlist_add_before(struct hlist_node *n, struct hlist_node *next)
add a new entry before the one specified.
Definition: linuxlist.h:517
struct llist_head * prev
Definition: linuxlist.h:48
static int hlist_empty(const struct hlist_head *h)
Is the specified hlist_head structure an empty hlist?.
Definition: linuxlist.h:455
static void hlist_add_behind(struct hlist_node *n, struct hlist_node *prev)
add a new entry after the one specified
Definition: linuxlist.h:530
static void prefetch(const void *x)
Definition: linuxlist.h:25
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
struct hlist_node * first
Definition: linuxlist.h:406
static bool hlist_fake(struct hlist_node *h)
Is this node a fake hlist?.
Definition: linuxlist.h:556