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

Hal Rosenstock hrosenstock at xsigo.com
Fri Mar 7 04:31:31 PST 2008


On Thu, 2008-03-06 at 18:30 -0800, Ira Weiny wrote:
> On Thu, 06 Mar 2008 16:24:55 -0800
> Hal Rosenstock <hrosenstock at xsigo.com> wrote:
> 
> > On Thu, 2008-03-06 at 14:20 -0800, Ira Weiny wrote:
> > > On Thu, 6 Mar 2008 20:29:08 +0000
> > > Sasha Khapyorsky <sashak at voltaire.com> wrote:
> > > 
> > > > On 08:58 Thu 06 Mar     , Hal Rosenstock wrote:
> > > > > 
> > > > > > +typedef uint8_t mad_gid_t[16];
> > > > > 
> > > > > Should this be ib_mad_gid_t ?
> > > > 
> > > > Or maybe ibmad_gid_t - to match library name exactly?
> > > 
> > > I think when we change every thing from ib_* to ibmad_* we should also change
> > > the name of the include file from mad.h to ibmad.h.  But I think that is a
> > > bigger change for another day.
> > > 
> > > Here is a new version of the patch using ibmad_gid_t.  Furthermore users of the
> > > new header can define USE_DEPRICATED_IB_GID_T to get the old definition.  For
> > > example:
> > > 
> > >    #define USE_DEPRICATED_IB_GID_T
> >                  ^^^^^^^^^^
> > typo             DEPRECATED
> 
> Oops, fixed.
> 
> > 
> > Anyhow, I meant by using gcc's deprecated attribute.
> > 
> 
> Ok, I added that as well, but that only reports a compile error when someone
> uses it.  Without the USE_DEPRECATED_IB_GID_T macro "ib_gid_t" still conflicts
> with ib_types.h. 

That's what I thought but wasn't sure :-( So we missed the window to
deprecate now since we ideally would be removing this now...

> I really want to fix that problem.  What I like about the
> macro is if someone has a lot of uses in their code this gives them an easy way
> to compile against the new version.

> Make sense?

I understand what you are trying to accomplish but am not sure wjat the
best way to move forward now. This may be the best alternative. I don't
have any others to offer.

-- Hal

> Ira
> 
> 
> From 44aae47f104441d921f10ded20800e796d0657d2 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 ibmad_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 |   11 +++++++----
>  libibmad/src/resolve.c            |    2 +-
>  libibmad/src/sa.c                 |    2 +-
>  4 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/infiniband-diags/src/ibaddr.c b/infiniband-diags/src/ibaddr.c
> index f71edf8..6c56a3e 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;
> +	ibmad_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..4f19a31 100644
> --- a/libibmad/include/infiniband/mad.h
> +++ b/libibmad/include/infiniband/mad.h
> @@ -156,7 +156,10 @@ 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 ibmad_gid_t[16];
> +#ifdef USE_DEPRECATED_IB_GID_T
> +typedef ibmad_gid_t ib_gid_t __attribute__((deprecated));
> +#endif
>  
>  typedef struct {
>  	int cnt;
> @@ -189,7 +192,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;
> +	ibmad_gid_t gid;
>  	uint32_t qp;
>  	uint32_t qkey;
>  	uint8_t sl;
> @@ -777,7 +780,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(ibmad_gid_t srcgid, ibmad_gid_t destgid, ib_portid_t *sm_id,
>  		      void *buf);	/* returns lid */
>  
>  inline static uint8_t *
> @@ -799,7 +802,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, ibmad_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..b063867 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, ibmad_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..59ef7de 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(ibmad_gid_t srcgid, ibmad_gid_t destgid, ib_portid_t *sm_id, void *buf)
>  {
>  	int npath;
>  	ib_sa_call_t sa = {0};



More information about the general mailing list