netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
list.h File Reference

Simple doubly linked list implementation. More...

Go to the source code of this file.

Data Structures

struct  list_head

Macros

#define ATALK_LIST_HEAD_INIT(name)
#define ATALK_LIST_HEAD(name)
#define ATALK_INIT_LIST_HEAD(ptr)
#define list_entry(ptr, type, member)
 get the struct for this entry
#define list_for_each(pos, head)
 iterate over a list
#define list_for_each_prev(pos, head)
 iterate over a list in reverse order

Detailed Description

Simple doubly linked list implementation.

Some of the internal functions ("__xxx") are useful when manipulating whole lists rather than single entries, as sometimes we already know the next/prev entries and we can generate better code by using them directly rather than using the generic single-entry routines.

Macro Definition Documentation

◆ ATALK_INIT_LIST_HEAD

#define ATALK_INIT_LIST_HEAD ( ptr)
Value:
do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
#define next
Definition hash.c:35

◆ ATALK_LIST_HEAD

#define ATALK_LIST_HEAD ( name)
Value:
struct list_head name = ATALK_LIST_HEAD_INIT(name)
#define ATALK_LIST_HEAD_INIT(name)
Definition include/atalk/list.h:22
Definition include/atalk/list.h:18

◆ ATALK_LIST_HEAD_INIT

#define ATALK_LIST_HEAD_INIT ( name)
Value:
{ &(name), &(name) }

◆ list_entry

#define list_entry ( ptr,
type,
member )
Value:
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
static enum op type
Definition nad_cp.c:96

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.

◆ list_for_each

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

iterate over a list

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

◆ list_for_each_prev

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

iterate over a list in reverse order

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