[ofa-general] [PATCH] Clean up printing of switch heading when printing "down links" only.
Ira Weiny
weiny2 at llnl.gov
Wed May 6 09:53:03 PDT 2009
Another corner case: If there are no down links on a switch and "-d" is selected then the header for that switch should not be printed.
Ira
From: Ira Weiny <weiny2 at llnl.gov>
Date: Thu, 30 Apr 2009 13:41:38 -0700
Subject: [PATCH] Clean up printing of switch heading when printing "down links" only.
Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
infiniband-diags/src/iblinkinfo.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c
index 2454bf2..cf38ecb 100644
--- a/infiniband-diags/src/iblinkinfo.c
+++ b/infiniband-diags/src/iblinkinfo.c
@@ -205,13 +205,8 @@ void
print_switch(ibnd_node_t *node, void *user_data)
{
int i = 0;
-
- if (!line_mode) {
- char *remap = remap_node_name(node_name_map, node->guid,
- node->nodedesc);
- printf("Switch 0x%016"PRIx64" %s:\n", node->guid, remap);
- free(remap);
- }
+ int head_print = 0;
+ char *remap = remap_node_name(node_name_map, node->guid, node->nodedesc);
for (i = 1; i <= node->numports; i++) {
ibnd_port_t *port = node->ports[i];
@@ -219,9 +214,14 @@ print_switch(ibnd_node_t *node, void *user_data)
continue;
if (!down_links_only ||
mad_get_field(port->info, 0, IB_PORT_STATE_F) == IB_LINK_DOWN) {
+ if (!head_print && !line_mode) {
+ printf("Switch 0x%016"PRIx64" %s:\n", node->guid, remap);
+ head_print = 1;
+ }
print_port(node, port);
}
}
+ free(remap);
}
void
--
1.5.4.5
More information about the general
mailing list