Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=135da0b037984c0284acdf40aaf4f7f31eb5cbd0
Commit:     135da0b037984c0284acdf40aaf4f7f31eb5cbd0
Parent:     6c0cd7c000dc0851035c5003bf9d47733d0b257b
Author:     Christian Borntraeger <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 23 17:56:50 2008 +0100
Committer:  Rusty Russell <[EMAIL PROTECTED]>
CommitDate: Mon Feb 4 23:50:09 2008 +1100

    virtio_blk: provide getgeo
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>
---
 drivers/block/virtio_blk.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6143337..d2fe679 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -152,9 +152,20 @@ static int virtblk_ioctl(struct inode *inode, struct file 
*filp,
                              (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)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to