From owner-freebsd-hackers Tue Aug 20 6:39:57 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F19B337B400 for ; Tue, 20 Aug 2002 06:39:52 -0700 (PDT) Received: from panzer.kdm.org (panzer.kdm.org [216.160.178.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id C86AD43E65 for ; Tue, 20 Aug 2002 06:39:51 -0700 (PDT) (envelope-from ken@panzer.kdm.org) Received: from panzer.kdm.org (localhost [127.0.0.1]) by panzer.kdm.org (8.12.5/8.12.5) with ESMTP id g7KDdnKD094059; Tue, 20 Aug 2002 07:39:49 -0600 (MDT) (envelope-from ken@panzer.kdm.org) Received: (from ken@localhost) by panzer.kdm.org (8.12.5/8.12.5/Submit) id g7KDdfoL094058; Tue, 20 Aug 2002 07:39:41 -0600 (MDT) (envelope-from ken) Date: Tue, 20 Aug 2002 07:39:41 -0600 From: "Kenneth D. Merry" To: Peter Wemm Cc: Terry Lambert , Gardner Buchanan , "'freebsd-hackers@freebsd.org'" Subject: Re: CAM "wiring", LUNs and duplicate wired entries Message-ID: <20020820073941.A94031@panzer.kdm.org> References: <20020819145538.A89963@panzer.kdm.org> <20020820070533.342CF2A7D6@canning.wemm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020820070533.342CF2A7D6@canning.wemm.org>; from peter@wemm.org on Tue, Aug 20, 2002 at 12:05:33AM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Aug 20, 2002 at 00:05:33 -0700, Peter Wemm wrote: > "Kenneth D. Merry" wrote: > > On Mon, Aug 19, 2002 at 13:52:33 -0700, Terry Lambert wrote: > > > "Kenneth D. Merry" wrote: > > > > I don't think that's the problem. I think the problem is that the device > > > > at target 8 is getting identified to camperiphnextunit() as a wired devic > e, > > > > when it isn't. > > > > > > > > Try the attached patch and see if it fixes things for you. > > > > > > > > I haven't tried compiling or running this, so beware. > > > > > > > > > That's some sneaky code. 8-). If this works and you commit it, > > > can you add an expository comment? > > > > Maybe. Peter Wemm wrote the hardwiring code, and would likely be in a > > slightly better position to explain it. > > Actually, Justin implemented the original design, I just changed the > underlying mechanism that it uses. It still uses Justin's algorithms but > looks in different places for the source data. I sort-of understand it, > but it has been a while since I looked at it. :-) > > Regarding the patch, yes, it does look like the 'hit = 0' should go inside > the loop. I would have done it more explicitly though, eg: > > +++ cam_periph.c 2002/08/20 06:48:50 > @@ -332,3 +332,2 @@ > unit = 0; > - hit = 0; > > @@ -338,2 +337,3 @@ > while ((i = resource_locate(i, periph_name)) != -1) { > + hit = 0; > dname = resource_query_name(i); > > The same problem is on -current too. It is probably worth changing "hit" > to "wired" since that is what it means. > > I think this bug came from an earlier verson of the changes where this was > a multi-layered loop, and the resetting of 'hit' got moved too far out when > it collapsed to a single loop. Justin had the above fix in his local tree, but after discussing it we figured out that it wouldn't work in all cases. The reason is, if you hit a partial match at the end of the resource list, hit will still be set to something non-zero, since you won't be going back through the loop again to reset hit. Thus the reason for the for() loop -- it resets hit after each loop iteration. So hit is always 0 when camperiphnextunit() is invoked, unless you break out of the loop due to a match. Ken -- Kenneth Merry ken@kdm.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message