aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Christie <mchristi@redhat.com>2017-01-13 05:47:48 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2017-02-19 00:36:50 -0500
commit0ab8ac6f504d61b59856bd34e62bbfd60edd2bb0 (patch)
tree7db286b7de7dd9e3347133dfcdd03f70e9b547af
parent6cb3216a7863fd13fb125f0867fce55c2bbd8c8e (diff)
target: export protocol identifier
I think the transport statistics device file was supposed to show scsiTransportProtocolType. It instead shows the fabric name which is normally closer to the driver name. I was thinking I cannot change from fabric name to protocol type name incase people are expecting the driver name, so this patch adds another file proto_id that exports the SCSI protocol identifier ID. Signed-off-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_stat.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index 1a39033d2bff..be380e4acfcd 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -795,16 +795,34 @@ static ssize_t target_stat_transport_dev_name_show(struct config_item *item,
795 return ret; 795 return ret;
796} 796}
797 797
798static ssize_t target_stat_transport_proto_id_show(struct config_item *item,
799 char *page)
800{
801 struct se_lun *lun = to_transport_stat(item);
802 struct se_device *dev;
803 struct se_portal_group *tpg = lun->lun_tpg;
804 ssize_t ret = -ENODEV;
805
806 rcu_read_lock();
807 dev = rcu_dereference(lun->lun_se_dev);
808 if (dev)
809 ret = snprintf(page, PAGE_SIZE, "%u\n", tpg->proto_id);
810 rcu_read_unlock();
811 return ret;
812}
813
798CONFIGFS_ATTR_RO(target_stat_transport_, inst); 814CONFIGFS_ATTR_RO(target_stat_transport_, inst);
799CONFIGFS_ATTR_RO(target_stat_transport_, device); 815CONFIGFS_ATTR_RO(target_stat_transport_, device);
800CONFIGFS_ATTR_RO(target_stat_transport_, indx); 816CONFIGFS_ATTR_RO(target_stat_transport_, indx);
801CONFIGFS_ATTR_RO(target_stat_transport_, dev_name); 817CONFIGFS_ATTR_RO(target_stat_transport_, dev_name);
818CONFIGFS_ATTR_RO(target_stat_transport_, proto_id);
802 819
803static struct configfs_attribute *target_stat_scsi_transport_attrs[] = { 820static struct configfs_attribute *target_stat_scsi_transport_attrs[] = {
804 &target_stat_transport_attr_inst, 821 &target_stat_transport_attr_inst,
805 &target_stat_transport_attr_device, 822 &target_stat_transport_attr_device,
806 &target_stat_transport_attr_indx, 823 &target_stat_transport_attr_indx,
807 &target_stat_transport_attr_dev_name, 824 &target_stat_transport_attr_dev_name,
825 &target_stat_transport_attr_proto_id,
808 NULL, 826 NULL,
809}; 827};
810 828