Skip to content
Snippets Groups Projects
Commit 18a1541a authored by Jason Wang's avatar Jason Wang Committed by Anthony Liguori
Browse files

net: introduce qemu_net_client_setup()


This patch separates the setup of NetClientState from its allocation, this will
allow allocating an arrays of NetClientState and does the initialization one by
one which is what multiqueue needs.

Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 6c51ae73
No related branches found
No related tags found
No related merge requests found
......@@ -182,17 +182,12 @@ static char *assign_name(NetClientState *nc1, const char *model)
return g_strdup(buf);
}
NetClientState *qemu_new_net_client(NetClientInfo *info,
NetClientState *peer,
const char *model,
const char *name)
static void qemu_net_client_setup(NetClientState *nc,
NetClientInfo *info,
NetClientState *peer,
const char *model,
const char *name)
{
NetClientState *nc;
assert(info->size >= sizeof(NetClientState));
nc = g_malloc0(info->size);
nc->info = info;
nc->model = g_strdup(model);
if (name) {
......@@ -210,6 +205,20 @@ NetClientState *qemu_new_net_client(NetClientInfo *info,
nc->send_queue = qemu_new_net_queue(nc);
}
NetClientState *qemu_new_net_client(NetClientInfo *info,
NetClientState *peer,
const char *model,
const char *name)
{
NetClientState *nc;
assert(info->size >= sizeof(NetClientState));
nc = g_malloc0(info->size);
qemu_net_client_setup(nc, info, peer, model, name);
return nc;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment