net: use Netdev instead of NetClientOptions in client init

This way we no longer need NetClientOptions and can convert Netdev
into a flat union.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <93ffdfed7054529635e6acb935150d95dc173a12.1441627176.git.DirtY.iCE.hu@gmail.com>

[rework net_client_init1() to pass Netdev by copying from NetdevLegacy,
rather than merging the two types - which means that we still need
NetClientOptions after all.  Rebase to qapi changes. The bulk of the
patch is mechanical, replacing 'opts' by 'netdev->opts', while
net_client_init1() takes care of converting between legacy and modern
types.]

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1468468228-27827-2-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Kővágó, Zoltán 2016-07-13 21:50:12 -06:00 committed by Markus Armbruster
parent 3d344c2aab
commit cebea51057
12 changed files with 53 additions and 49 deletions

View file

@ -571,7 +571,7 @@ static int net_bridge_run_helper(const char *helper, const char *bridge,
}
}
int net_init_bridge(const NetClientOptions *opts, const char *name,
int net_init_bridge(const Netdev *netdev, const char *name,
NetClientState *peer, Error **errp)
{
const NetdevBridgeOptions *bridge;
@ -579,8 +579,8 @@ int net_init_bridge(const NetClientOptions *opts, const char *name,
TAPState *s;
int fd, vnet_hdr;
assert(opts->type == NET_CLIENT_OPTIONS_KIND_BRIDGE);
bridge = opts->u.bridge.data;
assert(netdev->opts->type == NET_CLIENT_OPTIONS_KIND_BRIDGE);
bridge = netdev->opts->u.bridge.data;
helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER;
br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE;
@ -735,7 +735,7 @@ static int get_fds(char *str, char *fds[], int max)
return i;
}
int net_init_tap(const NetClientOptions *opts, const char *name,
int net_init_tap(const Netdev *netdev, const char *name,
NetClientState *peer, Error **errp)
{
const NetdevTapOptions *tap;
@ -747,8 +747,8 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
const char *vhostfdname;
char ifname[128];
assert(opts->type == NET_CLIENT_OPTIONS_KIND_TAP);
tap = opts->u.tap.data;
assert(netdev->opts->type == NET_CLIENT_OPTIONS_KIND_TAP);
tap = netdev->opts->u.tap.data;
queues = tap->has_queues ? tap->queues : 1;
vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;