Patchwork [v3,07/38] scsi: remove block descriptors from CDs

login
register
mail settings
Submitter Stefan Hajnoczi
Date Nov. 23, 2011, 11:44 a.m.
Message ID <1322048728-26061-8-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/127275/
State New
Headers show

Comments

Stefan Hajnoczi - Nov. 23, 2011, 11:44 a.m.
From: Paolo Bonzini <pbonzini@redhat.com>

Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Tested-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/scsi-disk.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 0b06fef..9dd2be8 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -956,8 +956,9 @@  static int scsi_disk_emulate_mode_sense(SCSIDiskReq *r, uint8_t *outbuf)
         p += 8;
     }
 
+    /* MMC prescribes that CD/DVD drives have no block descriptors.  */
     bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);
-    if (!dbd && nb_sectors) {
+    if (!dbd && s->qdev.type == TYPE_DISK && nb_sectors) {
         if (r->req.cmd.buf[0] == MODE_SENSE) {
             outbuf[3] = 8; /* Block descriptor length  */
         } else { /* MODE_SENSE_10 */