* [PATCH] virtio_blk: provide getgeo
@ 2008-01-23 16:56 Christian Borntraeger
2008-01-23 22:06 ` Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Christian Borntraeger @ 2008-01-23 16:56 UTC (permalink / raw)
To: Rusty Russell; +Cc: virtualization
Rusty,
I currently try to make my guest boot from an virtio root device
without having an external kernel. Some of the tools that I tried
expect HDIO_GETGEO to work. The most interesting value is likely
the geo.start value to get the offset of a partition. This value
is filled by block/ioctl.c if fops->getgeo is set. This patch also
fills in some standard values for heads, sectors and cylinders.
Makes sense?
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
drivers/block/virtio_blk.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
Index: kvm/drivers/block/virtio_blk.c
===================================================================
--- kvm.orig/drivers/block/virtio_blk.c
+++ kvm/drivers/block/virtio_blk.c
@@ -154,9 +154,20 @@ static int virtblk_ioctl(struct inode *i
(void __user *)data);
}
+/* We provide getgeo only to please some old bootloader/partitioning tools */
+static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
+{
+ /* some standard values, similar to sd */
+ geo->heads = 1 << 6;
+ geo->sectors = 1 << 5;
+ geo->cylinders = get_capacity(bd->bd_disk) >> 11;
+ return 0;
+}
+
static struct block_device_operations virtblk_fops = {
- .ioctl = virtblk_ioctl,
- .owner = THIS_MODULE,
+ .ioctl = virtblk_ioctl,
+ .owner = THIS_MODULE,
+ .getgeo = virtblk_getgeo,
};
static int virtblk_probe(struct virtio_device *vdev)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] virtio_blk: provide getgeo
2008-01-23 16:56 [PATCH] virtio_blk: provide getgeo Christian Borntraeger
@ 2008-01-23 22:06 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2008-01-23 22:06 UTC (permalink / raw)
To: Christian Borntraeger; +Cc: Jens Axboe, virtualization
On Thursday 24 January 2008 03:56:50 Christian Borntraeger wrote:
> Rusty,
>
> I currently try to make my guest boot from an virtio root device
> without having an external kernel. Some of the tools that I tried
> expect HDIO_GETGEO to work. The most interesting value is likely
> the geo.start value to get the offset of a partition. This value
> is filled by block/ioctl.c if fops->getgeo is set. This patch also
> fills in some standard values for heads, sectors and cylinders.
>
> Makes sense?
Perfect sense, applied.
I wonder if there's a standard helper for this?
> +/* We provide getgeo only to please some old bootloader/partitioning tools
> */ +static int virtblk_getgeo(struct block_device *bd, struct hd_geometry
> *geo) +{
> + /* some standard values, similar to sd */
> + geo->heads = 1 << 6;
> + geo->sectors = 1 << 5;
> + geo->cylinders = get_capacity(bd->bd_disk) >> 11;
> + return 0;
> +}
Thanks,
Rusty.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-23 22:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-23 16:56 [PATCH] virtio_blk: provide getgeo Christian Borntraeger
2008-01-23 22:06 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).