public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: Andries.Brouwer@cwi.nl
Cc: mdharm-scsi@one-eyed-alien.net, 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: 26 Apr 2003 17:29:55 -0500	[thread overview]
Message-ID: <1051396197.1768.81.camel@mulgrave> (raw)
In-Reply-To: <UTC200304262144.h3QLiAt04450.aeb@smtp.cwi.nl>

On Sat, 2003-04-26 at 16:44, Andries.Brouwer@cwi.nl wrote:
> [[problem solved, we understand the hardware, it seems,
> now wish to find an elegant way of doing what is required
> (and only what is required) in the scsi and/or usb storage code]]
> 
> (1) usb-storage is broken in the sense that it uses sr_bufflen
> for the transfer size instead of the buffer length, then fudges
> commands to make them transfer a different length, but without
> updating sr_bufflen.

definitely agreed.

> (1A)
> Of course it is bad when variables have a function that differs
> from what is suggested by their name. So, sr_bufflen must be
> the length of the buffer and nothing else. If the length of
> the transfer is needed, there must be a field sr_xferlen or so.

This looks fine to me.  Originally, sr_bufflen was exactly that (because
all SCSI LLDs have to be prepared to transfer fewer than the specified
number of bytes anyway, since that's required by the spec).  I believe
only USB needs this to be set to the actual command length (and further
require that we ensure that the device *will* transfer exactly
this...that's to some extent the origin of the INQUIRY problems), so the
change should be small.

[...]

> I dislike the choice of identifier "ten" - it is difficult to grep for,

agreed.

> and I changed it into use_10_for_rw, with the same function as before.
> Added a field use_10_for_ms. Thus, in scsi.h:
> 
> +       unsigned use_10_for_rw:1; /* first try 10-byte read / write */
> +       unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
> 
> in the declaration of struct scsi_device.
> 
> Now sd_do_mode_sense6() becomes sd_do_mode_sense() and does

This looks good (probably this should go in scsi_lib.c and sr should
start using it for consistency).

> All this is nice and well. Remains the question how usb-storage
> makes sure that the use_10_for_rw and use_10_for_ms flags are set
> for its devices.

Well, this should be done in the USB storage slave_configure...that's
almost exactly what the interface is designed for (altering scsi_device
parameters before the SCSI subsystem starts using it).

> Tonight I kludged this by setting this (in protocol.c) at the moment
> the first INQUIRY is done. But that is terribly ugly.
> Did I overlook some obvious means of communication?
> 
> Comments?

This sounds to be exactly the right approach (other than the missing
slave_configure).

James



  parent reply	other threads:[~2003-04-26 22:18 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
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 [this message]
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=1051396197.1768.81.camel@mulgrave \
    --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