X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fblock%2Fxen-blkfront.c;h=9c6f3f99208d073ad9cbfd3ff61e69a0e3dc0a02;hb=b23c9cc0ce652089a2f0af8c7f1541f10dc9b5db;hp=8afce67c0aa56293f815f55fb949983082ba2a9d;hpb=877c357e7511395bc923ec9efc2e8b021a17ed79;p=linux-2.6 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 8afce67c0a..9c6f3f9920 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -135,6 +136,22 @@ static void blkif_restart_queue_callback(void *arg) schedule_work(&info->work); } +int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg) +{ + /* We don't have real geometry info, but let's at least return + values consistent with the size of the device */ + sector_t nsect = get_capacity(bd->bd_disk); + sector_t cylinders = nsect; + + hg->heads = 0xff; + hg->sectors = 0x3f; + sector_div(cylinders, hg->heads * hg->sectors); + hg->cylinders = cylinders; + if ((sector_t)(hg->cylinders + 1) * hg->heads * hg->sectors < nsect) + hg->cylinders = 0xffff; + return 0; +} + /* * blkif_queue_request * @@ -937,6 +954,7 @@ static struct block_device_operations xlvbd_block_fops = .owner = THIS_MODULE, .open = blkif_open, .release = blkif_release, + .getgeo = blkif_getgeo, };