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 MODE_SENSE on CDs to probe for capabilities: this is required > behaviour and we've been doing for a long time. > > sd also uses MODE_SENSE to probe the cache type as well as the write > protect state. Cache type certainly can't be obtained any other way, > and I'm not sure allowing writes to read only media wouldn't cause us > more problems in the long run.
CD is fine, I was referring to MODE_SENSE in sd.c
I think allowing write to read-only media is the only way to go. I don't
see another way to get write-protect status.
> > I'd be willing to write a helper, but I'm a bit out of my element here...
> > can someone at least suggest a good place to put such a helper (or
> > volunteer to mock one up for me)?
>
> 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, you need to go by more than the first command byte -- ex. INQUIRY is
okay, unless length != 36 or EVPD.
I think a blacklist is probably in order, but with a BIG COMMENT mentioning
that if someone adds new commands into the code paths they should at least
consider if they belong in the blacklist.
Matt
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
Type "format c:" That should fix everything.
-- Greg
User Friendly, 12/18/1997
pgp00000.pgp
Description: PGP signature
