Date: Wed, 23 May 2001 23:22:31 +0100 From: Brian Somers <brian@Awfulhak.org> To: Brian Somers <brian@Awfulhak.org> Cc: Mike Smith <msmith@FreeBSD.ORG>, freebsd-arch@FreeBSD.ORG, brian@Awfulhak.org Subject: Re: RFC: unit_list routines Message-ID: <200105232222.f4NMMVF12972@hak.lan.Awfulhak.org> In-Reply-To: Message from Brian Somers <brian@Awfulhak.org> of "Wed, 23 May 2001 21:20:02 BST." <200105232020.f4NKK2F10389@hak.lan.Awfulhak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> > > > > >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...
Guessing again (and realising that it's time I slept), if_tun doesn't
have a devclass. It doesn't look that appropriate to add one either
as methods like devclass_destroy() seem to be missing from the
devclass interface.
I'll try to figure out what I really think later...
--
Brian <brian@Awfulhak.org> <brian@[uk.]FreeBSD.org>
<http://www.Awfulhak.org> <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105232222.f4NMMVF12972>
