[ofa-general] [PATCH TRIVIAL] opensm: trivial osm_port cleanups

Sasha Khapyorsky sashak at voltaire.com
Sun May 6 11:19:37 PDT 2007


This removes non-meanful osm_port_construct() and osm_port_destroy()
functions and makes static locally used osm_port_init().

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/include/opensm/osm_port.h |  111 +---------------------------------------
 osm/opensm/osm_port.c         |   14 +++--
 2 files changed, 11 insertions(+), 114 deletions(-)

diff --git a/osm/include/opensm/osm_port.h b/osm/include/opensm/osm_port.h
index 347ab3b..775f228 100644
--- a/osm/include/opensm/osm_port.h
+++ b/osm/include/opensm/osm_port.h
@@ -289,7 +289,7 @@ osm_physp_destroy(
 *	osm_physp_init.
 *
 * SEE ALSO
-*	Port, osm_port_init, osm_port_destroy
+*	Port
 *********/
 
 /****f* OpenSM: Physical Port/osm_physp_is_valid
@@ -1313,70 +1313,6 @@ typedef struct _osm_port
 *	Port, Physical Port, Physical Port Table
 *********/
 
-/****f* OpenSM: Port/osm_port_construct
-* NAME
-*	osm_port_construct
-*
-* DESCRIPTION
-*	This function constructs a Port object.
-*
-* SYNOPSIS
-*/
-static inline void
-osm_port_construct(
-	IN osm_port_t* const p_port )
-{
-	memset( p_port, 0, sizeof(*p_port) );
-	cl_qlist_init( &p_port->mcm_list );
-}
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to a Port object to construct.
-*
-* RETURN VALUE
-*	This function does not return a value.
-*
-* NOTES
-*	Allows calling osm_port_init, and osm_port_destroy.
-*
-*	Calling osm_port_construct is a prerequisite to calling any other
-*	method except osm_port_init.
-*
-* SEE ALSO
-*	Port, osm_port_init, osm_port_destroy
-*********/
-
-/****f* OpenSM: Port/osm_port_destroy
-* NAME
-*	osm_port_destroy
-*
-* DESCRIPTION
-*	This function destroys a Port object.
-*
-* SYNOPSIS
-*/
-void
-osm_port_destroy(
-  IN osm_port_t* const p_port );
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to a Port object to construct.
-*
-* RETURN VALUE
-*	This function does not return a value.
-*
-* NOTES
-*	Performs any necessary cleanup of the specified Port object.
-*	Further operations should not be attempted on the destroyed object.
-*	This function should only be called after a call to osm_port_construct
-*	or osm_port_init.
-*
-* SEE ALSO
-*	Port, osm_port_init, osm_port_destroy
-*********/
-
 /****f* OpenSM: Port/osm_port_delete
 * NAME
 *	osm_port_delete
@@ -1386,14 +1322,9 @@ osm_port_destroy(
 *
 * SYNOPSIS
 */
-inline static void
+void
 osm_port_delete(
-	IN OUT osm_port_t** const pp_port )
-{
-	osm_port_destroy( *pp_port );
-	free( *pp_port );
-	*pp_port = NULL;
-}
+	IN OUT osm_port_t** const pp_port );
 /*
 * PARAMETERS
 *	pp_port
@@ -1407,42 +1338,6 @@ osm_port_delete(
 *	Performs any necessary cleanup of the specified Port object.
 *
 * SEE ALSO
-*	Port, osm_port_init, osm_port_destroy
-*********/
-
-/****f* OpenSM: Port/osm_port_init
-* NAME
-*	osm_port_init
-*
-* DESCRIPTION
-*	This function initializes a Port object.
-*
-* SYNOPSIS
-*/
-void
-osm_port_init(
-	IN osm_port_t* const p_port,
-	IN const ib_node_info_t* p_ni,
-	IN const struct _osm_node* const p_parent_node );
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to a Port object to initialize.
-*
-*	p_ni
-*		[in] Pointer to the NodeInfo attribute relavent for this port.
-*
-*	p_parent_node
-*		[in] Pointer to the initialized parent osm_node_t object
-*		that owns this port.
-*
-* RETURN VALUE
-*	None.
-*
-* NOTES
-*	Allows calling other port methods.
-*
-* SEE ALSO
 *	Port
 *********/
 
diff --git a/osm/opensm/osm_port.c b/osm/opensm/osm_port.c
index ec2998c..260e28a 100644
--- a/osm/opensm/osm_port.c
+++ b/osm/opensm/osm_port.c
@@ -154,16 +154,18 @@ osm_physp_init(
 /**********************************************************************
  **********************************************************************/
 void
-osm_port_destroy(
-  IN osm_port_t* const p_port )
+osm_port_delete(
+  IN OUT osm_port_t** const pp_port )
 {
   /* cleanup all mcm recs attached */
-  osm_port_remove_all_mgrp( p_port );
+  osm_port_remove_all_mgrp( *pp_port );
+  free( *pp_port );
+  *pp_port = NULL;
 }
 
 /**********************************************************************
  **********************************************************************/
-void
+static void
 osm_port_init(
   IN osm_port_t* const p_port,
   IN const ib_node_info_t* p_ni,
@@ -178,8 +180,8 @@ osm_port_init(
   CL_ASSERT( p_ni );
   CL_ASSERT( p_parent_node );
 
-  osm_port_construct( p_port );
-
+  memset( p_port, 0, sizeof(*p_port) );
+  cl_qlist_init( &p_port->mcm_list );
   p_port->p_node = (struct _osm_node *)p_parent_node;
   port_guid = p_ni->port_guid;
   p_port->guid = port_guid;
-- 
1.5.2.rc2.20.gac2a




More information about the general mailing list