summary refs log tree commit diff stats
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-11-26 15:34:14 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:40 -0600
commit39ec9a504ddebc9432de892c185447af5b192f2a (patch)
tree07361cc45f8593a4fdc820ca43e9fba1c39a473c /hw/scsi-disk.c
parent5dd90e2ad7a0ac27fc132f778827e70b7dbaf627 (diff)
downloadfocaccia-qemu-39ec9a504ddebc9432de892c185447af5b192f2a.tar.gz
focaccia-qemu-39ec9a504ddebc9432de892c185447af5b192f2a.zip
scsi-disk: restruct emulation: REPORT_LUNS
Move REPORT_LUNS emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add REPORT_LUNS to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r--hw/scsi-disk.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index b481c1396b..1507bcd1f6 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -787,6 +787,13 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
         }
         DPRINTF("Unsupported Service Action In\n");
         goto illegal_request;
+    case REPORT_LUNS:
+        if (req->cmd.xfer < 16)
+            goto illegal_request;
+        memset(outbuf, 0, 16);
+        outbuf[3] = 8;
+        buflen = 16;
+        break;
     default:
         goto illegal_request;
     }
@@ -904,6 +911,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
     case READ_TOC:
     case GET_CONFIGURATION:
     case SERVICE_ACTION_IN:
+    case REPORT_LUNS:
         rc = scsi_disk_emulate_command(&r->req, outbuf);
         if (rc > 0) {
             r->iov.iov_len = rc;
@@ -932,14 +940,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
         r->sector_count = len * s->cluster_size;
         is_write = 1;
         break;
-    case 0xa0:
-        DPRINTF("Report LUNs (len %d)\n", len);
-        if (len < 16)
-            goto fail;
-        memset(outbuf, 0, 16);
-        outbuf[3] = 8;
-        r->iov.iov_len = 16;
-        break;
     case VERIFY:
         DPRINTF("Verify (sector %" PRId64 ", count %d)\n", lba, len);
         break;