From: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
To: James Bottomley <James.Bottomley@SteelEye.com>
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: Sun, 27 Apr 2003 02:35:17 -0700 [thread overview]
Message-ID: <20030427023517.A15212@one-eyed-alien.net> (raw)
In-Reply-To: <1051409717.4089.146.camel@mulgrave>; from James.Bottomley@SteelEye.com on Sat, Apr 26, 2003 at 09:15:07PM -0500
[-- Attachment #1: Type: text/plain, Size: 2892 bytes --]
On Sat, Apr 26, 2003 at 09:15:07PM -0500, James Bottomley wrote:
> On Sat, 2003-04-26 at 20:34, Matthew Dharm wrote:
> > To parse correctly, I would need to remember what type of device it is by
> > snooping the INQUIRY data. I would also have to keep around data such as
> > block size (for TYPE_DISK). I haven't even looked at what extra data I
> > would need to keep around for all the other types.
>
> OK, I don't understand this. To extract the transfer length from a
> given SCSI command (excluding vendor specific ones) is a well defined
> process. All you need is the command, it doesn't require knowing device
> type or anything else.
Okay. A READ_10 command for 4 blocks. How many bytes is that? The
command bytes in question look something like this:
0x28 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x4 0x0
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.
> > Why should usb-storage do that when someone else (the command source)
> > already knows this data? Whatever is sending the command already knows how
> > much data to expect -- my reparsing the command to try to figure it out is
> > guaranteed to be less precise than just using the correct answer from the
> > source of the command.
>
> Because we're exploring options for this "lengthen the transfer size"
> behaviour the USB layer exhibits. Assuming you can transfer more bytes
> than the indicated buffer size is a recipe for data corruption problems
> down the line.
My point in asking the question was to emphasize that I do not believe the
transfer length to be calculable (only guessable) -- why guess when some
bit of code has to know?
The problem if transferring more data than the buffer has room for is an
obvious problem -- that I don't debate.
> > Also, user-issued commands can specify buffer size and transfer length
> > separately, but only one value gets given to the usb-storage driver. The
> > other is dropped on the floor somewhere in the mid-layer.
>
> I usually use the SCSI_IOCTL_SEND_COMMAND, which only allows the
> specification of a buffer size (rather than both length and buffer
> size), how do you send SCSI commands?
Okay, I'm wrong here. I would have sworn that the SG3 interface allowed me
to specify the two values separately -- I have quite a bit of code that
uses that interface.
Interestinly enough, the one value it specifies it defines as the length of
the transfer, not the size of the buffer -- at least, according to the sg
HOWTO.
Matt
--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver
Hey, has anyone seen the Microsoft sales guy? It's his feeding time...
-- Mike
User Friendly, 4/17/1998
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
next prev parent reply other threads:[~2003-04-27 9:23 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 [this message]
2003-04-27 15:41 ` James Bottomley
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=20030427023517.A15212@one-eyed-alien.net \
--to=mdharm-scsi@one-eyed-alien.net \
--cc=Andries.Brouwer@cwi.nl \
--cc=James.Bottomley@SteelEye.com \
--cc=greg@kroah.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.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