From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDfRB-00074P-9l for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDfR0-0006nU-NK for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:08 -0500 Received: from [199.232.76.173] (port=56170 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDfQw-0006mi-U0 for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:34:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44129) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDfQw-0000Ho-Jt for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:34:58 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAQEYvw1024896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Nov 2009 09:34:57 -0500 From: Gerd Hoffmann Date: Thu, 26 Nov 2009 15:34:07 +0100 Message-Id: <1259246056-5389-22-git-send-email-kraxel@redhat.com> In-Reply-To: <1259246056-5389-1-git-send-email-kraxel@redhat.com> References: <1259246056-5389-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 21/30] scsi-disk: restruct emulation: START_STOP List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Move START_STOP emulation from scsi_send_command() to scsi_disk_emulate_command(). Signed-off-by: Gerd Hoffmann --- hw/scsi-disk.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 06289c3..11e85f2 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -670,6 +670,12 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf) if (req->cmd.buf[1] & 3) goto illegal_request; break; + case START_STOP: + if (bdrv_get_type_hint(bdrv) == BDRV_TYPE_CDROM && (req->cmd.buf[4] & 2)) { + /* load/eject medium */ + bdrv_eject(bdrv, !(req->cmd.buf[4] & 1)); + } + break; default: goto illegal_request; } @@ -781,6 +787,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, case RESERVE_10: case RELEASE: case RELEASE_10: + case START_STOP: rc = scsi_disk_emulate_command(&r->req, outbuf); if (rc > 0) { r->iov.iov_len = rc; @@ -790,13 +797,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, return 0; } break; - case START_STOP: - DPRINTF("Start Stop Unit\n"); - if (bdrv_get_type_hint(s->qdev.dinfo->bdrv) == BDRV_TYPE_CDROM && - (buf[4] & 2)) - /* load/eject medium */ - bdrv_eject(s->qdev.dinfo->bdrv, !(buf[4] & 1)); - break; case ALLOW_MEDIUM_REMOVAL: DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3); bdrv_set_locked(s->qdev.dinfo->bdrv, buf[4] & 1); -- 1.6.2.5