[ofa-general] Re: [PATCHv2 1/2] opensm: Add common ib_gid_is_notzero routine
Sasha Khapyorsky
sashak at voltaire.com
Tue Mar 17 12:08:17 PDT 2009
On 15:19 Thu 12 Mar , Hal Rosenstock wrote:
>
> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
Applied (with changes described below). Thanks.
> diff --git a/opensm/include/opensm/osm_helper.h b/opensm/include/opensm/osm_helper.h
> index 9222853..cbb6408 100644
> --- a/opensm/include/opensm/osm_helper.h
> +++ b/opensm/include/opensm/osm_helper.h
> @@ -2,6 +2,7 @@
> * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
> * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
> * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
> + * Copyright (c) 2009 HNR Consulting. All rights reserved.
> *
> * This software is available to you under a choice of one of two
> * licenses. You may choose to be licensed under the terms of the GNU
> @@ -168,6 +169,40 @@ const char *ib_get_trap_str(uint16_t trap_num);
> *
> *********/
>
> +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
OSM_EXPORT and OSM_API were never used in osm_helper.h, I removed it.
> +ib_gid_is_notzero(IN const ib_gid_t * const p_gid)
Second 'const' means that this function cannot change p_gid pointer value.
It is almost useless in C where parameters are passed by value anyway.
> +{
> + if (memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid)))
> + return TRUE;
> + return FALSE;
Did this as 'return !memcmp(....)' to simplify the flow.
Sasha
More information about the general
mailing list