* [Qemu-devel] [6469] SCSI divide capacity by s->cluster_size (Rik van Riel)
@ 2009-01-28 21:58 Anthony Liguori
0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2009-01-28 21:58 UTC (permalink / raw)
To: qemu-devel
Revision: 6469
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6469
Author: aliguori
Date: 2009-01-28 21:58:29 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
SCSI divide capacity by s->cluster_size (Rik van Riel)
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.
aliguori: fixed typo
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Modified Paths:
--------------
trunk/hw/scsi-disk.c
Modified: trunk/hw/scsi-disk.c
===================================================================
--- trunk/hw/scsi-disk.c 2009-01-28 21:58:25 UTC (rev 6468)
+++ trunk/hw/scsi-disk.c 2009-01-28 21:58:29 UTC (rev 6469)
@@ -734,6 +734,7 @@
/* 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 @@
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--;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-28 21:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-28 21:58 [Qemu-devel] [6469] SCSI divide capacity by s->cluster_size (Rik van Riel) Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).