aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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