Sasha,

I am finally getting back to adding the OpenSSL option to the console.

This patch, as well as the next one, are just a little cleanup to prepare for 
that effort.

From e1cd363fe9a24e7d88b0b4354b0467a191627073 Mon Sep 17 00:00:00 2001
From: Tim Meier <[EMAIL PROTECTED]>
Date: Fri, 1 Feb 2008 16:43:47 -0800
Subject: [PATCH] opensm: separated current loop in main into its own function

Put the endless while loop in "main" into its own function to
support decoupling the osm_console from opensm.

Signed-off-by: Tim Meier <[EMAIL PROTECTED]>
---
 opensm/opensm/main.c |   66 ++++++++++++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index 7c435a0..239de84 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -551,6 +551,40 @@ static int daemonize(osm_opensm_t * osm)

 /**********************************************************************
  **********************************************************************/
+int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm)
+{
+       osm_console_init(p_opt, p_osm);
+
+       /*
+          Sit here forever
+        */
+       while (!osm_exit_flag) {
+               if (strcmp(p_opt->console, OSM_LOCAL_CONSOLE) == 0
+#ifdef ENABLE_OSM_CONSOLE_SOCKET
+                   || strcmp(p_opt->console, OSM_REMOTE_CONSOLE) == 0
+                   || strcmp(p_opt->console, OSM_LOOPBACK_CONSOLE) == 0
+#endif
+                   )
+                       osm_console(p_osm);
+               else
+                       cl_thread_suspend(10000);
+
+               if (osm_usr1_flag) {
+                       osm_usr1_flag = 0;
+                       osm_log_reopen_file(&(p_osm->log));
+               }
+               if (osm_hup_flag) {
+                       osm_hup_flag = 0;
+                       /* a HUP signal should only start a new heavy sweep */
+                       p_osm->subn.force_heavy_sweep = TRUE;
+                       osm_opensm_sweep(p_osm);
+               }
+       }
+       osm_console_close_socket(p_osm);
+       return 0;
+}
+/**********************************************************************
+ **********************************************************************/
 int main(int argc, char *argv[])
 {
        osm_opensm_t osm;
@@ -1010,34 +1044,10 @@ int main(int argc, char *argv[])
                                osm_exit_flag = 1;
                }
        } else {
-               osm_console_init(&opt, &osm);
-
-               /*
-                  Sit here forever
-                */
-               while (!osm_exit_flag) {
-                       if (strcmp(opt.console, OSM_LOCAL_CONSOLE) == 0
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
-                           || strcmp(opt.console, OSM_REMOTE_CONSOLE) == 0
-                           || strcmp(opt.console, OSM_LOOPBACK_CONSOLE) == 0
-#endif
-                           )
-                               osm_console(&osm);
-                       else
-                               cl_thread_suspend(10000);
-
-                       if (osm_usr1_flag) {
-                               osm_usr1_flag = 0;
-                               osm_log_reopen_file(&osm.log);
-                       }
-                       if (osm_hup_flag) {
-                               osm_hup_flag = 0;
-                               /* a HUP signal should only start a new heavy 
sweep */
-                               osm.subn.force_heavy_sweep = TRUE;
-                               osm_opensm_sweep(&osm);
-                       }
-               }
-               osm_console_close_socket(&osm);
+       /*
+        *         Sit here until signaled to exit
+        */
+               osm_manager_loop(&opt, &osm);
        }

        if (osm.mad_pool.mads_out) {
--
1.5.1



--
Timothy A. Meier
Computer Scientist
ICCD/High Performance Computing
925.422.3341
[EMAIL PROTECTED]
>From e1cd363fe9a24e7d88b0b4354b0467a191627073 Mon Sep 17 00:00:00 2001
From: Tim Meier <[EMAIL PROTECTED]>
Date: Fri, 1 Feb 2008 16:43:47 -0800
Subject: [PATCH] opensm: separated current loop in main into its own function

Put the endless while loop in "main" into its own function to
support decoupling the osm_console from opensm.

Signed-off-by: Tim Meier <[EMAIL PROTECTED]>
---
 opensm/opensm/main.c |   66 ++++++++++++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index 7c435a0..239de84 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -551,6 +551,40 @@ static int daemonize(osm_opensm_t * osm)
 
 /**********************************************************************
  **********************************************************************/
+int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm)
+{
+       osm_console_init(p_opt, p_osm);
+
+       /*
+          Sit here forever
+        */
+       while (!osm_exit_flag) {
+               if (strcmp(p_opt->console, OSM_LOCAL_CONSOLE) == 0
+#ifdef ENABLE_OSM_CONSOLE_SOCKET
+                   || strcmp(p_opt->console, OSM_REMOTE_CONSOLE) == 0
+                   || strcmp(p_opt->console, OSM_LOOPBACK_CONSOLE) == 0
+#endif
+                   )
+                       osm_console(p_osm);
+               else
+                       cl_thread_suspend(10000);
+
+               if (osm_usr1_flag) {
+                       osm_usr1_flag = 0;
+                       osm_log_reopen_file(&(p_osm->log));
+               }
+               if (osm_hup_flag) {
+                       osm_hup_flag = 0;
+                       /* a HUP signal should only start a new heavy sweep */
+                       p_osm->subn.force_heavy_sweep = TRUE;
+                       osm_opensm_sweep(p_osm);
+               }
+       }
+       osm_console_close_socket(p_osm);
+       return 0;
+}
+/**********************************************************************
+ **********************************************************************/
 int main(int argc, char *argv[])
 {
        osm_opensm_t osm;
@@ -1010,34 +1044,10 @@ int main(int argc, char *argv[])
                                osm_exit_flag = 1;
                }
        } else {
-               osm_console_init(&opt, &osm);
-
-               /*
-                  Sit here forever
-                */
-               while (!osm_exit_flag) {
-                       if (strcmp(opt.console, OSM_LOCAL_CONSOLE) == 0
-#ifdef ENABLE_OSM_CONSOLE_SOCKET
-                           || strcmp(opt.console, OSM_REMOTE_CONSOLE) == 0
-                           || strcmp(opt.console, OSM_LOOPBACK_CONSOLE) == 0
-#endif
-                           )
-                               osm_console(&osm);
-                       else
-                               cl_thread_suspend(10000);
-
-                       if (osm_usr1_flag) {
-                               osm_usr1_flag = 0;
-                               osm_log_reopen_file(&osm.log);
-                       }
-                       if (osm_hup_flag) {
-                               osm_hup_flag = 0;
-                               /* a HUP signal should only start a new heavy 
sweep */
-                               osm.subn.force_heavy_sweep = TRUE;
-                               osm_opensm_sweep(&osm);
-                       }
-               }
-               osm_console_close_socket(&osm);
+       /*
+        *         Sit here until signaled to exit
+        */
+               osm_manager_loop(&opt, &osm);
        }
 
        if (osm.mad_pool.mads_out) {
-- 
1.5.1

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to