From patchwork Thu Nov 26 14:34:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 39551 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 EC9D21007D9 for ; Fri, 27 Nov 2009 03:00:46 +1100 (EST) Received: from localhost ([127.0.0.1]:49073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDglv-0007k7-CI for incoming@patchwork.ozlabs.org; Thu, 26 Nov 2009 11:00:43 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDfRC-00074z-OH 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 1NDfR3-0006tA-Jo for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:11 -0500 Received: from [199.232.76.173] (port=56176 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDfR2-0006rF-6K for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23852) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDfR1-0000Ip-Cm for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:03 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAQEZ2Ie024903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Nov 2009 09:35:02 -0500 Received: from zweiblum.home.kraxel.org (vpn2-8-164.ams2.redhat.com [10.36.8.164]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id nAQEYqiM016137; Thu, 26 Nov 2009 09:34:56 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 6327A70119; Thu, 26 Nov 2009 15:34:18 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 26 Nov 2009 15:34:08 +0100 Message-Id: <1259246056-5389-23-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.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 22/30] scsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL 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 ALLOW_MEDIUM_REMOVAL emulation from scsi_send_command() to scsi_disk_emulate_command(). Signed-off-by: Gerd Hoffmann --- hw/scsi-disk.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 11e85f2..7d59998 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -676,6 +676,9 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf) bdrv_eject(bdrv, !(req->cmd.buf[4] & 1)); } break; + case ALLOW_MEDIUM_REMOVAL: + bdrv_set_locked(bdrv, req->cmd.buf[4] & 1); + break; default: goto illegal_request; } @@ -788,6 +791,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, case RELEASE: case RELEASE_10: case START_STOP: + case ALLOW_MEDIUM_REMOVAL: rc = scsi_disk_emulate_command(&r->req, outbuf); if (rc > 0) { r->iov.iov_len = rc; @@ -797,10 +801,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, return 0; } 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); - break; case READ_CAPACITY: DPRINTF("Read Capacity\n"); /* The normal LEN field for this command is zero. */