[openib-general] [PATCH] Opensm - default cache dir as constant

Yael Kalka eitan at mtl001.openib.org
Tue Sep 13 05:11:05 PDT 2005


Hi Hal,

The default cache dir used was hard coded. I replaced it with a
constant in osm_base.h.
Attached is a patch for that.

Thanks,
Yael

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

Index: include/opensm/osm_base.h
===================================================================
--- include/opensm/osm_base.h	(revision 3395)
+++ include/opensm/osm_base.h	(working copy)
@@ -193,6 +193,22 @@ BEGIN_C_DECLS
 #endif
 /***********/
 
+/****d* OpenSM: Base/OSM_DEFAULT_CACHE_DIR
+* NAME
+*	OSM_DEFAULT_CACHE_DIR
+*
+* DESCRIPTION
+*	Specifies the default cache directory for the db files.
+*
+* SYNOPSIS
+*/
+#ifdef __WIN__
+#define OSM_DEFAULT_CACHE_DIR "C:\\Windows\\Temp\\"
+#else
+#define OSM_DEFAULT_CACHE_DIR "/var/cache/osm"
+#endif
+/***********/
+
 /****d* OpenSM: Base/OSM_DEFAULT_LOG_FILE
 * NAME
 *	OSM_DEFAULT_LOG_FILE
Index: include/opensm/osm_subnet.h
===================================================================
--- include/opensm/osm_subnet.h	(revision 3395)
+++ include/opensm/osm_subnet.h	(working copy)
@@ -978,7 +978,7 @@ osm_subn_parse_conf_file(
 *
 * NOTES
 *  Assumes the conf file is part of the cache dir which defaults to
-*  /var/cache/osm or OSM_CACHE_DIR the name is opensm.opts
+*  OSM_DEFAULT_CACHE_DIR or OSM_CACHE_DIR the name is opensm.opts
 *
 * SEE ALSO
 *	Subnet object, osm_subn_construct, osm_subn_destroy,
@@ -1008,7 +1008,7 @@ osm_subn_write_conf_file(
 *
 * NOTES
 *  Assumes the conf file is part of the cache dir which defaults to
-*  /var/cache/osm or OSM_CACHE_DIR the name is opensm.opts
+*  OSM_DEFAULT_CACHE_DIR or OSM_CACHE_DIR the name is opensm.opts
 *
 * SEE ALSO
 *	Subnet object, osm_subn_construct, osm_subn_destroy,
Index: opensm/osm_subnet.c
===================================================================
--- opensm/osm_subnet.c	(revision 3395)
+++ opensm/osm_subnet.c	(working copy)
@@ -609,7 +609,7 @@ osm_subn_parse_conf_file(
   char *p_key, *p_val ,*p_last;
   
   /* try to open the options file from the cache dir */
-  if (! p_cache_dir) p_cache_dir = "/var/cache/osm";
+  if (! p_cache_dir) p_cache_dir = OSM_DEFAULT_CACHE_DIR;
 
   strcpy(file_name, p_cache_dir);
   strcat(file_name,"/opensm.opts");
@@ -773,7 +773,7 @@ osm_subn_write_conf_file(
   FILE *opts_file;
   
   /* try to open the options file from the cache dir */
-  if (! p_cache_dir) p_cache_dir = "/var/cache/osm";
+  if (! p_cache_dir) p_cache_dir = OSM_DEFAULT_CACHE_DIR;
 
   strcpy(file_name, p_cache_dir);
   strcat(file_name,"/opensm.opts");




More information about the general mailing list