|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Add the 'NeedReboot' flag back in
Older versions of the code used to set a 'NeedReboot' registry value if
the PDO failed to start because the corresponding emulated device was
found to be still present. The value was set directly in the service key
which is non-volatile and thus the value would persist after reboot.
This patch adds code to again set a 'NeedReboot' value, but this time it
is in a volatile 'Status' key under the service key so that it does not
persist. This value can then be used by the XENNET co-installer to
determine whether it should request a reboot during postinstall
processing.
Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
src/xenvif/driver.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
src/xenvif/driver.h | 2 +-
src/xenvif/pdo.c | 23 +++++++++++++++++++++++
3 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/src/xenvif/driver.c b/src/xenvif/driver.c
index 8cf843f..b9e6d2f 100644
--- a/src/xenvif/driver.c
+++ b/src/xenvif/driver.c
@@ -48,6 +48,7 @@ typedef struct _XENVIF_DRIVER {
PDRIVER_OBJECT DriverObject;
HANDLE ParametersKey;
HANDLE AddressesKey;
+ HANDLE StatusKey;
} XENVIF_DRIVER, *PXENVIF_DRIVER;
static XENVIF_DRIVER Driver;
@@ -124,6 +125,30 @@ DriverGetAddressesKey(
return __DriverGetAddressesKey();
}
+static FORCEINLINE VOID
+__DriverSetStatusKey(
+ IN HANDLE Key
+ )
+{
+ Driver.StatusKey = Key;
+}
+
+static FORCEINLINE HANDLE
+__DriverGetStatusKey(
+ VOID
+ )
+{
+ return Driver.StatusKey;
+}
+
+HANDLE
+DriverGetStatusKey(
+ VOID
+ )
+{
+ return __DriverGetStatusKey();
+}
+
DRIVER_UNLOAD DriverUnload;
VOID
@@ -133,6 +158,7 @@ DriverUnload(
{
HANDLE AddressesKey;
HANDLE ParametersKey;
+ HANDLE StatusKey;
ASSERT3P(DriverObject, ==, __DriverGetDriverObject());
@@ -141,7 +167,12 @@ DriverUnload(
if (*InitSafeBootMode > 0)
goto done;
- AddressesKey = __DriverGetParametersKey();
+ StatusKey = __DriverGetStatusKey();
+ __DriverSetStatusKey(NULL);
+
+ RegistryCloseKey(StatusKey);
+
+ AddressesKey = __DriverGetAddressesKey();
__DriverSetAddressesKey(NULL);
RegistryCloseKey(AddressesKey);
@@ -254,6 +285,7 @@ DriverEntry(
HANDLE ServiceKey;
HANDLE ParametersKey;
HANDLE AddressesKey;
+ HANDLE StatusKey;
ULONG Index;
NTSTATUS status;
@@ -308,6 +340,15 @@ DriverEntry(
__DriverSetAddressesKey(AddressesKey);
+ status = RegistryCreateSubKey(ServiceKey,
+ "Status",
+ REG_OPTION_VOLATILE,
+ &StatusKey);
+ if (!NT_SUCCESS(status))
+ goto fail5;
+
+ __DriverSetStatusKey(StatusKey);
+
RegistryCloseKey(ServiceKey);
DriverObject->DriverExtension->AddDevice = AddDevice;
@@ -323,6 +364,13 @@ done:
return STATUS_SUCCESS;
+fail5:
+ Error("fail5\n");
+
+ __DriverSetAddressesKey(NULL);
+
+ RegistryCloseKey(AddressesKey);
+
fail4:
Error("fail4\n");
diff --git a/src/xenvif/driver.h b/src/xenvif/driver.h
index cdef7d1..17ed726 100644
--- a/src/xenvif/driver.h
+++ b/src/xenvif/driver.h
@@ -48,7 +48,7 @@ DriverGetAddressesKey(
);
extern HANDLE
-DriverGetAliasesKey(
+DriverGetStatusKey(
VOID
);
diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index 369efb0..9352594 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -1207,6 +1207,26 @@ PdoS3ToS4(
Trace("(%s) <====\n", __PdoGetName(Pdo));
}
+static VOID
+PdoRequestReboot(
+ IN PXENVIF_PDO Pdo
+ )
+{
+ HANDLE StatusKey;
+
+ UNREFERENCED_PARAMETER(Pdo);
+
+ Info("<===>\n");
+
+ ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
+
+ StatusKey = DriverGetStatusKey();
+
+ (VOID) RegistryUpdateDwordValue(StatusKey,
+ "NeedReboot",
+ 1);
+}
+
static DECLSPEC_NOINLINE NTSTATUS
PdoStartDevice(
IN PXENVIF_PDO Pdo,
@@ -1292,9 +1312,12 @@ fail6:
fail5:
Error("fail5\n");
+ goto fail3;
+
fail4:
Error("fail4\n");
+ PdoRequestReboot(Pdo);
__FreeMibTable(Table);
fail3:
--
2.1.1
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |