Skip to contentSkip to conversation

lpfc: Fix provide host name and OS name in RSNN-NN FC-GS command

PATCH In review James Smart 2 participants 3 messages Feb 5, 2015 – Feb 16, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 10/21 lpfc: Fix provide host name and OS name in RSNN-NN FC-GS command

---
 drivers/scsi/lpfc/lpfc_ct.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +20 -3
index 61a32cd..5091184 100644
@@ -1070,12 +1070,29 @@ lpfc_vport_symbolic_node_name(struct lpfc_vport *vport, char *symbol,
 	size_t size)
 {
 	char fwrev[FW_REV_STR_SIZE];
-	int n;
+	int n = 0;
 
 	lpfc_decode_firmware_rev(vport->phba, fwrev, 0);
 
-	n = snprintf(symbol, size, "Emulex %s FV%s DV%s",
-		vport->phba->ModelName, fwrev, lpfc_release_version);
+	n = snprintf(symbol, size, "Emulex %s", vport->phba->ModelName);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " FV%s", fwrev);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " DV%s", lpfc_release_version);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " HN:%s", init_utsname()->nodename);
+
+	/* Note :- OS name is "Linux" as per requirement BZ168199. */
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " OS:%s", init_utsname()->sysname);
+
 	return n;
 }
 
Signature · 4 lines
1.7.11.7

Signed-off-by: James Smart <[email protected]>
Signed-off-by: Dick Kennedy <[email protected]>
#1 lore raw
Quoted 9 lines · James Smart
---
 drivers/scsi/lpfc/lpfc_ct.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +0 -0
index 61a32cd..5091184 100644

drivers/scsi/lpfc/lpfc_ct.c lpfc_vport_symbolic_node_name(struct lpfc_vport *vport, char *symbol, · line 1073

Quoted 5 lines
drivers/scsi/lpfc/lpfc_ct.c +1 -1
@@ -1070,12 +1070,29 @@ lpfc_vport_symbolic_node_name(struct lpfc_vport *vport, char *symbol,
 	size_t size)
 {
 	char fwrev[FW_REV_STR_SIZE];
-	int n;
+	int n = 0;

No need for this^ initialisation , as 'n' is directly set two lines later

Quoted 27 lines
drivers/scsi/lpfc/lpfc_ct.c +19 -2
 	lpfc_decode_firmware_rev(vport->phba, fwrev, 0);
 
-	n = snprintf(symbol, size, "Emulex %s FV%s DV%s",
-		vport->phba->ModelName, fwrev, lpfc_release_version);
+	n = snprintf(symbol, size, "Emulex %s", vport->phba->ModelName);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " FV%s", fwrev);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " DV%s", lpfc_release_version);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " HN:%s", init_utsname()->nodename);
+
+	/* Note :- OS name is "Linux" as per requirement BZ168199. */
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " OS:%s", init_utsname()->sysname);
+
 	return n;
 }
 
#2 lore raw

agree - nice nit.

I'll add this to the list of things to merge in the next patch update.

-- james

Quoted 46 lines · Tomas Henzl
Quoted 9 lines · James Smart
---
  drivers/scsi/lpfc/lpfc_ct.c | 23 ++++++++++++++++++++---
  1 file changed, 20 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +0 -0
index 61a32cd..5091184 100644

drivers/scsi/lpfc/lpfc_ct.c lpfc_vport_symbolic_node_name(struct lpfc_vport *vport, char *symbol, · line 1073

Quoted 5 lines
drivers/scsi/lpfc/lpfc_ct.c +1 -1
@@ -1070,12 +1070,29 @@ lpfc_vport_symbolic_node_name(struct lpfc_vport *vport, char *symbol,
  	size_t size)
  {
  	char fwrev[FW_REV_STR_SIZE];
-	int n;
+	int n = 0;

No need for this^ initialisation , as 'n' is directly set two lines later

Quoted 27 lines
drivers/scsi/lpfc/lpfc_ct.c +19 -2
  	lpfc_decode_firmware_rev(vport->phba, fwrev, 0);
 
-	n = snprintf(symbol, size, "Emulex %s FV%s DV%s",
-		vport->phba->ModelName, fwrev, lpfc_release_version);
+	n = snprintf(symbol, size, "Emulex %s", vport->phba->ModelName);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " FV%s", fwrev);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " DV%s", lpfc_release_version);
+
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " HN:%s", init_utsname()->nodename);
+
+	/* Note :- OS name is "Linux" as per requirement BZ168199. */
+	if (size < n)
+		return n;
+	n += snprintf(symbol + n, size - n, " OS:%s", init_utsname()->sysname);
+
  	return n;
  }