Use of list_head struct

Martin Houry martinhoury at
Fri Jun 17 06:11:54 EDT 2016

Hello mailing list!
I've read some code in the NFS4.1 client. I have trouble to access
variables in a list_head.

So I have :
(include/linux/sunrpc/xprt.h line 168)
struct rpc_xprt{

    struct rpc_wait_queue pending; /* requests in flight */


struct rpc_wait_queue {
    struct list_head        tasks[RPC_NR_PRIORITY]; /* task queue for
each priority level */

The struct "list_head" is a classical  linked list. But How do I know
the type of the struct in this list?
I can maybe guess the struct in it :

struct rpc_task {}

But how can I be certain that "struct list_head tasks" contains some
"struct rpc_task"?

I'm new here, thank you for your help!

More information about the Kernelnewbies mailing list