[openib-general] [PATCH] OpenSM: Remove unicast and multicast dump files relative to dump_files_dir

Hal Rosenstock halr at voltaire.com
Tue May 30 05:11:31 PDT 2006


OpenSM: Remove unicast and multicast dump files relative to
dump_files_dir

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: opensm/osm_mcast_mgr.c
===================================================================
--- opensm/osm_mcast_mgr.c	(revision 7535)
+++ opensm/osm_mcast_mgr.c	(working copy)
@@ -1461,6 +1461,25 @@ osm_mcast_mgr_dump_mcast_routes(
   OSM_LOG_EXIT( p_mgr->p_log );
 }
 
+static void
+__unlink_mcast_fdb(IN osm_mcast_mgr_t* const p_mgr)
+{
+  char *file_name = NULL;
+
+  file_name =
+    (char*)cl_malloc(strlen(p_mgr->p_subn->opt.dump_files_dir) + 12);
+
+  CL_ASSERT(file_name);
+
+  strcpy(file_name, p_mgr->p_subn->opt.dump_files_dir);
+  strcat(file_name, "/osm.mcfdbs");
+
+  unlink(file_name);
+
+  if (file_name)
+    cl_free(file_name);
+}
+
 /**********************************************************************
  Process the entire group.
 
@@ -1496,7 +1515,9 @@ osm_mcast_mgr_process_mgrp(
 
   /* initialize the mc fdb dump file: */
   if( osm_log_is_active( p_mgr->p_log, OSM_LOG_ROUTING ) )
-    unlink("/tmp/osm.mcfdbs");
+  {
+    __unlink_mcast_fdb( p_mgr );
+  }
 
   /*
     Walk the switches and download the tables for each.
@@ -1570,7 +1591,9 @@ osm_mcast_mgr_process(
 
   /* initialize the mc fdb dump file: */
   if( osm_log_is_active( p_mgr->p_log, OSM_LOG_ROUTING ) )
-    unlink("/tmp/osm.mcfdbs");
+  {
+    __unlink_mcast_fdb( p_mgr );
+  }
 
   /*
     Walk the switches and download the tables for each.
Index: opensm/osm_ucast_mgr.c
===================================================================
--- opensm/osm_ucast_mgr.c	(revision 7535)
+++ opensm/osm_ucast_mgr.c	(working copy)
@@ -1047,6 +1047,7 @@ osm_ucast_mgr_process(
   uint32_t iteration_max;
   osm_signal_t signal;
   cl_qmap_t *p_sw_guid_tbl;
+  char *file_name = NULL;
 
   OSM_LOG_ENTER( p_mgr->p_log, osm_ucast_mgr_process );
 
@@ -1149,7 +1150,20 @@ osm_ucast_mgr_process(
 
     /* initialize the fdb dump file: */
     if( osm_log_is_active( p_mgr->p_log, OSM_LOG_ROUTING ) )
-      unlink("/tmp/osm.fdbs");
+    {
+      file_name =
+        (char*)cl_malloc(strlen(p_mgr->p_subn->opt.dump_files_dir) + 12);
+
+      CL_ASSERT(file_name);
+
+      strcpy(file_name, p_mgr->p_subn->opt.dump_files_dir);
+      strcat(file_name, "/osm.fdbs");
+
+      unlink(file_name);  
+
+      if (file_name)
+        cl_free(file_name);
+    }
 
     cl_qmap_apply_func( p_sw_guid_tbl,
                         __osm_ucast_mgr_process_tbl, p_mgr );






More information about the general mailing list