]> Git Repo - qemu.git/commitdiff
net: introduce qemu_net_client_setup()
authorJason Wang <[email protected]>
Wed, 30 Jan 2013 11:12:26 +0000 (19:12 +0800)
committerAnthony Liguori <[email protected]>
Fri, 1 Feb 2013 17:03:01 +0000 (11:03 -0600)
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: Jason Wang <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
net/net.c

index 16dd327782f0f1ac195fedd3551cedee2b52f667..3a5bdf6b3fcf7d3f003aedddeca6bc1090d407ec 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -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;
 }
 
This page took 0.027348 seconds and 4 git commands to generate.