qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/raw-win32: Always use -errno in hdev_open
@ 2013-10-11 12:30 Max Reitz
  2013-10-11 12:42 ` Eric Blake
  2013-10-17 12:55 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Max Reitz @ 2013-10-11 12:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Max Reitz

On one occasion, hdev_open() returned -1 in case of an unknown error
instead of a proper -errno value. Adjust this to match the behavior of
raw_open() (in raw-win32), which is to return -EINVAL in this case.
Also, change the call to error_setg*() to match the one in raw_open() as
well.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
Follow-up to (as suggested by Eric):
 - block/raw-win32: Employ error parameter
   (3/5 from the "block: Employ error parameter" series)
---
 block/raw-win32.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/block/raw-win32.c b/block/raw-win32.c
index c3e4c62..676b570 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -590,12 +590,11 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
         int err = GetLastError();
 
         if (err == ERROR_ACCESS_DENIED) {
-            error_setg_errno(errp, EACCES, "Could not open device");
             ret = -EACCES;
         } else {
-            error_setg(errp, "Could not open device");
-            ret = -1;
+            ret = -EINVAL;
         }
+        error_setg_errno(errp, -ret, "Could not open device");
         goto done;
     }
 
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] block/raw-win32: Always use -errno in hdev_open
  2013-10-11 12:30 [Qemu-devel] [PATCH] block/raw-win32: Always use -errno in hdev_open Max Reitz
@ 2013-10-11 12:42 ` Eric Blake
  2013-10-17 12:55 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2013-10-11 12:42 UTC (permalink / raw)
  To: Max Reitz, qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

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

On 10/11/2013 06:30 AM, Max Reitz wrote:
> On one occasion, hdev_open() returned -1 in case of an unknown error
> instead of a proper -errno value. Adjust this to match the behavior of
> raw_open() (in raw-win32), which is to return -EINVAL in this case.
> Also, change the call to error_setg*() to match the one in raw_open() as
> well.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> Follow-up to (as suggested by Eric):
>  - block/raw-win32: Employ error parameter
>    (3/5 from the "block: Employ error parameter" series)
> ---
>  block/raw-win32.c | 5 ++---
>  1 file changed, 2 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: 621 bytes --]

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

* Re: [Qemu-devel] [PATCH] block/raw-win32: Always use -errno in hdev_open
  2013-10-11 12:30 [Qemu-devel] [PATCH] block/raw-win32: Always use -errno in hdev_open Max Reitz
  2013-10-11 12:42 ` Eric Blake
@ 2013-10-17 12:55 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-10-17 12:55 UTC (permalink / raw)
  To: Max Reitz; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

On Fri, Oct 11, 2013 at 02:30:16PM +0200, Max Reitz wrote:
> On one occasion, hdev_open() returned -1 in case of an unknown error
> instead of a proper -errno value. Adjust this to match the behavior of
> raw_open() (in raw-win32), which is to return -EINVAL in this case.
> Also, change the call to error_setg*() to match the one in raw_open() as
> well.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> Follow-up to (as suggested by Eric):
>  - block/raw-win32: Employ error parameter
>    (3/5 from the "block: Employ error parameter" series)
> ---
>  block/raw-win32.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

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

Stefan

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

end of thread, other threads:[~2013-10-17 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 12:30 [Qemu-devel] [PATCH] block/raw-win32: Always use -errno in hdev_open Max Reitz
2013-10-11 12:42 ` Eric Blake
2013-10-17 12:55 ` 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).