qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH v2 2/6] scsi-disk: fix the mode data header retu


From: Bernhard Kohl
Subject: [Qemu-devel] Re: [PATCH v2 2/6] scsi-disk: fix the mode data header returned by the MODE SENSE(10) command
Date: Tue, 31 Aug 2010 12:24:17 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100720 Fedora/3.0.6-1.fc12 Thunderbird/3.0.6

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 <address@hidden>
> ---
>  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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]