Buddy Allocator  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Functions
list.h File Reference

Go to the source code of this file.

Data Structures

struct  list_head
 

Macros

#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_for_each(pos, head)
 
#define list_for_each_prev(pos, head)
 
#define list_for_each_safe(pos, n, head)
 
#define list_for_each_entry(pos, head, member)
 
#define list_for_each_entry_safe(pos, n, head, member)
 

Functions

static void __list_add (struct list_head *new, struct list_head *prev, struct list_head *next)
 
static void list_add (struct list_head *new, struct list_head *head)
 
static void list_add_tail (struct list_head *new, struct list_head *head)
 
static void __list_del (struct list_head *prev, struct list_head *next)
 
static void list_del (struct list_head *entry)
 
static void list_del_init (struct list_head *entry)
 
static void list_move (struct list_head *list, struct list_head *head)
 
static void list_move_tail (struct list_head *list, struct list_head *head)
 
static int list_empty (struct list_head *head)
 
static void __list_splice (struct list_head *list, struct list_head *head)
 
static void list_splice (struct list_head *list, struct list_head *head)
 
static void list_splice_init (struct list_head *list, struct list_head *head)
 

Macro Definition Documentation

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

Definition at line 30 of file list.h.

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

list_entry - get the struct for this entry

Parameters
ptrthe &struct list_head pointer.
typethe type of the struct this is embedded in.
memberthe name of the list_struct within the struct.

Definition at line 190 of file list.h.

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

list_for_each - iterate over a list

Parameters
posthe &struct list_head to use as a loop counter.
headthe head for your list.

Definition at line 198 of file list.h.

#define list_for_each_entry (   pos,
  head,
  member 
)
Value:
for (pos = list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
#define list_entry(ptr, type, member)
Definition: list.h:190

list_for_each_entry - iterate over list of given type

Parameters
posthe type * to use as a loop counter.
headthe head for your list.
memberthe name of the list_struct within the struct.

Definition at line 226 of file list.h.

#define list_for_each_entry_safe (   pos,
  n,
  head,
  member 
)
Value:
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
#define list_entry(ptr, type, member)
Definition: list.h:190

list_for_each_entry_safe - iterate over list of given type safe against removal of list entry

Parameters
posthe type * to use as a loop counter.
nanother type * to use as temporary storage
headthe head for your list.
memberthe name of the list_struct within the struct.

Definition at line 238 of file list.h.

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

list_for_each_prev - iterate over a list backwards

Parameters
posthe &struct list_head to use as a loop counter.
headthe head for your list.

Definition at line 206 of file list.h.

#define list_for_each_safe (   pos,
  n,
  head 
)
Value:
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

Parameters
posthe &struct list_head to use as a loop counter.
nanother &struct list_head to use as temporary storage
headthe head for your list.

Definition at line 216 of file list.h.

#define LIST_HEAD (   name)    struct list_head name = LIST_HEAD_INIT(name)

Definition at line 27 of file list.h.

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

Definition at line 25 of file list.h.

Function Documentation

static void __list_add ( struct list_head new,
struct list_head prev,
struct list_head next 
)
inlinestatic

Definition at line 40 of file list.h.

static void __list_del ( struct list_head prev,
struct list_head next 
)
inlinestatic

Definition at line 83 of file list.h.

static void __list_splice ( struct list_head list,
struct list_head head 
)
inlinestatic

Definition at line 143 of file list.h.

static void list_add ( struct list_head new,
struct list_head head 
)
inlinestatic

list_add - add a new entry

Parameters
newnew entry to be added
headlist head to add it after

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

Definition at line 58 of file list.h.

static void list_add_tail ( struct list_head new,
struct list_head head 
)
inlinestatic

list_add_tail - add a new entry

Parameters
newnew entry to be added
headlist head to add it before

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

Definition at line 71 of file list.h.

static void list_del ( struct list_head entry)
inlinestatic

list_del - deletes entry from list.

Parameters
entrythe element to delete from the list.
Note
list_empty on entry does not return true after this, the entry is in an undefined state.

Definition at line 94 of file list.h.

static void list_del_init ( struct list_head entry)
inlinestatic

list_del_init - deletes entry from list and reinitialize it.

Parameters
entrythe element to delete from the list.

Definition at line 105 of file list.h.

static int list_empty ( struct list_head head)
inlinestatic

list_empty - tests whether a list is empty

Parameters
headthe list to test.

Definition at line 138 of file list.h.

static void list_move ( struct list_head list,
struct list_head head 
)
inlinestatic

list_move - delete from one list and add as another's head

Parameters
listthe entry to move
headthe head that will precede our entry

Definition at line 116 of file list.h.

static void list_move_tail ( struct list_head list,
struct list_head head 
)
inlinestatic

list_move_tail - delete from one list and add as another's tail

Parameters
listthe entry to move
headthe head that will follow our entry

Definition at line 127 of file list.h.

static void list_splice ( struct list_head list,
struct list_head head 
)
inlinestatic

list_splice - join two lists

Parameters
listthe new list to add.
headthe place to add it in the first list.

Definition at line 162 of file list.h.

static void list_splice_init ( struct list_head list,
struct list_head head 
)
inlinestatic

list_splice_init - join two lists and reinitialise the emptied list.

Parameters
listthe new list to add.
headthe place to add it in the first list.

The list at the list parameter is reinitialised

Definition at line 175 of file list.h.