From owner-freebsd-current@FreeBSD.ORG Fri Apr 30 07:48:49 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2AE6E16A4CE for ; Fri, 30 Apr 2004 07:48:49 -0700 (PDT) Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id E924F43D31 for ; Fri, 30 Apr 2004 07:48:48 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 21257 invoked from network); 30 Apr 2004 14:48:48 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 30 Apr 2004 14:48:48 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i3UEmi8C035769; Fri, 30 Apr 2004 10:48:45 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-current@FreeBSD.org Date: Fri, 30 Apr 2004 10:49:00 -0400 User-Agent: KMail/1.6 References: <200404291855.i3TItUTr048530@green.homeunix.org> <200404291656.02104.jhb@FreeBSD.org> <20040429215236.GA42902@xor.obsecurity.org> In-Reply-To: <20040429215236.GA42902@xor.obsecurity.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200404301049.00979.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: Brian Fundakowski Feldman cc: Alex Lyashkov cc: Julian Elischer cc: Kris Kennaway Subject: Re: code cleanup X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Apr 2004 14:48:49 -0000 On Thursday 29 April 2004 05:52 pm, Kris Kennaway 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 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. I normally do this: cd work/p4/blah grep -r foo `ls | grep -v i386` then cd i386 grep -r foo `ls | grep -v compile` That avoids all the kernel compile directories and is quite fast. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org