[ofa-general] [PATCH 1/8] [ib-diag] sminfo: add support for WinOF

Sean Hefty sean.hefty at intel.com
Tue Feb 17 14:30:54 PST 2009


Allow sminfo to build and run on both Linux and Windows.  Window
build files are maintained in the WinOF respository.  These changes
allow dropping the infiniband-diags into the WinOF build environment.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Note: all patches are also available at:

git://git.openfabrics.org/~shefty/ib-mgmt.git master

 infiniband-diags/src/ibdiag_common.c |   10 ++++------
 infiniband-diags/src/sminfo.c        |   10 +++++-----
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/infiniband-diags/src/ibdiag_common.c b/infiniband-diags/src/ibdiag_common.c
index bda1efa..5f2472d 100644
--- a/infiniband-diags/src/ibdiag_common.c
+++ b/infiniband-diags/src/ibdiag_common.c
@@ -204,7 +204,7 @@ static const struct ibdiag_opt common_opts[] = {
 	{ "usage", 'u', 0, NULL, "usage message" },
 	{ "help", 'h', 0, NULL, "help message" },
 	{ "version", 'V', 0, NULL, "show version" },
-	{}
+	{ 0 }
 };
 
 static void make_opt(struct option *l, const struct ibdiag_opt *o,
@@ -254,11 +254,11 @@ static struct option *make_long_opts(const char *exclude_str,
 
 static void make_str_opts(const struct option *o, char *p, unsigned size)
 {
-	int i, n = 0;
+	unsigned i, n = 0;
 
 	for (n = 0; o->name  && n + 2 + o->has_arg < size; o++) {
-		p[n++] = o->val;
-		for (i = 0; i < o->has_arg; i++)
+		p[n++] = (char) o->val;
+		for (i = 0; i < (unsigned) o->has_arg; i++)
 			p[n++] = ':';
 	}
 	p[n] = '\0';
@@ -273,8 +273,6 @@ int ibdiag_process_opts(int argc, char * const argv[], void *cxt,
 	char str_opts[1024];
 	const struct ibdiag_opt *o;
 
-	memset(opts_map, 0, sizeof(opts_map));
-
 	prog_name = argv[0];
 	prog_args = usage_args;
 	prog_examples = usage_examples;
diff --git a/infiniband-diags/src/sminfo.c b/infiniband-diags/src/sminfo.c
index e96c782..549cb81 100644
--- a/infiniband-diags/src/sminfo.c
+++ b/infiniband-diags/src/sminfo.c
@@ -59,10 +59,10 @@ enum {
 };
 
 char *statestr[] = {
-	[SMINFO_NOTACT] "SMINFO_NOTACT",
-	[SMINFO_DISCOVER] "SMINFO_DISCOVER",
-	[SMINFO_STANDBY] "SMINFO_STANDBY",
-	[SMINFO_MASTER] "SMINFO_MASTER",
+	"SMINFO_NOTACT",
+	"SMINFO_DISCOVER",
+	"SMINFO_STANDBY",
+	"SMINFO_MASTER",
 };
 
 #define STATESTR(s)	(((unsigned)(s)) < SMINFO_STATE_LAST ? statestr[s] : "???")
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
 		{ "state", 's', 1, "<0-3>", "set SM state"},
 		{ "priority", 'p', 1, "<0-15>", "set SM priority"},
 		{ "activity", 'a', 1, NULL, "set activity count"},
-		{ }
+		{ 0 }
 	};
 	char usage_args[] = "<sm_lid|sm_dr_path> [modifier]";
 






More information about the general mailing list