scsi: Export transport identifier
Subsystems (6)
PATCH 1/1 scsi: Export transport identifier
This patch exports a transport identifier for each host. This removes the need for heuristics in management utilities that need to know the transport type.
The identifier is set by the SCSI transport class except for ATA, USB and FireWire. The default identifier is SPI as not all legacy HBA drivers are using transport classes.
This patch is based on work by FUJITA Tomonori
<[email protected]>.
Signed-off-by Martin K. Petersen <[email protected]>
---
drivers/ata/libata-scsi.c +1 -0
@@ -3191,6 +3191,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) shost->max_lun =1 ; shost->max_channel =1 ; shost->max_cmd_len =16 ; + shost->transport_id =SCSI_TRANSPORT_ATA ;/* Schedule policy is determined by ->qc_defer() * callback and it needs to see every deferred qc.
drivers/firewire/fw-sbp2.c +1 -0
@@ -1139,6 +1139,7 @@ static int sbp2_probe(struct device *dev)if (scsi_add_host (shost, &unit->device) <0 ) goto fail_shost_put; + shost->transport_id =SCSI_TRANSPORT_SBP ;fw_device_get (device);fw_unit_get (unit);
drivers/ieee1394/sbp2.c +1 -0
@@ -870,6 +870,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud) } shost->hostdata[0 ] = (unsigned long )lu; + shost->transport_id =SCSI_TRANSPORT_SBP ;if (!scsi_add_host (shost, &ud->device)) { lu->shost = shost;
drivers/scsi/scsi_sysfs.c +43 -0
61 lines not on this page · raw message
drivers/scsi/scsi_transport_fc.c +1 -0
@@ -410,6 +410,7 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev, fc_host->work_q =NULL ;return -ENOMEM ; } + shost->transport_id =SCSI_TRANSPORT_FC ;return 0 ; }
drivers/scsi/scsi_transport_iscsi.c +1 -0
@@ -253,6 +253,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, ihost->scan_workq_name);if (!ihost->scan_workq)return -ENOMEM ; + shost->transport_id =SCSI_TRANSPORT_ISCSI ;return 0 ; }
drivers/scsi/scsi_transport_sas.c +1 -0
@@ -287,6 +287,7 @@ static int sas_host_setup(struct transport_container *tc, struct device *dev,dev_printk (KERN_ERR , dev,"fail to a bsg device %d\n" , shost->host_no); + shost->transport_id =SCSI_TRANSPORT_SAS ;return 0 ; }
drivers/scsi/scsi_transport_srp.c +1 -0
@@ -63,6 +63,7 @@ static int srp_host_setup(struct transport_container *tc, struct device *dev,struct srp_host_attrs *srp_host =to_srp_host_attrs (shost);atomic_set (&srp_host->next_port_id,0 ); + shost->transport_id =SCSI_TRANSPORT_SRP ;return 0 ; }
drivers/usb/storage/usb.c +1 -0
@@ -1041,6 +1041,7 @@ static int storage_probe(struct usb_interface *intf,* Allow 16-byte CDBs and thus > 2TB */ host->max_cmd_len =16 ; + host->transport_id =SCSI_TRANSPORT_USB ; us =host_to_us (host);memset (us,0 ,sizeof (struct us_data ));mutex_init (&(us->dev_mutex));
include/scsi/scsi.h +11 -0
@@ -523,4 +523,15 @@ static inline __u32 scsi_to_u32(__u8 *ptr) return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; } +enum scsi_transport_id { +SCSI_TRANSPORT_UNKNOWN =0 , +SCSI_TRANSPORT_SPI , +SCSI_TRANSPORT_FC , +SCSI_TRANSPORT_SAS , +SCSI_TRANSPORT_ISCSI , +SCSI_TRANSPORT_SBP , +SCSI_TRANSPORT_USB , +SCSI_TRANSPORT_ATA , +}; +#endif /* _SCSI_SCSI_H */
include/scsi/scsi_host.h +1 -0
@@ -648,6 +648,7 @@ struct Scsi_Host {enum scsi_host_state shost_state; +enum scsi_transport_id transport_id;/* ldm bits */ struct device shost_gendev, shost_dev;