[ofa-general] [PATCH] opensm: osm_opensm.c added a method to remove plugins

Timothy A. Meier meier3 at llnl.gov
Mon Nov 10 10:26:17 PST 2008


Sasha,

During development, I am constantly bringing the SM up and down, so this helps make sure things
shut down gracefully.

Should have no impact, if people are not using plugins... yet.

>From e0434e676d0b3dd63a323218d207f029da9e27a4 Mon Sep 17 00:00:00 2001
From: Tim Meier <meier3 at llnl.gov>
Date: Mon, 10 Nov 2008 09:48:55 -0800
Subject: [PATCH] opensm:  osm_opensm.c added a method to remove plugins

Upon shutdown, iterates through the plugins and releases
resources and removes them via their destroy() method.

Signed-off-by: Tim Meier <meier3 at llnl.gov>
---
 opensm/opensm/osm_opensm.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 7deea6d..7286782 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -238,6 +238,19 @@ static void destroy_routing_engines(osm_opensm_t *osm)
        }
 }

+/**********************************************************************
+ **********************************************************************/
+static void destroy_plugins(osm_opensm_t *osm)
+{
+       osm_epi_plugin_t *p;
+       // remove from the list, and destroy it
+       while (!cl_is_qlist_empty(&osm->plugin_list)){
+               p = (osm_epi_plugin_t *)cl_qlist_remove_head(&osm->plugin_list);
+               // plugin is responsible for freeing its own resources
+               osm_epi_destroy(p);
+       }
+}
+
 void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
 {
        /* in case of shutdown through exit proc - no ^C */
@@ -275,6 +288,7 @@ void osm_opensm_destroy(IN osm_opensm_t * const p_osm)
        osm_sa_db_file_dump(p_osm);

        /* do the destruction in reverse order as init */
+       destroy_plugins(p_osm);
        destroy_routing_engines(p_osm);
        osm_sa_destroy(&p_osm->sa);
        osm_sm_destroy(&p_osm->sm);
--
1.5.4.5

-- 
Timothy A. Meier
Computer Scientist
ICCD/High Performance Computing
925.422.3341
meier3 at llnl.gov
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-opensm-osm_opensm.c-added-a-method-to-remove-plugi.patch
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20081110/436f10b0/attachment.ksh>


More information about the general mailing list