[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/15] net: Permit incremental conversion of ini
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 02/15] net: Permit incremental conversion of init functions to Error |
Date: |
Thu, 14 May 2015 09:45:05 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 05/12/2015 06:02 AM, Markus Armbruster wrote:
> Error reporting for netdev_add is broken: the net_client_init_fun[]
> report the actual errors with (at best) error_report(), and their
> caller net_client_init1() makes up a generic error on top.
>
> For command line and HMP, this produces an mildly ugly error cascande.
s/cascande/cascade/
>
> In QMP, the actual errors go to stderr, and the generic error becomes
> the command's error reply.
>
> To fix this, we need to convert the net_client_init_fun[] to Error.
>
> To permit fixing them one by one, add an Error ** parameter to the
> net_client_init_fun[]. If the call fails without returning an Error,
> make up the same generic Error as before. But if it returns one, use
> that instead. Since none of them does so far, no functional change.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> @@ -802,7 +803,7 @@ static int net_init_nic(const NetClientOptions *opts,
> const char *name,
> static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
> const NetClientOptions *opts,
> const char *name,
> - NetClientState *peer) = {
> + NetClientState *peer, Error **errp) = {
> [NET_CLIENT_OPTIONS_KIND_NIC] = net_init_nic,
Not this patch, but would this be easier to read with the use of a
typedef for the function pointer?
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 12/15] tap-bsd: Convert tap_open() to Error, (continued)
- [Qemu-devel] [PATCH 01/15] net: Improve error message for -net hubport a bit, Markus Armbruster, 2015/05/12
- [Qemu-devel] [PATCH 09/15] tap: Convert launch_script() to Error, Markus Armbruster, 2015/05/12
- [Qemu-devel] [PATCH 13/15] tap-solaris: Convert tap_open() to Error, Markus Armbruster, 2015/05/12
- [Qemu-devel] [PATCH 02/15] net: Permit incremental conversion of init functions to Error, Markus Armbruster, 2015/05/12
- Re: [Qemu-devel] [PATCH 02/15] net: Permit incremental conversion of init functions to Error,
Eric Blake <=
- [Qemu-devel] [PATCH 15/15] tap: Improve -netdev/netdev_add/-net/... tap error reporting, Markus Armbruster, 2015/05/12
- [Qemu-devel] [PATCH 14/15] tap: Finish conversion of tap_open() to Error, Markus Armbruster, 2015/05/12
- [Qemu-devel] [PATCH 08/15] tap: Convert net_init_tap_one() to Error, Markus Armbruster, 2015/05/12