linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: how to look for source code in kernel
       [not found]   ` <CABuSbKbk5DdhvuwYUeLkm=eub1CsSaOB_oX7bkBZcAV_MNsSdg@mail.gmail.com>
@ 2012-12-28  4:49     ` anish singh
  2012-12-28  5:12       ` amit mehta
  0 siblings, 1 reply; 19+ messages in thread
From: anish singh @ 2012-12-28  4:49 UTC (permalink / raw)
  To: Henrique Rodrigues
  Cc: Jonathan Neuschäfer, kishore kumar, Kernelnewbies,
	linux-kernel

On Fri, Dec 28, 2012 at 1:23 AM, Henrique Rodrigues
<henriquesilvar@gmail.com> wrote:
> http://lxr.linux.no/ is a really good linux cross referencing website for
> code reference.
>
> On Thu, Dec 27, 2012 at 10:40 AM, Jonathan Neuschäfer
> <j.neuschaefer@gmx.net> wrote:
>>
>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>> > can anybody tell me how to look into source code, as most are hidden in
>> > kernel.
>>
>> You can find the Linux source code at http://kernel.org/ .
for browsing the code unfortunately there is no good tool as in windows we
have source insight.We can use wine in linux but that sucks.
>>
>> HTH,
>> Jonathan Neuschäfer
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
>
> --
> Henrique Rodrigues
> http://www.dcc.ufmg.br/~hsr
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28  4:49     ` how to look for source code in kernel anish singh
@ 2012-12-28  5:12       ` amit mehta
  2012-12-28  5:19         ` anish singh
                           ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: amit mehta @ 2012-12-28  5:12 UTC (permalink / raw)
  To: anish singh
  Cc: Henrique Rodrigues, kishore kumar, Jonathan Neuschäfer,
	linux-kernel, Kernelnewbies

>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>> > can anybody tell me how to look into source code, as most are hidden in
>>> > kernel.
>>>
>>> You can find the Linux source code at http://kernel.org/ .
> for browsing the code unfortunately there is no good tool as in windows we
> have source insight.We can use wine in linux but that sucks.
Funny you say that!
Never heard of cscope, ctags ?

-Amit

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  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  5:40         ` Chen Gang F T
  2012-12-28  5:49         ` Chen Gang F T
  2 siblings, 2 replies; 19+ messages in thread
From: anish singh @ 2012-12-28  5:19 UTC (permalink / raw)
  To: amit mehta
  Cc: Henrique Rodrigues, kishore kumar, Jonathan Neuschäfer,
	linux-kernel, Kernelnewbies

On Fri, Dec 28, 2012 at 10:42 AM, amit mehta <gmate.amit@gmail.com> wrote:
>>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>>> > can anybody tell me how to look into source code, as most are hidden in
>>>> > kernel.
>>>>
>>>> You can find the Linux source code at http://kernel.org/ .
>> for browsing the code unfortunately there is no good tool as in windows we
>> have source insight.We can use wine in linux but that sucks.
> Funny you say that!
> Never heard of cscope, ctags ?
It is not as convenient as source insight or is it?
>
> -Amit

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28  5:19         ` anish singh
@ 2012-12-28  5:37           ` Alex Belits
  2012-12-28  7:36           ` Eric W. Biederman
  1 sibling, 0 replies; 19+ messages in thread
From: Alex Belits @ 2012-12-28  5:37 UTC (permalink / raw)
  To: anish singh
  Cc: amit mehta, Henrique Rodrigues, kishore kumar,
	Jonathan Neuschäfer, linux-kernel, Kernelnewbies

On Fri, 28 Dec 2012, anish singh wrote:

>>> have source insight.We can use wine in linux but that sucks.
>> Funny you say that!
>> Never heard of cscope, ctags ?
> It is not as convenient as source insight or is it?

There is also LXR.

If it's not good enough for you, then don't look at it.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28  5:12       ` amit mehta
  2012-12-28  5:19         ` anish singh
@ 2012-12-28  5:40         ` Chen Gang F T
  2012-12-28  5:49         ` Chen Gang F T
  2 siblings, 0 replies; 19+ messages in thread
From: Chen Gang F T @ 2012-12-28  5:40 UTC (permalink / raw)
  To: amit mehta
  Cc: anish singh, Henrique Rodrigues, kishore kumar,
	Jonathan Neuschäfer, linux-kernel, Kernelnewbies

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

于 2012年12月28日 13:12, amit mehta 写道:
>>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>>>> can anybody tell me how to look into source code, as most are hidden in
>>>>> kernel.
>>>> You can find the Linux source code at http://kernel.org/ .
>> for browsing the code unfortunately there is no good tool as in windows we
>> have source insight.We can use wine in linux but that sucks.
> Funny you say that!
> Never heard of cscope, ctags ?

  at least for me:
     vi (or vim) with another command line tools (grep, wc...) are enough.

     for reading or editing source code: grasp one editor is enough.
       I originally work under Windows OS
          using VC IDE and source insight for many years (at least 6 years).
       but I never feel they are better than vi, and neither less than vi.
       each editor has its own efficiency using ways, 
         what we need do is to grasp it.

    when you grasp the editor (no matter what it is), it will be enough for you.

    

>
> -Amit
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


-- 
Flying Transformer


[-- Attachment #2: chen_gang_flying_transformer.vcf --]
[-- Type: text/x-vcard, Size: 67 bytes --]

begin:vcard
fn:Chen Gang
n:;Chen Gang
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28  5:12       ` amit mehta
  2012-12-28  5:19         ` anish singh
  2012-12-28  5:40         ` Chen Gang F T
@ 2012-12-28  5:49         ` Chen Gang F T
  2 siblings, 0 replies; 19+ messages in thread
From: Chen Gang F T @ 2012-12-28  5:49 UTC (permalink / raw)
  To: amit mehta
  Cc: anish singh, Henrique Rodrigues, kishore kumar,
	Jonathan Neuschäfer, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]

于 2012年12月28日 13:12, amit mehta 写道:
>>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>>>> can anybody tell me how to look into source code, as most are hidden in
>>>>> kernel.
>>>> You can find the Linux source code at http://kernel.org/ .
>> for browsing the code unfortunately there is no good tool as in windows we
>> have source insight.We can use wine in linux but that sucks.
> Funny you say that!
> Never heard of cscope, ctags ?

  at least for me:
     vi (or vim) with another command line tools (grep, wc...) are enough.

     for reading or editing source code: grasp one editor is enough.
       I originally work under Windows OS,
         using VC IDE and source insight for many years (at least 6 years).
       but I never feel they are better than vi, and neither less than vi.
       each editor has its own efficiency using ways,
         what we need do is to grasp it.

    when you grasp the editor (no matter what it is), it will be enough for you.

    


> -Amit
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


-- 
Flying Transformer


[-- Attachment #2: chen_gang_flying_transformer.vcf --]
[-- Type: text/x-vcard, Size: 67 bytes --]

begin:vcard
fn:Chen Gang
n:;Chen Gang
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  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
  2012-12-28 16:09             ` how to look for source code in kernel Al Viro
  1 sibling, 2 replies; 19+ messages in thread
From: Eric W. Biederman @ 2012-12-28  7:36 UTC (permalink / raw)
  To: anish singh
  Cc: amit mehta, Henrique Rodrigues, kishore kumar,
	Jonathan Neuschäfer, linux-kernel, Kernelnewbies

anish singh <anish198519851985@gmail.com> writes:

> On Fri, Dec 28, 2012 at 10:42 AM, amit mehta <gmate.amit@gmail.com> wrote:
>>>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>>>> > can anybody tell me how to look into source code, as most are hidden in
>>>>> > kernel.
>>>>>
>>>>> You can find the Linux source code at http://kernel.org/ .
>>> for browsing the code unfortunately there is no good tool as in windows we
>>> have source insight.We can use wine in linux but that sucks.
>> Funny you say that!
>> Never heard of cscope, ctags ?
> It is not as convenient as source insight or is it?

I took a look and source insite seems to have a whole lot of
inconvinient mousing around.  A setup where you get to stay on your home
keys seems much more convinient to me.

But then I am probably peculiar keeping an index of the source code in
my head.  When I need to look for something and I don't know where to
find it I do.

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?

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.

So I suspect source insight would be terribly inconvinient to the point
of uselessness to me.

Eric

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28  7:36           ` Eric W. Biederman
@ 2012-12-28 13:07             ` Borislav Petkov
  2012-12-28 22:03               ` Geert Uytterhoeven
  2012-12-28 22:23               ` Guennadi Liakhovetski
  2012-12-28 16:09             ` how to look for source code in kernel Al Viro
  1 sibling, 2 replies; 19+ messages in thread
From: Borislav Petkov @ 2012-12-28 13:07 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: anish singh, amit mehta, Henrique Rodrigues, kishore kumar,
	Jonathan Neuschäfer, linux-kernel, Kernelnewbies

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.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28  7:36           ` Eric W. Biederman
  2012-12-28 13:07             ` Borislav Petkov
@ 2012-12-28 16:09             ` Al Viro
  2012-12-28 19:49               ` Eric W. Biederman
  2012-12-28 21:31               ` Joe Perches
  1 sibling, 2 replies; 19+ messages in thread
From: Al Viro @ 2012-12-28 16:09 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: anish singh, amit mehta, Henrique Rodrigues, kishore kumar,
	Jonathan Neusch??fer, linux-kernel, Kernelnewbies

On Thu, Dec 27, 2012 at 11:36:13PM -0800, Eric W. Biederman wrote:
> But then I am probably peculiar keeping an index of the source code in
> my head.  When I need to look for something and I don't know where to
> find it I do.
> 
> git-ls-files | xargs fgrep 'struct f2fs_inode'

What's wrong with git grep?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  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
  1 sibling, 1 reply; 19+ messages in thread
From: Eric W. Biederman @ 2012-12-28 19:49 UTC (permalink / raw)
  To: Al Viro
  Cc: anish singh, amit mehta, Henrique Rodrigues, kishore kumar,
	Jonathan Neusch??fer, linux-kernel, Kernelnewbies

Al Viro <viro@ZenIV.linux.org.uk> writes:

> On Thu, Dec 27, 2012 at 11:36:13PM -0800, Eric W. Biederman wrote:
>> But then I am probably peculiar keeping an index of the source code in
>> my head.  When I need to look for something and I don't know where to
>> find it I do.
>> 
>> git-ls-files | xargs fgrep 'struct f2fs_inode'
>
> What's wrong with git grep?

I haven't learned it yet.  git-ls-files is a lot better than find
speed wise so is very much worth doing.    I haven't a clue if
there is an advantage to git-grep, over just knowing find, xargs, and
grep.

Eric


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28 19:49               ` Eric W. Biederman
@ 2012-12-28 20:42                 ` Jonathan Neuschäfer
  0 siblings, 0 replies; 19+ messages in thread
From: Jonathan Neuschäfer @ 2012-12-28 20:42 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Al Viro, anish singh, amit mehta, Henrique Rodrigues,
	kishore kumar, Jonathan Neusch??fer, linux-kernel, Kernelnewbies

On Fri, Dec 28, 2012 at 11:49:53AM -0800, Eric W. Biederman wrote:
> Al Viro <viro@ZenIV.linux.org.uk> writes:
> 
> > On Thu, Dec 27, 2012 at 11:36:13PM -0800, Eric W. Biederman wrote:
> >> But then I am probably peculiar keeping an index of the source code in
> >> my head.  When I need to look for something and I don't know where to
> >> find it I do.
> >> 
> >> git-ls-files | xargs fgrep 'struct f2fs_inode'
> >
> > What's wrong with git grep?
> 
> I haven't learned it yet.  git-ls-files is a lot better than find
> speed wise so is very much worth doing.    I haven't a clue if
> there is an advantage to git-grep, over just knowing find, xargs, and
> grep.

Brevity.

Jonathan

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  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 21:31               ` Joe Perches
  1 sibling, 0 replies; 19+ messages in thread
From: Joe Perches @ 2012-12-28 21:31 UTC (permalink / raw)
  To: Al Viro
  Cc: Eric W. Biederman, anish singh, amit mehta, Henrique Rodrigues,
	kishore kumar, Jonathan Neusch??fer, linux-kernel, Kernelnewbies

On Fri, 2012-12-28 at 16:09 +0000, Al Viro wrote:
> On Thu, Dec 27, 2012 at 11:36:13PM -0800, Eric W. Biederman wrote:
> > But then I am probably peculiar keeping an index of the source code in
> > my head.  When I need to look for something and I don't know where to
> > find it I do.
> > 
> > git-ls-files | xargs fgrep 'struct f2fs_inode'
> 
> What's wrong with git grep?

Positive: it loads multiple cpus with very little file I/O
Negative: it doesn't use -P very well.
          it won't spans lines like:

	struct name
	{

with git grep -P "\bstruct\s+\w+\s*{"

(the last grep that does I believe is 2.54)



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28 13:07             ` Borislav Petkov
@ 2012-12-28 22:03               ` Geert Uytterhoeven
  2012-12-29 11:09                 ` Borislav Petkov
  2012-12-28 22:23               ` Guennadi Liakhovetski
  1 sibling, 1 reply; 19+ messages in thread
From: Geert Uytterhoeven @ 2012-12-28 22:03 UTC (permalink / raw)
  To: Borislav Petkov, Eric W. Biederman, anish singh, amit mehta,
	Henrique Rodrigues, kishore kumar, Jonathan Neuschäfer,
	linux-kernel, Kernelnewbies

On Fri, Dec 28, 2012 at 2:07 PM, Borislav Petkov <bp@alien8.de> wrote:
> 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

That's the first run. Now everything is in the buffer cache (assumed you have
enough RAM), and try again...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28 13:07             ` Borislav Petkov
  2012-12-28 22:03               ` Geert Uytterhoeven
@ 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
  1 sibling, 2 replies; 19+ messages in thread
From: Guennadi Liakhovetski @ 2012-12-28 22:23 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Eric W. Biederman, anish singh, amit mehta, Henrique Rodrigues,
	kishore kumar, Jonathan Neuschäfer, linux-kernel,
	Kernelnewbies

On Fri, 28 Dec 2012, Borislav Petkov wrote:

> 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.

...same works with TAGS under emacs, the only annoying problem with it 
since "recently" (about half a year or more) is that "make TAGS" is 
spewing out tons of

etags: Unmatched ( or \( while compiling pattern

oh well, looks like noone is using it / noone cares enough...

Thanks
Guennadi

> 
> > 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.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  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
  1 sibling, 0 replies; 19+ messages in thread
From: Jesper Juhl @ 2012-12-28 22:38 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Borislav Petkov, Eric W. Biederman, anish singh, amit mehta,
	Henrique Rodrigues, kishore kumar, Jonathan Neuschäfer,
	linux-kernel, Kernelnewbies

On Fri, 28 Dec 2012, Guennadi Liakhovetski wrote:

> On Fri, 28 Dec 2012, Borislav Petkov wrote:
> 
> > 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.
> 
> ...same works with TAGS under emacs, the only annoying problem with it 
> since "recently" (about half a year or more) is that "make TAGS" is 
> spewing out tons of
> 
> etags: Unmatched ( or \( while compiling pattern
> 
> oh well, looks like noone is using it / noone cares enough...
> 
I use it. I haven't bothered (yet) to look into the cause of the message 
it spews since the etags ('TAGS') file it produces still seems to work 
well enough.

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH] scripts/tags.sh: Fix regex syntax for etags
  2012-12-28 22:23               ` Guennadi Liakhovetski
  2012-12-28 22:38                 ` Jesper Juhl
@ 2012-12-28 23:08                 ` Andreas Schwab
  2012-12-28 23:22                   ` Jesper Juhl
  1 sibling, 1 reply; 19+ messages in thread
From: Andreas Schwab @ 2012-12-28 23:08 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-kernel

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 scripts/tags.sh | 50 +++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 08f06c0..4c53b7d 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -201,34 +201,34 @@ exuberant()
 emacs()
 {
 	all_target_sources | xargs $1 -a                        \
-	--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'            \
+	--regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/'         \
 	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
 	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
 	--regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
-	--regex='/PAGEFLAG\(([^,)]*).*/Page\1/'			\
-	--regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/'		\
-	--regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/'		\
-	--regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/'	\
-	--regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/'		\
-	--regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/'		\
-	--regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/'	\
-	--regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/'	\
-	--regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/'	\
-	--regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/'	\
-	--regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/'	\
-	--regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/'		\
-	--regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/'	\
-	--regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/'		\
-	--regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/'	\
-	--regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/'	\
-	--regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/'	\
-	--regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/'	\
-	--regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
-	--regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
-	--regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
-	--regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'		\
-	--regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \
-	--regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/'
+	--regex='/PAGEFLAG(\([^,)]*\).*/Page\1/'			\
+	--regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/'		\
+	--regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/'		\
+	--regex='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/'	\
+	--regex='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/'		\
+	--regex='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/'		\
+	--regex='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/'	\
+	--regex='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'	\
+	--regex='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'	\
+	--regex='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/'	\
+	--regex='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/'	\
+	--regex='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/'		\
+	--regex='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/'	\
+	--regex='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/'		\
+	--regex='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/'	\
+	--regex='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/'	\
+	--regex='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/'	\
+	--regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/'	\
+	--regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
+	--regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
+	--regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \
+	--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'		\
+	--regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
+	--regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
 
 	all_kconfigs | xargs $1 -a                              \
 	--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
-- 
1.8.0.3


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH] scripts/tags.sh: Fix regex syntax for etags
  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
  0 siblings, 1 reply; 19+ messages in thread
From: Jesper Juhl @ 2012-12-28 23:22 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Guennadi Liakhovetski, linux-kernel

On Sat, 29 Dec 2012, Andreas Schwab wrote:

> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
> ---
>  scripts/tags.sh | 50 +++++++++++++++++++++++++-------------------------
>  1 file changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/scripts/tags.sh b/scripts/tags.sh
> index 08f06c0..4c53b7d 100755
> --- a/scripts/tags.sh
> +++ b/scripts/tags.sh
> @@ -201,34 +201,34 @@ exuberant()
>  emacs()
>  {
>  	all_target_sources | xargs $1 -a                        \
> -	--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'            \
> +	--regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/'         \
>  	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
>  	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
>  	--regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
> -	--regex='/PAGEFLAG\(([^,)]*).*/Page\1/'			\
> -	--regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/'		\
> -	--regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/'		\
> -	--regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/'	\
> -	--regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/'		\
> -	--regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/'		\
> -	--regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/'	\
> -	--regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/'	\
> -	--regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/'	\
> -	--regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/'	\
> -	--regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/'	\
> -	--regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/'		\
> -	--regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/'	\
> -	--regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/'		\
> -	--regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/'	\
> -	--regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/'	\
> -	--regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/'	\
> -	--regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/'	\
> -	--regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
> -	--regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
> -	--regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
> -	--regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'		\
> -	--regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \
> -	--regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/'
> +	--regex='/PAGEFLAG(\([^,)]*\).*/Page\1/'			\
> +	--regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/'		\
> +	--regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/'		\
> +	--regex='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/'	\
> +	--regex='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/'		\
> +	--regex='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/'		\
> +	--regex='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/'	\
> +	--regex='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'	\
> +	--regex='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'	\
> +	--regex='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/'	\
> +	--regex='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/'	\
> +	--regex='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/'		\
> +	--regex='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/'	\
> +	--regex='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/'		\
> +	--regex='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/'	\
> +	--regex='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/'	\
> +	--regex='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/'	\
> +	--regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/'	\
> +	--regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
> +	--regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
> +	--regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \
> +	--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'		\
> +	--regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
> +	--regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
>  
>  	all_kconfigs | xargs $1 -a                              \
>  	--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
> 

This works for me. Thanks.

Tested-by: Jesper Juhl <jj@chaosbits.net>


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: how to look for source code in kernel
  2012-12-28 22:03               ` Geert Uytterhoeven
@ 2012-12-29 11:09                 ` Borislav Petkov
  0 siblings, 0 replies; 19+ messages in thread
From: Borislav Petkov @ 2012-12-29 11:09 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Eric W. Biederman, anish singh, amit mehta, Henrique Rodrigues,
	kishore kumar, Jonathan Neuschäfer, linux-kernel,
	Kernelnewbies

On Fri, Dec 28, 2012 at 11:03:40PM +0100, Geert Uytterhoeven wrote:
> That's the first run. Now everything is in the buffer cache (assumed
> you have enough RAM), and try again...

Right, until you do something else on the box requiring just the right
amount of memory to overflow the buffer cache working set and start
kicking out pages. Btw, the thing has 4G of RAM.

* first run:

$  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

* second run coming from the buffer cache, search for something else:

$ time git ls-files | xargs grep -E 'struct task_struct\W*{'
include/linux/sched.h:struct task_struct {

real    0m1.651s
user    0m0.672s
sys     0m1.048s

* do something else (kernel build, git gc, some (very leaky) userspace
memory hog, whatever :)) which kicks some buffer cache pages out:

$ 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    0m37.360s
user    0m1.152s
sys     0m4.176s

so on a machine with a lot of memory and an SSD, you can probably safely
rely on the buffer cache but not on a laptop, in my experience.

Btw, cscope can also grep for regex patterns so you don't need the git
grep thing anymore, especially since it looks at tracked files only.

Thanks.

-- 
Regards/Gruss,
Boris.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] scripts/tags.sh: Fix regex syntax for etags
  2012-12-28 23:22                   ` Jesper Juhl
@ 2013-01-13 21:23                     ` Michal Marek
  0 siblings, 0 replies; 19+ messages in thread
From: Michal Marek @ 2013-01-13 21:23 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: Andreas Schwab, Guennadi Liakhovetski, linux-kernel

On Sat, Dec 29, 2012 at 12:22:44AM +0100, Jesper Juhl wrote:
> On Sat, 29 Dec 2012, Andreas Schwab wrote:
> 
> > Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
> > ---
> >  scripts/tags.sh | 50 +++++++++++++++++++++++++-------------------------
> >  1 file changed, 25 insertions(+), 25 deletions(-)
[...] 
> This works for me. Thanks.
> 
> Tested-by: Jesper Juhl <jj@chaosbits.net>

Applied to kbuild.git#misc, thanks.

Michal

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-01-13 21:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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     ` how to look for source code in kernel 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).