Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 2004 20:15:34 -0400
From:      Brian Fundakowski Feldman <green@FreeBSD.org>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        Julian Elischer <julian@elischer.org>
Subject:   Re: code cleanup 
Message-ID:  <200404300015.i3U0FYVJ050060@green.homeunix.org>
In-Reply-To: Message from Kris Kennaway <kris@obsecurity.org>  <20040429215236.GA42902@xor.obsecurity.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
Kris Kennaway <kris@obsecurity.org> wrote:
> On Thu, Apr 29, 2004 at 04:56:02PM -0400, John Baldwin wrote:
> > On Thursday 29 April 2004 02:55 pm, Brian Fundakowski Feldman wrote:
> > > John Baldwin <jhb@FreeBSD.org> wrote:
> > > > On Thursday 29 April 2004 12:06 am, Alex Lyashkov wrote:
> > > > > > Note that the allproc_lock protects the allproc list.  W/o the
> > > > > > FOREACH_PROC macro, I can grep for 'allproc' in the source tree to
> > > > > > find all users to verify locking, etc.  With the extra macro, I now
> > > > > > have to do multiple greps.
> > > > >
> > > > > two greps is multiple ? first of FOREACH_PROC, second allproc or
> > > > > combine at one grep with two -e parameters.
> > > >
> > > > Multiple means more than one, yes.  When I'm searching the tree when
> > > > locking a structure or fields of a structure I don't usually come up with
> > > > complex grep statements, and actually, I wouldn't find the FOREACH_FOO
> > > > macro until I did the first grep anyway.  When you add lots of macros
> > > > that do this you get a compounding problem.
> > >
> > > For what it's worth, I don't think it is good to hide things as much as
> > > FOREACH_PROC_IN_SYSTEM() -- this specific instance -- does, but grep is not
> > > a good tool for a tree as large as FreeBSD's.  Try using cscope instead.
> > 
> > I've used glimpse in the past but it is buggy.  Actually, grep -r on ssc/sys 
> > doesn't take that long, esp. if you do it multiple times as most of the tree 
> > is still in cache for subsequent grep's (at least on my laptop).  I also tend 
> > to have lots (around 7 or so) trees that have work going on in them at any 
> > one time.
> 
> The problem with grep -r in src/sys is that it chokes on the symlinks
> created by module builds and pollutes the output with hundreds of
> lines of errors unless you remember to first remove the module build
> files.

Well, I implore you all to give cscope a shot.  Unlike glimpse, it's not 
buggy ;-) and it understands C code -- something grep and glimpse don't do 
-- so you don't generally get falses.  I believe cscope is to grep and 
glimpse as Perforce is to CVS... and we know how much of a difference that 
is ;)

-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green@FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404300015.i3U0FYVJ050060>