Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
|
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | list_head |
Macros | |
#define | container_of(ptr, type, member) ((type *) ((void *) ptr - offsetof(type, member))) |
Get the object entry. More... | |
#define | list_entry(ptr, type, member) container_of(ptr, type, member) |
Get the object entry of a list. More... | |
#define | list_first_entry(ptr, type, member) list_entry((ptr)->next, type, member) |
Get the first object entry. More... | |
#define | list_prev_entry(pos, member) list_entry((pos)->member.prev, typeof(*(pos)), member) |
Get the previous object entry. More... | |
#define | list_next_entry(pos, member) list_entry((pos)->member.next, typeof(*(pos)), member) |
Get the next object entry. More... | |
#define | list_entry_is_head(pos, head, member) (&pos->member == (head)) |
Check if the list entry is at the end of the list. More... | |
#define | list_for_each(pos, head) for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next) |
Iterate the whole list with list pointer. More... | |
#define | list_for_each_safe(pos, _next, head) |
Safely iterate the whole list with list pointer. More... | |
#define | list_for_each_entry(pos, head, member) |
Iterate the whole list with list entry. More... | |
#define | LIST_HEAD_INIT(name) |
Statically initialize the list head. More... | |
#define | LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name) |
Declare and initialize a new list head. More... | |
Functions | |
void | INIT_LIST_HEAD (struct list_head *list) |
Initialize the list head. More... | |
int | list_empty (struct list_head *head) |
Check if the list is empty. More... | |
int | list_is_last (const struct list_head *list, const struct list_head *head) |
Check if the list object is the last of the list. More... | |
void | list_add (struct list_head *new, struct list_head *head) |
Add new list member to the list. More... | |
void | list_del (struct list_head *entry) |
Delete a list item from its list. More... | |
void | list_del_init (struct list_head *entry) |
Delete and force initialize a list member from its list. More... | |
void | list_move (struct list_head *list, struct list_head *new_head) |
Move a list member from original list to another. More... | |
#define container_of | ( | ptr, | |
type, | |||
member | |||
) | ((type *) ((void *) ptr - offsetof(type, member))) |
Get the object entry.
ptr | Pointer to the structure member. |
type | Type of the object. |
member | Name of the structure member. |
&obj | Returning object. |
#define list_entry | ( | ptr, | |
type, | |||
member | |||
) | container_of(ptr, type, member) |
Get the object entry of a list.
ptr | Pointer to the list member of the object. |
type | Type of the object. |
member | Name of the list member in the structure. |
&obj | Retuning object. |
#define list_entry_is_head | ( | pos, | |
head, | |||
member | |||
) | (&pos->member == (head)) |
Check if the list entry is at the end of the list.
pos | Position of the object in the list. |
member | Name of the list member in the structure. |
bool | true or false. |
#define list_first_entry | ( | ptr, | |
type, | |||
member | |||
) | list_entry((ptr)->next, type, member) |
Get the first object entry.
ptr | Head of the list. |
type | Type of the object. |
member | Name of the list member in the structure. |
&obj | Retunring object. |
#define list_for_each | ( | pos, | |
head | |||
) | for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next) |
Iterate the whole list with list pointer.
pos | Current position of the object in the list. |
head | Head of the list. |
None |
#define list_for_each_entry | ( | pos, | |
head, | |||
member | |||
) |
Iterate the whole list with list entry.
pos | Current position of the object in the list. |
head | Head of the list. |
member | Name of the list member in the structure. |
None |
#define list_for_each_safe | ( | pos, | |
_next, | |||
head | |||
) |
Safely iterate the whole list with list pointer.
pos | Current position of the object in the list. |
head | Head of the list. |
None |
#define LIST_HEAD | ( | name | ) | struct list_head name = LIST_HEAD_INIT(name) |
Declare and initialize a new list head.
name | Name of the list head variable. |
None |
#define LIST_HEAD_INIT | ( | name | ) |
Statically initialize the list head.
name | Name of the list head variable. |
None |
#define list_next_entry | ( | pos, | |
member | |||
) | list_entry((pos)->member.next, typeof(*(pos)), member) |
Get the next object entry.
pos | Current position of the object in the list. |
member | Name of the list member in the structure. |
&obj | Returning object. |
#define list_prev_entry | ( | pos, | |
member | |||
) | list_entry((pos)->member.prev, typeof(*(pos)), member) |
Get the previous object entry.
pos | Current position of the object in the list. |
member | Name of the list member in the structure. |
&obj | Returning object. |
void INIT_LIST_HEAD | ( | struct list_head * | list | ) |
Initialize the list head.
list | List head to initialize. |
None |
Add new list member to the list.
new | New list member. |
head | Head of the list. |
None |
void list_del | ( | struct list_head * | entry | ) |
Delete a list item from its list.
entry | The list member to delete. |
None |
void list_del_init | ( | struct list_head * | entry | ) |
Delete and force initialize a list member from its list.
entry | The list member to delete. |
None |
int list_empty | ( | struct list_head * | head | ) |
Check if the list is empty.
head | Head of the list. |
int | 0 as false; otherwise true. |
Check if the list object is the last of the list.
list | List member to check. |
head | Head of the list. |
int | 0 as false, otherwise true. |