cemu
载入中...
搜索中...
未找到
list.h 文件参考

浏览源代码.

struct  list_head
 
struct  hlist_node
 
struct  hlist_head
 

宏定义

#define NULL   0
 
#define LIST_POISON1   ((void *) 0x00100100)
 
#define LIST_POISON2   ((void *) 0x00200200)
 
#define LIST_HEAD_INIT(name)   { &(name), &(name) }
 
#define LIST_HEAD(name)    struct list_head name = LIST_HEAD_INIT(name)
 
#define INIT_LIST_HEAD(ptr)
 
#define list_entry(ptr, type, member)    ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 
#define list_first_entry(ptr, type, member)    list_entry((ptr)->next, type, member)
 
#define list_last_entry(ptr, type, member)    list_entry((ptr)->prev, type, member)
 
#define list_first_entry_or_null(ptr, type, member)    (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
 
#define list_for_each(pos, head)    for (pos = (head)->next; pos != (head); pos = pos->next)
 
#define list_for_each_safe(pos, n, head)
 
#define list_for_each_prev(pos, head)    for (pos = (head)->prev; pos != (head); pos = pos->prev)
 
#define INIT_HLIST_HEAD(ptr)   ((ptr)->first = NULL)
 
#define INIT_HLIST_NODE(h)
 
#define hlist_unhashed(h)   (!h->pprev)
 
#define hlist_empty(h)   (!h->first)
 
#define hlist_entry(ptr, type, member)    ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 
#define hlist_for_each(pos, head)    for (pos = (head)->first; pos ; pos = pos->next)
 
#define hlist_for_each_safe(pos, n, head)    for (pos = (head)->first; pos && ({ n = pos->next; 1; }); pos = n)
 

函数

void __list_add (struct list_head *l_new, struct list_head *prev, struct list_head *next)
 
void list_add (struct list_head *l_new, struct list_head *head)
 
void list_add_tail (struct list_head *l_new, struct list_head *head)
 
void __list_del (struct list_head *prev, struct list_head *next)
 
void list_del (struct list_head *entry)
 
void list_del_init (struct list_head *entry)
 
int list_empty (struct list_head *head)
 
void list_splice (struct list_head *list, struct list_head *head)
 
void hlist_del (struct hlist_node *n)
 
void hlist_del_init (struct hlist_node *n)
 
void hlist_add_head (struct hlist_node *n, struct hlist_head *h)
 
void hlist_add_before (struct hlist_node *n, struct hlist_node *next)
 
void hlist_add_behind (struct hlist_node *n, struct hlist_node *prev)
 
void hlist_add_fake (struct hlist_node *n)
 
int hlist_fake (struct hlist_node *h)
 
void hlist_move_list (struct hlist_head *old, struct hlist_head *l_new)
 

详细描述

作者
your name (you@d.nosp@m.omai.nosp@m.n.com)
版本
0.1
日期
2024-01-08

宏定义说明

◆ INIT_HLIST_NODE

#define INIT_HLIST_NODE ( h)
值:
{ \
h->next = NULL; \
h->pprev = NULL; \
}
#define NULL
Definition list.h:22

◆ INIT_LIST_HEAD

#define INIT_LIST_HEAD ( ptr)
值:
do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)

◆ list_entry

#define list_entry ( ptr,
type,
member )    ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))

list_entry - get the struct for this entry @ptr: the &struct list_head pointer. @type: the type of the struct this is embedded in. @member: the name of the list_struct within the struct.

◆ list_first_entry

#define list_first_entry ( ptr,
type,
member )    list_entry((ptr)->next, type, member)

list_first_entry - get the first element from a list @ptr: the list head to take the element from. @type: the type of the struct this is embedded in. @member: the name of the list_head within the struct.

Note, that list is expected to be not empty.

◆ list_first_entry_or_null

#define list_first_entry_or_null ( ptr,
type,
member )    (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)

list_first_entry_or_null - get the first element from a list @ptr: the list head to take the element from. @type: the type of the struct this is embedded in. @member: the name of the list_head within the struct.

Note that if the list is empty, it returns NULL.

◆ list_for_each

#define list_for_each ( pos,
head )    for (pos = (head)->next; pos != (head); pos = pos->next)

list_for_each - iterate over a list @pos: the &struct list_head to use as a loop counter. @head: the head for your list.

◆ list_for_each_prev

#define list_for_each_prev ( pos,
head )    for (pos = (head)->prev; pos != (head); pos = pos->prev)

list_for_each_prev - iterate over a list in reverse order @pos: the &struct list_head to use as a loop counter. @head: the head for your list.

◆ list_for_each_safe

#define list_for_each_safe ( pos,
n,
head )
值:
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)

list_for_each_safe - iterate over a list safe against removal of list entry @pos: the &struct list_head to use as a loop counter.
: another &struct list_head to use as temporary storage @head: the head for your list.

◆ list_last_entry

#define list_last_entry ( ptr,
type,
member )    list_entry((ptr)->prev, type, member)

list_last_entry - get the last element from a list @ptr: the list head to take the element from. @type: the type of the struct this is embedded in. @member: the name of the list_head within the struct.

Note, that list is expected to be not empty.

◆ NULL

#define NULL   0

from linux kenrel source

函数说明

◆ list_add()

void list_add ( struct list_head * l_new,
struct list_head * head )

list_add - add a l_new entry @l_new: l_new entry to be added @head: list head to add it after

Insert a l_new entry after the specified head. This is good for implementing stacks.

◆ list_add_tail()

void list_add_tail ( struct list_head * l_new,
struct list_head * head )

list_add_tail - add a l_new entry @l_new: l_new entry to be added @head: list head to add it before

Insert a l_new entry before the specified head. This is useful for implementing queues.

◆ list_del()

void list_del ( struct list_head * entry)

list_del - deletes entry from list. @entry: the element to delete from the list. Note: list_empty on entry does not return true after this, the entry is in an undefined state.

◆ list_del_init()

void list_del_init ( struct list_head * entry)

list_del_init - deletes entry from list and reinitialize it. @entry: the element to delete from the list.

◆ list_empty()

int list_empty ( struct list_head * head)

list_empty - tests whether a list is empty @head: the list to test.

◆ list_splice()

void list_splice ( struct list_head * list,
struct list_head * head )

list_splice - join two lists @list: the l_new list to add. @head: the place to add it in the first list.