[ofw] [PATCH] don't include initguid in interface headers

Fab Tillier ftillier at microsoft.com
Tue Jan 11 16:20:45 PST 2011


Including initguid in an interface header can have undesirable side effects.  The WDK docs provide guidance for how to define/export GUIDs in drivers: http://msdn.microsoft.com/en-us/library/ff542998(VS.85).aspx

This patch updates the RDMA_INTERFACE_VERBS and INFINIBAND_INTERFACE_CM definitions to follow the recommendations.  It also removes the include of the AL interface from the CM interface definition, as there is no dependency between them.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

Index: core/winverbs/kernel/wv_driver.c
===================================================================
--- core/winverbs/kernel/wv_driver.c	(revision 3068)
+++ core/winverbs/kernel/wv_driver.c	(working copy)
@@ -31,10 +31,8 @@
 #include <wdf.h>
 #include <wdmsec.h>
 #include <ntstatus.h>
-#include <initguid.h>
 
 #include "index_list.c"
-#include <rdma/verbs.h>
 #include "wv_driver.h"
 #include "wv_ioctl.h"
 #include "wv_provider.h"
@@ -45,6 +43,10 @@
 #include "wv_srq.h"
 #include "wv_qp.h"
 #include "wv_ep.h"
+
+#include <initguid.h>
+#include <rdma/verbs.h>
+#include <iba\ib_cm_ifc.h>
 
 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WV_RDMA_DEVICE, WvRdmaDeviceGetContext)
 
Index: core/bus/kernel/bus_pnp.c
===================================================================
--- core/bus/kernel/bus_pnp.c	(revision 3068)
+++ core/bus/kernel/bus_pnp.c	(working copy)
@@ -44,12 +44,15 @@
 #include "bus_port_mgr.h"
 #include "bus_iou_mgr.h"
 #include "complib/cl_memory.h"
-#include <initguid.h>
-#include "iba/ib_ci_ifc.h"
-#include "iba/ib_cm_ifc.h"
 #include "al_cm_cep.h"
 #include "al_mgr.h"
 #include "bus_ev_log.h"
+
+#include <initguid.h>
+#include "rdma/verbs.h"
+#include "iba/ib_al_ifc.h"
+#include "iba/ib_ci_ifc.h"
+#include "iba/ib_cm_ifc.h"
 
 
 /* Interface names are generated by IoRegisterDeviceInterface. */
Index: inc/kernel/rdma/verbs.h
===================================================================
--- inc/kernel/rdma/verbs.h	(revision 3068)
+++ inc/kernel/rdma/verbs.h	(working copy)
@@ -27,12 +27,9 @@
  * SOFTWARE.
  */
 
-#pragma once
-
 #ifndef _VERBS_H_
 #define _VERBS_H_
 
-#include <initguid.h>
 #include <iba/ib_ci.h>
 
 static inline USHORT VerbsVersion(UINT8 Major, UINT8 Minor)
@@ -50,9 +47,6 @@ static inline UINT8 VerbsVersionMinor(US
 	return (UINT8) Version;
 }
 
-DEFINE_GUID(GUID_RDMA_INTERFACE_VERBS, 0xf0ebae86, 0xedb5, 0x4b40,
-			0xa1, 0xa, 0x44, 0xd5, 0xdb, 0x3b, 0x96, 0x4e);
-
 typedef struct _RDMA_INTERFACE_VERBS
 {
 	INTERFACE		InterfaceHeader;
@@ -61,3 +55,6 @@ typedef struct _RDMA_INTERFACE_VERBS
 }	RDMA_INTERFACE_VERBS;
 
 #endif // _VERBS_H_
+
+DEFINE_GUID(GUID_RDMA_INTERFACE_VERBS, 0xf0ebae86, 0xedb5, 0x4b40,
+			0xa1, 0xa, 0x44, 0xd5, 0xdb, 0x3b, 0x96, 0x4e);
Index: inc/kernel/iba/ib_cm_ifc.h
===================================================================
--- inc/kernel/iba/ib_cm_ifc.h	(revision 3068)
+++ inc/kernel/iba/ib_cm_ifc.h	(working copy)
@@ -30,8 +30,6 @@
 #ifndef _ib_cm_ifc_h_
 #define _ib_cm_ifc_h_
 
-#include <initguid.h>
-#include <iba/ib_al_ifc.h>
 #include <iba/ib_types.h>
 #include <iba/ib_al.h>
 
@@ -304,10 +302,6 @@ static inline UINT8 IbaCmVersionMinor(US
 	return (UINT8) Version;
 }
 
-// {6A11D060-8957-49e6-BE2A-01EDF1BD22B3}
-DEFINE_GUID(GUID_INFINIBAND_INTERFACE_CM, 0x6a11d060, 0x8957, 0x49e6,
-			0xbe, 0x2a, 0x1, 0xed, 0xf1, 0xbd, 0x22, 0xb3);
-
 typedef struct _INFINIBAND_INTERFACE_CM
 {
 	INTERFACE			InterfaceHeader;
@@ -315,4 +309,9 @@ typedef struct _INFINIBAND_INTERFACE_CM
 
 }	INFINIBAND_INTERFACE_CM;
 
-#endif // _ib_cm_ifc_h_
\ No newline at end of file
+#endif // _ib_cm_ifc_h_
+
+
+// {6A11D060-8957-49e6-BE2A-01EDF1BD22B3}
+DEFINE_GUID(GUID_INFINIBAND_INTERFACE_CM, 0x6a11d060, 0x8957, 0x49e6,
+			0xbe, 0x2a, 0x1, 0xed, 0xf1, 0xbd, 0x22, 0xb3);
Index: hw/mthca/kernel/hca_pnp.c
===================================================================
--- hw/mthca/kernel/hca_pnp.c	(revision 3068)
+++ hw/mthca/kernel/hca_pnp.c	(working copy)
@@ -12,7 +12,6 @@
 
 #include "hca_driver.h"
 #include "mthca_dev.h"
-#include <rdma\verbs.h>
 
 #if defined(EVENT_TRACING)
 #ifdef offsetof
@@ -22,6 +21,7 @@
 #endif
 #include "mthca.h"
 #include <initguid.h>
+#include <rdma\verbs.h>
 #include <wdmguid.h>
 
 extern const char *mthca_version;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifc_guid.patch
Type: application/octet-stream
Size: 3897 bytes
Desc: ifc_guid.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20110112/5a068584/attachment.obj>


More information about the ofw mailing list