qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v4 17/29] vhost-user: add get_vhost_net() assertions


From: marcandre . lureau
Subject: [Qemu-devel] [PATCH v4 17/29] vhost-user: add get_vhost_net() assertions
Date: Thu, 7 Jul 2016 03:00:41 +0200

From: Marc-André Lureau <address@hidden>

Add a few assertions to be more explicit about the runtime behaviour
after the previous patch: get_vhost_net() is non-null after
net_vhost_user_init().

Signed-off-by: Marc-André Lureau <address@hidden>
---
 hw/net/vhost_net.c | 1 +
 net/vhost-user.c   | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 08c7d1e..473e6e5 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -417,6 +417,7 @@ VHostNetState *get_vhost_net(NetClientState *nc)
         break;
     case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
         vhost_net = vhost_user_get_vhost_net(nc);
+        assert(vhost_net != NULL);
         break;
     default:
         break;
diff --git a/net/vhost-user.c b/net/vhost-user.c
index a80f008..2442925 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -257,6 +257,8 @@ static int net_vhost_user_init(NetClientState *peer, const 
char *device,
 
     qemu_chr_add_handlers(chr, NULL, NULL, net_vhost_user_event, nc[0].name);
 
+    assert(s->vhost_net != NULL);
+
     return 0;
 }
 
-- 
2.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]