[openib-general] [PATCH] opensm: osm_log_init_v2() - new osm_log initializer

Sasha Khapyorsky sashak at voltaire.com
Mon Sep 4 10:20:06 PDT 2006


There is new osm_log initializer osm_log_init_v2(), this is wrapped
by osm_log_init() in order to preserve existing API.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---

 diags/src/saquery.c          |    4 ++--
 osm/complib/cl_event_wheel.c |    2 +-
 osm/include/opensm/osm_log.h |   29 +++++++++++++++++++++++++----
 osm/opensm/libopensm.map     |    1 +
 osm/opensm/osm_db_files.c    |    2 +-
 osm/opensm/osm_log.c         |   13 ++++++++++++-
 osm/opensm/osm_opensm.c      |    6 +++---
 osm/osmtest/osmtest.c        |    4 ++--
 8 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/diags/src/saquery.c b/diags/src/saquery.c
index 0bb46be..5e4b5f1 100644
--- a/diags/src/saquery.c
+++ b/diags/src/saquery.c
@@ -442,8 +442,8 @@ get_bind_handle(void)
 	complib_init();
 
 	osm_log_construct(&log_osm);
-	if ((status = osm_log_init( &log_osm, TRUE,
-				    0x0001, NULL, 0, TRUE )) != IB_SUCCESS) {
+	if ((status = osm_log_init_v2(&log_osm, TRUE, 0x0001, NULL,
+				      0, TRUE)) != IB_SUCCESS) {
 		fprintf(stderr, "Failed to init osm_log: %s\n",
 			ib_get_err_str(status));
 		exit (-1);
diff --git a/osm/complib/cl_event_wheel.c b/osm/complib/cl_event_wheel.c
index a215f40..e1ab141 100644
--- a/osm/complib/cl_event_wheel.c
+++ b/osm/complib/cl_event_wheel.c
@@ -610,7 +610,7 @@ main ()
   cl_event_wheel_construct( &event_wheel );
 
   /* init */
-  osm_log_init( &log, TRUE, 0xff, NULL, 0, FALSE);
+  osm_log_init_v2( &log, TRUE, 0xff, NULL, 0, FALSE);
   cl_event_wheel_init( &event_wheel, &log );
 
   /* Start Playing */
diff --git a/osm/include/opensm/osm_log.h b/osm/include/opensm/osm_log.h
index 5bfaef5..6f536f3 100644
--- a/osm/include/opensm/osm_log.h
+++ b/osm/include/opensm/osm_log.h
@@ -203,18 +203,18 @@ osm_log_destroy(
 *	osm_log_init
 *********/
 
-/****f* OpenSM: Log/osm_log_init
+/****f* OpenSM: Log/osm_log_init_v2
 * NAME
-*	osm_log_init
+*	osm_log_init_v2
 *
 * DESCRIPTION
-*	The osm_log_init function initializes a
+*	The osm_log_init_v2 function initializes a
 *	Log object for use.
 *
 * SYNOPSIS
 */
 ib_api_status_t
-osm_log_init(
+osm_log_init_v2(
   IN osm_log_t* const p_log,
   IN const boolean_t flush,
   IN const uint8_t log_flags,
@@ -249,6 +249,27 @@ osm_log_init(
 *	osm_log_destroy
 *********/
 
+/****f* OpenSM: Log/osm_log_init
+* NAME
+*	osm_log_init
+*
+* DESCRIPTION
+*	The osm_log_init function initializes a
+*	Log object for use. It wrapper for osm_log_init_v2()
+*
+* SYNOPSIS
+*/
+ib_api_status_t
+osm_log_init(
+  IN osm_log_t* const p_log,
+  IN const boolean_t flush,
+  IN const uint8_t log_flags,
+  IN const char *log_file,
+  IN const boolean_t accum_log_file );
+/*
+* All as above (osm_log_init_v2()), but without max_size parameters
+*/
+
 /****f* OpenSM: Log/osm_log_get_level
 * NAME
 *	osm_log_get_level
diff --git a/osm/opensm/libopensm.map b/osm/opensm/libopensm.map
index c60e3d5..3ac0dc4 100644
--- a/osm/opensm/libopensm.map
+++ b/osm/opensm/libopensm.map
@@ -3,6 +3,7 @@ OPENSM_1.2 {
 		osm_log;
 		osm_is_debug;
 		osm_log_init;
+		osm_log_init_v2;
 		osm_mad_pool_construct;
 		osm_mad_pool_destroy;
 		osm_mad_pool_init;
diff --git a/osm/opensm/osm_db_files.c b/osm/opensm/osm_db_files.c
index 6ae968e..d2f39ac 100644
--- a/osm/opensm/osm_db_files.c
+++ b/osm/opensm/osm_db_files.c
@@ -712,7 +712,7 @@ main(int argc, char **argv)
   cl_list_construct( &keys );
   cl_list_init( &keys, 10 );
 
-  osm_log_init( &log, TRUE, 0xff, "/tmp/test_osm_db.log", FALSE);
+  osm_log_init_v2( &log, TRUE, 0xff, "/tmp/test_osm_db.log", 0, FALSE);
 
   osm_db_construct(&db);
   if (osm_db_init(&db, &log))
diff --git a/osm/opensm/osm_log.c b/osm/opensm/osm_log.c
index a5dac10..45acebc 100644
--- a/osm/opensm/osm_log.c
+++ b/osm/opensm/osm_log.c
@@ -225,7 +225,7 @@ #endif /* defined( _DEBUG_ ) */
 }
 
 ib_api_status_t
-osm_log_init(
+osm_log_init_v2(
   IN osm_log_t* const p_log,
   IN const boolean_t flush,
   IN const uint8_t log_flags,
@@ -279,3 +279,14 @@ osm_log_init(
   else
     return IB_ERROR;
 }
+
+ib_api_status_t
+osm_log_init(
+  IN osm_log_t* const p_log,
+  IN const boolean_t flush,
+  IN const uint8_t log_flags,
+  IN const char *log_file,
+  IN const boolean_t accum_log_file )
+{
+  return osm_log_init_v2(p_log, flush, log_flags, log_file, 0, accum_log_file);
+}
diff --git a/osm/opensm/osm_opensm.c b/osm/opensm/osm_opensm.c
index 0b39d13..19d0412 100644
--- a/osm/opensm/osm_opensm.c
+++ b/osm/opensm/osm_opensm.c
@@ -180,9 +180,9 @@ osm_opensm_init(
    /* Can't use log macros here, since we're initializing the log. */
    osm_opensm_construct( p_osm );
 
-   status = osm_log_init( &p_osm->log, p_opt->force_log_flush,
-                          p_opt->log_flags, p_opt->log_file,
-                          p_opt->log_max_size, p_opt->accum_log_file );
+   status = osm_log_init_v2( &p_osm->log, p_opt->force_log_flush,
+                             p_opt->log_flags, p_opt->log_file,
+                             p_opt->log_max_size, p_opt->accum_log_file );
    if( status != IB_SUCCESS )
       return ( status );
 
diff --git a/osm/osmtest/osmtest.c b/osm/osmtest/osmtest.c
index 4f41e38..7b719a7 100644
--- a/osm/osmtest/osmtest.c
+++ b/osm/osmtest/osmtest.c
@@ -520,8 +520,8 @@ osmtest_init( IN osmtest_t * const p_osm
   /* Can't use log macros here, since we're initializing the log. */
   osmtest_construct( p_osmt );
 
-  status = osm_log_init( &p_osmt->log, p_opt->force_log_flush,
-                         0x0001, p_opt->log_file, 0, TRUE );
+  status = osm_log_init_v2( &p_osmt->log, p_opt->force_log_flush,
+                            0x0001, p_opt->log_file, 0, TRUE );
   if( status != IB_SUCCESS )
     return ( status );
 




More information about the general mailing list