From: James Bottomley <James.Bottomley@steeleye.com>
To: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
Cc: Andries.Brouwer@cwi.nl, greg@kroah.com,
SCSI Mailing List <linux-scsi@vger.kernel.org>,
linux-usb-devel@lists.sourceforge.net
Subject: Re: [example PATCH - not for applying] exclude certain commands
Date: 27 Apr 2003 10:41:45 -0500 [thread overview]
Message-ID: <1051458107.2427.25.camel@fuzzy> (raw)
In-Reply-To: <20030427023517.A15212@one-eyed-alien.net>
On Sun, 2003-04-27 at 04:35, Matthew Dharm wrote:
> I don't see a way to know the byte count without having additional
> knowledge about the device. Maybe I'm wrong -- I certainly don't claim to
> be a SCSI expert. So explain it to me.
Certainly. It's documented in the SCSI3 Primary commands (for
reference, I'm using SPC-3 r12), section 4.3.
The SCSI opcode is divided into a group code (bits 7-5) and a Command
Code (bits 4-0), see section 4.3.4.1.
The group code identifies the command length:
Group Length
0 6 byte
1 10 byte
2 10 byte
3 reserved (except for 0x7f, the variable length commands)
4 16 byte
5 12 byte
6 vendor specific
7 vendor specific
Thus, when you | 0x40 into MODE_SENSE, you change it from group0 to
group2 and it becomes a ten byte command.
For each of the non vendor specific groups, called the fixed length
commands, the location of the transfer count in each command is laid out
in the standard, too, section 4.3.3 (as well as other things like the
block location).
They are
Command Size transfer offset transfer size
6 byte byte 4 1 byte
10 byte byte 7 2 bytes
12 byte byte 6 4 bytes
16 byte byte 10 4 bytes
32 byte(*) byte 28 2 bytes
* The 32 byte commands are variable length commands (opcode 0x7f) with
Additional CDB length set to 0x18. The actual command is specified in
the service action field (two bytes).
So the algorithm is quite simple: you get the command length from the
group (using a table with one exception for the 32 byte commands), and
then extract the transfer length from the command
For the other reserved or vendor specific commands, you just return -1
or some other indicator that we have to believe the buffer length to be
the command length.
James
next prev parent reply other threads:[~2003-04-27 15:29 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-26 21:44 [example PATCH - not for applying] exclude certain commands Andries.Brouwer
2003-04-26 22:13 ` Matthew Dharm
2003-04-26 22:43 ` James Bottomley
2003-04-27 1:34 ` Matthew Dharm
2003-04-27 2:15 ` James Bottomley
2003-04-27 9:35 ` Matthew Dharm
2003-04-27 15:41 ` James Bottomley [this message]
2003-04-27 18:52 ` Kai Makisara
2003-04-27 19:52 ` Matthew Dharm
2003-04-28 19:05 ` Luben Tuikov
2003-04-28 19:12 ` Luben Tuikov
2003-04-28 20:19 ` Matthew Dharm
2003-04-28 21:33 ` Luben Tuikov
2003-04-26 22:29 ` James Bottomley
2003-04-27 0:24 ` Patrick Mansfield
2003-04-27 1:39 ` Matthew Dharm
2003-04-27 14:04 ` [linux-usb-devel] " Alan Stern
-- strict thread matches above, loose matches on Subject: below --
2003-04-27 2:29 Andries.Brouwer
2003-04-27 4:32 ` James Bottomley
2003-04-25 0:43 Andries.Brouwer
2003-04-25 2:12 ` Matthew Dharm
2003-04-25 14:32 ` Alan Stern
2003-04-25 15:12 ` Oliver Neukum
2003-04-26 0:58 ` Alan Stern
2003-04-26 8:24 ` Oliver Neukum
2003-04-26 15:22 ` Alan Stern
2003-04-24 18:59 Andries.Brouwer
2003-04-24 19:14 ` Matthew Dharm
2003-04-24 20:20 ` James Bottomley
2003-04-24 20:59 ` Matthew Dharm
2003-04-24 21:43 ` Patrick Mansfield
2003-04-24 15:21 Andries.Brouwer
2003-04-24 15:56 ` Pete
2003-04-24 21:33 ` Stelian Pop
2003-04-24 9:46 Andries.Brouwer
2003-04-24 9:56 ` Stelian Pop
2003-04-24 14:05 ` Alan Stern
2003-04-24 14:26 ` James Bottomley
2003-04-24 14:46 ` Alan Stern
2003-04-24 15:26 ` James Bottomley
2003-04-24 9:08 Andries.Brouwer
2003-04-24 18:22 ` Matthew Dharm
2003-04-23 22:39 Andries.Brouwer
2003-04-24 0:10 ` Matthew Dharm
2003-04-24 8:05 ` André Cruz
2003-04-24 9:15 ` Stelian Pop
2003-04-24 9:22 ` Stelian Pop
2003-04-24 11:45 ` Mike Bursell
2003-04-24 12:44 ` James Bottomley
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=1051458107.2427.25.camel@fuzzy \
--to=james.bottomley@steeleye.com \
--cc=Andries.Brouwer@cwi.nl \
--cc=greg@kroah.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=mdharm-scsi@one-eyed-alien.net \
/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