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@xxxxxxxxxx> 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@xxxxxxxxxx> > > [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@xxxxxxxxxx Phone: (650) 506-8127 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html