[ofa-general] Re: [PATCH 1/2] opensm: Add common ib_gid_is_notzero routine

Sasha Khapyorsky sashak at voltaire.com
Thu Mar 12 11:19:51 PDT 2009


On 14:22 Tue 10 Mar     , Hal Rosenstock wrote:
> 
> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com> 
> ---
> diff --git a/opensm/include/iba/ib_types.h b/opensm/include/iba/ib_types.h
> index e7cbb79..bfe8665 100644
> --- a/opensm/include/iba/ib_types.h
> +++ b/opensm/include/iba/ib_types.h
> @@ -2338,6 +2338,40 @@ ib_gid_get_guid(IN const ib_gid_t * const p_gid)
>  *	ib_gid_t
>  *********/
>  
> +OSM_EXPORT const ib_gid_t ib_zero_gid;
> +
> +/****f* IBA Base: Types/ib_gid_is_notzero
> +* NAME
> +*	ib_gid_is_notzero
> +*
> +* DESCRIPTION
> +*	Returns a boolean indicating whether or not the GID is zero.
> +*
> +* SYNOPSIS
> +*/
> +static inline boolean_t OSM_API
> +ib_gid_is_notzero(IN const ib_gid_t * const p_gid)
> +{
> +	if (memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid)))
> +		return TRUE;
> +	return FALSE;
> +}

[snip...]

> diff --git a/opensm/opensm/osm_helper.c b/opensm/opensm/osm_helper.c
> index c56f5b2..b40ba0c 100644
> --- a/opensm/opensm/osm_helper.c
> +++ b/opensm/opensm/osm_helper.c
> @@ -535,6 +535,8 @@ const char *ib_get_trap_str(ib_net16_t trap_num)
>  	return "Unknown";
>  }
>  
> +const ib_gid_t ib_zero_gid = {};
> +

This introduces dependency against libopensm for ib_types.h users.

I would suggest to put all this stuff to osm_helper.

Sasha



More information about the general mailing list