tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: getting wedge information (esp. size) in kenrel ?

On Mon, Feb 25, 2008 at 09:39:49AM -0600, Ronald Roskens wrote:
> On Sun, 2008-02-24 at 19:34 +0100, Manuel Bouyer wrote:
> > Hi,
> > right now, the Xen block device backend gets the size information
> > of the backing device with
> > VOP_IOCTL(xbdi->xbdi_vp, DIOCGPART, &dpart, FREAD, 0);
> > but with this the size information is trucated to 32bits. If xbdi_vp points
> > to a wedge device, is there a way to get its 64bit size (and how do I
> > know it's a wedge in the first place) ?
> Hi Maneul,
> I had opened a bug (kern/37370) regarding a xen dom0 directly using
> wedges for the domU's disk devices. You can probably close the bug once
> you decide what to do.
> See the function rf_getdisksize() in sys/dev/raidframe/rf_netbsdkintf.c
> which is what I based my patch off of. Essentially, you need to call
> VOP_IOCTL(..., DIOCGWEDGEINFO, ...) if the DIOCGPART failed.

Ops, thanks for reminding me this one. Would have saved me some time if
I didn't let it root :(

There's one minor issue with your patch, which is I'm not sure it's
correct to call DISKPART() on a dk(4) device. At this point we can use
dkw_devname, which has the complete name of the device.
Also, instead of trying blindly DIOCGPART, we can compare devname against "dk"
to use DIOCGPART or DIOCGWEDGEINFO. isswap() already does it.

Manuel Bouyer, LIP6, Universite Paris VI.  
     NetBSD: 26 ans d'experience feront toujours la difference

Home | Main Index | Thread Index | Old Index