The site lxr.free-electrons.com is very useful when I want to find the definition of a struct in linux kernel.
However, what's annoying is:
If a struct is declared in many other header files, then the found results will be a lot of incomplete declarations and one complete definition of the struct. It's hard to distinguish the definition and the declarations.
For instance, the search results of struct task_struct
are:
task_struct
Defined as a struct type in:
drivers/mmc/card/queue.h, line 7 drivers/oprofile/cpu_buffer.h, line 21
drivers/net/wireless/cw1200/cw1200.h, line 34
include/uapi/linux/capability.h, line 18
include/asm-generic/syscall.h, line 22
......
......
That's very terrible to locate the complete definition of struct task_struct
.
How to solve this problem?
I find it much useful to download the linux source code in my system and browse using
cscope
command line tool. It together withctags
is very useful for code navigation.