From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36703 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqO0s-0005Qy-GG for qemu-devel@nongnu.org; Tue, 31 Aug 2010 06:24:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqO0r-0004fb-1Y for qemu-devel@nongnu.org; Tue, 31 Aug 2010 06:24:22 -0400 Received: from demumfd002.nsn-inter.net ([93.183.12.31]:13274) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqO0q-0004ez-N8 for qemu-devel@nongnu.org; Tue, 31 Aug 2010 06:24:21 -0400 Message-ID: <4C7CD851.2070301@nsn.com> Date: Tue, 31 Aug 2010 12:24:17 +0200 From: Bernhard Kohl MIME-Version: 1.0 References: <1283246554-10253-1-git-send-email-bernhard.kohl@nsn.com> <1283246554-10253-3-git-send-email-bernhard.kohl@nsn.com> <4C7CCFBA.7050501@redhat.com> In-Reply-To: <4C7CCFBA.7050501@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2 2/6] scsi-disk: fix the mode data header returned by the MODE SENSE(10) command List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ext Kevin Wolf Cc: qemu-devel@nongnu.org Am 31.08.2010 11:47, schrieb ext Kevin Wolf: > > Am 31.08.2010 11:22, schrieb Bernhard Kohl: > > The header for the MODE SENSE(10) command is 8 bytes long. > > > > Signed-off-by: Bernhard Kohl > > --- > > hw/scsi-disk.c | 33 +++++++++++++++++++++++++++------ > > 1 files changed, 27 insertions(+), 6 deletions(-) > > > buflen = p - outbuf; > > - outbuf[0] = buflen - 1; > > + if (req->cmd.buf[0] == MODE_SENSE) { > > + outbuf[0] = buflen - 1; > > + } else { /* MODE_SENSE_10 */ > > + outbuf[0] = ((buflen - 1) >> 8) & 0xff; > > + outbuf[1] = (buflen - 1) & 0xff; > > Missed that last time, but it should be buflen - 2 here, right? The mode > data length field is two bytes here. > > While we're at it, maybe adding a comment before the if wouldn't hurt > which explains why we're subtracting something at all. > Yes, thats right. I'll change that in v3 and add a comment. SCSI-Spec: http://ldkelley.com/SCSI2/SCSI2/SCSI2-08.html#8.3.3 "When using the MODE SENSE command, the mode data length field specifies the length in bytes of the following data that is available to be transferred. The mode data length does not include itself." Bernhard