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:10 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:39 -0600
commitfc903943f8df1226294783b0df607c928393bae4 (patch)
tree5cfa09dc0ddd9f0e2664d1f84ca3c793622d37fe /hw/scsi-disk.c
parente7e25e32693b052b29edb8396dbc577e1bf2a09f (diff)
downloadfocaccia-qemu-fc903943f8df1226294783b0df607c928393bae4.tar.gz
focaccia-qemu-fc903943f8df1226294783b0df607c928393bae4.zip
scsi-disk: restruct emulation: SYNCHRONIZE_CACHE
Move SYNCHRONIZE_CACHE emulation from scsi_send_command() to
scsi_disk_emulate_command().

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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 4f56a22901..865c5db8f9 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -705,6 +705,9 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
         outbuf[7] = 0;
         buflen = 8;
 	break;
+    case SYNCHRONIZE_CACHE:
+        bdrv_flush(bdrv);
+        break;
     default:
         goto illegal_request;
     }
@@ -819,6 +822,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
     case START_STOP:
     case ALLOW_MEDIUM_REMOVAL:
     case READ_CAPACITY:
+    case SYNCHRONIZE_CACHE:
         rc = scsi_disk_emulate_command(&r->req, outbuf);
         if (rc > 0) {
             r->iov.iov_len = rc;
@@ -847,10 +851,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
         r->sector_count = len * s->cluster_size;
         is_write = 1;
         break;
-    case SYNCHRONIZE_CACHE:
-        DPRINTF("Synchronise cache (sector %" PRId64 ", count %d)\n", lba, len);
-        bdrv_flush(s->qdev.dinfo->bdrv);
-        break;
     case READ_TOC:
         {
             int start_track, format, msf, toclen;