[ofa-general] [PATCH 2/7] Change switch map function names to reflect the new functionality of a simple node name map.

Ira Weiny weiny2 at llnl.gov
Thu Nov 1 20:15:02 PDT 2007


>From b4f6bbea815aaa91837d464f882d30405ffe9d98 Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Wed, 31 Oct 2007 16:34:44 -0700
Subject: [PATCH] Change switch map function names to reflect the new functionality of a simple

node name map.

Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/configure.in             |   30 ++++++++++++++--------------
 infiniband-diags/include/ibdiag_common.h  |   10 ++++----
 infiniband-diags/infiniband-diags.spec.in |    9 +++++--
 infiniband-diags/man/ibnetdiscover.8      |   12 +++++-----
 infiniband-diags/man/ibtracert.8          |   10 +++++---
 infiniband-diags/man/saquery.8            |    8 +++---
 infiniband-diags/man/smpquery.8           |    9 +++++++-
 infiniband-diags/src/ibdiag_common.c      |   24 +++++++++++-----------
 infiniband-diags/src/ibnetdiscover.c      |   24 +++++++++++-----------
 infiniband-diags/src/ibtracert.c          |   20 +++++++++---------
 infiniband-diags/src/saquery.c            |   16 +++++++-------
 infiniband-diags/src/smpquery.c           |   16 +++++++-------
 12 files changed, 100 insertions(+), 88 deletions(-)

diff --git a/infiniband-diags/configure.in b/infiniband-diags/configure.in
index 95c7b34..0a5f3c8 100644
--- a/infiniband-diags/configure.in
+++ b/infiniband-diags/configure.in
@@ -72,30 +72,30 @@ AC_CHECK_FUNCS([strchr strrchr strtol strtoul memset])
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 
-dnl Check for the specification of a default switch map file
-AC_MSG_CHECKING(for --with-switch-map )
-AC_ARG_WITH(switch-map,
-    AC_HELP_STRING([--with-switch-map=file],
-                   [define a default switch map file]),
+dnl Check for the specification of a default node name map file
+AC_MSG_CHECKING(for --with-node-name-map )
+AC_ARG_WITH(node-name-map,
+    AC_HELP_STRING([--with-node-name-map=file],
+                   [define a default node name map file]),
     [ case "$withval" in
     no)
         ;;
     *)
-        withswitchmap=yes
-        SWITCHMAPFILE=$withval
+        withnodenamemap=yes
+        NODENAMEMAPFILE=$withval
         ;;
     esac ]
 )
-AC_MSG_RESULT(${withswitchmap=no})
+AC_MSG_RESULT(${withnodenamemap=no})
 
-if test $withswitchmap = "yes"; then
-   SWITCHMAP_TMP1="`eval echo ${sysconfdir}/$SWITCHMAPFILE`"
-   SWITCHMAP_TMP2="`echo $SWITCHMAP_TMP1 | sed 's/^NONE/$ac_default_prefix/'`"
-   SWITCHMAP="`eval echo $SWITCHMAP_TMP2`"
+if test $withnodenamemap = "yes"; then
+   NODENAMEMAP_TMP1="`eval echo ${sysconfdir}/$NODENAMEMAPFILE`"
+   NODENAMEMAP_TMP2="`echo $NODENAMEMAP_TMP1 | sed 's/^NONE/$ac_default_prefix/'`"
+   NODENAMEMAP="`eval echo $NODENAMEMAP_TMP2`"
 
-   AC_DEFINE_UNQUOTED(HAVE_DEFAULT_SWITCH_MAP,
-	         ["$SWITCHMAP"],
-	         [Define a default switch map file])
+   AC_DEFINE_UNQUOTED(HAVE_DEFAULT_NODENAME_MAP,
+	         ["$NODENAMEMAP"],
+	         [Define a default node name map file])
 fi
 
 dnl Check for perl and perl install location
diff --git a/infiniband-diags/include/ibdiag_common.h b/infiniband-diags/include/ibdiag_common.h
index 159e929..55df3fe 100644
--- a/infiniband-diags/include/ibdiag_common.h
+++ b/infiniband-diags/include/ibdiag_common.h
@@ -46,12 +46,12 @@ extern int   ibdebug;
 /*========================================================*/
 
 /**
- * Switch map interface.
- * It is OK to pass NULL for the switch_map[_fp] parameters.
+ * Node name map interface.
+ * It is OK to pass NULL for the node_name_map[_fp] parameters.
  */
-FILE *open_switch_map(char *switch_map);
-void  close_switch_map(FILE *switch_map_fp);
-char *lookup_switch_name(FILE *switch_map_fp, uint64_t target_guid,
+FILE *open_node_name_map(char *node_name_map);
+void  close_node_name_map(FILE *node_name_map_fp);
+char *remap_node_name(FILE *node_name_map_fp, uint64_t target_guid,
 			char *nodedesc);
 	/* NOTE: parameter "nodedesc" may be modified here. */
 
diff --git a/infiniband-diags/infiniband-diags.spec.in b/infiniband-diags/infiniband-diags.spec.in
index f4a08ab..75880c0 100644
--- a/infiniband-diags/infiniband-diags.spec.in
+++ b/infiniband-diags/infiniband-diags.spec.in
@@ -21,12 +21,12 @@ diagnose an IB subnet.
 %prep
 %setup -q
 
-%if %{?_with_switch_map:1}%{!?_with_switch_map:0}
-%define _enable_switch_map --with-switch-map%{?_with_switch_map}
+%if %{?_with_node_name_map:1}%{!?_with_node_name_map:0}
+%define _enable_node_name_map --with-node-name-map%{?_with_node_name_map}
 %endif
 
 %build
-%configure %{?_enable_switch_map}
+%configure %{?_enable_node_name_map}
 make
 
 %install
@@ -55,6 +55,9 @@ rm -rf $RPM_BUILD_ROOT
 %doc README ChangeLog
 
 %changelog
+* Wed Oct 31 2007 Ira Weiny <weiny2 at llnl.gov> - 1.3.2
+- Change switch-map option to node-name-map
+
 * Thu Aug 9 2007 Ira Weiny <weiny2 at llnl.gov> - 1.3.1
 - Change set_mthca_nodedesc.sh to set_nodedesc.sh
 
diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8
index 03303be..9099cf3 100644
--- a/infiniband-diags/man/ibnetdiscover.8
+++ b/infiniband-diags/man/ibnetdiscover.8
@@ -5,7 +5,7 @@ ibnetdiscover \- discover InfiniBand topology
 
 .SH SYNOPSIS
 .B ibnetdiscover
-[\-d(ebug)] [\-e(rr_show)] [\-v(erbose)] [\-s(how)] [\-l(ist)] [\-g(rouping)] [\-H(ca_list)] [\-S(witch_list)] [\-R(outer_list)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\--switch-map <switch-map>] [\-h(elp)] [<topology-file>]
+[\-d(ebug)] [\-e(rr_show)] [\-v(erbose)] [\-s(how)] [\-l(ist)] [\-g(rouping)] [\-H(ca_list)] [\-S(witch_list)] [\-R(outer_list)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\--node-name-map <node-name-map>] [\-h(elp)] [<topology-file>]
 
 .SH DESCRIPTION
 .PP
@@ -39,8 +39,8 @@ List of connected routers
 \fB\-s\fR, \fB\-\-show\fR
 Show more information
 .TP
-\fB\-\-switch\-map\fR <switch-map>
-Specify a switch map.  The switch map file maps GUIDs to more user friendly
+\fB\-\-node\-name\-map\fR <node-name-map>
+Specify a node name map.  The node name map file maps GUIDs to more user friendly
 names.  See file format below.
 
 .SH COMMON OPTIONS
@@ -180,8 +180,8 @@ displayed as "Non-Chassis Nodes".  External ports are also shown on the
 connectivity lines.
  
 
-.SH SWITCH MAP FILE FORMAT
-The switch map is used to specify a user friendly name for switches in the
+.SH NODE NAME MAP FILE FORMAT
+The node name map is used to specify user friendly names for nodes in the
 output.  GUIDs are used to perform the lookup.
 
 .TP
@@ -222,7 +222,7 @@ output.  GUIDs are used to perform the lookup.
 0x0008f10400400e32 "IB1 (Rack 11 spine 2   ) ISR9288 Voltaire sFB-12D"
 .br
 .br
-# GUID   Switch Name
+# GUID   Node Name
 .br
 0x0008f10400411a08 "SW1  (Rack  3) ISR9024 Voltaire 9024D"
 .br
diff --git a/infiniband-diags/man/ibtracert.8 b/infiniband-diags/man/ibtracert.8
index 214b09b..32109fe 100644
--- a/infiniband-diags/man/ibtracert.8
+++ b/infiniband-diags/man/ibtracert.8
@@ -5,7 +5,9 @@ ibtracert\- trace InfiniBand path
 
 .SH SYNOPSIS
 .B ibtracert
-[\-d(ebug)] [-v(erbose)] [\-D(irect)] [\-G(uids)] [-n(o_info)] [-m mlid] [-s smlid] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\-\-switch\-map <switch-map>] [\-h(elp)] [<dest dr_path|lid|guid> [<startlid> [<endlid>]]]
+[\-d(ebug)] [-v(erbose)] [\-D(irect)] [\-G(uids)] [-n(o_info)] [-m mlid] [-s
+smlid] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)]
+[\-\-node\-name\-\-map <node-name-map>] [\-h(elp)] [<dest dr_path|lid|guid> [<startlid> [<endlid>]]]
 
 .SH DESCRIPTION
 .PP
@@ -24,11 +26,11 @@ simple format; don't show additional information
 \fB\-m\fR
 show the multicast trace of the specified mlid
 .TP
-\fB\-\-switch\-map\fR <switch-map>
-Specify a switch map.  The switch map file maps GUIDs to more user friendly
+\fB\-\-node\-name\-map\fR <node-name-map>
+Specify a node name map.  The node name map file maps GUIDs to more user friendly
 names.  See 
 .B ibnetdiscover(8)
-for switch map file format.
+for node name map file format.
 
 .SH COMMON OPTIONS
 
diff --git a/infiniband-diags/man/saquery.8 b/infiniband-diags/man/saquery.8
index 5558cc9..516ae85 100644
--- a/infiniband-diags/man/saquery.8
+++ b/infiniband-diags/man/saquery.8
@@ -7,7 +7,7 @@ saquery \- query InfiniBand subnet administration attributes
 .B saquery 
 [\-h] [\-d] [\-p] [\-N] [\-\-list | \-D] [\-S] [\-I] [\-L] [\-l] [\-G] [\-O]
 [\-U] [\-c] [\-s] [\-g] [\-m] [--src-to-dst <src:dst>] [\-C ca_name]
-[\-P ca_port] [\-t(imeout) <msec>] [\-\-switch\-map <switch-map>]
+[\-P ca_port] [\-t(imeout) <msec>] [\-\-node\-name\-map <node-name-map>]
 [<name> | <lid> | <guid>]
 
 .SH DESCRIPTION
@@ -77,11 +77,11 @@ Specify SA query response timeout in milliseconds.
 Default is 100 milliseconds. You may want to use
 this option if IB_TIMEOUT is indicated.
 .TP
-\fB\-\-switch\-map\fR <switch-map>
-Specify a switch map.  The switch map file maps GUIDs to more user friendly
+\fB\-\-node\-name\-map\fR <node-name-map>
+Specify a node name map.  The node name map file maps GUIDs to more user friendly
 names.  See 
 .B ibnetdiscover(8)
-for switch map file format.  Only used with the \fB\-O\fR and \fB\-U\fR options.
+for node name map file format.  Only used with the \fB\-O\fR and \fB\-U\fR options.
 .TP
 \fB\-d\fR
 enable debugging
diff --git a/infiniband-diags/man/smpquery.8 b/infiniband-diags/man/smpquery.8
index b81dc81..be619e9 100644
--- a/infiniband-diags/man/smpquery.8
+++ b/infiniband-diags/man/smpquery.8
@@ -5,7 +5,7 @@ smpquery \- query InfiniBand subnet management attributes
 
 .SH SYNOPSIS
 .B smpquery 
-[\-d(ebug)] [\-e(rr_show)] [\-v(erbose)] [\-D(irect)] [\-G(uid)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\-h(elp)] <op> <dest dr_path|lid|guid> [op params]
+[\-d(ebug)] [\-e(rr_show)] [\-v(erbose)] [\-D(irect)] [\-G(uid)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms --node-name-map node-name-map] [\-V(ersion)] [\-h(elp)] <op> <dest dr_path|lid|guid> [op params]
 
 .SH DESCRIPTION
 .PP
@@ -27,6 +27,13 @@ Current supported operations and their parameters:
         vlarb <addr> [<portnum>]
         guids <addr>
 
+.TP
+\fB\-\-node\-name\-map\fR <node-name-map>
+Specify a node name map.  The node name map file maps GUIDs to more user friendly
+names.  See
+.B ibnetdiscover(8)
+for node name map file format.
+
 .SH COMMON OPTIONS
 
 Most OpenIB diagnostics take the following common flags. The exact list of 
diff --git a/infiniband-diags/src/ibdiag_common.c b/infiniband-diags/src/ibdiag_common.c
index bfddfd7..c152853 100644
--- a/infiniband-diags/src/ibdiag_common.c
+++ b/infiniband-diags/src/ibdiag_common.c
@@ -52,34 +52,34 @@
 int ibdebug;
 
 FILE *
-open_switch_map(char *switch_map)
+open_node_name_map(char *node_name_map)
 {
 	FILE *rc = NULL;
 
-	if (switch_map != NULL) {
-		rc = fopen(switch_map, "r");
+	if (node_name_map != NULL) {
+		rc = fopen(node_name_map, "r");
 		if (rc == NULL) {
 			fprintf(stderr,
 				"WARNING failed to open switch map \"%s\" (%s)\n",
-				switch_map, strerror(errno));
+				node_name_map, strerror(errno));
 		}
-#ifdef HAVE_DEFAULT_SWITCH_MAP
+#ifdef HAVE_DEFAULT_NODENAME_MAP
 	} else {
-		rc = fopen(HAVE_DEFAULT_SWITCH_MAP, "r");
-#endif /* HAVE_DEFAULT_SWITCH_MAP */
+		rc = fopen(HAVE_DEFAULT_NODENAME_MAP, "r");
+#endif /* HAVE_DEFAULT_NODENAME_MAP */
 	}
 	return (rc);
 }
 
 void
-close_switch_map(FILE *fp)
+close_node_name_map(FILE *fp)
 {
 	if (fp)
 		fclose(fp);
 }
 
 char *
-lookup_switch_name(FILE *switch_map_fp, uint64_t target_guid, char *nodedesc)
+remap_node_name(FILE *node_name_map_fp, uint64_t target_guid, char *nodedesc)
 {
 #define NAME_LEN (256)
 	char     *line = NULL;
@@ -88,12 +88,12 @@ lookup_switch_name(FILE *switch_map_fp, uint64_t target_guid, char *nodedesc)
 	char     *rc = NULL;
 	int       line_count = 0;
 
-	if (switch_map_fp == NULL)
+	if (node_name_map_fp == NULL)
 		goto done;
 
-	rewind(switch_map_fp);
+	rewind(node_name_map_fp);
 	for (line_count = 1;
-		getline(&line, &len, switch_map_fp) != -1;
+		getline(&line, &len, node_name_map_fp) != -1;
 		line_count++) {
 		line[len-1] = '\0';
 		if (line[0] == '#')
diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c
index fd824c0..5594b1c 100644
--- a/infiniband-diags/src/ibnetdiscover.c
+++ b/infiniband-diags/src/ibnetdiscover.c
@@ -91,8 +91,8 @@ static FILE *f;
 
 char *argv0 = "ibnetdiscover";
 
-static char *switch_map = NULL;
-static FILE *switch_map_fp = NULL;
+static char *node_name_map = NULL;
+static FILE *node_name_map_fp = NULL;
 
 Node *nodesdist[MAXHOPS+1];     /* last is Ca list */
 Node *mynode;
@@ -459,7 +459,7 @@ void
 list_node(Node *node)
 {
 	char *node_type;
-	char *nodename = lookup_switch_name(switch_map_fp, node->nodeguid,
+	char *nodename = remap_node_name(node_name_map_fp, node->nodeguid,
 					      node->nodedesc);
 
 	switch(node->type) {
@@ -536,7 +536,7 @@ out_switch(Node *node, int group, char *chname)
 		fprintf(f, "%d Chip %d", node->chrecord->slotnum, node->chrecord->anafanum);
 	}
 
-	nodename = lookup_switch_name(switch_map_fp, node->nodeguid,
+	nodename = remap_node_name(node_name_map_fp, node->nodeguid,
 				node->nodedesc);
 
 	fprintf(f, "\nSwitch\t%d %s\t\t# \"%s\" %s port 0 lid %d lmc %d\n",
@@ -605,7 +605,7 @@ out_switch_port(Port *port, int group)
 	if (ext_port_str)
 		fprintf(f, "%s", ext_port_str);
 
-	rem_nodename = lookup_switch_name(switch_map_fp,
+	rem_nodename = remap_node_name(node_name_map_fp,
 				port->remoteport->node->nodeguid,
 				port->remoteport->node->nodedesc);
 
@@ -649,7 +649,7 @@ out_ca_port(Port *port, int group)
 	if (port->remoteport->node->type != SWITCH_NODE)
 		fprintf(f, " (%" PRIx64 ") ", port->remoteport->portguid);
 
-	rem_nodename = lookup_switch_name(switch_map_fp,
+	rem_nodename = remap_node_name(node_name_map_fp,
 				port->remoteport->node->nodeguid,
 				port->remoteport->node->nodedesc);
 
@@ -842,9 +842,9 @@ void
 usage(void)
 {
 	fprintf(stderr, "Usage: %s [-d(ebug)] -e(rr_show) -v(erbose) -s(how) -l(ist) -g(rouping) -H(ca_list) -S(witch_list) -R(outer_list) -V(ersion) -C ca_name -P ca_port "
-			"-t(imeout) timeout_ms --switch-map switch-map] [<topology-file>]\n",
+			"-t(imeout) timeout_ms --node-name-map node-name-map] [<topology-file>]\n",
 			argv0);
-	fprintf(stderr, "       --switch-map <switch-map> specify a switch-map file\n");
+	fprintf(stderr, "       --node-name-map <node-name-map> specify a node name map file\n");
 	exit(-1);
 }
 
@@ -872,7 +872,7 @@ main(int argc, char **argv)
 		{ "Switch_list", 0, 0, 'S'},
 		{ "Router_list", 0, 0, 'R'},
 		{ "timeout", 1, 0, 't'},
-		{ "switch-map", 1, 0, 1},
+		{ "node-name-map", 1, 0, 1},
 		{ "Version", 0, 0, 'V'},
 		{ "help", 0, 0, 'h'},
 		{ "usage", 0, 0, 'u'},
@@ -889,7 +889,7 @@ main(int argc, char **argv)
 			break;
 		switch(ch) {
 		case 1:
-			switch_map = strdup(optarg);
+			node_name_map = strdup(optarg);
 			break;
 		case 'C':
 			ca = optarg;
@@ -946,7 +946,7 @@ main(int argc, char **argv)
 		IBERROR("can't open file %s for writing", argv[0]);
 
 	madrpc_init(ca, ca_port, mgmt_classes, 2);
-	switch_map_fp = open_switch_map(switch_map);
+	node_name_map_fp = open_node_name_map(node_name_map);
 
 	if (discover(&my_portid) < 0)
 		IBERROR("discover");
@@ -956,6 +956,6 @@ main(int argc, char **argv)
 
 	dump_topology(list, group);
 
-	close_switch_map(switch_map_fp);
+	close_node_name_map(node_name_map_fp);
 	exit(0);
 }
diff --git a/infiniband-diags/src/ibtracert.c b/infiniband-diags/src/ibtracert.c
index 5cf8043..2e04f2f 100644
--- a/infiniband-diags/src/ibtracert.c
+++ b/infiniband-diags/src/ibtracert.c
@@ -70,8 +70,8 @@ static FILE *f;
 
 char *argv0 = "ibtracert";
 
-static char *switch_map = NULL;
-static FILE *switch_map_fp = NULL;
+static char *node_name_map = NULL;
+static FILE *node_name_map_fp = NULL;
 
 typedef struct Port Port;
 typedef struct Switch Switch;
@@ -204,7 +204,7 @@ dump_endnode(int dump, char *prompt, Node *node, Port *port)
 		return;
 	}
 
-	nodename = lookup_switch_name(switch_map_fp, node->nodeguid, node->nodedesc);
+	nodename = remap_node_name(node_name_map_fp, node->nodeguid, node->nodedesc);
 
 	fprintf(f, "%s %s {0x%016" PRIx64 "} portnum %d lid 0x%x-0x%x \"%s\"\n",
 		prompt,
@@ -224,7 +224,7 @@ dump_route(int dump, Node *node, int outport, Port *port)
 	if (!dump && !verbose)
 		return;
 
-	nodename = lookup_switch_name(switch_map_fp, node->nodeguid, node->nodedesc);
+	nodename = remap_node_name(node_name_map_fp, node->nodeguid, node->nodedesc);
 
 	if (dump == 1)
 		fprintf(f, "[%d] -> {0x%016" PRIx64 "}[%d]\n",
@@ -636,7 +636,7 @@ dump_mcpath(Node *node, int dumplevel)
 	if (node->upnode)
 		dump_mcpath(node->upnode, dumplevel);
 
-	nodename = lookup_switch_name(switch_map_fp, node->nodeguid, node->nodedesc);
+	nodename = remap_node_name(node_name_map_fp, node->nodeguid, node->nodedesc);
 
 	if (!node->dist) {
 		printf("From %s 0x%" PRIx64 " port %d lid 0x%x-0x%x \"%s\"\n",
@@ -684,7 +684,7 @@ usage(void)
 		basename++;
 
 	fprintf(stderr, "Usage: %s [-d(ebug) -v(erbose) -D(irect) -G(uids) -n(o_info) -C ca_name -P ca_port "
-			"-s smlid -t(imeout) timeout_ms -m mlid --switch-map switch-map ] <src-addr> <dest-addr>\n",
+			"-s smlid -t(imeout) timeout_ms -m mlid --node-name-map node-name-map ] <src-addr> <dest-addr>\n",
 			basename);
 	fprintf(stderr, "\n\tUnicast examples:\n");
 	fprintf(stderr, "\t\t%s 4 16\t\t\t# show path between lids 4 and 16\n", basename);
@@ -726,7 +726,7 @@ main(int argc, char **argv)
 		{ "Version", 0, 0, 'V'},
 		{ "help", 0, 0, 'h'},
 		{ "usage", 0, 0, 'u'},
-		{ "switch-map", 1, 0, 1},
+		{ "node-name-map", 1, 0, 1},
 		{ }
 	};
 
@@ -740,7 +740,7 @@ main(int argc, char **argv)
 			break;
 		switch(ch) {
 		case 1:
-			switch_map = strdup(optarg);
+			node_name_map = strdup(optarg);
 			break;
 		case 'C':
 			ca = optarg;
@@ -798,7 +798,7 @@ main(int argc, char **argv)
 		usage();
 
 	madrpc_init(ca, ca_port, mgmt_classes, 3);
-	switch_map_fp = open_switch_map(switch_map);
+	node_name_map_fp = open_node_name_map(node_name_map);
 
 	if (ib_resolve_portid_str(&src_portid, argv[0], dest_type, sm_id) < 0)
 		IBERROR("can't resolve source port %s", argv[0]);
@@ -837,6 +837,6 @@ main(int argc, char **argv)
 	/* dump multicast path */
 	dump_mcpath(endnode, dumplevel);
 
-	close_switch_map(switch_map_fp);
+	close_node_name_map(node_name_map_fp);
 	exit(0);
 }
diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index dfcc61a..7dcd5fb 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -59,8 +59,8 @@
 
 char *argv0 = "saquery";
 
-static char *switch_map = NULL;
-static FILE *switch_map_fp = NULL;
+static char *node_name_map = NULL;
+static FILE *node_name_map_fp = NULL;
 
 /**
  * Declare some globals because I don't want this to be too complex.
@@ -136,7 +136,7 @@ print_node_record(ib_node_record_t *node_record)
 		return;
 	case NAME_OF_LID:
 	case NAME_OF_GUID:
-		name = lookup_switch_name(switch_map_fp,
+		name = remap_node_name(node_name_map_fp,
 					  cl_ntoh64(p_ni->node_guid),
 					  (char *)p_nd->description);
 		printf("%s\n", name);
@@ -1076,7 +1076,7 @@ usage(void)
 	fprintf(stderr, "   -t | --timeout <msec> specify the SA query "
 				"response timeout (default %u msec)\n",
 			DEFAULT_SA_TIMEOUT_MS);
-	fprintf(stderr, "   --switch-map <switch-map> specify a switch map\n");
+	fprintf(stderr, "   --node-name-map <node-name-map> specify a node name map\n");
 	exit(-1);
 }
 
@@ -1115,7 +1115,7 @@ main(int argc, char **argv)
 	   {"list", 0, 0, 'D'},
 	   {"src-to-dst", 1, 0, 1},
 	   {"timeout", 1, 0, 't'},
-	   {"switch-map", 1, 0, 2},
+	   {"node-name-map", 1, 0, 2},
 	   { }
 	};
 
@@ -1142,7 +1142,7 @@ main(int argc, char **argv)
 			break;
 		}
 		case 2:
-			switch_map = strdup(optarg);
+			node_name_map = strdup(optarg);
 			break;
 		case 'p':
 			query_type = IB_MAD_ATTR_PATH_RECORD;
@@ -1247,7 +1247,7 @@ main(int argc, char **argv)
 	}
 
 	bind_handle = get_bind_handle();
-	switch_map_fp = open_switch_map(switch_map);
+	node_name_map_fp = open_node_name_map(node_name_map);
 
 	switch (query_type) {
 	case IB_MAD_ATTR_NODE_RECORD:
@@ -1293,6 +1293,6 @@ main(int argc, char **argv)
 	if (dst)
 		free(dst);
 	clean_up();
-	close_switch_map(switch_map_fp);
+	close_node_name_map(node_name_map_fp);
 	return (status);
 }
diff --git a/infiniband-diags/src/smpquery.c b/infiniband-diags/src/smpquery.c
index 7d09e35..60212f5 100644
--- a/infiniband-diags/src/smpquery.c
+++ b/infiniband-diags/src/smpquery.c
@@ -84,8 +84,8 @@ static const match_rec_t match_tbl[] = {
 };
 
 char *argv0 = "smpquery";
-static char *switch_map = NULL;
-static FILE *switch_map_fp = NULL;
+static char *node_name_map = NULL;
+static FILE *node_name_map_fp = NULL;
 
 /*******************************************/
 static char *
@@ -107,7 +107,7 @@ node_desc(ib_portid_t *dest, char **argv, int argc)
 	if (!smp_query(nd, dest, IB_ATTR_NODE_DESC, 0, 0))
 		return "node desc query failed";
 
-	nodename = lookup_switch_name(switch_map_fp, node_guid, nd);
+	nodename = remap_node_name(node_name_map_fp, node_guid, nd);
 
 	l = strlen(nodename);
 	if (l < 32) {
@@ -401,7 +401,7 @@ usage(void)
 		basename++;
 
 	fprintf(stderr, "Usage: %s [-d(ebug) -e(rr_show) -v(erbose) -D(irect) -G(uid) -s smlid -V(ersion) -C ca_name -P ca_port "
-			"-t(imeout) timeout_ms --switch-map switch-map] <op> <dest dr_path|lid|guid> [op params]\n",
+			"-t(imeout) timeout_ms --node-name-map node-name-map] <op> <dest dr_path|lid|guid> [op params]\n",
 			basename);
 	fprintf(stderr, "\tsupported ops:\n");
 	for (r = match_tbl ; r->name ; r++) {
@@ -441,7 +441,7 @@ main(int argc, char **argv)
 		{ "Guid", 0, 0, 'G'},
 		{ "smlid", 1, 0, 's'},
 		{ "timeout", 1, 0, 't'},
-		{ "switch-map", 1, 0, 1},
+		{ "node-name-map", 1, 0, 1},
 		{ "Version", 0, 0, 'V'},
 		{ "help", 0, 0, 'h'},
 		{ "usage", 0, 0, 'u'},
@@ -456,7 +456,7 @@ main(int argc, char **argv)
 			break;
 		switch(ch) {
 		case 1:
-			switch_map = strdup(optarg);
+			node_name_map = strdup(optarg);
 			break;
 		case 'd':
 			ibdebug++;
@@ -512,7 +512,7 @@ main(int argc, char **argv)
 		IBERROR("operation '%s' not supported", argv[0]);
 
 	madrpc_init(ca, ca_port, mgmt_classes, 3);
-	switch_map_fp = open_switch_map(switch_map);
+	node_name_map_fp = open_node_name_map(node_name_map);
 
 	if (dest_type != IB_DEST_DRSLID) {
 		if (ib_resolve_portid_str(&portid, argv[1], dest_type, sm_id) < 0)
@@ -529,6 +529,6 @@ main(int argc, char **argv)
 		if ((err = fn(&portid, argv+3, argc-3)))
 			IBERROR("operation %s: %s", argv[0], err);
 	}
-	close_switch_map(switch_map_fp);
+	close_node_name_map(node_name_map_fp);
 	exit(0);
 }
-- 
1.5.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Change-switch-map-function-names-to-reflect-the-new.patch
Type: application/octet-stream
Size: 22688 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20071101/e9ce11e6/attachment.obj>


More information about the general mailing list