[openib-general] [PATCH] Opensm - using default dir

Yael Kalka yael at mellanox.co.il
Mon Jan 30 03:18:16 PST 2006


Hi Hal,

The following patch adds the use of the OSM_DEFAULT_CACHE_DIR instead
of full name usage. Also - add the "/" at the end of the
OSM_DEFAULT_CACHE_DIR definition, and refrain from adding it in the
code, to avoid problems in Windows.

Thanks,
Yael


Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: include/opensm/osm_base.h
===================================================================
--- include/opensm/osm_base.h	(revision 5203)
+++ include/opensm/osm_base.h	(working copy)
@@ -194,7 +194,7 @@ BEGIN_C_DECLS
 #ifdef __WIN__
 #define OSM_DEFAULT_CACHE_DIR "C:\\Windows\\Temp\\"
 #else
-#define OSM_DEFAULT_CACHE_DIR "/var/cache/osm"
+#define OSM_DEFAULT_CACHE_DIR "/var/cache/osm/"
 #endif
 /***********/
 
Index: include/opensm/osm_svn_revision.h
===================================================================
--- include/opensm/osm_svn_revision.h	(revision 5203)
+++ include/opensm/osm_svn_revision.h	(working copy)
@@ -1 +1 @@
-#define OSM_SVN_REVISION ""
+#define OSM_SVN_REVISION "5203M"
Index: opensm/osm_subnet.c
===================================================================
--- opensm/osm_subnet.c	(revision 5203)
+++ opensm/osm_subnet.c	(working copy)
@@ -617,7 +617,7 @@ osm_subn_parse_conf_file(
   if (! p_cache_dir) p_cache_dir = OSM_DEFAULT_CACHE_DIR;
 
   strcpy(file_name, p_cache_dir);
-  strcat(file_name,"/opensm.opts");
+  strcat(file_name,"opensm.opts");
   
   opts_file = fopen(file_name, "r");
   if (!opts_file) return;
@@ -789,7 +789,7 @@ osm_subn_write_conf_file(
   if (! p_cache_dir) p_cache_dir = OSM_DEFAULT_CACHE_DIR;
 
   strcpy(file_name, p_cache_dir);
-  strcat(file_name,"/opensm.opts");
+  strcat(file_name,"opensm.opts");
   
   opts_file = fopen(file_name, "w");
   if (!opts_file) return;
Index: opensm/osm_db_files.c
===================================================================
--- opensm/osm_db_files.c	(revision 5203)
+++ opensm/osm_db_files.c	(working copy)
@@ -170,7 +170,7 @@ osm_db_init(
 
   p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR");
   if ( p_db_imp->db_dir_name == NULL )
-    p_db_imp->db_dir_name = "/var/cache/osm";
+    p_db_imp->db_dir_name = OSM_DEFAULT_CACHE_DIR;
 
   /* make sure the directory exists */
   if (lstat(p_db_imp->db_dir_name, &dstat))
@@ -226,7 +226,6 @@ osm_db_domain_init(
     (char *)cl_malloc(sizeof(char)*(dir_name_len) + strlen(domain_name) + 2);
   CL_ASSERT(p_domain_imp->file_name != NULL);
   strcpy(p_domain_imp->file_name,((osm_db_imp_t*)p_db->p_db_imp)->db_dir_name);
-  strcat(p_domain_imp->file_name,"/");
   strcat(p_domain_imp->file_name,domain_name);
 
   /* make sure the file exists - or exit if not writable */
@@ -413,6 +412,7 @@ osm_db_restore(
 
  Exit:
   cl_spinlock_release( &p_domain_imp->lock );
+  OSM_LOG_EXIT( p_log );
   return status;
 }
 




More information about the general mailing list