mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "anish singh" <anish198519851985@gmail.com>,
	"amit mehta" <gmate.amit@gmail.com>,
	"Henrique Rodrigues" <henriquesilvar@gmail.com>,
	"kishore kumar" <kishoreopen@gmail.com>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	linux-kernel@vger.kernel.org, Kernelnewbies@kernelnewbies.org
Subject: Re: how to look for source code in kernel
Date: Fri, 28 Dec 2012 14:07:34 +0100	[thread overview]
Message-ID: <20121228130734.GB13224@x1.alien8.de> (raw)
In-Reply-To: <87a9syhbma.fsf@xmission.com>

On Thu, Dec 27, 2012 at 11:36:13PM -0800, Eric W. Biederman wrote:
> git-ls-files | xargs fgrep 'struct f2fs_inode'
> 
> That returns instantly and tells me where to look.  If you can do an
> instant brute force search what is the point of an index?

Not if you're using a lame-ass laptop with a rotating disk:

$ time git ls-files | xargs grep -E 'struct mce\W*{'
arch/x86/include/uapi/asm/mce.h:struct mce {
arch/x86/kernel/cpu/mcheck/mce.c:               if (!final || memcmp(m, final, sizeof(struct mce))) {

real    2m48.415s
user    0m2.388s
sys     0m15.668s

What I've grown accustomed to is cscope with a prior find run on the
kernel source tree to create a custom cscope.files which cscope uses to
index and then using vim bindings in cscope so that if, for example, the
cursor is on a function call, executing a keyboard shortcut opens the
definition of that function in another vim tab. I.e., a thin IDE done
right.

> My experience with gui editors is that they always hide something I
> need to see, or my code is just strange enough (say having asm file,
> or supporting multiple architectures) that the tools get horribly
> confused.

That's true, then I tend to use another xterm with tabbed vim showing
additional files. Btw, git ls-files assumes a source file is tracked by
git and in the seldom case where you're adding new, yet untracked files,
that won't work.

So probably a mixed approach of cscope in one window and grep + editor
in another would cover all bases. For a newbie who wants to only browse
the code, cscope should be enough for starters, I'd say.

Thanks.

-- 
Regards/Gruss,
Boris.

  reply	other threads:[~2012-12-28 13:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+8YGd6UqfbzEHOb2NUL5p3EF4OECVq7yc2vRV3GViVT64CTbQ@mail.gmail.com>
     [not found] ` <20121227184034.GA2982@debian.debian>
     [not found]   ` <CABuSbKbk5DdhvuwYUeLkm=eub1CsSaOB_oX7bkBZcAV_MNsSdg@mail.gmail.com>
2012-12-28  4:49     ` anish singh
2012-12-28  5:12       ` amit mehta
2012-12-28  5:19         ` anish singh
2012-12-28  5:37           ` Alex Belits
2012-12-28  7:36           ` Eric W. Biederman
2012-12-28 13:07             ` Borislav Petkov [this message]
2012-12-28 22:03               ` Geert Uytterhoeven
2012-12-29 11:09                 ` Borislav Petkov
2012-12-28 22:23               ` Guennadi Liakhovetski
2012-12-28 22:38                 ` Jesper Juhl
2012-12-28 23:08                 ` [PATCH] scripts/tags.sh: Fix regex syntax for etags Andreas Schwab
2012-12-28 23:22                   ` Jesper Juhl
2013-01-13 21:23                     ` Michal Marek
2012-12-28 16:09             ` how to look for source code in kernel Al Viro
2012-12-28 19:49               ` Eric W. Biederman
2012-12-28 20:42                 ` Jonathan Neuschäfer
2012-12-28 21:31               ` Joe Perches
2012-12-28  5:40         ` Chen Gang F T
2012-12-28  5:49         ` Chen Gang F T

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121228130734.GB13224@x1.alien8.de \
    --to=bp@alien8.de \
    --cc=Kernelnewbies@kernelnewbies.org \
    --cc=anish198519851985@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=gmate.amit@gmail.com \
    --cc=henriquesilvar@gmail.com \
    --cc=j.neuschaefer@gmx.net \
    --cc=kishoreopen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®