Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2002 07:39:41 -0600
From:      "Kenneth D. Merry" <ken@kdm.org>
To:        Peter Wemm <peter@wemm.org>
Cc:        Terry Lambert <tlambert2@mindspring.com>, Gardner Buchanan <gardner.buchanan@adobe.com>, "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: CAM "wiring", LUNs and duplicate wired entries
Message-ID:  <20020820073941.A94031@panzer.kdm.org>
In-Reply-To: <20020820070533.342CF2A7D6@canning.wemm.org>; from peter@wemm.org on Tue, Aug 20, 2002 at 12:05:33AM -0700
References:  <20020819145538.A89963@panzer.kdm.org> <20020820070533.342CF2A7D6@canning.wemm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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