From owner-freebsd-arch Thu May 24 3: 8:21 2001 Delivered-To: freebsd-arch@freebsd.org Received: from finch-post-11.mail.demon.net (finch-post-11.mail.demon.net [194.217.242.39]) by hub.freebsd.org (Postfix) with ESMTP id 82EB637B423; Thu, 24 May 2001 03:08:14 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from [62.49.251.130] (helo=herring.nlsystems.com) by finch-post-11.mail.demon.net with esmtp (Exim 2.12 #1) id 152s2P-0007QH-0B; Thu, 24 May 2001 10:08:13 +0000 Received: from herring (herring [10.0.0.2]) by herring.nlsystems.com (8.11.2/8.11.2) with ESMTP id f4OA6v758884; Thu, 24 May 2001 11:06:57 +0100 (BST) (envelope-from dfr@nlsystems.com) Date: Thu, 24 May 2001 11:06:57 +0100 (BST) From: Doug Rabson To: Brian Somers Cc: Mike Smith , Subject: Re: RFC: unit_list routines In-Reply-To: <200105232020.f4NKK2F10389@hak.lan.Awfulhak.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 23 May 2001, Brian Somers wrote: > > > > > >I didn't do it that way because the ``usual'' way units are allocated > > > > > >is sequentially. Using bits when there are large numbers of units > > > > > >gets awkward. I figured what was required was something small and > > > > > >simple that would cover the requirements of most/all drivers that > > > > > >need to track their units so that it's easy to find an unused one, > > > > > >and it's easy to allocate/deallocate things. > > > > > > > > > > How does newbus allocate/manage unit numbers ? > > > > > > > > I don't think it does. The only way to find out what's in use > > > > (AFAIK) is by looking at every specinfo in dev_hash.... > > > > > > Er, what exactly are you smoking? > > > > > > Newbus manages unit numbers using the devclass: > > > > > > struct devclass { > > > TAILQ_ENTRY(devclass) link; > > > driver_list_t drivers; /* bus devclasses store drivers for bus */ > > > char *name; > > > device_t *devices; /* array of devices indexed by unit */ > > > int maxunit; /* size of devices array */ > > > }; > > > > Yes, Garrett pointed this out. I misunderstood the question because > > newbus doesn't manage unit numbers. It ``manages'' the maximum unit > > number allocated and nothing else. > > > > My answer was describing the only way I know of to figure out which > > units for a given device are allocated/opened. > > Hmm, hang on. I'll stop smoking.... If that device_t array knows > which devices are open it could solve my problems... This object will not help you unless we rewrite the pseudo devices to use newbus. You don't have a device_t instance for your tunX instance. I can think of good reasons for wanting to represent pseudo devices with newbus but it doesn't work that way right now. -- Doug Rabson Mail: dfr@nlsystems.com Phone: +44 20 8348 6160 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message