FW: [ofa-general] porting IB management code to Windows
Sean Hefty
sean.hefty at intel.com
Thu Dec 11 12:53:16 PST 2008
Sorry about this, but resending to include the WinOF mailing list...
We've started porting the IB management code (IB-diags at this point) to
Windows. My strong preference is to avoid branching the code and instead keep a
single source code tree. Is there any objection to accepting changes against
the management tree to allow the code to run on both Linux and Windows? (We can
figure out the logistics of build related files later. I'm most concerned about
the code itself.)
The patch below gives an example of the changes needed to make this happen.
Most are a result of compiler differences.
- Sean
--- infiniband-diags-1.4.2\src\sminfo.c 2008-10-19 11:34:42.000000000 -0700
+++ scm\winof\branches\winverbs\tools\infiniband_diags\src\sminfo.c
2008-12-10 15:06:01.096000000 -0800
@@ -37,12 +37,19 @@
#include <stdio.h>
#include <stdlib.h>
+
+#if defined(_WIN32) || defined(_WIN64)
+#include <windows.h>
+#include <winsock2.h>
+#include "..\..\..\..\etc\user\getopt.c"
+#include "..\ibdiag_common.c"
+#else
#include <unistd.h>
#include <stdarg.h>
#include <inttypes.h>
#include <getopt.h>
+#endif
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
@@ -72,13 +79,13 @@ 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) (((uint)(s)) < SMINFO_STATE_LAST ? statestr[s] : "???")
+#define STATESTR(s) (((unsigned int)(s)) < SMINFO_STATE_LAST ? statestr[s] :
"???")
int
main(int argc, char **argv)
@@ -88,7 +95,7 @@ main(int argc, char **argv)
ib_portid_t portid = {0};
int timeout = 0; /* use default */
uint8_t *p;
- uint act = 0;
+ unsigned int act = 0;
int prio = 0, state = SMINFO_STANDBY;
uint64_t guid = 0, key = 0;
extern int ibdebug;
@@ -97,8 +104,8 @@ main(int argc, char **argv)
char *ca = 0;
int ca_port = 0;
- static char const str_opts[] = "C:P:t:s:p:a:deDGVhu";
- static const struct option long_opts[] = {
+ static char str_opts[] = "C:P:t:s:p:a:deDGVhu";
+ static struct option long_opts[] = {
{ "C", 1, 0, 'C'},
{ "P", 1, 0, 'P'},
{ "debug", 0, 0, 'd'},
@@ -112,7 +119,7 @@ main(int argc, char **argv)
{ "timeout", 1, 0, 't'},
{ "help", 0, 0, 'h'},
{ "usage", 0, 0, 'u'},
- { }
+ { 0 }
};
argv0 = argv[0];
@@ -188,7 +195,7 @@ main(int argc, char **argv)
if (mod) {
if (!(p = smp_set(sminfo, &portid, IB_ATTR_SMINFO, mod,
timeout)))
- IBERROR("query");
+ IBERROR("set");
} else
if (!(p = smp_query(sminfo, &portid, IB_ATTR_SMINFO, 0,
timeout)))
IBERROR("query");
_______________________________________________
general mailing list
general at lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
More information about the general
mailing list