public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: Julian Calaby <julian.calaby@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Subject: Re: RFC: Transport identifier
Date: Wed, 25 Feb 2009 21:32:21 -0800	[thread overview]
Message-ID: <20090226053221.GB1145@ca-server1.us.oracle.com> (raw)
In-Reply-To: <646765f40902252054t3def25e4j73ccd0192e0be51e@mail.gmail.com>

On Thu, Feb 26, 2009 at 03:54:30PM +1100, Julian Calaby wrote:
> On Thu, Feb 26, 2009 at 15:31, Martin K. Petersen
> <martin.petersen@oracle.com> wrote:
> >
> > There are a few cases where it would be useful to know which transport
> > is associated with a scsi_device.  For instance when determining whether
> > to send a READ CAPACITY(16) to a device or not:
> >
> >    static int sd_try_rc16_first(struct scsi_device *sdp)
> >    {
> >        if (scsi_device_transport(sdp) == SCSI_TRANSPORT_USB)
> >           return 0; /* Run screaming for the hills */
> >    [...]
> >
> > This patch implements support for a transport identifier in the
> > scsi_host.  The id defaults to SPI and it is explicitly overridden in
> > the host templates for FC, SAS, USB, etc. drivers.
> >
> > It also looks like the availability of this transport id could improve
> > the sysfs parsing in lsscsi.
> >
> > Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> 
> [snip]
> 
> > +/* These strings must match the scsi_transport_id enum in scsi.h */
> > +static const char * const transport_names[] = {
> > +       "spi", "fc", "sas", "iscsi", "sbp", "usb", "ata",
> > +};
> 
> Firstly, this should probably mark which name is for which value. (I
> know it's obvious, but it could get confusing if there are ever user
> friendly names here.)

I like doing this:

static const char * const transport_names[] = {
	[SCSI_TRANSPORT_SPI]		= "spi",
	...
};

Joel

-- 

"It is not the function of our government to keep the citizen from
 falling into error; it is the function of the citizen to keep the
 government from falling into error."
	- Robert H. Jackson

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-02-26  5:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26  4:31 RFC: Transport identifier Martin K. Petersen
2009-02-26  4:54 ` Julian Calaby
2009-02-26  5:32   ` Joel Becker [this message]
2009-02-26 20:22     ` Martin K. Petersen
2009-02-26  9:53 ` Douglas Gilbert
2009-02-26 15:39 ` Mike Christie
2009-02-26 15:48 ` James Bottomley
2009-02-26 20:32   ` Martin K. Petersen
2009-02-27  7:33     ` FUJITA Tomonori
2009-02-28  4:13       ` Martin K. Petersen
2009-02-28  4:50         ` Matthew Wilcox
2009-02-28  5:19           ` FUJITA Tomonori
2009-02-28 15:40             ` Martin K. Petersen
2009-02-28 14:53     ` Stefan Richter
2009-02-28 15:06       ` Matthew Wilcox
2009-02-28 15:19         ` Stefan Richter
2009-02-28 15:36           ` James Bottomley
2009-02-28 15:54           ` Martin K. Petersen
2009-02-28 15:42       ` Martin K. Petersen

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=20090226053221.GB1145@ca-server1.us.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=julian.calaby@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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