[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 2/2] Remove defunct XENFILT_PVDEVICE interface



Nothing should now need this interface so the code can be removed.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 include/pvdevice_interface.h   | 132 ------------
 src/xenbus/fdo.c               |   1 -
 src/xenfilt/driver.c           | 137 +++++++------
 src/xenfilt/driver.h           |  13 +-
 src/xenfilt/pdo.c              |  45 +----
 src/xenfilt/pvdevice.c         | 447 -----------------------------------------
 src/xenfilt/pvdevice.h         |  59 ------
 vs2012/xenfilt/xenfilt.vcxproj |   1 -
 vs2013/xenfilt/xenfilt.vcxproj |   1 -
 9 files changed, 81 insertions(+), 755 deletions(-)
 delete mode 100644 include/pvdevice_interface.h
 delete mode 100644 src/xenfilt/pvdevice.c
 delete mode 100644 src/xenfilt/pvdevice.h

diff --git a/include/pvdevice_interface.h b/include/pvdevice_interface.h
deleted file mode 100644
index 9024396..0000000
--- a/include/pvdevice_interface.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* 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.
- */
-
-/*! \file pvdevice_interface.h
-    \brief XENFILT PVDEVICE Interface
-
-    This interface provides primitives to determine whether a pvdevice
-    device is active (and claim the active device id if not)
-*/
-
-#ifndef _XENFILT_PVDEVICE_INTERFACE_H
-#define _XENFILT_PVDEVICE_INTERFACE_H
-
-#ifndef _WINDLL
-
-/*! \typedef XENFILT_PVDEVICE_ACQUIRE
-    \brief Acquire a reference to the PVDEVICE interface
-
-    \param Interface The interface header
-*/
-typedef NTSTATUS
-(*XENFILT_PVDEVICE_ACQUIRE)(
-    IN  PINTERFACE  Interface
-    );
-
-/*! \typedef XENFILT_PVDEVICE_RELEASE
-    \brief Release a reference to the PVDEVICE interface
-
-    \param Interface The interface header
-*/
-typedef VOID
-(*XENFILT_PVDEVICE_RELEASE)(
-    IN  PINTERFACE  Interface
-    );
-
-/*! \typedef XENFILT_PVDEVICE_GET_ACTIVE
-    \brief Get the active device instance
-
-    \param Interface The interface header
-    \param DeviceID A buffer of length MAXNAMELEN to receive the device id
-    \param InstanceID A buffer of length MAXNAMELEN to receive the instance id
-*/
-typedef NTSTATUS
-(*XENFILT_PVDEVICE_GET_ACTIVE)(
-    IN  PVOID   Context,
-    OUT PCHAR   DeviceID,
-    OUT PCHAR   InstanceID
-    );
-
-/*! \typedef XENFILT_PVDEVICE_SET_ACTIVE
-    \brief Set the active device instance
-
-    \param Interface The interface header
-    \param DeviceID Buffer containing the device id
-    \param InstanceID Buffer containing the instance id
-*/
-typedef NTSTATUS
-(*XENFILT_PVDEVICE_SET_ACTIVE)(
-    IN  PVOID   Context,
-    IN  PCHAR   DeviceID,
-    IN  PCHAR   InstanceID
-    );
-
-/*! \typedef XENFILT_PVDEVICE_CLEAR_ACTIVE
-    \brief Clear the active device instance
-
-    \param Interface The interface header
-*/
-typedef NTSTATUS
-(*XENFILT_PVDEVICE_CLEAR_ACTIVE)(
-    IN  PVOID   Context
-    );
-
-// {7d09b250-898f-4fea-b7fa-e0490e46f95f}
-DEFINE_GUID(GUID_XENFILT_PVDEVICE_INTERFACE,
-0x7d09b250, 0x898f, 0x4fea, 0xb7, 0xfa, 0xe0, 0x49, 0x0e, 0x46, 0xf9, 0x5f);
-
-/*! \struct _XENFILT_PVDEVICE_INTERFACE_V1
-    \brief PVDEVICE interface version 1
-    \ingroup interfaces
-*/
-struct _XENFILT_PVDEVICE_INTERFACE_V1 {
-    INTERFACE                       Interface;
-    XENFILT_PVDEVICE_ACQUIRE        PvdeviceAcquire;
-    XENFILT_PVDEVICE_RELEASE        PvdeviceRelease;
-    XENFILT_PVDEVICE_GET_ACTIVE     PvdeviceGetActive;
-    XENFILT_PVDEVICE_SET_ACTIVE     PvdeviceSetActive;
-    XENFILT_PVDEVICE_CLEAR_ACTIVE   PvdeviceClearActive;
-};
-
-typedef struct _XENFILT_PVDEVICE_INTERFACE_V1 XENFILT_PVDEVICE_INTERFACE, 
*PXENFILT_PVDEVICE_INTERFACE;
-
-/*! \def XENFILT_PVDEVICE
-    \brief Macro at assist in method invocation
-*/
-#define XENFILT_PVDEVICE(_Method, _Interface, ...)    \
-    (_Interface)->Pvdevice ## _Method((PINTERFACE)(_Interface), __VA_ARGS__)
-
-#endif  // _WINDLL
-
-#define XENFILT_PVDEVICE_INTERFACE_VERSION_MIN  1
-#define XENFILT_PVDEVICE_INTERFACE_VERSION_MAX  1
-
-#endif  // _XENFILT_PVDEVICE_INTERFACE_H
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 49ae08d..ce4840c 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -38,7 +38,6 @@
 #include <stdlib.h>
 #include <xen.h>
 
-#include <pvdevice_interface.h>
 #include <version.h>
 
 #include "names.h"
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 342d2b2..bfc96ee 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -39,7 +39,6 @@
 #include "pdo.h"
 #include "driver.h"
 #include "emulated.h"
-#include "pvdevice.h"
 #include "mutex.h"
 #include "dbg_print.h"
 #include "assert.h"
@@ -60,9 +59,6 @@ typedef struct _XENFILT_DRIVER {
 
     PXENFILT_EMULATED_CONTEXT   EmulatedContext;
     XENFILT_EMULATED_INTERFACE  EmulatedInterface;
-
-    PXENFILT_PVDEVICE_CONTEXT   PvdeviceContext;
-    XENFILT_PVDEVICE_INTERFACE  PvdeviceInterface;
 } XENFILT_DRIVER, *PXENFILT_DRIVER;
 
 static XENFILT_DRIVER   Driver;
@@ -158,30 +154,6 @@ DriverGetEmulatedContext(
 }
 
 static FORCEINLINE VOID
-__DriverSetPvdeviceContext(
-    IN  PXENFILT_PVDEVICE_CONTEXT   Context
-    )
-{
-    Driver.PvdeviceContext = Context;
-}
-
-static FORCEINLINE PXENFILT_PVDEVICE_CONTEXT
-__DriverGetPvdeviceContext(
-    VOID
-    )
-{
-    return Driver.PvdeviceContext;
-}
-
-PXENFILT_PVDEVICE_CONTEXT
-DriverGetPvdeviceContext(
-    VOID
-    )
-{
-    return __DriverGetPvdeviceContext();
-}
-
-static FORCEINLINE VOID
 __DriverAcquireMutex(
     VOID
     )
@@ -246,6 +218,74 @@ DriverRemoveFunctionDeviceObject(
     --Driver.References;
 }
 
+static FORCEINLINE NTSTATUS
+__DriverGetActive(
+    OUT PCHAR       DeviceID,
+    OUT PCHAR       InstanceID
+    )
+{
+    HANDLE          ParametersKey;
+    PANSI_STRING    Ansi;
+    NTSTATUS        status;
+
+    Trace("====>\n");
+
+    ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
+
+    ParametersKey = __DriverGetParametersKey();
+
+    status = RegistryQuerySzValue(ParametersKey,
+                                  "ActiveDeviceID",
+                                  NULL,
+                                  &Ansi);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    status = RtlStringCbPrintfA(DeviceID,
+                                MAX_DEVICE_ID_LEN,
+                                "%Z",
+                                &Ansi[0]);
+    ASSERT(NT_SUCCESS(status));
+
+    RegistryFreeSzValue(Ansi);
+
+    status = RegistryQuerySzValue(ParametersKey,
+                                  "ActiveInstanceID",
+                                  NULL,
+                                  &Ansi);
+    if (!NT_SUCCESS(status))
+        goto fail2;
+
+    status = RtlStringCbPrintfA(InstanceID,
+                                MAX_DEVICE_ID_LEN,
+                                "%Z",
+                                &Ansi[0]);
+    ASSERT(NT_SUCCESS(status));
+
+    RegistryFreeSzValue(Ansi);
+
+    Trace("<====\n");
+
+    return STATUS_SUCCESS;
+
+fail2:
+    Error("fail2\n");
+
+fail1:
+    Error("fail1 (%08x)\n", status);
+
+    return status;
+}
+
+NTSTATUS
+DriverGetActive(
+    OUT PCHAR       DeviceID,
+    OUT PCHAR       InstanceID
+    )
+{
+    return __DriverGetActive(DeviceID, InstanceID);
+}
+
 static BOOLEAN
 DriverIsActivePresent(
     VOID
@@ -256,20 +296,14 @@ DriverIsActivePresent(
     BOOLEAN     Present;
     NTSTATUS    status;
 
-    status = XENFILT_PVDEVICE(Acquire, &Driver.PvdeviceInterface);
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
     status = XENFILT_EMULATED(Acquire, &Driver.EmulatedInterface);
     if (!NT_SUCCESS(status))
-        goto fail2;
+        goto fail1;
 
     Present = FALSE;
 
-    status = XENFILT_PVDEVICE(GetActive,
-                              &Driver.PvdeviceInterface,
-                              ActiveDeviceID,
-                              ActiveInstanceID);
+    status = __DriverGetActive(ActiveDeviceID,
+                               ActiveInstanceID);
     if (!NT_SUCCESS(status))
         goto done;
 
@@ -280,13 +314,9 @@ DriverIsActivePresent(
 
 done:
     XENFILT_EMULATED(Release, &Driver.EmulatedInterface);
-    XENFILT_PVDEVICE(Release, &Driver.PvdeviceInterface);
 
     return Present;
 
-fail2:
-    Error("fail2\n");
-
 fail1:
     Error("fail1 (%08x)\n", status);
 
@@ -385,15 +415,9 @@ DriverUnload(
     RtlZeroMemory(&Driver.List, sizeof (LIST_ENTRY));
     RtlZeroMemory(&Driver.Mutex, sizeof (MUTEX));
 
-    RtlZeroMemory(&Driver.PvdeviceInterface,
-                  sizeof (XENFILT_PVDEVICE_INTERFACE));
-
     RtlZeroMemory(&Driver.EmulatedInterface,
                   sizeof (XENFILT_EMULATED_INTERFACE));
 
-    PvdeviceTeardown(Driver.PvdeviceContext);
-    Driver.PvdeviceContext = NULL;
-
     EmulatedTeardown(Driver.EmulatedContext);
     Driver.EmulatedContext = NULL;
 
@@ -654,7 +678,6 @@ DriverEntry(
     HANDLE                      ServiceKey;
     HANDLE                      ParametersKey;
     PXENFILT_EMULATED_CONTEXT   EmulatedContext;
-    PXENFILT_PVDEVICE_CONTEXT   PvdeviceContext;
     ULONG                       Index;
     NTSTATUS                    status;
 
@@ -711,24 +734,12 @@ DriverEntry(
 
     __DriverSetEmulatedContext(EmulatedContext);
 
-    status = PvdeviceInitialize(&PvdeviceContext);
-    if (!NT_SUCCESS(status))
-        goto fail5;
-
-    __DriverSetPvdeviceContext(PvdeviceContext);
-
     status = EmulatedGetInterface(__DriverGetEmulatedContext(),
                                   XENFILT_EMULATED_INTERFACE_VERSION_MAX,
                                   (PINTERFACE)&Driver.EmulatedInterface,
                                   sizeof (Driver.EmulatedInterface));
     ASSERT(NT_SUCCESS(status));
 
-    status = PvdeviceGetInterface(__DriverGetPvdeviceContext(),
-                                  XENFILT_PVDEVICE_INTERFACE_VERSION_MAX,
-                                  (PINTERFACE)&Driver.PvdeviceInterface,
-                                  sizeof (Driver.PvdeviceInterface));
-    ASSERT(NT_SUCCESS(status));
-
     RegistryCloseKey(ServiceKey);
 
     DriverObject->DriverExtension->AddDevice = DriverAddDevice;
@@ -747,12 +758,6 @@ done:
     Trace("<====\n");
     return STATUS_SUCCESS;
 
-fail5:
-    Error("fail5\n");
-
-    EmulatedTeardown(Driver.EmulatedContext);
-    Driver.EmulatedContext = NULL;
-
 fail4:
     Error("fail4\n");
 
diff --git a/src/xenfilt/driver.h b/src/xenfilt/driver.h
index 772436d..c6ae957 100644
--- a/src/xenfilt/driver.h
+++ b/src/xenfilt/driver.h
@@ -52,6 +52,12 @@ DriverReleaseMutex(
     VOID
      );
 
+extern NTSTATUS
+DriverGetActive(
+    OUT PCHAR   DeviceID,
+    OUT PCHAR   InstanceID
+    );
+
 typedef enum _XENFILT_FILTER_STATE {
     XENFILT_FILTER_ENABLED = 0,
     XENFILT_FILTER_PENDING,
@@ -75,13 +81,6 @@ DriverGetEmulatedContext(
     VOID
     );
 
-#include "pvdevice.h"
-
-PXENFILT_PVDEVICE_CONTEXT
-DriverGetPvdeviceContext(
-    VOID
-    );
-
 typedef struct _XENFILT_FDO XENFILT_FDO, *PXENFILT_FDO;
 typedef struct _XENFILT_PDO XENFILT_PDO, *PXENFILT_PDO;
 
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index e2c8c81..6be7a76 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -37,7 +37,6 @@
 #include <stdlib.h>
 
 #include "emulated.h"
-#include "pvdevice.h"
 #include "names.h"
 #include "fdo.h"
 #include "pdo.h"
@@ -68,8 +67,6 @@ struct _XENFILT_PDO {
 
     XENFILT_EMULATED_OBJECT_TYPE    Type;
     PXENFILT_EMULATED_OBJECT        EmulatedObject;
-
-    XENFILT_PVDEVICE_INTERFACE      PvdeviceInterface;
 };
 
 static FORCEINLINE PVOID
@@ -253,7 +250,7 @@ __PdoGetFdo(
     return Pdo->Fdo;
 }
 
-static NTSTATUS
+static VOID
 PdoSetDeviceInstance(
     IN  PXENFILT_PDO    Pdo,
     IN  PCHAR           DeviceID,
@@ -265,14 +262,8 @@ PdoSetDeviceInstance(
     CHAR                ActiveInstanceID[MAX_DEVICE_ID_LEN];
     NTSTATUS            status;
 
-    status = XENFILT_PVDEVICE(Acquire, &Pdo->PvdeviceInterface);
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
-    status = XENFILT_PVDEVICE(GetActive,
-                              &Pdo->PvdeviceInterface,
-                              ActiveDeviceID,
-                              ActiveInstanceID);
+    status = DriverGetActive(ActiveDeviceID,
+                             ActiveInstanceID);
     if (!NT_SUCCESS(status))
         goto done;
 
@@ -288,8 +279,6 @@ PdoSetDeviceInstance(
     }
 
 done:
-    XENFILT_PVDEVICE(Release, &Pdo->PvdeviceInterface);
-
     status = RtlStringCbPrintfA(Dx->DeviceID,
                                 MAX_DEVICE_ID_LEN,
                                 "%s",
@@ -301,13 +290,6 @@ done:
                                 "%s",
                                 InstanceID);
     ASSERT(NT_SUCCESS(status));
-
-    return STATUS_SUCCESS;
-
-fail1:
-    Error("fail1 (%08x)\n", status);
-
-    return status;
 }
 
 static FORCEINLINE PCHAR
@@ -920,7 +902,6 @@ done:                                                       
        \
 }                                                                   \
 
 DEFINE_PDO_QUERY_INTERFACE(Emulated)
-DEFINE_PDO_QUERY_INTERFACE(Pvdevice)
 
 struct _INTERFACE_ENTRY {
     const GUID  *Guid;
@@ -933,7 +914,6 @@ struct _INTERFACE_ENTRY {
 
 struct _INTERFACE_ENTRY PdoInterfaceTable[] = {
     DEFINE_INTERFACE_ENTRY(EMULATED_INTERFACE, Emulated),
-    DEFINE_INTERFACE_ENTRY(PVDEVICE_INTERFACE, Pvdevice),
     { NULL, NULL, NULL }
 };
 
@@ -2015,15 +1995,7 @@ PdoCreate(
     if (!NT_SUCCESS(status))
         goto fail6;
 
-    status = PvdeviceGetInterface(DriverGetPvdeviceContext(),
-                                  XENFILT_PVDEVICE_INTERFACE_VERSION_MAX,
-                                  (PINTERFACE)&Pdo->PvdeviceInterface,
-                                  sizeof (Pdo->PvdeviceInterface));
-    ASSERT(NT_SUCCESS(status));
-
-    status = PdoSetDeviceInstance(Pdo, DeviceID, InstanceID);
-    if (!NT_SUCCESS(status))
-        goto fail7;
+    PdoSetDeviceInstance(Pdo, DeviceID, InstanceID);
 
     __PdoSetName(Pdo);
 
@@ -2044,12 +2016,6 @@ PdoCreate(
 
     return STATUS_SUCCESS;
 
-fail7:
-    Error("fail7\n");
-
-    RtlZeroMemory(&Pdo->PvdeviceInterface,
-                  sizeof (XENFILT_PVDEVICE_INTERFACE));
-
 fail6:
     Error("fail6\n");
 
@@ -2119,9 +2085,6 @@ PdoDestroy(
 
     RtlZeroMemory(Pdo->Name, sizeof (Pdo->Name));
 
-    RtlZeroMemory(&Pdo->PvdeviceInterface,
-                  sizeof (XENFILT_PVDEVICE_INTERFACE));
-
     EmulatedRemoveObject(DriverGetEmulatedContext(),
                          Pdo->EmulatedObject);
     Pdo->EmulatedObject = NULL;
diff --git a/src/xenfilt/pvdevice.c b/src/xenfilt/pvdevice.c
deleted file mode 100644
index 179dc3d..0000000
--- a/src/xenfilt/pvdevice.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/* 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.
- */
-
-#include <ntddk.h>
-#include <ntstrsafe.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <xen.h>
-
-#include "driver.h"
-#include "registry.h"
-#include "emulated.h"
-#include "pvdevice.h"
-#include "mutex.h"
-#include "dbg_print.h"
-#include "assert.h"
-#include "util.h"
-
-struct _XENFILT_PVDEVICE_CONTEXT {
-    KSPIN_LOCK                  Lock;
-    LONG                        References;
-    XENFILT_EMULATED_INTERFACE  EmulatedInterface;
-    MUTEX                       Mutex;
-};
-
-#define XENFILT_PVDEVICE_TAG    'EDVP'
-
-static FORCEINLINE PVOID
-__PvdeviceAllocate(
-    IN  ULONG   Length
-    )
-{
-    return __AllocatePoolWithTag(NonPagedPool, Length, XENFILT_PVDEVICE_TAG);
-}
-
-static FORCEINLINE VOID
-__PvdeviceFree(
-    IN  PVOID   Buffer
-    )
-{
-    ExFreePoolWithTag(Buffer, XENFILT_PVDEVICE_TAG);
-}
-
-static const CHAR *PvdeviceLegacyPrefix[] = {
-    "PCI\\VEN_5853&DEV_0001",
-    "PCI\\VEN_5853&DEV_0002",
-    NULL
-};
-
-static BOOLEAN
-PvdeviceIsLegacy(
-    IN  PXENFILT_PVDEVICE_CONTEXT   Context,
-    IN  PCHAR                       DeviceID
-    )
-{
-    ULONG                           Index;
-
-    UNREFERENCED_PARAMETER(Context);
-
-    for (Index = 0; PvdeviceLegacyPrefix[Index] != NULL; Index++) {
-        const CHAR  *Prefix = PvdeviceLegacyPrefix[Index];
-
-        if (_strnicmp(DeviceID, Prefix, strlen(Prefix)) == 0)
-            return TRUE;
-    }
-
-    return FALSE;
-}
-
-static const CHAR *PvdeviceVendorDeviceID[] = {
-#ifdef VENDOR_DEVICE_ID_STR
-    "PCI\\VEN_5853&DEV_" VENDOR_DEVICE_ID_STR "&SUBSYS_C0005853&REV_01",
-#endif
-    NULL
-};
-
-static BOOLEAN
-PvdeviceIsVendorPresent(
-    IN  PXENFILT_PVDEVICE_CONTEXT   Context
-    )
-{
-    ULONG                           Index;
-
-    for (Index = 0; PvdeviceVendorDeviceID[Index] != NULL; Index++) {
-        const CHAR  *DeviceID = PvdeviceVendorDeviceID[Index];
-
-        if (XENFILT_EMULATED(IsDevicePresent,
-                             &Context->EmulatedInterface,
-                             (PCHAR)DeviceID,
-                             NULL))
-            return TRUE;
-    }
-
-    return FALSE;
-}
-
-static NTSTATUS
-PvdeviceGetActive(
-    IN  PINTERFACE              Interface,
-    OUT PCHAR                   DeviceID,
-    OUT PCHAR                   InstanceID
-    )
-{
-    PXENFILT_PVDEVICE_CONTEXT   Context = Interface->Context;
-    HANDLE                      ParametersKey;
-    PANSI_STRING                Ansi;
-    NTSTATUS                    status;
-
-    Trace("====>\n");
-
-    ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
-
-    ParametersKey = DriverGetParametersKey();
-
-    AcquireMutex(&Context->Mutex);
-
-    status = RegistryQuerySzValue(ParametersKey,
-                                  "ActiveDeviceID",
-                                  NULL,
-                                  &Ansi);
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
-    status = RtlStringCbPrintfA(DeviceID,
-                                MAX_DEVICE_ID_LEN,
-                                "%Z",
-                                &Ansi[0]);
-    ASSERT(NT_SUCCESS(status));
-
-    RegistryFreeSzValue(Ansi);
-
-    status = RegistryQuerySzValue(ParametersKey,
-                                  "ActiveInstanceID",
-                                  NULL,
-                                  &Ansi);
-    if (!NT_SUCCESS(status))
-        goto fail2;
-
-    status = RtlStringCbPrintfA(InstanceID,
-                                MAX_DEVICE_ID_LEN,
-                                "%Z",
-                                &Ansi[0]);
-    ASSERT(NT_SUCCESS(status));
-
-    RegistryFreeSzValue(Ansi);
-
-    ReleaseMutex(&Context->Mutex);
-
-    Trace("<====\n");
-
-    return STATUS_SUCCESS;
-
-fail2:
-fail1:
-    ReleaseMutex(&Context->Mutex);
-
-    return status;
-}
-
-static NTSTATUS
-PvdeviceSetActive(
-    IN  PINTERFACE              Interface,
-    IN  PCHAR                   DeviceID,
-    IN  PCHAR                   InstanceID
-    )
-{
-    PXENFILT_PVDEVICE_CONTEXT   Context = Interface->Context;
-    HANDLE                      ParametersKey;
-    ANSI_STRING                 Ansi[2];
-    NTSTATUS                    status;
-
-    Trace("====>\n");
-
-    ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
-
-    ParametersKey = DriverGetParametersKey();
-
-    AcquireMutex(&Context->Mutex);
-
-    status = STATUS_UNSUCCESSFUL;
-    if (PvdeviceIsLegacy(Context, DeviceID) &&
-        PvdeviceIsVendorPresent(Context))
-        goto fail1;
-
-    RtlZeroMemory(Ansi, sizeof (ANSI_STRING) * 2);
-
-    RtlInitAnsiString(&Ansi[0], DeviceID);
-
-    status = RegistryUpdateSzValue(ParametersKey,
-                                   "ActiveDeviceID",
-                                   REG_SZ,
-                                   Ansi);
-    if (!NT_SUCCESS(status))
-        goto fail2;
-
-    RtlInitAnsiString(&Ansi[0], InstanceID);
-
-    status = RegistryUpdateSzValue(ParametersKey,
-                                   "ActiveInstanceID",
-                                   REG_SZ,
-                                   Ansi);
-    if (!NT_SUCCESS(status))
-        goto fail3;
-
-    Info("%s\\%s\n", DeviceID, InstanceID);
-
-    ReleaseMutex(&Context->Mutex);
-
-    Trace("<====\n");
-
-    return STATUS_SUCCESS;
-
-fail3:
-fail2:
-fail1:
-    ReleaseMutex(&Context->Mutex);
-
-    return status;
-}
-
-static NTSTATUS
-PvdeviceClearActive(
-    IN  PINTERFACE              Interface
-    )
-{
-    PXENFILT_PVDEVICE_CONTEXT   Context = Interface->Context;
-    HANDLE                      ParametersKey;
-    NTSTATUS                    status;
-
-    Trace("====>\n");
-
-    ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
-
-    ParametersKey = DriverGetParametersKey();
-
-    AcquireMutex(&Context->Mutex);
-
-    status = RegistryDeleteValue(ParametersKey,
-                                 "ActiveDeviceID");
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
-    status = RegistryDeleteValue(ParametersKey,
-                                 "ActiveInstanceID");
-    if (!NT_SUCCESS(status))
-        goto fail2;
-
-    Info("DONE\n");
-
-    ReleaseMutex(&Context->Mutex);
-
-    Trace("<====\n");
-
-    return STATUS_SUCCESS;
-
-fail2:
-fail1:
-    ReleaseMutex(&Context->Mutex);
-
-    return status;
-}
-
-static NTSTATUS
-PvdeviceAcquire(
-    IN  PINTERFACE              Interface
-    )
-{
-    PXENFILT_PVDEVICE_CONTEXT   Context = Interface->Context;
-    KIRQL                       Irql;
-    NTSTATUS                    status;
-
-    KeAcquireSpinLock(&Context->Lock, &Irql);
-
-    if (Context->References++ != 0)
-        goto done;
-
-    Trace("====>\n");
-
-    status = XENFILT_EMULATED(Acquire, &Context->EmulatedInterface);
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
-    Trace("<====\n");
-
-done:
-    KeReleaseSpinLock(&Context->Lock, Irql);
-
-    return STATUS_SUCCESS;
-
-fail1:
-    Error("fail1 (%08x)\n", status);
-
-    KeReleaseSpinLock(&Context->Lock, Irql);
-
-    return status;
-}
-
-static VOID
-PvdeviceRelease(
-    IN  PINTERFACE              Interface
-    )
-{
-    PXENFILT_PVDEVICE_CONTEXT   Context = Interface->Context;
-    KIRQL                       Irql;
-
-    KeAcquireSpinLock(&Context->Lock, &Irql);
-
-    if (--Context->References > 0)
-        goto done;
-
-    Trace("====>\n");
-
-    XENFILT_EMULATED(Release, &Context->EmulatedInterface);
-
-    Trace("<====\n");
-
-done:
-    KeReleaseSpinLock(&Context->Lock, Irql);
-}
-
-static struct _XENFILT_PVDEVICE_INTERFACE_V1 PvdeviceInterfaceVersion1 = {
-    { sizeof (struct _XENFILT_PVDEVICE_INTERFACE_V1), 1, NULL, NULL, NULL },
-    PvdeviceAcquire,
-    PvdeviceRelease,
-    PvdeviceGetActive,
-    PvdeviceSetActive,
-    PvdeviceClearActive
-};
-
-NTSTATUS
-PvdeviceInitialize(
-    OUT PXENFILT_PVDEVICE_CONTEXT   *Context
-    )
-{
-    NTSTATUS                        status;
-
-    Trace("====>\n");
-
-    *Context = __PvdeviceAllocate(sizeof (XENFILT_PVDEVICE_CONTEXT));
-
-    status = STATUS_NO_MEMORY;
-    if (*Context == NULL)
-        goto fail1;
-
-    status = EmulatedGetInterface(DriverGetEmulatedContext(),
-                                  XENFILT_EMULATED_INTERFACE_VERSION_MAX,
-                                  (PINTERFACE)&(*Context)->EmulatedInterface,
-                                  sizeof ((*Context)->EmulatedInterface));
-    ASSERT(NT_SUCCESS(status));
-
-    KeInitializeSpinLock(&(*Context)->Lock);
-    InitializeMutex(&(*Context)->Mutex);
-
-    Trace("<====\n");
-
-    return STATUS_SUCCESS;
-
-fail1:
-    Error("fail1 (%08x)\n", status);
-
-    return status;
-}
-
-NTSTATUS
-PvdeviceGetInterface(
-    IN      PXENFILT_PVDEVICE_CONTEXT   Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
-    )
-{
-    NTSTATUS                            status;
-
-    ASSERT(Context != NULL);
-
-    switch (Version) {
-    case 1: {
-        struct _XENFILT_PVDEVICE_INTERFACE_V1   *PvdeviceInterface;
-
-        PvdeviceInterface = (struct _XENFILT_PVDEVICE_INTERFACE_V1 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENFILT_PVDEVICE_INTERFACE_V1))
-            break;
-
-        *PvdeviceInterface = PvdeviceInterfaceVersion1;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
-    default:
-        status = STATUS_NOT_SUPPORTED;
-        break;
-    }
-
-    return status;
-}
-
-VOID
-PvdeviceTeardown(
-    IN  PXENFILT_PVDEVICE_CONTEXT   Context
-    )
-{
-    Trace("====>\n");
-
-    RtlZeroMemory(&Context->Mutex, sizeof (MUTEX));
-    RtlZeroMemory(&Context->Lock, sizeof (KSPIN_LOCK));
-
-    RtlZeroMemory(&Context->EmulatedInterface,
-                  sizeof (XENFILT_EMULATED_INTERFACE));
-
-    ASSERT(IsZeroMemory(Context, sizeof (XENFILT_PVDEVICE_CONTEXT)));
-    __PvdeviceFree(Context);
-
-    Trace("<====\n");
-}
diff --git a/src/xenfilt/pvdevice.h b/src/xenfilt/pvdevice.h
deleted file mode 100644
index 30cd81c..0000000
--- a/src/xenfilt/pvdevice.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* 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.
- */
-
-#ifndef _XENFILT_PVDEVICE_H
-#define _XENFILT_PVDEVICE_H
-
-#include <ntddk.h>
-#include <xen.h>
-#include <pvdevice_interface.h>
-
-typedef struct _XENFILT_PVDEVICE_CONTEXT XENFILT_PVDEVICE_CONTEXT, 
*PXENFILT_PVDEVICE_CONTEXT;
-
-extern NTSTATUS
-PvdeviceInitialize(
-    OUT PXENFILT_PVDEVICE_CONTEXT   *Context
-    );
-
-extern NTSTATUS
-PvdeviceGetInterface(
-    IN      PXENFILT_PVDEVICE_CONTEXT   Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
-    );
-
-extern VOID
-PvdeviceTeardown(
-    IN  PXENFILT_PVDEVICE_CONTEXT   Context
-    );
-
-#endif  // _XENFILT_PVDEVICE_H
diff --git a/vs2012/xenfilt/xenfilt.vcxproj b/vs2012/xenfilt/xenfilt.vcxproj
index 6554ec9..4d5747d 100644
--- a/vs2012/xenfilt/xenfilt.vcxproj
+++ b/vs2012/xenfilt/xenfilt.vcxproj
@@ -69,7 +69,6 @@
     <ClCompile Include="../../src/common/registry.c" />
     <ClCompile Include="../../src/xenfilt/driver.c" />
     <ClCompile Include="../../src/xenfilt/emulated.c" />
-    <ClCompile Include="../../src/xenfilt/pvdevice.c" />
     <ClCompile Include="../../src/xenfilt/fdo.c" />
     <ClCompile Include="../../src/xenfilt/pdo.c" />
     <ClCompile Include="../../src/xenfilt/thread.c" />
diff --git a/vs2013/xenfilt/xenfilt.vcxproj b/vs2013/xenfilt/xenfilt.vcxproj
index 6250fcb..4f749b1 100644
--- a/vs2013/xenfilt/xenfilt.vcxproj
+++ b/vs2013/xenfilt/xenfilt.vcxproj
@@ -72,7 +72,6 @@
     <ClCompile Include="../../src/common/registry.c" />
     <ClCompile Include="../../src/xenfilt/driver.c" />
     <ClCompile Include="../../src/xenfilt/emulated.c" />
-    <ClCompile Include="../../src/xenfilt/pvdevice.c" />
     <ClCompile Include="../../src/xenfilt/fdo.c" />
     <ClCompile Include="../../src/xenfilt/pdo.c" />
     <ClCompile Include="../../src/xenfilt/thread.c" />
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.