Harish Chennamsetty
Harish Chennamsetty

Reputation: 55

is there any difference between list_head and LIST_HEAD

LIST_HEAD is found in the sys/queue.h file. After using man list_head, I get to know about "LIST_HEAD" but not about "list_head".

I'm just curious what are the definitions of LIST_HEAD and list_head. In which files are these definitions located in the include directory (I tried to use grep (grep command to search for the files that include them, but being a noob, it is not of much help) grep -hrn 'list_head" didn't help. is it that both list_head and LIST_HEAD are meant for two different tasks/functions? what is the difference if any?

Upvotes: 1

Views: 2037

Answers (1)

gby
gby

Reputation: 15218

struct list_head is the name of a C struct for holding a generic linked list head (pointer to prev and next of same type) - http://lxr.free-electrons.com/source/include/linux/types.h#L185

LIST_HEAD is a name of a macro that defines and initializes a struct list_head whose name is passed as parameter for the macro - http://lxr.free-electrons.com/source/include/linux/list.h#L22

Upvotes: 2

Related Questions