[ofa-general] [PATCH] opensm: add osm_version field to osm_opensm_t object

Sasha Khapyorsky sashak at voltaire.com
Wed Jun 25 15:21:35 PDT 2008


This adds osm_version field to osm_opensm_t object. The value is
generated in OSM_VERSION macro in osm_version.h file.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_opensm.h |    4 ++++
 opensm/opensm/osm_console.c        |    5 ++---
 opensm/opensm/osm_opensm.c         |    5 +++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/opensm/include/opensm/osm_opensm.h b/opensm/include/opensm/osm_opensm.h
index 285fd88..a1c255b 100644
--- a/opensm/include/opensm/osm_opensm.h
+++ b/opensm/include/opensm/osm_opensm.h
@@ -163,6 +163,7 @@ struct osm_routing_engine {
 * SYNOPSIS
 */
 typedef struct osm_opensm {
+	const char *osm_version;
 	osm_subn_t subn;
 	osm_sm_t sm;
 	osm_sa_t sa;
@@ -185,6 +186,9 @@ typedef struct osm_opensm {
 } osm_opensm_t;
 /*
 * FIELDS
+* 	osm_version
+* 		OpenSM version (as generated in osm_version.h)
+*
 *	subn
 *		Subnet object for this subnet.
 *
diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index 7f0b00f..39fb17a 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -50,7 +50,6 @@
 #include <ctype.h>
 #include <sys/time.h>
 #include <opensm/osm_console.h>
-#include <opensm/osm_version.h>
 #include <complib/cl_passivelock.h>
 #include <opensm/osm_perfmgr.h>
 #include <opensm/osm_fwd_tbl.h>
@@ -312,7 +311,7 @@ static void print_status(osm_opensm_t * p_osm, FILE * out)
 {
 	if (out) {
 		cl_plock_acquire(&p_osm->lock);
-		fprintf(out, "   OpenSM Version: %s\n", OSM_VERSION);
+		fprintf(out, "   OpenSM Version: %s\n", p_osm->osm_version);
 		fprintf(out, "   SM State      : %s\n",
 			sm_state_str(p_osm->subn.sm_state));
 		fprintf(out, "   SA State      : %s\n",
@@ -1137,7 +1136,7 @@ static void help_version(FILE * out, int detail)
 
 static void version_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
-	fprintf(out, "%s build %s %s\n", OSM_VERSION, __DATE__, __TIME__);
+	fprintf(out, "%s build %s %s\n", p_osm->osm_version, __DATE__, __TIME__);
 }
 
 /* more parse routines go here */
diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index adacd93..0101b97 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -169,6 +169,7 @@ static int osm_ucast_null_setup(osm_opensm_t * p_osm)
 void osm_opensm_construct(IN osm_opensm_t * const p_osm)
 {
 	memset(p_osm, 0, sizeof(*p_osm));
+	p_osm->osm_version = OSM_VERSION;
 	osm_subn_construct(&p_osm->subn);
 	osm_sm_construct(&p_osm->sm);
 	osm_sa_construct(&p_osm->sa);
@@ -283,9 +284,9 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 	/* If there is a log level defined - add the OSM_VERSION to it */
 	osm_log(&p_osm->log,
 		osm_log_get_level(&p_osm->log) & (OSM_LOG_SYS ^ 0xFF), "%s\n",
-		OSM_VERSION);
+		p_osm->osm_version);
 	/* Write the OSM_VERSION to the SYS_LOG */
-	osm_log(&p_osm->log, OSM_LOG_SYS, "%s\n", OSM_VERSION);	/* Format Waived */
+	osm_log(&p_osm->log, OSM_LOG_SYS, "%s\n", p_osm->osm_version);	/* Format Waived */
 
 	OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "[\n");	/* Format Waived */
 
-- 
1.5.5.1.178.g1f811




More information about the general mailing list