From Understanding the Linux Kernel:
the Linux kernel defines the list_head data structure, whose only fields next and prev represent the forward and back pointers of a generic doubly linked list element, respectively. It is important to note, however, that the pointers in a list_head field store the addresses of other list_head fields rather than the addresses of the whole data structures in which the list_head structure is included; see Figure 3-3 (a).
Why do the pointers in a list_head field store the addresses of other list_head fields rather than the addresses of the whole data structures in which the list_head structure is included?
Given a pointer to a list_head
object, how can I get the object of a data structure (such as "data structure 1") which contains the list_head
object? For example, How can I get the process descriptor from a PID in Linux kernel?
If it were in a OO language, is it that the list_head fields would likely be private in the data structures in which the list_head structure is included? So is it more reasonable that the pointers in a list_head field store the addresses of the whole data structures in which the list_head structure is included than the addresses of other list_head fields?