Subject: Re: new kpi proposal, sysdisk(9)
To: Elad Efrat <>
From: Bill Studenmund <>
List: tech-kern
Date: 12/29/2006 14:06:51
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Dec 29, 2006 at 10:29:04PM +0200, Elad Efrat wrote:
> I'm afraid I'm not familiar with most of the interfaces that what you
> suggest might involve messing with. as much as I'd be happy to dive
> into that big mess, at the moment it's not getting a top priority.
> in other words, can you please follow-up with some code? :)
> iiuc, adding a flag to the mode bits for VOP_OPEN() (say, FSYSTEM)
> will, for a disk device, end up in spec_open(), and then dispatched to
> 'd_open' -- the device-specific open routine.

Why do we need a flag? Why is "FSYSTEM" different from other opens?

i.e. don't we want the normal open mask handling?

> since I assume it's going to be less than optimal to try and hook
> all of those (not to mention, someone else's work), we can do
> something like:
> 	if (ap->a_mode & FSYSTEM)
> 		vp->v_systemcount++;
> and then checking if 'vp' is in use would simply have to check for
> 'vp->v_systemcount > 0'. similiar thing is done already for ttys:
> 	if (cdev->d_type =3D=3D D_TTY)
> 		vp->v_flag |=3D VISTTY;
> so it's okay. for close, we can VOP_CLOSE() with FSYSTEM too, and
> just do, in spec_close():
> 	if (ap->a_mode & FSYSTEM)
> 		vp->v_systemcount--;
> if the above is what you meant, then we still need a way to do
> the "by" thing: *what* subsystem is using, or no longer using, the
> device. for that we might introduce the following wrappers, that
> would take same arguments as VOP_OPEN() and VOP_CLOSE() respectively,
> plus a string:
> 	sysdisk_open(vp, mode, cred, l, who);
> 	sysdisk_close(vp, mode, cred, l, who);
> that would do the calls for us, add FSYSTEM to mode, and do a call to
> whatever function will be required to set the property of the using
> subsystem. (that last bit I leave to you :)
> my only remaining question is how can you tell /dev/wd0a and /dev/rwd0b
> are really the same thing, using the above? they have different device
> majors and different DISKPARTs.

They aren't the same thing. What we'd need to do is indicate this all by=20
partition or wedge. And that'd mean either partition/wedge-based names in=
a device-level proplib, or partition-level proplibs. I tend to think the=20
latter is better.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.3 (NetBSD)