Hi,

On Dec 20, 2007 6:28 AM, Manish Katiyar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> The other option is to browse the source code from web browser. you
> will get links there. Try lxr.linux.no
>
> Hope that helps
>
> On Dec 20, 2007 10:57 AM, Manish Katiyar <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > The other option is to browse the source code from web browser. you
> > will get links there. Try lxr.linux.no
> >
> > thanks
>
> >
> >
> > On Dec 20, 2007 10:43 AM, Rajat Jain <[EMAIL PROTECTED]> wrote:
> > > [EMAIL PROTECTED] wrote:
> > > > I am looking at the kernel and I see a call to foobar.
> > > >
> > > > How can I easily determine which source file has the foobar code?

In case you don't have cscope or something similar, or are not on a
machine where it is available, you can always use grep and find. For
example:

find <base-path-to-kernel> -name *.[ch] | xargs grep -n foobar

This will search in all .c and .h files for an occurrence of foobar.
Note that this will also list the uses of foobar, not only the
declaration.
It's possible to narrow down to the declaration using grep once again:

find <base-path-to-kernel> -name *.[ch] | xargs grep -n foobar | grep
-E "int|void|char|static"

This will only list occurences of foobar that have any of the
following keywords on that line: int, void, char, static. You can add
others if this doesn't work. However, I think that this list already
fairly good to get most occurrences.

If you assume that the coding style has been followed, then you can
also grep for { which should be on the same line as the function:
find <base-path-to-kernel> -name *.[ch] | xargs grep -n foobar | grep -E "{"
or
find <base-path-to-kernel> -name *.[ch] | xargs grep -n foobar | grep
-E "{|int|void|char|static"


(Note: you can write a small script or alias to automate this...)

Hope this helps,

Thomas

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to