[ofw] [PATCH] set opensm cache & config folder as %ProgramFiles%\WinOF\OpenSM

Smith, Stan stan.smith at intel.com
Fri Dec 11 17:12:23 PST 2009


Signed-off-by: stan smith <stan.smith at intel.com>

Revision: 2633
Author: stansmith
Date: 4:57:11 PM, Friday, December 11, 2009
Message:
[OPENSM] set opensm cache & config folder as %ProgramFiles%\WinOF\OpenSM; integrated with WinOF installers.
----
Modified : /gen1/trunk/WinOF/WIX/common/OpenSM_service.inc
Modified : /gen1/trunk/WinOF/WIX/common/requirements.inc
Modified : /gen1/trunk/WinOF/WIX/common/std_features.inc
Modified : /gen1/trunk/docs/Manual.htm
Modified : /gen1/trunk/ulp/opensm/user/include/opensm/osm_base.h
Modified : /gen1/trunk/ulp/opensm/user/include/opensm/osm_config.h
Modified : /gen1/trunk/ulp/opensm/user/include/vendor/winosm_common.h
Modified : /gen1/trunk/ulp/opensm/user/libvendor/winosm_common.c


--- a/ulp/opensm/user/include/opensm/osm_base.h Fri Dec 11 16:51:41 2009
+++ b/ulp/opensm/user/include/opensm/osm_base.h Thu Dec 10 10:18:28 2009
@@ -197,7 +197,7 @@
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_CACHE_DIR "%TEMP%\\"
+#define OSM_DEFAULT_CACHE_DIR "%ProgramFiles%\\WinOF\\OpenSM\\"
 #else
 #define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm/"
 #endif
@@ -228,7 +228,7 @@
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_CONFIG_FILE "%TEMP%\\opensm.conf"
+#define OSM_DEFAULT_CONFIG_FILE "%ProgramFiles%\\WinOF\\OpenSM\\opensm.conf"
 #elif defined(HAVE_DEFAULT_OPENSM_CONFIG_FILE)
 #define OSM_DEFAULT_CONFIG_FILE HAVE_DEFAULT_OPENSM_CONFIG_FILE
 #elif defined (OPENSM_CONFIG_DIR)
@@ -248,7 +248,7 @@
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_PARTITION_CONFIG_FILE "%TEMP%\\osm-partitions.conf"
+#define OSM_DEFAULT_PARTITION_CONFIG_FILE "%ProgramFiles%\\WinOF\\OpenSM\\osm-partitions.conf"
 #elif defined(HAVE_DEFAULT_PARTITION_CONFIG_FILE)
 #define OSM_DEFAULT_PARTITION_CONFIG_FILE HAVE_DEFAULT_PARTITION_CONFIG_FILE
 #elif defined(OPENSM_CONFIG_DIR)
@@ -268,7 +268,7 @@
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_QOS_POLICY_FILE "%TEMP%\\osm-qos-policy.conf"
+#define OSM_DEFAULT_QOS_POLICY_FILE "%ProgramFiles%\\WinOF\\OpenSM\\osm-qos-policy.conf"
 #elif defined(HAVE_DEFAULT_QOS_POLICY_FILE)
 #define OSM_DEFAULT_QOS_POLICY_FILE HAVE_DEFAULT_QOS_POLICY_FILE
 #elif defined(OPENSM_CONFIG_DIR)
@@ -288,7 +288,7 @@
 * SYNOPSIS
 */
 #ifdef __WIN__
-#define OSM_DEFAULT_PREFIX_ROUTES_FILE "%TEMP%\\osm-prefix-routes.conf"
+#define OSM_DEFAULT_PREFIX_ROUTES_FILE "%ProgramFiles%\\WinOF\\OpenSM\\osm-prefix-routes.conf"
 #elif defined(HAVE_DEFAULT_PREFIX_ROUTES_FILE)
 #define OSM_DEFAULT_PREFIX_ROUTES_FILE HAVE_DEFAULT_PREFIX_ROUTES_FILE
 #elif defined(OPENSM_CONFIG_DIR)

--- a/ulp/opensm/user/include/opensm/osm_config.h       Fri Dec 11 16:53:04 2009
+++ b/ulp/opensm/user/include/opensm/osm_config.h       Fri Dec 11 12:57:05 2009
@@ -30,7 +30,7 @@
 /* #undef ENABLE_OSM_PERF_MGR_PROFILE */

 /* Define a default node name map file */
-#define HAVE_DEFAULT_NODENAME_MAP "%TEMP%\\ib-node-name-map"
+#define HAVE_DEFAULT_NODENAME_MAP "%ProgramFiles%\\WinOF\\OpenSM\\ib-node-name.map"

 /* Define a default OpenSM config file */
 #undef HAVE_DEFAULT_OPENSM_CONFIG_FILE


--- a/ulp/opensm/user/include/vendor/winosm_common.h    Fri Dec 11 16:53:30 2009
+++ b/ulp/opensm/user/include/vendor/winosm_common.h    Fri Dec 11 12:58:12 2009
@@ -98,8 +98,12 @@
 extern char *strdup_expand(const char *);

 /* The following defines replace syslog.h */
-#define openlog(a,b,c)
-#define closelog()
+
+void openlog(char *ident, int option, int facility);
+void closelog(void);
+#define LOG_CONS       (1<<0)
+#define LOG_PID        (1<<2)
+#define LOG_USER       (1<<3)

 void syslog(int priority, char *fmt, ... );


--- a/ulp/opensm/user/libvendor/winosm_common.c Fri Dec 11 16:53:58 2009
+++ b/ulp/opensm/user/libvendor/winosm_common.c Fri Dec 11 12:59:40 2009
@@ -4,22 +4,69 @@
 #include <stdio.h>
 #include <io.h>
 #include <complib/cl_memory.h>
+#include <opensm/osm_base.h>

 #include <..\..\..\..\etc\user\inet.c>

 #define OSM_MAX_LOG_NAME_SIZE 512

+static char *syslog_fname;
+static FILE *syslog_file;
+static char *syslog_id;
+
+void openlog(char *ident, int option, int facility)
+{
+       if (!syslog_fname)
+               syslog_fname = strdup_expand(OSM_DEFAULT_TMP_DIR "osm.syslog");
+
+       if (!syslog_file) {
+               syslog_file = fopen(syslog_fname,"w");
+               if (syslog_file)
+                       syslog_id = strdup(ident);
+       }
+}
+
+void closelog(void)
+{
+       if (syslog_file) {
+               fprintf(syslog_file, "\n[%s] Closing syslog\n",syslog_id);
+               fflush(syslog_file);
+               fclose(syslog_file);
+               syslog_file = NULL;
+               if (syslog_id) {
+                       free((void*)syslog_id);
+                       syslog_id = NULL;
+               }
+               if (syslog_fname) {
+                       free((void*)syslog_fname);
+                       syslog_fname = NULL;
+               }
+       }
+}
+
 /* output to user-mode DebugView monitor if running */

 void syslog(int prio, char *fmt, ... )
 {
-       CHAR Buffer[1024];
-       va_list args;
+       char Buffer[1024];
+       SYSTEMTIME st;
+       uint32_t pid = GetCurrentThreadId();
+       va_list args;

        va_start(args,fmt);
        _vsnprintf(Buffer, 1024, (LPSTR)fmt, args);
        va_end(args);
-       OutputDebugStringA(Buffer);
+
+       if (!syslog_file) {
+               OutputDebugStringA(Buffer);
+               return;
+       }
+
+       GetLocalTime(&st);
+       fprintf(syslog_file, "[%s][%02d:%02d:%02d:%03d][%04X] %s", syslog_id,
+               st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, pid,
+               Buffer);
+       fflush(syslog_file);
 }


--- a/WinOF/WIX/common/requirements.inc Fri Dec 11 16:55:11 2009
+++ b/WinOF/WIX/common/requirements.inc Thu Dec 10 12:03:09 2009
@@ -55,5 +55,6 @@
     <Property Id="DiskPrompt" Value="WinOF Installation [1]" />

     <SetProperty Id="WINROOT" Value="[WindowsVolume]" Before="CostInitialize" />
+    <SetProperty Id="WINTEMP" Value="[WindowsFolder]\temp\" Before="CostInitialize" />

 </Include>


--- a/WinOF/WIX/common/std_features.inc Fri Dec 11 16:55:34 2009
+++ b/WinOF/WIX/common/std_features.inc Thu Dec 10 11:09:51 2009
@@ -14,6 +14,7 @@
       <ComponentRef Id="WinOFshortcuts" />
       <ComponentRef Id="Tools" />
       <ComponentRef Id="OpenSMservice" />
+      <ComponentRef Id="cOpenSMfolder" />

       <?if $(var.ARCHP) = "x64" AND ($(var.OS) = "wlh" OR $(var.OS) = "win7") ?>
          <ComponentRef Id="cCertPush" />

--- a/WinOF/WIX/common/OpenSM_service.inc       Fri Dec 11 16:54:25 2009
+++ b/WinOF/WIX/common/OpenSM_service.inc       Fri Dec 11 10:30:39 2009
@@ -38,4 +38,22 @@

     </Component>

+    <!-- create a folder for OpenSM config files -->
+    <Directory Id="OpenSMDir" Name="OpenSM">
+        <Component Id="cOpenSMfolder"
+                   Guid="3D4B2704-05C4-4378-9D49-17580945B367">
+
+            <CreateFolder />
+
+            <RemoveFile Id='fOSM1' On='uninstall' Name="gid2lid" />
+            <RemoveFile Id='fOSM2' On='uninstall' Name="*.*" />
+            <RemoveFile Id='fOSM3' On='uninstall' Name="*" />
+
+            <RemoveFile Id='fOsmlog' On='uninstall' Property="WINTEMP"
+                        Name="osm.log" />
+            <RemoveFile Id='fOsmsyslog' On='uninstall' Property="WINTEMP"
+                        Name="osm.syslog" />
+        </Component>
+    </Directory>
+
 </Include>



More information about the ofw mailing list