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

Hal Rosenstock hnrose at comcast.net
Tue Mar 10 12:22:34 PDT 2009


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;
+}
+
+/*
+* 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
+*********/
+
 /****s* IBA Base: Types/ib_path_rec_t
 * NAME
 *	ib_path_rec_t
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