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

[PATCH xenbus 5/8] Create interface to retrieve XEN driver 'Parameters' key



From: Paul Durrant <pdurrant@xxxxxxxxxx>

Subsequent patches will need to query a parameter. This patch simply adds the
interface.

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 src/xen/driver.c | 36 ++++++++++++++++++++++++++++++++++--
 src/xen/driver.h |  5 +++++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/xen/driver.c b/src/xen/driver.c
index 4670539b488a..3f126eefa8f2 100644
--- a/src/xen/driver.c
+++ b/src/xen/driver.c
@@ -60,6 +60,7 @@
 typedef struct _XEN_DRIVER {
     PLOG_DISPOSITION    XenDisposition;
     PLOG_DISPOSITION    QemuDisposition;
+    HANDLE              ParametersKey;
     HANDLE              UnplugKey;
     HANDLE              MemoryKey;
 } XEN_DRIVER, *PXEN_DRIVER;
@@ -94,6 +95,30 @@ __DriverSafeMode(
     return (*InitSafeBootMode > 0) ? TRUE : FALSE;
 }
 
+static FORCEINLINE VOID
+__DriverSetParametersKey(
+    IN  HANDLE  Key
+    )
+{
+    Driver.ParametersKey = Key;
+}
+
+static FORCEINLINE HANDLE
+__DriverGetParametersKey(
+    VOID
+    )
+{
+    return Driver.ParametersKey;
+}
+
+HANDLE
+DriverGetParametersKey(
+    VOID
+    )
+{
+    return __DriverGetParametersKey();
+}
+
 static FORCEINLINE VOID
 __DriverSetUnplugKey(
     IN  HANDLE  Key
@@ -504,6 +529,8 @@ DllInitialize(
     if (!NT_SUCCESS(status))
         goto fail4;
 
+    __DriverSetParametersKey(ParametersKey);
+
     status = LogReadLogLevel(ParametersKey,
                              "XenLogLevel",
                              &LogLevel);
@@ -584,8 +611,6 @@ DllInitialize(
     if (!NT_SUCCESS(status))
         goto fail12;
 
-    RegistryCloseKey(ParametersKey);
-
     RegistryCloseKey(ServiceKey);
 
     Trace("<====\n");
@@ -641,6 +666,7 @@ fail5:
     Driver.XenDisposition = NULL;
 
     RegistryCloseKey(ParametersKey);
+    __DriverSetParametersKey(NULL);
 
 fail4:
     Error("fail4\n");
@@ -672,6 +698,7 @@ DllUnload(
 {
     HANDLE  MemoryKey;
     HANDLE  UnplugKey;
+    HANDLE  ParametersKey;
 
     Trace("====>\n");
 
@@ -699,6 +726,11 @@ DllUnload(
     RegistryCloseKey(UnplugKey);
     __DriverSetUnplugKey(NULL);
 
+    ParametersKey = __DriverGetParametersKey();
+
+    RegistryCloseKey(ParametersKey);
+    __DriverSetParametersKey(NULL);
+
     RegistryTeardown();
 
     Info("XEN %d.%d.%d (%d) (%02d.%02d.%04d)\n",
diff --git a/src/xen/driver.h b/src/xen/driver.h
index 8c39735147c6..11b421b10f76 100644
--- a/src/xen/driver.h
+++ b/src/xen/driver.h
@@ -32,6 +32,11 @@
 #ifndef _XEN_DRIVER_H
 #define _XEN_DRIVER_H
 
+extern HANDLE
+DriverGetParametersKey(
+    VOID
+    );
+
 extern HANDLE
 DriverGetUnplugKey(
     VOID
-- 
2.17.1




 


Rackspace

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