[ofa-general] [RFC PATCH] Rename ib_gid_t in mad.h to mad_gid_t to prevent name collision with ib_types.h

Ira Weiny weiny2 at llnl.gov
Wed Mar 5 17:46:34 PST 2008


Whilst writing some test code, I came across this issue again.

   '[openib-general] Conflicting typedefs for "ib_gid_t"'
   http://lists.openfabrics.org/pipermail/general/2006-August/024903.html

One fix which suggested was to change the ib_gid_t to mad_gid_t.

   http://lists.openfabrics.org/pipermail/general/2006-August/024928.html

I think that is a pretty good choice.  I know there are many ways to fix this
but this seems to be the least invasive.  (I was actually surprised by how
little the code needed to change.)  Of course I don't know if other software
relies on the libibmad interface; so if your package uses mad.h, please
comment.  And finally I have just be running this afternoon with the fix.  So
there has been limited testing.

Thanks,
Ira


>From df270f4b955c16f25c65a89be074c78fd2f3521d Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Wed, 5 Mar 2008 17:25:33 -0800
Subject: [PATCH] Rename ib_gid_t in mad.h to mad_gid_t to prevent name collision with ib_types.h


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/src/ibaddr.c     |    2 +-
 libibmad/include/infiniband/mad.h |    8 ++++----
 libibmad/src/resolve.c            |    2 +-
 libibmad/src/sa.c                 |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/infiniband-diags/src/ibaddr.c b/infiniband-diags/src/ibaddr.c
index f71edf8..2ac6a4f 100644
--- a/infiniband-diags/src/ibaddr.c
+++ b/infiniband-diags/src/ibaddr.c
@@ -56,7 +56,7 @@ ib_resolve_addr(ib_portid_t *portid, int portnum, int show_lid, int show_gid)
 	uint8_t nodeinfo[64];
 	uint64_t guid, prefix;
 	char buf1[64], buf2[64];
-	ib_gid_t gid;
+	mad_gid_t gid;
 	int lmc;
 
 	if (!smp_query(nodeinfo, portid, IB_ATTR_NODE_INFO, 0, 0))
diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index 15b8246..adce3e8 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -156,7 +156,7 @@ enum GSI_ATTR_ID {
 #define IB_VENDOR_OPENIB_SYSSTAT_CLASS	(IB_VENDOR_RANGE2_START_CLASS + 3)
 #define IB_OPENIB_OUI			(0x001405)
 
-typedef uint8_t ib_gid_t[16];
+typedef uint8_t mad_gid_t[16];
 
 typedef struct {
 	int cnt;
@@ -189,7 +189,7 @@ typedef struct portid {
 	int lid;		/* lid or 0 if directed route */
 	ib_dr_path_t drpath;
 	int grh_present;	/* flag */
-	ib_gid_t gid;
+	mad_gid_t gid;
 	uint32_t qp;
 	uint32_t qkey;
 	uint8_t sl;
@@ -777,7 +777,7 @@ uint8_t * sa_call(void *rcvbuf, ib_portid_t *portid, ib_sa_call_t *sa,
 		  unsigned timeout);
 uint8_t * sa_rpc_call(void *ibmad_port, void *rcvbuf, ib_portid_t *portid,
 		      ib_sa_call_t *sa, unsigned timeout);
-int	ib_path_query(ib_gid_t srcgid, ib_gid_t destgid, ib_portid_t *sm_id,
+int	ib_path_query(mad_gid_t srcgid, mad_gid_t destgid, ib_portid_t *sm_id,
 		      void *buf);	/* returns lid */
 
 inline static uint8_t *
@@ -799,7 +799,7 @@ int	ib_resolve_guid(ib_portid_t *portid, uint64_t *guid,
 			ib_portid_t *sm_id, int timeout);
 int	ib_resolve_portid_str(ib_portid_t *portid, char *addr_str,
 			      int dest_type, ib_portid_t *sm_id);
-int	ib_resolve_self(ib_portid_t *portid, int *portnum, ib_gid_t *gid);
+int	ib_resolve_self(ib_portid_t *portid, int *portnum, mad_gid_t *gid);
 
 /* gs.c */
 uint8_t *perf_classportinfo_query(void *rcvbuf, ib_portid_t *dest, int port,
diff --git a/libibmad/src/resolve.c b/libibmad/src/resolve.c
index d8365b2..7d8eb6e 100644
--- a/libibmad/src/resolve.c
+++ b/libibmad/src/resolve.c
@@ -138,7 +138,7 @@ ib_resolve_portid_str(ib_portid_t *portid, char *addr_str, int dest_type, ib_por
 }
 
 int
-ib_resolve_self(ib_portid_t *portid, int *portnum, ib_gid_t *gid)
+ib_resolve_self(ib_portid_t *portid, int *portnum, mad_gid_t *gid)
 {
 	ib_portid_t self = {0};
 	uint8_t portinfo[64];
diff --git a/libibmad/src/sa.c b/libibmad/src/sa.c
index ddbfce3..fde10bd 100644
--- a/libibmad/src/sa.c
+++ b/libibmad/src/sa.c
@@ -112,7 +112,7 @@ sa_rpc_call(void *ibmad_port, void *rcvbuf, ib_portid_t *portid,
 			IB_PR_COMPMASK_NUMBPATH)
 
 int
-ib_path_query(ib_gid_t srcgid, ib_gid_t destgid, ib_portid_t *sm_id, void *buf)
+ib_path_query(mad_gid_t srcgid, mad_gid_t destgid, ib_portid_t *sm_id, void *buf)
 {
 	int npath;
 	ib_sa_call_t sa = {0};
-- 
1.5.1



More information about the general mailing list