[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


  • To: Owen Smith <owen.smith@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Durrant, Paul" <pdurrant@xxxxxxxxxxxx>
  • Date: Thu, 6 Feb 2020 15:08:05 +0000
  • Accept-language: en-GB, en-US
  • Delivery-date: Thu, 06 Feb 2020 15:08:27 +0000
  • Ironport-sdr: U8R1c02S3QhhTMF3mvYvsu7HMXpCjIABngGX/peg6EbxM3qrX6xRNeUPfal99ks4/CT3QCsmlB E7KOcmbK5lmA==
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHV3ETSyhap9gI9Q0SNIcltD4uuCagORaaw
  • Thread-topic: [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

 


Rackspace

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