Re: [RFC PATCH 04/12] target: use tpid in target_stat_iport_port_ident_show

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/20/20 21:14, Mike Christie wrote:
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index 237309d..cc9c966 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -1309,8 +1309,8 @@ static ssize_t target_stat_iport_port_ident_show(struct config_item *item,
  	struct se_node_acl *nacl = lacl->se_lun_nacl;
  	struct se_session *se_sess;
  	struct se_portal_group *tpg;
+	char *session_id = NULL;
  	ssize_t ret;
-	unsigned char buf[64];
spin_lock_irq(&nacl->nacl_sess_lock);
  	se_sess = nacl->nacl_sess;
@@ -1319,13 +1319,13 @@ static ssize_t target_stat_iport_port_ident_show(struct config_item *item,
  		return -ENODEV;
  	}
+ session_id = transport_id_get_sid(se_sess->tpid);
+	if (!session_id)
+		session_id = "";
  	tpg = nacl->se_tpg;
  	/* scsiAttIntrPortName+scsiAttIntrPortIdentifier */
-	memset(buf, 0, 64);
-	if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL)
-		tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, buf, 64);
-
-	ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname, buf);
+	ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname,
+		       session_id);
  	spin_unlock_irq(&nacl->nacl_sess_lock);
  	return ret;
  }

AFAICS, after the change "struct se_portal_group tpg" is no longer
necessary and can be removed completely.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux