Linux Kernel
3.7.1
|
#include <linux/kernel.h>
#include <asm/cmpxchg.h>
Go to the source code of this file.
Data Structures | |
struct | llist_head |
struct | llist_node |
Macros | |
#define | LLIST_HEAD_INIT(name) { NULL } |
#define | LLIST_HEAD(name) struct llist_head name = LLIST_HEAD_INIT(name) |
#define | llist_entry(ptr, type, member) container_of(ptr, type, member) |
#define | llist_for_each(pos, node) for ((pos) = (node); pos; (pos) = (pos)->next) |
#define | llist_for_each_entry(pos, node, member) |
Functions | |
bool | llist_add_batch (struct llist_node *new_first, struct llist_node *new_last, struct llist_head *head) |
struct llist_node * | llist_del_first (struct llist_head *head) |
#define llist_entry | ( | ptr, | |
type, | |||
member | |||
) | container_of(ptr, type, member) |
llist_for_each - iterate over some deleted entries of a lock-less list : the &struct llist_node to use as a loop cursor : the first entry of deleted list entries
In general, some entries of the lock-less list can be traversed safely only after being deleted from list, so start with an entry instead of list head.
If being used on entries deleted from lock-less list directly, the traverse order is from the newest to the oldest added entry. If you want to traverse from the oldest to the newest, you must reverse the order by yourself before traversing.
llist_for_each_entry - iterate over some deleted entries of lock-less list of given type : the type * to use as a loop cursor. : the fist entry of deleted list entries. : the name of the llist_node with the struct.
In general, some entries of the lock-less list can be traversed safely only after being removed from list, so start with an entry instead of list head.
If being used on entries deleted from lock-less list directly, the traverse order is from the newest to the oldest added entry. If you want to traverse from the oldest to the newest, you must reverse the order by yourself before traversing.
#define LLIST_HEAD | ( | name | ) | struct llist_head name = LLIST_HEAD_INIT(name) |
bool llist_add_batch | ( | struct llist_node * | new_first, |
struct llist_node * | new_last, | ||
struct llist_head * | head | ||
) |
|
read |
llist_del_first - delete the first entry of lock-less list : the head for your lock-less list
If list is empty, return NULL, otherwise, return the first entry deleted, this is the newest added one.
Only one llist_del_first user can be used simultaneously with multiple llist_add users without lock. Because otherwise llist_del_first, llist_add, llist_add (or llist_del_all, llist_add, llist_add) sequence in another user may change ->first->next, but keep ->first. If multiple consumers are needed, please use llist_del_all or use lock between consumers.