About the name of 'struct list_head', how about giving an alias for differentiating the usage?

Chan Kim ckim at etri.re.kr
Mon Jul 3 01:47:32 EDT 2023


Hello all,

Often when I analyze linux source code, it takes me some time to figure out
how a list_head member of a struct is being used.
Sometimes it points to a linked list's start member, but sometimes it used
to link the containing struct as a member of linked list.(you know we cat
get the struct in the linked list using container_of operator). Wouldn't it
be nice if we give list_head an alias like 'list_hook_head' (or just
list_hook) so that the alias can be used for the second case? By gradually
changing the type name to list_hook_head in some structs, we could make the
source code more easier to read. I hope someone do this someday..
Thank you.

Chan Kim








More information about the Kernelnewbies mailing list