From patchwork Mon Jul 16 14:25:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 171209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1DFA22C00E3 for ; Tue, 17 Jul 2012 00:26:34 +1000 (EST) Received: from localhost ([::1]:37028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SqmFs-0006cf-1J for incoming@patchwork.ozlabs.org; Mon, 16 Jul 2012 10:26:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SqmFb-0006LQ-Eu for qemu-devel@nongnu.org; Mon, 16 Jul 2012 10:26:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SqmFW-0003q4-Po for qemu-devel@nongnu.org; Mon, 16 Jul 2012 10:26:15 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:54623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SqmFW-0003pt-Lm for qemu-devel@nongnu.org; Mon, 16 Jul 2012 10:26:10 -0400 Received: by yenl1 with SMTP id l1so5595734yen.4 for ; Mon, 16 Jul 2012 07:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=s1+VaKm60X7GFdYm+JELOEcnbQMfJC32anjJk3Gia2w=; b=Gia2Z7oOn5XAfJEp19BgZ8gykzktQ9n8qV0Gkcu7a72xzHpSVCYd5VRFQ0CePcSqmw kXCIfN1d3THjA9rGu/q/nGQ8n5bB9DiQ3erTLkWAkKgzp+rTd3bijI+6nOARfJ5me54c DPVkNKmkp2Ub/kfULWx/BLtaN9WfR+1l6GTrGWcjS+iWl19UE6qvOqMt9woqnSDk2J68 3PQtWSSkNlUkSweEVvTOrWnCW73/sisl17LI77+lXHRZvFJll5wj596oaRkTJK4wDGT+ Eu9OFobqn7+F6VDOA8g0QNDnrKFWkdhLP4Edq6tDmGZ7MLrPgtC/TSVoj6qzLpYQlOZR DbVQ== Received: by 10.66.76.170 with SMTP id l10mr23034902paw.57.1342448769932; Mon, 16 Jul 2012 07:26:09 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-189-113.ip51.fastwebnet.it. [93.34.189.113]) by mx.google.com with ESMTPS id qa5sm11997476pbb.19.2012.07.16.07.26.07 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2012 07:26:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2012 16:25:52 +0200 Message-Id: <1342448756-7582-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342448756-7582-1-git-send-email-pbonzini@redhat.com> References: <1342448756-7582-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.173 Cc: kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 1/5] scsi-disk: removable hard disks support START/STOP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Support for START/STOP UNIT right now is limited to CD-ROMs. This is wrong, since removable hard disks (in the real world: SD card readers) also support it in pretty much the same way. Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index bcec66b..42bae3b 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1251,7 +1251,7 @@ static int scsi_disk_emulate_start_stop(SCSIDiskReq *r) bool start = req->cmd.buf[4] & 1; bool loej = req->cmd.buf[4] & 2; /* load on start, eject on !start */ - if (s->qdev.type == TYPE_ROM && loej) { + if ((s->features & (1 << SCSI_DISK_F_REMOVABLE)) && loej) { if (!start && !s->tray_open && s->tray_locked) { scsi_check_condition(r, bdrv_is_inserted(s->qdev.conf.bs)