Subject: Re: new kpi proposal, sysdisk(9)
To: Bill Studenmund <firstname.lastname@example.org>
From: Elad Efrat <elad@NetBSD.org>
Date: 12/29/2006 22:29:04
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.
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
if (ap->a_mode & FSYSTEM)
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 == D_TTY)
vp->v_flag |= 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)
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.
Bill Studenmund wrote:
> On Thu, Dec 28, 2006 at 05:10:46PM +0200, Elad Efrat wrote:
>> YAMAMOTO Takashi wrote:
>>>> YAMAMOTO Takashi wrote:
>>>>> YAMAMOTO Takashi
>>>> other than the obvious issue of this being not as extensible as
>>>> sysdisk(9), the VOP interface is something I'd rather not touch. :)
>>> extensible? can you explain?
>> in my original message I said we can, for example, add info as to what
>> subsystem is making use of the device. I don't have other ideas at the
> Ok, my thought here is that we really have two chunks of info, "In use"
> and "In use by." One is a bit, and is readily controllable via VOP_OPEN()
> and VOP_CLOSE() calls. And for security reasons, that probably is the best
> way to do it.
> The other chunk of info, "In use by," really is a free-form bit of info.
> i.e. a string. :-) It's a property of the device, and so you can probably
> guess what I'm going to suggest. :-)
> Since we're making use of property lists, let's add property lists to
> devices and add an ioctl that sets the, "In use by," property. Also add a
> "Get in use by" ioctl, and we're set for what you wanted to do.
> I realize this is a bit of feature creep, but I think it's a way to do
> what you want in a scalable method. And scaling was your (valid) concern
> with just using VOP_OPEN().
> Take care,