From patchwork Tue Aug 31 09:22:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Kohl X-Patchwork-Id: 63213 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 CE578B7132 for ; Tue, 31 Aug 2010 19:35:15 +1000 (EST) Received: from localhost ([127.0.0.1]:59667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqNBk-0001rj-8Z for incoming@patchwork.ozlabs.org; Tue, 31 Aug 2010 05:31:32 -0400 Received: from [140.186.70.92] (port=55838 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqN7l-0000D5-HR for qemu-devel@nongnu.org; Tue, 31 Aug 2010 05:27:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqN3x-0002FQ-1S for qemu-devel@nongnu.org; Tue, 31 Aug 2010 05:23:29 -0400 Received: from demumfd001.nsn-inter.net ([93.183.12.32]:13541) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqN3w-0002FL-Jo for qemu-devel@nongnu.org; Tue, 31 Aug 2010 05:23:28 -0400 Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd001.nsn-inter.net (8.12.11.20060308/8.12.11) with ESMTP id o7V9NOEs014025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 31 Aug 2010 11:23:24 +0200 Received: from localhost6.localdomain6 ([10.148.23.89]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id o7V9Mp4k025395; Tue, 31 Aug 2010 11:23:24 +0200 From: Bernhard Kohl To: qemu-devel@nongnu.org Date: Tue, 31 Aug 2010 11:22:34 +0200 Message-Id: <1283246554-10253-7-git-send-email-bernhard.kohl@nsn.com> X-Mailer: git-send-email 1.7.2.2 In-Reply-To: <1283246554-10253-1-git-send-email-bernhard.kohl@nsn.com> References: <1283246554-10253-1-git-send-email-bernhard.kohl@nsn.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: kwolf@redhat.com, Bernhard Kohl Subject: [Qemu-devel] [PATCH v2 6/6] scsi-disk: fix the check of the DBD bit in the MODE SENSE command 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 The DBD bit does not work as expected. SCSI-Spec: http://ldkelley.com/SCSI2/SCSI2/SCSI2-08.html#8.2.10 "A disable block descriptors (DBD) bit of zero indicates that the target may return zero or more block descriptors in the returned MODE SENSE data (see 8.3.3), at the target's discretion. A DBD bit of one specifies that the target shall not return any block descriptors in the returned MODE SENSE data." Signed-off-by: Bernhard Kohl --- hw/scsi-disk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 0041038..99b0464 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -655,7 +655,7 @@ static int scsi_disk_emulate_mode_sense(SCSIRequest *req, uint8_t *outbuf) } bdrv_get_geometry(s->bs, &nb_sectors); - if ((~dbd) & nb_sectors) { + if (!dbd && nb_sectors) { if (req->cmd.buf[0] == MODE_SENSE) { outbuf[3] = 8; /* Block descriptor length */ } else { /* MODE_SENSE_10 */