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 been mandatory since SCSI-1, so I didn't think this would > be a problem. Any end signal can be used, zero was the least line of > resistance.
For the sake of completeness, I think I'd rather see something else used --
perhaps something in the high-byte (where you currently store the inversion
bit).
> > (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 that distinction with your code, unless we put the filtering
> > code not in queuecommand but in places like sd.c.... or we need to change
> > the filter to also take a device type.
>
> What's wrong with
>
> - if(scsi_filter_cmd(SCp, &filter)) {
> + if(SCp->device->type == TYPE_DISK && scsi_filter_cmd(SCp, &filter)) {
>
> ?
>
> The whole idea is to provide a filter library that the emulated HBA
> drivers can use to cope with standard commands they don't like rather
> than add extra code to the mid-layer main code paths.
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 editing the filter table with an extra field will be easier to
get right than trying to maintain several different filter tables (for each
device type).
I guess the real power of this filter is in the ability to add logic to
scsi_filter_exceptions()... but centralizing that seems contrary to the
idea of doing this on a per-HBA basis.
What about a filter table of structs with 3 fields -- white/blacklist, type
to apply to, and function pointer to something that returns 0 or 1? We can
provide some of the 'test functions' in the core for those who want it
(i.e. provide something that implements the 36-byte INQUIRY restriction),
but each HBA can create an arbitrary list of their own as well.
With something like that, we might even be able to collapse some of the
current SCSI device blacklisting into this mechanism. But that's just a
thought for the future.
Matt
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
It's not that hard. No matter what the problem is, tell the customer
to reinstall Windows.
-- Nurse
User Friendly, 3/22/1998
pgp00000.pgp
Description: PGP signature
