Karg  v0.2.0
The kernel of CargOS
list.h File Reference
#include <stddef.h>
#include <types.h>

Go to the source code of this file.

Classes

struct  list_node
 

Macros

#define list_head_init(name)   {&name, &name}
 
#define list_entry(node, type, member)    ((type *) ((u8 *) (node) - offsetof(type, member)))
 
#define list_first_entry(head, type, member)    list_entry(list_front(head), type, member)
 
#define list_last_entry(head, type, member)    list_entry(list_back(head), type, member)
 
#define list_for_each(head, node)    for (node = (head)->next; node != (head); node = node->next)
 
#define list_for_each_entry(head, member, entry)
 

Typedefs

typedef struct list_node list_node_t
 

Macro Definition Documentation

◆ list_entry

#define list_entry (   node,
  type,
  member 
)     ((type *) ((u8 *) (node) - offsetof(type, member)))

◆ list_first_entry

#define list_first_entry (   head,
  type,
  member 
)     list_entry(list_front(head), type, member)

◆ list_for_each

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

◆ list_for_each_entry

#define list_for_each_entry (   head,
  member,
  entry 
)
Value:
for (entry = list_first_entry(head, typeof(*entry), member); \
&entry->member != (head); \
entry = list_entry(entry->member.next, typeof(*entry), member))
#define list_first_entry(head, type, member)
Definition: list.h:35
#define list_entry(node, type, member)
Definition: list.h:33

◆ list_head_init

#define list_head_init (   name)    {&name, &name}

◆ list_last_entry

#define list_last_entry (   head,
  type,
  member 
)     list_entry(list_back(head), type, member)

Typedef Documentation

◆ list_node_t

typedef struct list_node list_node_t