[openib-general] OpenSM/osm_log API: Use symbol versions rather than polluting namespace

Hal Rosenstock halr at voltaire.com
Wed Sep 6 06:21:25 PDT 2006


OpenSM/osm_log API: Rather than polluting the namespace with needless
symbols, use symbol versions and have a versioned osm_log_init rather
than adding osm_log_init_v2 as an additional API

This patch is intended to be applied to both trunk and 1.1 versions.

Signed-off-by: Doug Ledford <dledford at redhat.com>
Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: osm/opensm/libopensm.map
===================================================================
--- osm/opensm/libopensm.map	(revision 9253)
+++ osm/opensm/libopensm.map	(working copy)
@@ -3,7 +3,6 @@ OPENSM_1.3 {
 		osm_log;
 		osm_is_debug;
 		osm_log_init;
-		osm_log_init_v2;
 		osm_mad_pool_construct;
 		osm_mad_pool_destroy;
 		osm_mad_pool_init;
@@ -55,3 +54,8 @@ OPENSM_1.3 {
 		osm_get_sm_mgr_state_str;
 	local: *;
 };
+
+OPENSM_1.3.1 {
+	global:
+		osm_log_init;
+} OPENSM_1.3;
Index: osm/opensm/libopensm.ver
===================================================================
--- osm/opensm/libopensm.ver	(revision 9158)
+++ osm/opensm/libopensm.ver	(working copy)
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=2:0:1
+LIBVERSION=2:1:1
Index: osm/include/opensm/osm_log.h
===================================================================
--- osm/include/opensm/osm_log.h	(revision 9251)
+++ osm/include/opensm/osm_log.h	(working copy)
@@ -152,13 +152,13 @@ osm_log_construct(
 *	This function does not return a value.
 *
 * NOTES
-*	Allows calling osm_log_init, osm_log_init_v2, osm_log_destroy
+*	Allows calling osm_log_init, osm_log_destroy
 *
 *	Calling osm_log_construct is a prerequisite to calling any other
-*	method except osm_log_init or osm_log_init_v2.
+*	method except osm_log_init.
 *
 * SEE ALSO
-*	Log object, osm_log_init, osm_log_init_v2,
+*	Log object, osm_log_init,
 *	osm_log_destroy
 *********/
 
@@ -196,25 +196,25 @@ osm_log_destroy(
 *	Log object.
 *	Further operations should not be attempted on the destroyed object.
 *	This function should only be called after a call to
-*	osm_log_construct, osm_log_init, or osm_log_init_v2.
+*	osm_log_construct, osm_log_init.
 *
 * SEE ALSO
 *	Log object, osm_log_construct,
-*	osm_log_init, osm_log_init_v2
+*	osm_log_init
 *********/
 
-/****f* OpenSM: Log/osm_log_init_v2
+/****f* OpenSM: Log/osm_log_init
 * NAME
-*	osm_log_init_v2
+*	osm_log_init
 *
 * DESCRIPTION
-*	The osm_log_init_v2 function initializes a
+*	The osm_log_init function initializes a
 *	Log object for use.
 *
 * SYNOPSIS
 */
 ib_api_status_t
-osm_log_init_v2(
+osm_log_init(
   IN osm_log_t* const p_log,
   IN const boolean_t flush,
   IN const uint8_t log_flags,
@@ -249,27 +249,6 @@ osm_log_init_v2(
 *	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 is a 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 );
-/*
- * Same as osm_log_init_v2() but without max_size parameter
- */
-
 /****f* OpenSM: Log/osm_log_get_level
 * NAME
 *	osm_log_get_level
Index: osm/opensm/osm_log.c
===================================================================
--- osm/opensm/osm_log.c	(revision 9257)
+++ osm/opensm/osm_log.c	(working copy)
@@ -225,7 +225,7 @@ osm_is_debug(void)
 }
 
 ib_api_status_t
-osm_log_init_v2(
+osm_log_init_1_3_1(
   IN osm_log_t* const p_log,
   IN const boolean_t flush,
   IN const uint8_t log_flags,
@@ -280,13 +280,18 @@ osm_log_init_v2(
     return IB_ERROR;
 }
 
+__asm__(".symver osm_log_init_1_3_1, osm_log_init@@OPENSM_1.3.1");
+
 ib_api_status_t
-osm_log_init(
+osm_log_init_1_3(
   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 );
+  return osm_log_init_1_3_1( p_log, flush, log_flags, log_file, 0, accum_log_file );
 }
+
+__asm__(".symver osm_log_init_1_3, osm_log_init at OPENSM_1.3");
+
Index: osm/opensm/osm_opensm.c
===================================================================
--- osm/opensm/osm_opensm.c	(revision 9251)
+++ osm/opensm/osm_opensm.c	(working copy)
@@ -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_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 );
+   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 );
    if( status != IB_SUCCESS )
       return ( status );
 
Index: osm/opensm/osm_db_files.c
===================================================================
--- osm/opensm/osm_db_files.c	(revision 9275)
+++ osm/opensm/osm_db_files.c	(working copy)
@@ -712,7 +712,7 @@ main(int argc, char **argv)
   cl_list_construct( &keys );
   cl_list_init( &keys, 10 );
 
-  osm_log_init_v2( &log, TRUE, 0xff, "/var/log/osm_db_test.log", 0, FALSE);
+  osm_log_init( &log, TRUE, 0xff, "/var/log/osm_db_test.log", 0, FALSE );
 
   osm_db_construct(&db);
   if (osm_db_init(&db, &log))
Index: osm/osmtest/osmtest.c
===================================================================
--- osm/osmtest/osmtest.c	(revision 9251)
+++ osm/osmtest/osmtest.c	(working copy)
@@ -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_v2( &p_osmt->log, p_opt->force_log_flush,
-                            0x0001, p_opt->log_file, 0, TRUE );
+  status = osm_log_init( &p_osmt->log, p_opt->force_log_flush,
+                         0x0001, p_opt->log_file, 0, TRUE );
   if( status != IB_SUCCESS )
     return ( status );
 
Index: osm/complib/cl_event_wheel.c
===================================================================
--- osm/complib/cl_event_wheel.c	(revision 9251)
+++ osm/complib/cl_event_wheel.c	(working copy)
@@ -610,7 +610,7 @@ main ()
   cl_event_wheel_construct( &event_wheel );
 
   /* init */
-  osm_log_init_v2( &log, TRUE, 0xff, NULL, 0, FALSE);
+  osm_log_init( &log, TRUE, 0xff, NULL, 0, FALSE );
   cl_event_wheel_init( &event_wheel, &log );
 
   /* Start Playing */
Index: diags/src/saquery.c
===================================================================
--- diags/src/saquery.c	(revision 9251)
+++ diags/src/saquery.c	(working copy)
@@ -442,8 +442,8 @@ get_bind_handle(void)
 	complib_init();
 
 	osm_log_construct(&log_osm);
-	if ((status = osm_log_init_v2(&log_osm, TRUE, 0x0001, NULL,
-				      0, TRUE)) != IB_SUCCESS) {
+	if ((status = osm_log_init(&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);







More information about the general mailing list