Motr
M0
|
Data Structures | |
struct | m0_list_link |
struct | m0_list |
Macros | |
#define | m0_list_entry(link, type, member) container_of(link, type, member) |
#define | m0_list_for_each(head, pos) |
#define | m0_list_for_each_entry(head, pos, type, member) |
#define | m0_list_for_each_entry_safe(head, pos, next, type, member) |
#define | m0_list_forall(var, head, ...) |
#define | m0_list_entry_forall(var, head, type, member, ...) |
#define | m0_list_teardown(head, pos, type, member) |
Functions | |
struct m0_list_link | M0_XCA_DOMAIN (be) |
M0_INTERNAL void | m0_list_link_init (struct m0_list_link *link) |
M0_INTERNAL void | m0_list_link_fini (struct m0_list_link *link) |
M0_INTERNAL bool | m0_list_link_invariant (const struct m0_list_link *link) |
M0_BASSERT (offsetof(struct m0_list, l_head)==offsetof(struct m0_list_link, ll_next)) | |
M0_BASSERT (offsetof(struct m0_list, l_tail)==offsetof(struct m0_list_link, ll_prev)) | |
M0_INTERNAL void | m0_list_init (struct m0_list *head) |
M0_INTERNAL void | m0_list_fini (struct m0_list *head) |
M0_INTERNAL bool | m0_list_is_empty (const struct m0_list *head) |
M0_INTERNAL bool | m0_list_contains (const struct m0_list *list, const struct m0_list_link *link) |
M0_INTERNAL bool | m0_list_invariant (const struct m0_list *list) |
M0_INTERNAL size_t | m0_list_length (const struct m0_list *list) |
M0_INTERNAL void | m0_list_add (struct m0_list *head, struct m0_list_link *next) |
M0_INTERNAL void | m0_list_add_tail (struct m0_list *head, struct m0_list_link *next) |
M0_INTERNAL void | m0_list_add_after (struct m0_list_link *anchor, struct m0_list_link *next) |
M0_INTERNAL void | m0_list_add_before (struct m0_list_link *anchor, struct m0_list_link *next) |
M0_INTERNAL void | m0_list_del (struct m0_list_link *old) |
M0_INTERNAL void | m0_list_move (struct m0_list *head, struct m0_list_link *next) |
M0_INTERNAL void | m0_list_move_tail (struct m0_list *head, struct m0_list_link *next) |
static struct m0_list_link * | m0_list_first (const struct m0_list *head) |
M0_INTERNAL bool | m0_list_link_is_in (const struct m0_list_link *link) |
M0_INTERNAL bool | m0_list_link_is_last (const struct m0_list_link *link, const struct m0_list *head) |
#define m0_list_entry | ( | link, | |
type, | |||
member | |||
) | container_of(link, type, member) |
Returns a conjunction (logical AND) of an expression evaluated for each list element.
Declares a pointer variable named "var", in a new scope and evaluates user-supplied expression (the last argument) with "var" iterated over successive list elements, while this expression returns true. Returns true iff the whole list was iterated over.
The list can be modified by the user-supplied expression.
This function is useful for invariant checking.
#define m0_list_for_each | ( | head, | |
pos | |||
) |
Iterates over a list
head | the head of list. |
pos | the pointer to list_link to use as a loop counter. |
Read-only iterates over a "typed" list.
The loop body is not allowed to modify the list.
#define m0_list_forall | ( | var, | |
head, | |||
... | |||
) |
Returns a conjunction (logical AND) of an expression evaluated for each list element.
Declares a struct m0_list_link pointer variable named "var" in a new scope and evaluates user-supplied expression (the last argument) with "var" iterated over successive list elements, while this expression returns true. Returns true iff the whole list was iterated over.
The list can not be modified by the user-supplied expression.
This function is useful for invariant checking.
Empties the list by taking its elements to and removing them one after another starting from head.
head | of list. |
pos | current list element. |
type | containing m0_list_link . |
member | field name at the . |
M0_INTERNAL void m0_list_add | ( | struct m0_list * | head, |
struct m0_list_link * | next | ||
) |
M0_INTERNAL void m0_list_add_after | ( | struct m0_list_link * | anchor, |
struct m0_list_link * | next | ||
) |
M0_INTERNAL void m0_list_add_before | ( | struct m0_list_link * | anchor, |
struct m0_list_link * | next | ||
) |
M0_INTERNAL void m0_list_add_tail | ( | struct m0_list * | head, |
struct m0_list_link * | next | ||
) |
M0_INTERNAL bool m0_list_contains | ( | const struct m0_list * | list, |
const struct m0_list_link * | link | ||
) |
M0_INTERNAL void m0_list_del | ( | struct m0_list_link * | old | ) |
M0_INTERNAL void m0_list_fini | ( | struct m0_list * | head | ) |
|
inlinestatic |
M0_INTERNAL void m0_list_init | ( | struct m0_list * | head | ) |
M0_INTERNAL bool m0_list_invariant | ( | const struct m0_list * | list | ) |
This function iterate over the argument list checking that double-linked list invariant holds (x->ll_prev->ll_next == x && x->ll_next->ll_prev == x).
Definition at line 70 of file list.c.
M0_INTERNAL bool m0_list_is_empty | ( | const struct m0_list * | head | ) |
M0_INTERNAL size_t m0_list_length | ( | const struct m0_list * | list | ) |
M0_INTERNAL void m0_list_link_fini | ( | struct m0_list_link * | link | ) |
M0_INTERNAL void m0_list_link_init | ( | struct m0_list_link * | link | ) |
M0_INTERNAL bool m0_list_link_invariant | ( | const struct m0_list_link * | link | ) |
M0_INTERNAL bool m0_list_link_is_in | ( | const struct m0_list_link * | link | ) |
M0_INTERNAL bool m0_list_link_is_last | ( | const struct m0_list_link * | link, |
const struct m0_list * | head | ||
) |
M0_INTERNAL void m0_list_move | ( | struct m0_list * | head, |
struct m0_list_link * | next | ||
) |
M0_INTERNAL void m0_list_move_tail | ( | struct m0_list * | head, |
struct m0_list_link * | next | ||
) |
struct m0_list_link M0_XCA_DOMAIN | ( | be | ) |