[openib-general] [PATCHv2 7/13] osm: port to WinIB stack : opensm/osm_ucast_file.c

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Sun Oct 8 08:42:48 PDT 2006


Hi Hal

This is the re-submission of the patch that was 
originally sibmitted by Eitan - just removing some
cosmetic changes from the patch and re-diffing it 
with the trunk:

1. Avoid varargs macros not supported by Windows
2. Included additional header for PRIx64 macro

Yevgeny

Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>

Index: opensm/osm_ucast_file.c
===================================================================
--- opensm/osm_ucast_file.c	(revision 9738)
+++ opensm/osm_ucast_file.c	(working copy)
@@ -52,18 +52,11 @@
 
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
+#include <complib/cl_debug.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_log.h>
 
-#define PARSEERR(log, file_name, lineno, fmt, arg...) \
-		osm_log(log, OSM_LOG_ERROR, "PARSE ERROR: %s:%u: " fmt , \
-			file_name, lineno, ##arg )
-
-#define PARSEWARN(log, file_name, lineno, fmt, arg...) \
-		osm_log(log, OSM_LOG_VERBOSE, "PARSE WARN: %s:%u: " fmt , \
-			file_name, lineno, ##arg )
-
 static uint16_t remap_lid(osm_opensm_t *p_osm, uint16_t lid, ib_net64_t guid)
 {
 	osm_port_t *p_port;
@@ -183,16 +176,17 @@ static int do_ucast_file_load(void *cont
 		} else if (!strncmp(p, "Unicast lids", 12)) {
 			q = strstr(p, " guid 0x");
 			if (!q) {
-				PARSEERR(&p_osm->log, file_name, lineno,
-					 "cannot parse switch definition\n");
+				osm_log(&p_osm->log, OSM_LOG_ERROR, "PARSE ERROR: %s:%u:" 
+						  " cannot parse switch definition\n", 
+						  file_name, lineno);
 				return -1;
 			}
 			p = q + 6;
 			sw_guid = strtoull(p, &q, 16);
 			if (q && !isspace(*q)) {
-				PARSEERR(&p_osm->log, file_name, lineno,
-					 "cannot parse switch guid: \'%s\'\n",
-					 p);
+				osm_log(&p_osm->log, OSM_LOG_ERROR, "PARSE ERROR: %s:%u:" 
+						  "cannot parse switch guid: \'%s\'\n",
+						  file_name, lineno, p);
 				return -1;
 			}
 			sw_guid = cl_hton64(sw_guid);
@@ -211,8 +205,8 @@ static int do_ucast_file_load(void *cont
 		} else if (p_sw && !strncmp(p, "0x", 2)) {
 			lid = (uint16_t)strtoul(p, &q, 16);
 			if (q && !isspace(*q)) {
-				PARSEERR(&p_osm->log, file_name, lineno,
-					 "cannot parse lid: \'%s\'\n", p);
+				osm_log(&p_osm->log, OSM_LOG_ERROR, "PARSE ERROR: %s:%u:"
+						  "cannot parse lid: \'%s\'\n", file_name, lineno, p);
 				return -1;
 			}
 			p = q;
@@ -220,17 +214,17 @@ static int do_ucast_file_load(void *cont
 				p++;
 			port_num = (uint8_t)strtoul(p, &q, 10);
 			if (q && !isspace(*q)) {
-				PARSEERR(&p_osm->log, file_name, lineno,
-					 "cannot parse port: \'%s\'\n", p);
+				osm_log(&p_osm->log, OSM_LOG_ERROR, "PARSE ERROR: %s:%u:" 
+						  "cannot parse port: \'%s\'\n", file_name, lineno, p);
 				return -1;
 			}
 			p = q;
 			/* additionally try to exract guid */
 			q = strstr(p, " portguid 0x");
 			if (!q) {
-				PARSEWARN(&p_osm->log, file_name, lineno,
-					  "cannot find port guid "
-					  "(maybe broken dump): \'%s\'\n", p);
+				osm_log(&p_osm->log, OSM_LOG_VERBOSE, "PARSE WARNING: %s:%u:" 
+						  "cannot find port guid "
+						  "(maybe broken dump): \'%s\'\n", file_name, lineno, p);
 				port_guid = 0;
 			}
 			else
@@ -238,11 +232,10 @@ static int do_ucast_file_load(void *cont
 				p = q + 10;
 				port_guid = strtoull(p, &q, 16);
 				if (!q && !isspace(*q) && *q != ':') {
-					PARSEWARN(&p_osm->log, file_name,
-						  lineno,
-						  "cannot parse port guid "
-						  "(maybe broken dump): "
-						  "\'%s\'\n", p);
+					osm_log(&p_osm->log, OSM_LOG_VERBOSE, "PARSE WARNING: %s:%u:" 
+							  "cannot parse port guid "
+							  "(maybe broken dump): "
+							  "\'%s\'\n", file_name, lineno, p);
 					port_guid = 0;
 				}
 			}





More information about the general mailing list