October 2017
Intermediate to advanced
586 pages
14h 8m
English
Static allocation is done through the LIST_HEAD macro:
LIST_HEAD(mylist)
The LIST_HEAD definition is as follows:
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
The following is its expansion:
#define LIST_HEAD_INIT(name) { &(name), &(name) }
This assigns each pointer (prev and next) inside the name field to point to name itself (just like INIT_LIST_HEAD does).