]> xenbits.xensource.com Git - pvdrivers/win/xeniface.git/commitdiff
Add SDV to the standard build
authorBen Chalmers <Ben.Chalmers@citrix.com>
Tue, 25 Mar 2014 11:02:59 +0000 (11:02 +0000)
committerBen Chalmers <Ben.Chalmers@citrix.com>
Tue, 25 Mar 2014 11:02:59 +0000 (11:02 +0000)
build.py
msbuild.bat [new file with mode: 0644]
proj/msbuild.bat [deleted file]
proj/xeniface/xeniface.vcxproj
sdv.py [deleted file]
src/xeniface/assert.h
src/xeniface/fdo.c
src/xeniface/log.h

index 01b0ca973da941a5522f032578e2e7d280cfcf0c..02a2fdb793f67983f6f3d301e4e45ef59f761cdc 100644 (file)
--- a/build.py
+++ b/build.py
@@ -37,6 +37,7 @@ import re
 import glob
 import tarfile
 import subprocess
+import shutil
 
 def make_header():
     now = datetime.datetime.now()
@@ -110,19 +111,8 @@ def get_expired_symbols(age = 30):
     file.close()
 
     return expired
-
-def get_configuration_name(debug):
-    configuration = 'WindowsVista'
-
-    if debug:
-        configuration += 'Debug'
-    else:
-        configuration += 'Release'
-
-    return configuration
-
-def get_configuration(debug):
-    configuration = 'Windows Vista'
+def get_configuration(release, debug):
+    configuration = release
 
     if debug:
         configuration += ' Debug'
@@ -131,12 +121,11 @@ def get_configuration(debug):
 
     return configuration
 
-
-def get_target_path(arch, debug):
-    configuration = get_configuration_name(debug)
-
+def get_target_path(release, arch, debug):
+    configuration = get_configuration(release, debug)
+    name = ''.join(configuration.split(' '))
     target = { 'x86': 'proj', 'x64': os.sep.join(['proj', 'x64']) }
-    target_path = os.sep.join([target[arch], configuration])
+    target_path = os.sep.join([target[arch], name])
 
     return target_path
 
@@ -159,27 +148,74 @@ class msbuild_failure(Exception):
     def __str__(self):
         return repr(self.value)
 
-def msbuild(name, arch, debug):
+def msbuild(platform, configuration, target, file, args, dir):
+
+    os.environ['PLATFORM'] = platform
+    os.environ['CONFIGURATION'] = configuration
+    os.environ['TARGET'] = target
+    os.environ['FILE'] = file
+    os.environ['EXTRA'] = args
+
     cwd = os.getcwd()
-    configuration = get_configuration(debug)
+    bin = os.path.join(cwd, 'msbuild.bat')
 
-    os.environ['SOLUTION'] = name
+    os.chdir(dir)
+    status = shell(bin)
+    os.chdir(cwd)
+
+    if (status != None):
+        raise msbuild_failure(configuration)
+
+def build_sln(name, release, arch, debug):
+    configuration = get_configuration(release, debug)
 
     if arch == 'x86':
-        os.environ['PLATFORM'] = 'Win32'
+        platform = 'Win32'
     elif arch == 'x64':
-        os.environ['PLATFORM'] = 'x64'
+        platform = 'x64'
 
-    os.environ['CONFIGURATION'] = configuration
-    os.environ['TARGET'] = 'Build'
+    cwd = os.getcwd()
 
-    os.chdir('proj')
-    status = shell('msbuild.bat')
-    os.chdir(cwd)
+    msbuild(platform, configuration, 'Build', name+'.sln', '', 'proj')
 
-    if (status != None):
-        raise msbuild_failure(configuration)
 
+def remove_timestamps(path):
+    try:
+        os.unlink(path + '.orig')
+    except OSError:
+        pass
+
+    os.rename(path, path + '.orig')
+
+    src = open(path + '.orig', 'r')
+    dst = open(path, 'w')
+
+    for line in src:
+        if line.find('TimeStamp') == -1:
+            dst.write(line)
+
+    dst.close()
+    src.close()
+
+def run_sdv(name, dir):
+    configuration = get_configuration('Windows 8', False)
+    platform = 'x64'
+
+    msbuild(platform, configuration, 'Build', name + '.vcxproj',
+            '', os.path.join('proj', name))
+    msbuild(platform, configuration, 'sdv', name + '.vcxproj',
+            '/p:Inputs="/clean"', os.path.join('proj', name))
+    msbuild(platform, configuration, 'sdv', name + '.vcxproj',
+            '/p:Inputs="/check:default.sdv"', os.path.join('proj', name))
+
+    path = ['proj', name, 'sdv', 'SDV.DVL.xml']
+    remove_timestamps(os.path.join(*path))
+
+    msbuild(platform, configuration, 'dvl', name + '.vcxproj',
+            '', os.path.join('proj', name))
+
+    path = ['proj', name, name + '.DVL.XML']
+    shutil.copy(os.path.join(*path), dir)
 
 def symstore_del(age):
     symstore_path = [os.environ['KIT'], 'Debuggers']
@@ -201,10 +237,9 @@ def symstore_del(age):
 
         shell(' '.join(command))
 
-def symstore_add(name, arch, debug):
+def symstore_add(name, release, arch, debug):
     cwd = os.getcwd()
-    configuration = get_configuration_name(debug)
-    target_path = get_target_path(arch, debug)
+    target_path = get_target_path(release, arch, debug)
 
     symstore_path = [os.environ['KIT'], 'Debuggers']
     if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
@@ -263,6 +298,8 @@ def archive(filename, files, tgz=False):
 
 
 if __name__ == '__main__':
+
+    driver = 'xeniface'
     os.environ['MAJOR_VERSION'] = '7'
     os.environ['MINOR_VERSION'] = '2'
     os.environ['MICRO_VERSION'] = '0'
@@ -281,11 +318,16 @@ if __name__ == '__main__':
 
     symstore_del(30)
 
-    msbuild('xeniface', 'x86', debug[sys.argv[1]])
-    msbuild('xeniface', 'x64', debug[sys.argv[1]])
+    release = 'Windows Vista'
+
+    build_sln(driver, release, 'x86', debug[sys.argv[1]])
+    build_sln(driver, release, 'x64', debug[sys.argv[1]])
+
+    symstore_add(driver, release, 'x86', debug[sys.argv[1]])
+    symstore_add(driver, release, 'x64', debug[sys.argv[1]])
 
-    symstore_add('xeniface', 'x86', debug[sys.argv[1]])
-    symstore_add('xeniface', 'x64', debug[sys.argv[1]])
+    if len(sys.argv) <= 2 or sys.argv[2] != 'nosdv':
+        run_sdv(driver, driver)
 
     listfile = callfnout(['git','ls-tree', '-r', '--name-only', 'HEAD'])
     archive('xeniface\\source.tgz', listfile.splitlines(), tgz=True)
diff --git a/msbuild.bat b/msbuild.bat
new file mode 100644 (file)
index 0000000..f9fceec
--- /dev/null
@@ -0,0 +1,4 @@
+call "%VS%\VC\vcvarsall.bat" x86
+@echo on
+msbuild.exe /p:Configuration="%CONFIGURATION%" /p:Platform="%PLATFORM%" /t:"%TARGET%" %EXTRA% %FILE%
+
diff --git a/proj/msbuild.bat b/proj/msbuild.bat
deleted file mode 100644 (file)
index 6965b80..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-call "%VS%\VC\vcvarsall.bat" x86
-msbuild.exe /p:Configuration="%CONFIGURATION%" /p:Platform="%PLATFORM%" /t:"%TARGET%" %SOLUTION%.sln
-
index 4c5b1e09e6dce2d733209035854ea8dea4b5bcb0..b9222edbae602469f8155fb507f55d0a175b67ad 100644 (file)
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
-    <IncludePath>$(IncludePath)</IncludePath>
+    <IncludePath>..\..\include;$(IncludePath)</IncludePath>
     <RunCodeAnalysis>true</RunCodeAnalysis>
     <EnableInf2cat>false</EnableInf2cat>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
     <ClCompile>
       <AdditionalIncludeDirectories>$(SolutionDir)..\include;$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>__i386__;__MODULE__="XENIFACE";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>__i386__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <EnablePREfast>true</EnablePREfast>
     </ClCompile>
     <Link>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/sdv.py b/sdv.py
deleted file mode 100644 (file)
index 9abb28e..0000000
--- a/sdv.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!python -u
-
-# Copyright (c) Citrix Systems Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, 
-# with or without modification, are permitted provided 
-# that the following conditions are met:
-#
-# *   Redistributions of source code must retain the above 
-#     copyright notice, this list of conditions and the 
-#     following disclaimer.
-# *   Redistributions in binary form must reproduce the above 
-#     copyright notice, this list of conditions and the 
-#     following disclaimer in the documentation and/or other 
-#     materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
-# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
-# SUCH DAMAGE.
-
-
-import os, sys
-import datetime
-import re
-import glob
-import tarfile
-import subprocess
-
-def shell(command):
-    print(command)
-    sys.stdout.flush()
-
-    pipe = os.popen(command, 'r', 1)
-
-    for line in pipe:
-        print(line.rstrip())
-
-    return pipe.close()
-
-
-class msbuild_failure(Exception):
-    def __init__(self, value):
-        self.value = value
-    def __str__(self):
-        return repr(self.value)
-
-def msbuild(batfile, projdir, name, sdv_arg):
-    cwd = os.getcwd()
-
-    os.environ['CONFIGURATION'] = 'Windows 8 Release'
-    os.environ['SDV_PROJ'] = name
-    os.environ['SDV_ARG'] = sdv_arg
-
-    os.chdir('proj')
-    os.chdir(projdir)
-    status = shell(batfile)
-    os.chdir(cwd)
-
-#    if (status != None):
-#        raise msbuild_failure(sdv_arg)
-
-
-if __name__ == '__main__':
-    msbuild('..\msbuild_sdv.bat', 'xeniface', 'xeniface.vcxproj', '/clean')
-
-    msbuild('..\msbuild_sdv.bat', 'xeniface', 'xeniface.vcxproj', '/check:default.sdv')
-
-    msbuild('..\msbuild_dvl.bat', 'xeniface', 'xeniface.vcxproj', '')
index 89bec5f4a782fdf4816f1e5c90c05d6bbb65bc82..4229f7c6d0100e52f9d5a134f4a191944e3083bb 100644 (file)
@@ -72,6 +72,8 @@ __BugCheck(
 #define BUG_ON(_EXP)                \
         if (_EXP) BUG(#_EXP)
 
+#undef  ASSERT
+
 #if DBG
 
 #define __NT_ASSERT(_EXP)                                       \
@@ -83,14 +85,6 @@ __BugCheck(
 
 #define __ASSERT(_EXP)  __NT_ASSERT(_EXP)
 
-#else   // DBG
-
-#define __ASSERT(_EXP)  BUG_ON(!(_EXP))
-
-#endif  // DBG
-
-#undef  ASSERT
-
 #define ASSERT(_EXP)                    \
         do {                            \
             __ASSERT(_EXP);             \
@@ -130,6 +124,15 @@ __BugCheck(
             }                                       \
         } while (FALSE)
 
+#else   // DBG
+
+#define ASSERT(_EXP)
+#define ASSERT3U(_X, _OP, _Y)
+#define ASSERT3S(_X, _OP, _Y)
+#define ASSERT3P(_X, _OP, _Y)
+
+#endif  // DBG
+
 #ifndef TEST_MEMORY
 #define TEST_MEMORY DBG
 #endif
index 3f26583f5369342b49954ea4a24b4dc14991170e..0c388dde925d2403a488369ce26d00b19a471351 100644 (file)
@@ -871,6 +871,7 @@ FdoStartDevice(
 
 fail5:
        Error("fail5\n");
+#pragma warning(suppress : 6031)
        IoSetDeviceInterfaceState(&Fdo->InterfaceName, FALSE);
 
 fail4:
@@ -1003,8 +1004,9 @@ FdoSurpriseRemoval(
     __FdoSetDevicePnpState(Fdo, SurpriseRemovePending);
 
     Irp->IoStatus.Status = STATUS_SUCCESS;
-       IoSetDeviceInterfaceState(&Fdo->InterfaceName, FALSE);
-       WmiFinalise(Fdo);
+#pragma warning(suppress : 6031) 
+    IoSetDeviceInterfaceState(&Fdo->InterfaceName, FALSE);
+    WmiFinalise(Fdo);
 
     IoSkipCurrentIrpStackLocation(Irp);
     status = IoCallDriver(Fdo->LowerDeviceObject, Irp);
@@ -1037,8 +1039,9 @@ done:
     __FdoSetDevicePnpState(Fdo, Deleted);
 
     Irp->IoStatus.Status = STATUS_SUCCESS;
-       IoSetDeviceInterfaceState(&Fdo->InterfaceName, FALSE);
-       WmiFinalise(Fdo);
+#pragma warning(suppress : 6031) 
+    IoSetDeviceInterfaceState(&Fdo->InterfaceName, FALSE);
+    WmiFinalise(Fdo);
 
     IoSkipCurrentIrpStackLocation(Irp);
     status = IoCallDriver(Fdo->LowerDeviceObject, Irp);
@@ -1990,8 +1993,6 @@ FdoCreateFile (
 {
     NTSTATUS     status;
 
-    PAGED_CODE();
-
 
     XenIfaceDebugPrint(TRACE, "Create \n");
 
@@ -2022,8 +2023,6 @@ FdoClose (
 
     NTSTATUS     status;
 
-    PAGED_CODE();
-
     XenIfaceDebugPrint(TRACE, "Close \n");
 
     status = STATUS_SUCCESS;
@@ -2045,9 +2044,6 @@ FdoReadWrite (
 
     NTSTATUS     status;
 
-    PAGED_CODE();
-
-
     XenIfaceDebugPrint(TRACE, "ReadWrite called\n");
 
     status = STATUS_SUCCESS;
@@ -2391,6 +2387,7 @@ FdoCreate(
     if (!NT_SUCCESS(status))
         goto fail5;
 
+#pragma prefast(suppress:6014) // Possibly leaking Fdo->InterfaceName
        status = IoRegisterDeviceInterface(PhysicalDeviceObject,
                                                                                (LPGUID)&GUID_INTERFACE_XENIFACE,
                                                                                NULL,
index 39d97560b1f79a49e110d63044b20fd13e5e004e..375a61f731bef8c70bcfe4f9275acd922ec5f176 100644 (file)
@@ -42,6 +42,8 @@
 
 #pragma warning(disable:4127)   // conditional expression is constant
 
+#define __MODULE__ "XENIFACE"
+
 static __inline VOID
 __Error(
     IN  const CHAR  *Prefix,