qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event()
@ 2014-10-10 19:33 Peter Maydell
  2014-10-10 19:40 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2014-10-10 19:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Luiz Capitulino, Stefan Hajnoczi, patches

The local variable 'ac' in send_qmp_error_event() is declared with the
wrong type, which causes clang to complain when it is initialized
and again when it is used:

block.c:3655:20: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
    ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
       ~           ^~~~~~~~~~~~~~~~~~~~~~
block.c:3655:45: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
    ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
       ~                                    ^~~~~~~~~~~~~~~~~~~~~~~
block.c:3656:62: warning: implicit conversion from enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') to different enumeration type 'IoOperationType' (aka 'enum IoOperationType') [-Wenum-conversion]
    qapi_event_send_block_io_error(bdrv_get_device_name(bs), ac, action,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                           ^~

Correct the type to IoOperationType, and rename the variable
to 'optype' to match its correct type.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Bug introduced when this code was pulled out into its
own function in commit c7c2ff0c7e5d2c04.

 block.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block.c b/block.c
index d3aebeb..b61baca 100644
--- a/block.c
+++ b/block.c
@@ -3650,10 +3650,10 @@ static void send_qmp_error_event(BlockDriverState *bs,
                                  BlockErrorAction action,
                                  bool is_read, int error)
 {
-    BlockErrorAction ac;
+    IoOperationType optype;
 
-    ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
-    qapi_event_send_block_io_error(bdrv_get_device_name(bs), ac, action,
+    optype = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
+    qapi_event_send_block_io_error(bdrv_get_device_name(bs), optype, action,
                                    bdrv_iostatus_is_enabled(bs),
                                    error == ENOSPC, strerror(error),
                                    &error_abort);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event()
  2014-10-10 19:33 [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event() Peter Maydell
@ 2014-10-10 19:40 ` Eric Blake
  2014-10-22 12:44 ` Luiz Capitulino
  2014-10-28 15:10 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2014-10-10 19:40 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Kevin Wolf, Luiz Capitulino, Stefan Hajnoczi, patches

[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]

On 10/10/2014 01:33 PM, Peter Maydell wrote:
> The local variable 'ac' in send_qmp_error_event() is declared with the
> wrong type, which causes clang to complain when it is initialized
> and again when it is used:
> 
> block.c:3655:20: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
>     ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
>        ~           ^~~~~~~~~~~~~~~~~~~~~~
> block.c:3655:45: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
>     ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
>        ~                                    ^~~~~~~~~~~~~~~~~~~~~~~
> block.c:3656:62: warning: implicit conversion from enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') to different enumeration type 'IoOperationType' (aka 'enum IoOperationType') [-Wenum-conversion]
>     qapi_event_send_block_io_error(bdrv_get_device_name(bs), ac, action,
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                           ^~
> 
> Correct the type to IoOperationType, and rename the variable
> to 'optype' to match its correct type.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Bug introduced when this code was pulled out into its
> own function in commit c7c2ff0c7e5d2c04.
> 
>  block.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event()
  2014-10-10 19:33 [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event() Peter Maydell
  2014-10-10 19:40 ` Eric Blake
@ 2014-10-22 12:44 ` Luiz Capitulino
  2014-10-28 15:10 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Capitulino @ 2014-10-22 12:44 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi, patches

On Fri, 10 Oct 2014 20:33:03 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:

> The local variable 'ac' in send_qmp_error_event() is declared with the
> wrong type, which causes clang to complain when it is initialized
> and again when it is used:
> 
> block.c:3655:20: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
>     ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
>        ~           ^~~~~~~~~~~~~~~~~~~~~~
> block.c:3655:45: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
>     ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
>        ~                                    ^~~~~~~~~~~~~~~~~~~~~~~
> block.c:3656:62: warning: implicit conversion from enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') to different enumeration type 'IoOperationType' (aka 'enum IoOperationType') [-Wenum-conversion]
>     qapi_event_send_block_io_error(bdrv_get_device_name(bs), ac, action,
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                           ^~
> 
> Correct the type to IoOperationType, and rename the variable
> to 'optype' to match its correct type.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>

I'm assuming this will go in via block layer tree.

> ---
> Bug introduced when this code was pulled out into its
> own function in commit c7c2ff0c7e5d2c04.
> 
>  block.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block.c b/block.c
> index d3aebeb..b61baca 100644
> --- a/block.c
> +++ b/block.c
> @@ -3650,10 +3650,10 @@ static void send_qmp_error_event(BlockDriverState *bs,
>                                   BlockErrorAction action,
>                                   bool is_read, int error)
>  {
> -    BlockErrorAction ac;
> +    IoOperationType optype;
>  
> -    ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
> -    qapi_event_send_block_io_error(bdrv_get_device_name(bs), ac, action,
> +    optype = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
> +    qapi_event_send_block_io_error(bdrv_get_device_name(bs), optype, action,
>                                     bdrv_iostatus_is_enabled(bs),
>                                     error == ENOSPC, strerror(error),
>                                     &error_abort);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event()
  2014-10-10 19:33 [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event() Peter Maydell
  2014-10-10 19:40 ` Eric Blake
  2014-10-22 12:44 ` Luiz Capitulino
@ 2014-10-28 15:10 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-10-28 15:10 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Kevin Wolf, patches, qemu-devel, Stefan Hajnoczi, Luiz Capitulino

[-- Attachment #1: Type: text/plain, Size: 1702 bytes --]

On Fri, Oct 10, 2014 at 08:33:03PM +0100, Peter Maydell wrote:
> The local variable 'ac' in send_qmp_error_event() is declared with the
> wrong type, which causes clang to complain when it is initialized
> and again when it is used:
> 
> block.c:3655:20: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
>     ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
>        ~           ^~~~~~~~~~~~~~~~~~~~~~
> block.c:3655:45: warning: implicit conversion from enumeration type 'enum IoOperationType' to different enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') [-Wenum-conversion]
>     ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
>        ~                                    ^~~~~~~~~~~~~~~~~~~~~~~
> block.c:3656:62: warning: implicit conversion from enumeration type 'BlockErrorAction' (aka 'enum BlockErrorAction') to different enumeration type 'IoOperationType' (aka 'enum IoOperationType') [-Wenum-conversion]
>     qapi_event_send_block_io_error(bdrv_get_device_name(bs), ac, action,
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                           ^~
> 
> Correct the type to IoOperationType, and rename the variable
> to 'optype' to match its correct type.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Bug introduced when this code was pulled out into its
> own function in commit c7c2ff0c7e5d2c04.
> 
>  block.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-28 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-10 19:33 [Qemu-devel] [PATCH] block.c: Fix type of IoOperationType variable in send_qmp_error_event() Peter Maydell
2014-10-10 19:40 ` Eric Blake
2014-10-22 12:44 ` Luiz Capitulino
2014-10-28 15:10 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).