ChangeSet 1.1876, 2005/05/20 15:16:06+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxx>
blkback/vbd.c | 5 ++++-
blkfront/vbd.c | 30 +++++++++---------------------
2 files changed, 13 insertions(+), 22 deletions(-)
diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c
b/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c 2005-05-20 11:02:54
-04:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c 2005-05-20 11:02:54
-04:00
@@ -65,7 +65,7 @@
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);
@@ -162,6 +162,9 @@
sz = x->bdev->bd_part->nr_sects;
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 -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c 2005-05-20
11:02:55 -04:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c 2005-05-20
11:02:55 -04:00
@@ -278,15 +278,15 @@
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 @@
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;
@@ -346,24 +352,6 @@
gd = xlvbd_alloc_gendisk(mi, minor, 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:
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|