[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/3] SCSI divide capacity by s->cluster_size
From: |
Rik van Riel |
Subject: |
[Qemu-devel] [PATCH 3/3] SCSI divide capacity by s->cluster_size |
Date: |
Wed, 28 Jan 2009 09:51:40 -0500 |
User-agent: |
quilt/0.46-1 |
Paul Brook pointed out that the number of sectors reported
by the SCSI read capacity commands needs to be divided by
s->cluster_size, because bdrv_get_geometry reports the number
of 512 byte sectors, while emulated CDROMs report 2048 byte
sectors back to the guest.
This has no consequences for emulated hard disks, which use
a cluster size of 1.
Signed-off-by: Rik van Riel <address@hidden>
Index: qemu/trunk/hw/scsi-disk.c
===================================================================
--- qemu.orig/trunk/hw/scsi-disk.c
+++ qemu/trunk/hw/scsi-disk.c
@@ -734,6 +734,7 @@ static int32_t scsi_send_command(SCSIDev
/* The normal LEN field for this command is zero. */
memset(outbuf, 0, 8);
bdrv_get_geometry(s->bdrv, &nb_sectors);
+ nb_sectors =/ s->cluster_size;
/* Returned value is the address of the last sector. */
if (nb_sectors) {
nb_sectors--;
@@ -834,6 +835,7 @@ static int32_t scsi_send_command(SCSIDev
DPRINTF("SAI READ CAPACITY(16)\n");
memset(outbuf, 0, len);
bdrv_get_geometry(s->bdrv, &nb_sectors);
+ nb_sectors =/ s->cluster_size;
/* Returned value is the address of the last sector. */
if (nb_sectors) {
nb_sectors--;
--
All rights reversed.