Subject: Re: new kpi proposal, sysdisk(9)
To: Elad Efrat <elad@NetBSD.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 12/29/2006 14:06:51
--W/nzBZO5zC0uMSeA
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.
>=20
> in other words, can you please follow-up with some code? :)
>=20
> 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:
>=20
> if (ap->a_mode & FSYSTEM)
> vp->v_systemcount++;
>=20
> 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:
>=20
> if (cdev->d_type =3D=3D D_TTY)
> vp->v_flag |=3D VISTTY;
>=20
> so it's okay. for close, we can VOP_CLOSE() with FSYSTEM too, and
> just do, in spec_close():
>=20
> if (ap->a_mode & FSYSTEM)
> vp->v_systemcount--;
>=20
> 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:
>=20
> sysdisk_open(vp, mode, cred, l, who);
> sysdisk_close(vp, mode, cred, l, who);
>=20
> 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 :)
>=20
> 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=
=20
a device-level proplib, or partition-level proplibs. I tend to think the=20
latter is better.
Take care,
Bill
--W/nzBZO5zC0uMSeA
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)
iD8DBQFFlZF7Wz+3JHUci9cRAmcPAKCPxoIxHdmk42eWptkWX37QhtCUlQCdEE0K
ls1cuBwFGDdrl5gtPfn0r1o=
=JBzT
-----END PGP SIGNATURE-----
--W/nzBZO5zC0uMSeA--