[ofa-general] ***SPAM*** [PATCHv2 1/2] opensm: Add common ib_gid_is_notzero routine

Hal Rosenstock hnrose at comcast.net
Thu Mar 12 13:19:18 PDT 2009


Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com> 
---
Changes since v1:
Moved ib_gid_is_notzero from ib_types.h to osm_helper.h

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
+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;
+}
+
+/*
+* PARAMETERS
+*	p_gid
+*		[in] Pointer to the GID object.
+*
+* RETURN VALUES
+*	Returns TRUE if GID is not zero.
+*	FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_gid_t
+*********/
+
 /****f* OpenSM: Helper/osm_dump_port_info
 * NAME
 *	osm_dump_port_info
diff --git a/opensm/opensm/libopensm.map b/opensm/opensm/libopensm.map
index 7cd2aba..9cfa886 100644
--- a/opensm/opensm/libopensm.map
+++ b/opensm/opensm/libopensm.map
@@ -18,6 +18,7 @@ OPENSM_1.5 {
 		ib_get_sm_attr_str;
 		ib_get_sa_attr_str;
 		ib_get_trap_str;
+		ib_zero_gid;
 		osm_dump_port_info;
 		osm_dump_portinfo_record;
 		osm_dump_guidinfo_record;
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 = {};
+
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t



More information about the general mailing list