public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: print port name via %*phC
@ 2014-04-29 14:26 Andy Shevchenko
  2014-04-30 10:43 ` Saurav Kashyap
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2014-04-29 14:26 UTC (permalink / raw)
  To: qla2xxx-upstream, linux-scsi; +Cc: Andy Shevchenko

Instead of pushing each byte via stack let's use custom specifier which allows
to print small buffers as a hex string.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 68fb66fd..c9b2421 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -1492,9 +1492,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(
 	 * match the format by tcm_qla2xxx explict ConfigFS NodeACLs.
 	 */
 	memset(&port_name, 0, 36);
-	snprintf(port_name, 36, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
-		fc_wwpn[0], fc_wwpn[1], fc_wwpn[2], fc_wwpn[3], fc_wwpn[4],
-		fc_wwpn[5], fc_wwpn[6], fc_wwpn[7]);
+	snprintf(port_name, sizeof(port_name), "%8phC", fc_wwpn);
 	/*
 	 * Locate our struct se_node_acl either from an explict NodeACL created
 	 * via ConfigFS, or via running in TPG demo mode.
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: qla2xxx: print port name via %*phC
  2014-04-29 14:26 [PATCH] scsi: qla2xxx: print port name via %*phC Andy Shevchenko
@ 2014-04-30 10:43 ` Saurav Kashyap
  0 siblings, 0 replies; 4+ messages in thread
From: Saurav Kashyap @ 2014-04-30 10:43 UTC (permalink / raw)
  To: Andy Shevchenko, Dept-Eng QLA2xxx Upstream, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

Acked-by: Saurav Kashyap <saurav.kashyap@qlogic.com>


>Instead of pushing each byte via stack let's use custom specifier which
>allows
>to print small buffers as a hex string.
>
>Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>---
> drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
>diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
>b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
>index 68fb66fd..c9b2421 100644
>--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
>+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
>@@ -1492,9 +1492,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(
> 	 * match the format by tcm_qla2xxx explict ConfigFS NodeACLs.
> 	 */
> 	memset(&port_name, 0, 36);
>-	snprintf(port_name, 36, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
>-		fc_wwpn[0], fc_wwpn[1], fc_wwpn[2], fc_wwpn[3], fc_wwpn[4],
>-		fc_wwpn[5], fc_wwpn[6], fc_wwpn[7]);
>+	snprintf(port_name, sizeof(port_name), "%8phC", fc_wwpn);
> 	/*
> 	 * Locate our struct se_node_acl either from an explict NodeACL created
> 	 * via ConfigFS, or via running in TPG demo mode.
>-- 
>1.9.2
>


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 4433 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] scsi: qla2xxx: print port name via %*phC
@ 2015-01-15 11:28 Andy Shevchenko
  2015-01-20 23:39 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2015-01-15 11:28 UTC (permalink / raw)
  To: qla2xxx-upstream, Saurav Kashyap, Christoph Hellwig, linux-scsi
  Cc: Andy Shevchenko

Instead of pushing each byte via stack let's use custom specifier which allows
to print small buffers as a hex string.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 73f9fee..99f43b7 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -1570,9 +1570,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(
 	 * match the format by tcm_qla2xxx explict ConfigFS NodeACLs.
 	 */
 	memset(&port_name, 0, 36);
-	snprintf(port_name, 36, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
-		fc_wwpn[0], fc_wwpn[1], fc_wwpn[2], fc_wwpn[3], fc_wwpn[4],
-		fc_wwpn[5], fc_wwpn[6], fc_wwpn[7]);
+	snprintf(port_name, sizeof(port_name), "%8phC", fc_wwpn);
 	/*
 	 * Locate our struct se_node_acl either from an explict NodeACL created
 	 * via ConfigFS, or via running in TPG demo mode.
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: qla2xxx: print port name via %*phC
  2015-01-15 11:28 Andy Shevchenko
@ 2015-01-20 23:39 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas A. Bellinger @ 2015-01-20 23:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: qla2xxx-upstream, Saurav Kashyap, Christoph Hellwig, linux-scsi

On Thu, 2015-01-15 at 13:28 +0200, Andy Shevchenko wrote:
> Instead of pushing each byte via stack let's use custom specifier which allows
> to print small buffers as a hex string.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index 73f9fee..99f43b7 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -1570,9 +1570,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(
>  	 * match the format by tcm_qla2xxx explict ConfigFS NodeACLs.
>  	 */
>  	memset(&port_name, 0, 36);
> -	snprintf(port_name, 36, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
> -		fc_wwpn[0], fc_wwpn[1], fc_wwpn[2], fc_wwpn[3], fc_wwpn[4],
> -		fc_wwpn[5], fc_wwpn[6], fc_wwpn[7]);
> +	snprintf(port_name, sizeof(port_name), "%8phC", fc_wwpn);
>  	/*
>  	 * Locate our struct se_node_acl either from an explict NodeACL created
>  	 * via ConfigFS, or via running in TPG demo mode.

Picking this one up, since it's specific to tcm_qla2xxx code.

Applied to target-pending/for-next.

Thanks Andy!

--nab



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-20 23:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-29 14:26 [PATCH] scsi: qla2xxx: print port name via %*phC Andy Shevchenko
2014-04-30 10:43 ` Saurav Kashyap
  -- strict thread matches above, loose matches on Subject: below --
2015-01-15 11:28 Andy Shevchenko
2015-01-20 23:39 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox