qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 2/4] qga: Fix an enum conversion warningincom


From: GH Cao
Subject: Re: [Qemu-devel] [PATCH v2 2/4] qga: Fix an enum conversion warningincommands-win32.c, hit by clang.
Date: Fri, 3 May 2019 06:24:36 +0800

On 5/3/19 6:20 AM, Eric Blake wrote:

> Where is enum STORAGE_BUS_TYPE defined? 
In the Windows SDK (winioctl.h), so a two-way conversion table is needed.

> In fact, it looks like win2qemu[] is supposed to be that table,
> but it was incorrectly written.  You WANT to do:

> diff --git i/qga/commands-win32.c w/qga/commands-win32.c
> index d40d61f605c..6b67f16faf1 100644
> --- i/qga/commands-win32.c
> +++ w/qga/commands-win32.c
> @@ -457,7 +457,7 @@ void qmp_guest_file_flush(int64_t handle, Error **errp)
>
> #ifdef CONFIG_QGA_NTDDSCSI
>
> -static STORAGE_BUS_TYPE win2qemu[] = {
> +static GuestDiskBusType win2qemu[] = {
>     [BusTypeUnknown] = GUEST_DISK_BUS_TYPE_UNKNOWN,
>     [BusTypeScsi] = GUEST_DISK_BUS_TYPE_SCSI,
>     [BusTypeAtapi] = GUEST_DISK_BUS_TYPE_IDE,
>
> with no casts needed, either in the table or in the function that
> references the table.

Yes, I can confirm that fixes the issue, and clearly better than my previous 
effort.
I'll use this instead in my upcoming v3 patch set.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]