|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH 1/2] Continue checking for emulated type if not PCI or IDE
> -----Original Message-----
> From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf
> Of Owen Smith
> Sent: 05 February 2020 16:53
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH 1/2] Continue checking for emulated type if
> not PCI or IDE
>
> When determining the XENFILT_EMULATED_OBJECT_TYPE, keep trying all
> supplied HardwareIDs/CompatibleIDs until an exact match is made. If an
> early match is made that is not a valid type, ignore the match and
> continue checking for either "PCI" or "IDE".
> This covers situations where XenFilt's Parameters key contains stale
> strings from previous (v8.x) versions, and fixes an upgrade failure when
> upgrading v8.x to v9.x
>
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
> src/xenfilt/driver.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
> index 0167c21..53df169 100644
> --- a/src/xenfilt/driver.c
> +++ b/src/xenfilt/driver.c
> @@ -760,7 +760,8 @@ DriverGetEmulatedType(
> Type = XENFILT_EMULATED_OBJECT_TYPE_IDE;
>
> RegistryFreeSzValue(Ansi);
> - break;
> + if (Type != XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN)
> + break;
> } else {
> Trace("NO MATCH: %s\n", &Id[Index]);
> }
> --
I think it would be neater to code it as follows:
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 0167c21..8f14ec8 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -738,7 +738,7 @@ DriverGetEmulatedType(
Type = XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN;
Index = 0;
- for (;;) {
+ do {
ULONG Length;
PANSI_STRING Ansi;
NTSTATUS status;
@@ -760,13 +760,12 @@ DriverGetEmulatedType(
Type = XENFILT_EMULATED_OBJECT_TYPE_IDE;
RegistryFreeSzValue(Ansi);
- break;
} else {
Trace("NO MATCH: %s\n", &Id[Index]);
}
Index += Length + 1;
- }
+ } while (Type == XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN);
return Type;
}
Paul
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |