Commit 5cdf5a87 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Nicholas Bellinger

iscsi-target: use '%*ph' specifier to dump hex buffer

Instead of pushing each byte via stack the %*ph specifier allows to supply just
a pointer and length of the buffer. The patch converts code to use the
specifier.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 3c9786e5
...@@ -674,12 +674,9 @@ static ssize_t lio_target_nacl_show_info( ...@@ -674,12 +674,9 @@ static ssize_t lio_target_nacl_show_info(
rb += sprintf(page+rb, "InitiatorAlias: %s\n", rb += sprintf(page+rb, "InitiatorAlias: %s\n",
sess->sess_ops->InitiatorAlias); sess->sess_ops->InitiatorAlias);
rb += sprintf(page+rb, "LIO Session ID: %u " rb += sprintf(page+rb,
"ISID: 0x%02x %02x %02x %02x %02x %02x " "LIO Session ID: %u ISID: 0x%6ph TSIH: %hu ",
"TSIH: %hu ", sess->sid, sess->sid, sess->isid, sess->tsih);
sess->isid[0], sess->isid[1], sess->isid[2],
sess->isid[3], sess->isid[4], sess->isid[5],
sess->tsih);
rb += sprintf(page+rb, "SessionType: %s\n", rb += sprintf(page+rb, "SessionType: %s\n",
(sess->sess_ops->SessionType) ? (sess->sess_ops->SessionType) ?
"Discovery" : "Normal"); "Discovery" : "Normal");
...@@ -1758,9 +1755,7 @@ static u32 lio_sess_get_initiator_sid( ...@@ -1758,9 +1755,7 @@ static u32 lio_sess_get_initiator_sid(
/* /*
* iSCSI Initiator Session Identifier from RFC-3720. * iSCSI Initiator Session Identifier from RFC-3720.
*/ */
return snprintf(buf, size, "%02x%02x%02x%02x%02x%02x", return snprintf(buf, size, "%6phN", sess->isid);
sess->isid[0], sess->isid[1], sess->isid[2],
sess->isid[3], sess->isid[4], sess->isid[5]);
} }
static int lio_queue_data_in(struct se_cmd *se_cmd) static int lio_queue_data_in(struct se_cmd *se_cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment