[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-04-05 Thread Matthew Dharm
On Sat, Apr 05, 2003 at 01:45:43PM -0600, James Bottomley wrote: > What's wrong with > > - if(scsi_filter_cmd(SCp, &filter)) { > + if(SCp->device->type == TYPE_DISK && scsi_filter_cmd(SCp, &filter)) { > > ? Out of curiosity, at what point is SCp->device->type a valid refe

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-04-05 Thread Matthew Dharm
On Sat, Apr 05, 2003 at 02:08:29PM -0600, James Bottomley wrote: > On Sat, 2003-04-05 at 13:55, Matthew Dharm wrote: > > > > My big complaint about that is that it's ugly. I would like to keep the > > device type as part of the filter command structure, so I can keep the call > > to scsi_filter_c

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-04-05 Thread James Bottomley
On Sat, 2003-04-05 at 13:55, Matthew Dharm wrote: > > My big complaint about that is that it's ugly. I would like to keep the > device type as part of the filter command structure, so I can keep the call > to scsi_filter_cmd() simple and easy to maintain. Maybe it's just me, but > I think that e

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-04-05 Thread Matthew Dharm
On Sat, Apr 05, 2003 at 01:45:43PM -0600, James Bottomley wrote: > On Sat, 2003-04-05 at 13:27, Matthew Dharm wrote: > > I don't think this will work. I see two problems: > > > > (1) You can't filter TEST_UNIT_READY (opcode 0). Not a big deal, but a > > theoretical problem. > > Yes, TUR has bee

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-04-05 Thread James Bottomley
On Sat, 2003-04-05 at 13:27, Matthew Dharm wrote: > I don't think this will work. I see two problems: > > (1) You can't filter TEST_UNIT_READY (opcode 0). Not a big deal, but a > theoretical problem. Yes, TUR has been mandatory since SCSI-1, so I didn't think this would be a problem. Any end s

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-04-05 Thread Matthew Dharm
I don't think this will work. I see two problems: (1) You can't filter TEST_UNIT_READY (opcode 0). Not a big deal, but a theoretical problem. (2) We need to be able to filter at the originator. For example, MODE_SENSE is perfectly fine to send to a CD-ROM, but not to a hard-disk. We can't make

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-04-05 Thread James Bottomley
On Mon, 2003-03-24 at 11:30, Matthew Dharm wrote: > On Mon, Mar 24, 2003 at 09:15:57AM -0600, James Bottomley wrote: > > OK, I can do this: A simple one with either a blacklist (reject these > > commands) or whitelist (only accept these commands) going by the first > > command byte OK? > > Well, y

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-24 Thread Matthew Dharm
On Mon, Mar 24, 2003 at 09:15:57AM -0600, James Bottomley wrote: > On Mon, 2003-03-24 at 01:04, Matthew Dharm wrote: > > Note that MODE_SENSE isn't on this list. How does the 'popular OS' test > > for write-protect, you ask? It tries to write and then looks for a > > failure, AFAICT. > > We use

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-24 Thread James Bottomley
On Mon, 2003-03-24 at 10:29, Linus Torvalds wrote: > Really? The code was _supposed_ to always start off with READ/WRITE_10's, > and then fall back to the old READ/WRITE_6 if it gets errors from that. Do > we really have some broken random-number generator semantic still in teh > SCSI layer? That

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-24 Thread James Bottomley
On Mon, 2003-03-24 at 10:52, Jens Axboe wrote: > It's not true, ->ten is set unconditionally and we only fall back to 6 > byte cdb's if we see an ILLEGAL_REQUEST on a READ_10/WRITE_10. > > So the logic is, always assume 10-byte commands. If an incoming request > cannot be addressed with 10-byte co

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-24 Thread Jens Axboe
On Mon, Mar 24 2003, Linus Torvalds wrote: > > On 24 Mar 2003, James Bottomley wrote: > > > > > > For disk-like media: > > > > > > READ_10 > > > WRITE_10 > > > > We do about the best we can for read and write. For sd, we gauge the > > size of the command from the size of the medium: <1Gb=> si

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-24 Thread Linus Torvalds
On 24 Mar 2003, James Bottomley wrote: > > > > For disk-like media: > > > > READ_10 > > WRITE_10 > > We do about the best we can for read and write. For sd, we gauge the > size of the command from the size of the medium: <1Gb=> six byte, from > 1Gb to 2Tb 10 byte, over 2Tb 16 byte, so I think

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-24 Thread James Bottomley
On Mon, 2003-03-24 at 01:04, Matthew Dharm wrote: > Well, here's my list of what the 'popular OS' uses for all devices: > > INQUIRY (for only 36 bytes -- nothing else!) > TEST_UNIT_READY > REQUEST_SENSE > ALLOW_MEDIUM_REMOVAL (mostly for eject purposes) > > For disk-like media: > > READ_10 > WRI

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-23 Thread Matthew Dharm
Well, here's my list of what the 'popular OS' uses for all devices: INQUIRY (for only 36 bytes -- nothing else!) TEST_UNIT_READY REQUEST_SENSE ALLOW_MEDIUM_REMOVAL (mostly for eject purposes) For disk-like media: READ_10 WRITE_10 I'd have to go back to my notes for tape and CD media. But those

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-23 Thread Matthew Dharm
Well, I've already done that -- notice that we don't use START_STOP anymore... EVPD INQUIRY, INQUIRY for bytes != 36, and MODE_SENSE are big offenders. But, EVPD INQUIRY is something that's a problem. Getting rid of it isn't easy -- someone put it in there because they wanted/needed the data. I

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-23 Thread Linus Torvalds
On Sun, 23 Mar 2003, Matthew Dharm wrote: > On Sun, Mar 23, 2003 at 07:26:09PM -0600, James Bottomley wrote: > > The problem with this type of approach is that there's no unified list > > of "known good" commands that actually let you operate a device. The > > SCSI and ATAPI standards have been

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-23 Thread James Bottomley
On Sun, 2003-03-23 at 01:31, Matthew Dharm wrote: > The problem is this: usb-storage interfaces via SCSI, but not just for > disks. Tape, CD, etc. are all handled with the same protocol. Heck, ATAPI > disk/cd/tape are handled with these code paths. ATAPI isn't really "emulated" in the sense tha

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-23 Thread Matthew Dharm
On Sun, Mar 23, 2003 at 07:26:09PM -0600, James Bottomley wrote: > The problem with this type of approach is that there's no unified list > of "known good" commands that actually let you operate a device. The > SCSI and ATAPI standards have been gradually deprecating the commands > that SCSI-1 (an

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-22 Thread Linus Torvalds
On Sat, 22 Mar 2003, Matthew Dharm wrote: > > As I see it, SCSI commands break down into two basic categories: common > and uncommon. Common things (basic read and write, 36-byte INQUIRY, eject, > etc.) are all fine, but the 'uncommon' things (checking cache type, > 255-byte INQUIRY, etc) cause

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-22 Thread Matthew Dharm
On Sat, Mar 22, 2003 at 08:09:57PM -0800, Linus Torvalds wrote: > > On Sat, 22 Mar 2003, Matthew Dharm wrote: > > > > This patch changes how devices a probed on a SCSI bus if they are on an > > emulated host. > > I really think this is wrong. I'd much much rather get _rid_ of that > stupid "emul

[linux-usb-devel] Re: PATCH: exclude certain commands from emulated SCSI hosts

2003-03-22 Thread Linus Torvalds
On Sat, 22 Mar 2003, Matthew Dharm wrote: > > This patch changes how devices a probed on a SCSI bus if they are on an > emulated host. I really think this is wrong. I'd much much rather get _rid_ of that stupid "emulated" flag, instead of adding meaning to it. > If a host is emulated, we (a) do