From patchwork Thu Nov 26 14:34:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 39542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7A2721007D3 for ; Fri, 27 Nov 2009 02:43:50 +1100 (EST) Received: from localhost ([127.0.0.1]:35936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDgVW-0006Vu-Vm for incoming@patchwork.ozlabs.org; Thu, 26 Nov 2009 10:43:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDfR8-0006yO-6s for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDfQx-0006nC-Nq for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:05 -0500 Received: from [199.232.76.173] (port=56168 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDfQw-0006mD-Lc for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:34:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13914) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDfQw-0000Hi-7W for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:34:58 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAQEYv7R012659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Nov 2009 09:34:57 -0500 Received: from zweiblum.home.kraxel.org (vpn2-8-164.ams2.redhat.com [10.36.8.164]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id nAQEYdsM029210; Thu, 26 Nov 2009 09:34:53 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 5388C70116; Thu, 26 Nov 2009 15:34:18 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 26 Nov 2009 15:34:05 +0100 Message-Id: <1259246056-5389-20-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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 19/30] scsi-disk: restruct emulation: RESERVE+RELEASE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Move RESERVE+RELEASE emulation from scsi_send_command() to scsi_disk_emulate_command(). Signed-off-by: Gerd Hoffmann --- hw/scsi-disk.c | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index f94d513..c67712a 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -473,6 +473,22 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf) if (buflen < 0) goto illegal_request; break; + case RESERVE: + if (req->cmd.buf[1] & 1) + goto illegal_request; + break; + case RESERVE_10: + if (req->cmd.buf[1] & 3) + goto illegal_request; + break; + case RELEASE: + if (req->cmd.buf[1] & 1) + goto illegal_request; + break; + case RELEASE_10: + if (req->cmd.buf[1] & 3) + goto illegal_request; + break; default: goto illegal_request; } @@ -578,6 +594,10 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, case TEST_UNIT_READY: case REQUEST_SENSE: case INQUIRY: + case RESERVE: + case RESERVE_10: + case RELEASE: + case RELEASE_10: rc = scsi_disk_emulate_command(&r->req, outbuf); if (rc > 0) { r->iov.iov_len = rc; @@ -587,16 +607,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, return 0; } break; - case RESERVE: - DPRINTF("Reserve(6)\n"); - if (buf[1] & 1) - goto fail; - break; - case RELEASE: - DPRINTF("Release(6)\n"); - if (buf[1] & 1) - goto fail; - break; case MODE_SENSE: case MODE_SENSE_10: { @@ -857,16 +867,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, outbuf[7] = 8; // CD-ROM r->iov.iov_len = 8; break; - case RESERVE_10: - DPRINTF("Reserve(10)\n"); - if (buf[1] & 3) - goto fail; - break; - case RELEASE_10: - DPRINTF("Release(10)\n"); - if (buf[1] & 3) - goto fail; - break; case 0x9e: /* Service Action In subcommands. */ if ((buf[1] & 31) == 0x10) {