qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Kohl <bernhard.kohl@nsn.com>
To: ext Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <4C7CD851.2070301@nsn.com> (raw)
In-Reply-To: <4C7CCFBA.7050501@redhat.com>

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 <bernhard.kohl@nsn.com>
> > ---
> >  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	other threads:[~2010-08-31 10:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31  9:22 [Qemu-devel] [PATCH v2 0/6] scsi-disk: improve the emulation of theMODE SENSE command Bernhard Kohl
2010-08-31  9:22 ` [Qemu-devel] [PATCH v2 1/6] scsi-disk: fix the mode data length field returned by the MODE " Bernhard Kohl
2010-08-31 10:26   ` [Qemu-devel] " Kevin Wolf
2010-08-31 10:52     ` Bernhard Kohl
2010-08-31  9:22 ` [Qemu-devel] [PATCH v2 2/6] scsi-disk: fix the mode data header returned by the MODE SENSE(10) command Bernhard Kohl
2010-08-31  9:47   ` [Qemu-devel] " Kevin Wolf
2010-08-31 10:24     ` Bernhard Kohl [this message]
2010-08-31  9:22 ` [Qemu-devel] [PATCH v2 3/6] scsi-disk: respect the page control (PC) field in the MODE SENSE command Bernhard Kohl
2010-08-31  9:22 ` [Qemu-devel] [PATCH v2 4/6] scsi-disk: fix the block descriptor returned by " Bernhard Kohl
2010-08-31  9:22 ` [Qemu-devel] [PATCH v2 5/6] scsi-disk: return CHECK CONDITION for unknown page codes in " Bernhard Kohl
2010-08-31  9:22 ` [Qemu-devel] [PATCH v2 6/6] scsi-disk: fix the check of the DBD bit " Bernhard Kohl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C7CD851.2070301@nsn.com \
    --to=bernhard.kohl@nsn.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).