[ofa-general] [PATCH] Fix some missing node name map substitutions

Ira Weiny weiny2 at llnl.gov
Mon Aug 18 15:46:51 PDT 2008


>From 1b7ed57320796720a0e8c25f04a2544ac9374aa5 Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2 at llnl.gov>
Date: Mon, 18 Aug 2008 15:42:01 -0700
Subject: [PATCH] Fix some missing node name map substitutions

These are 2 cases where the node name map substitution was missed.

Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/src/ibnetdiscover.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c
index 20da1ea..803c300 100644
--- a/infiniband-diags/src/ibnetdiscover.c
+++ b/infiniband-diags/src/ibnetdiscover.c
@@ -510,7 +510,7 @@ out_ids(Node *node, int group, char *chname)
 	    && node->chrecord && node->chrecord->chassisnum) {
 		fprintf(f, "\t\t# Chassis %d", node->chrecord->chassisnum);
 		if (chname)
-			fprintf(f, " (%s)", clean_nodedesc(chname));
+			fprintf(f, " (%s)", chname);
 		if (is_xsigo_tca(node->nodeguid) && node->ports->remoteport)
 			fprintf(f, " slot %d", node->ports->remoteport->portnum);
 	}
@@ -569,6 +569,8 @@ out_ca(Node *node, int group, char *chname)
 {
 	char *node_type;
 	char *node_type2;
+	char *nodename = remap_node_name(node_name_map, node->nodeguid,
+					      node->nodedesc);
 
 	out_ids(node, group, chname);
 	switch(node->type) {
@@ -589,10 +591,12 @@ out_ca(Node *node, int group, char *chname)
 	fprintf(f, "%sguid=0x%" PRIx64 "\n", node_type, node->nodeguid);
 	fprintf(f, "%s\t%d %s\t\t# \"%s\"",
 		node_type2, node->numports, node_name(node),
-		clean_nodedesc(node->nodedesc));
+		nodename);
 	if (group && is_xsigo_hca(node->nodeguid))
 		fprintf(f, " (scp)");
 	fprintf(f, "\n");
+
+	free(nodename);
 }
 
 static char *
@@ -705,6 +709,8 @@ dump_topology(int listtype, int group)
 			if (!ch->chassisnum)
 				continue;
 			chguid = out_chassis(ch->chassisnum);
+			if (chname)
+				free(chname);
 			chname = NULL;
 			if (is_xsigo_guid(chguid)) {
 				for (node = nodesdist[MAXHOPS]; node; node = node->dnext) {
@@ -716,8 +722,10 @@ dump_topology(int listtype, int group)
 						continue;
 
 					if (is_xsigo_hca(node->nodeguid)) {
-						chname = node->nodedesc;
-						fprintf(f, "Hostname: %s\n", clean_nodedesc(node->nodedesc));
+						chname = remap_node_name(node_name_map,
+								node->nodeguid,
+								node->nodedesc);
+						fprintf(f, "Hostname: %s\n", chname);
 					}
 				}
 			}
@@ -804,6 +812,8 @@ dump_topology(int listtype, int group)
 		}
 	}
 
+	if (chname)
+		free(chname);
 	chname = NULL;
 	if (group && !listtype) {
 
@@ -851,6 +861,9 @@ dump_topology(int listtype, int group)
 				out_ca_port(port, group);
 	}
 
+	if (chname)
+		free(chname);
+
 	return i;
 }
 
-- 
1.5.4.5




More information about the general mailing list