diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-05-20 14:16:06 +0000 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-05-20 14:16:06 +0000 |
commit | 186965e1ed510a3f2883ac3f4826bf4e382010d2 (patch) | |
tree | 1cb110e8910e2c2e6e690a66d5df9846fbe46641 | |
parent | 642d0333322a840e00b76522b26af65db729980a (diff) | |
download | xen-186965e1ed510a3f2883ac3f4826bf4e382010d2.tar.gz xen-186965e1ed510a3f2883ac3f4826bf4e382010d2.tar.bz2 xen-186965e1ed510a3f2883ac3f4826bf4e382010d2.zip |
bitkeeper revision 1.1159.258.142 (428df12661vmA7WwXT170kC1Qyxpxw)
Pass CD-ROM type info through from blkback to blkfront, and interpret
correctly in blkfront. Data accesses still cause buffer underruns in
domain0 though...
Signed-off-by: Keir Fraser <keir@xensource.com>
-rw-r--r-- | linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c | 5 | ||||
-rw-r--r-- | linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c | 30 |
2 files changed, 13 insertions, 22 deletions
diff --git a/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c b/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c index 90d194680b..493a2a7268 100644 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c @@ -65,7 +65,7 @@ void vbd_create(blkif_be_vbd_create_t *create) vbd->vdevice = vdevice; vbd->readonly = create->readonly; - vbd->type = VDISK_TYPE_DISK | VDISK_FLAG_VIRT; + vbd->type = VDISK_TYPE_DISK; vbd->extents = NULL; spin_lock(&blkif->vbd_lock); @@ -163,6 +163,9 @@ void vbd_grow(blkif_be_vbd_grow_t *grow) else sz = x->bdev->bd_disk->capacity; + vbd->type = (x->bdev->bd_disk->flags & GENHD_FL_CD) ? + VDISK_TYPE_CDROM : VDISK_TYPE_DISK; + #else if( !blk_size[MAJOR(x->extent.device)] ) { diff --git a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c index 0110d11223..9a33656469 100644 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c @@ -278,15 +278,15 @@ struct gendisk *xlvbd_alloc_gendisk( di->mi = mi; di->xd_device = disk->device; - /* Full disk rather than a single partition? */ - if ((minor & ((1 << mi->type->partn_shift) - 1)) == 0) + if ((VDISK_TYPE(disk->info) == VDISK_TYPE_DISK) && + ((minor & ((1 << mi->type->partn_shift) - 1)) == 0)) nr_minors = 1 << mi->type->partn_shift; gd = alloc_disk(nr_minors); if ( !gd ) goto out; - if ( nr_minors > 1 ) /* full disk? */ + if ((VDISK_TYPE(disk->info) != VDISK_TYPE_DISK) || (nr_minors > 1)) sprintf(gd->disk_name, "%s%c", mi->type->diskname, 'a' + mi->index * mi->type->disks_per_major + (minor >> mi->type->partn_shift)); @@ -305,6 +305,12 @@ struct gendisk *xlvbd_alloc_gendisk( if ((xlbd_blk_queue == NULL) && xlvbd_blk_queue_alloc(mi->type)) goto out_gendisk; + if (VDISK_READONLY(disk->info)) + set_disk_ro(gd, 1); + + if (VDISK_TYPE(disk->info) == VDISK_TYPE_CDROM) + gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD; + gd->queue = xlbd_blk_queue; add_disk(gd); return gd; @@ -347,24 +353,6 @@ static int xlvbd_device_add(struct list_head *list, vdisk_t *disk) if (gd == NULL) goto out_bd; - if (VDISK_READONLY(disk->info)) - set_disk_ro(gd, 1); - - switch (VDISK_TYPE(disk->info)) { - case VDISK_TYPE_CDROM: - gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD; - break; - case VDISK_TYPE_FLOPPY: - case VDISK_TYPE_TAPE: - gd->flags |= GENHD_FL_REMOVABLE; - break; - case VDISK_TYPE_DISK: - break; - default: - WPRINTK("unknown device type %d\n", VDISK_TYPE(disk->info)); - break; - } - list_add(&new->list, list); out_bd: bdput(bd); |