diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-05-15 13:58:50 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2015-05-27 09:51:04 +0100 |
commit | a30ecde6e795682d1473c45acae66a60a76fca2f (patch) | |
tree | c7e546745660f2427f34a294f44940ce1721fc1f /net/netmap.c | |
parent | ca7eb1848bb06d9b75784d7760b83c7b0beb1102 (diff) |
net: Permit incremental conversion of init functions to Error
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 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 <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-3-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'net/netmap.c')
-rw-r--r-- | net/netmap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netmap.c b/net/netmap.c index 0c1772b03f..69300eb1ae 100644 --- a/net/netmap.c +++ b/net/netmap.c @@ -446,8 +446,9 @@ static NetClientInfo net_netmap_info = { * ... -net netmap,ifname="..." */ int net_init_netmap(const NetClientOptions *opts, - const char *name, NetClientState *peer) + const char *name, NetClientState *peer, Error **errp) { + /* FIXME error_setg(errp, ...) on failure */ const NetdevNetmapOptions *netmap_opts = opts->netmap; NetClientState *nc; NetmapPriv me; |