Skip to contentSkip to conversation

How can I locate a struct's defination?

DISCUSSION Navy Cheng 3 participants 3 messages Aug 2, 2015 – Aug 3, 2015

lore
Share & tools
lore

Navy Cheng

author
#0 lore raw

Hi,
I use emacs and tags to read kernel source. The tags is create by

make tags

in the kernel source tree. When I want to find a struct's defination, something goes wrong. For example: when I find *dentry* , the first result is:

    struct rchan_buf
    {
       ...
            struct dentry *dentry;          /* channel file dentry */
       ...
    }

There are so many items like this before I find

    struct dentry
    {
        ....
    }

How can I find the struct's defination directly?

Thanks.

#1 lore raw
Quoted 16 lines · Navy Cheng

Hi,
I use emacs and tags to read kernel source. The tags is create by

make tags

in the kernel source tree. When I want to find a struct's defination, something goes wrong. For example: when I find *dentry* , the first result is:

    struct rchan_buf
    {
       ...
            struct dentry *dentry;          /* channel file dentry */
       ...
    }
Quoted 6 lines

There are so many items like this before I find

    struct dentry
    {
        ....
    }

Usually the definition has the curly brace on the same line, like this:

struct dentry {.

Just search for "{", it work in vim.

Daniel.

#2 lore raw
In reply to Navy Cheng
Quoted 24 lines

-----Original Message-----
From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies- bounces at kernelnewbies.org] On Behalf Of Navy Cheng
Sent: Saturday, August 01, 2015 10:01 PM
To: kernelnewbies at kernelnewbies.org
Subject: How can I locate a struct's defination?

Hi,
I use emacs and tags to read kernel source. The tags is create by

make tags

in the kernel source tree. When I want to find a struct's defination, something goes wrong. For example: when I find *dentry* , the first result is:

    struct rchan_buf
    {
       ...
            struct dentry *dentry;          /* channel file dentry */
       ...
    }

There are so many items like this before I find

Quoted 8 lines
    struct dentry
    {
        ....
    }

How can I find the struct's defination directly?

Thanks.

https://scan.coverity.com/

Create an account and sign up for the linux project.

It is a proprietary platform but you can sign up for free and it is the best code browser out there. It beats ctags, cscope, etc. by a mile.

Jeff Haran