Subject: Re: Cloning bdev/cdev devices, step one
To: Bill Studenmund <>
From: Jason R Thorpe <>
List: tech-kern
Date: 07/05/2000 20:32:03
On Wed, Jul 05, 2000 at 07:26:26PM -0700, Bill Studenmund wrote:

 > I guess one other thing I'd had in mind was that we'd make all of these
 > devices "real" devices. So in the kernel config we'd have:
 > pseudobus at root
 > ccd*	at pseudobus?
 > raid*	at pseudobus?
 > ...

This is certainly another possible approach (although, I don't
particularly like explcitly saying "pseudobus" ... it could all
be done with pseudo-device and hidden inside the guts of the
autoconfiguration code).

It would, however, require Something Else to work .. like a system call
which took a device name, or something.

...otherwise, what do you do the ioctl on?

 > > 	cs = ccd_lookup(DISKUNIT(vp->v_rdev));
 > Uhm, that's not using the vnode, is it? :-)

For `open' (and `dump'), you use the dev_t ... for everything else,
you don't.

 > I mean that for this code snippet to work, you've got to be saving that cs
 > you allocate below somwhere where ccd_lookup will find it. If that's so,
 > do we need the vnode?

The other part you didn't get the first time (because that's "step two",
and I was trying to focus on "step one")... true cloning devices (like
what bpf and ptys will become) will have a mechanism by which the
upper layer devices will know that they must allocate a new vnode for
each open and not do alias checking ... in those cases, you MUST keep
a pointer to the softc in the vnode, because there is a *separate*
device instance for each open, even though *the dev_t is the same*.

        -- Jason R. Thorpe <>