[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 02/33] vhost-user: minor simplification
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v6 02/33] vhost-user: minor simplification |
Date: |
Wed, 27 Jul 2016 01:14:56 +0400 |
From: Marc-André Lureau <address@hidden>
Shorten the code and make it more clear by using the specialized
function g_str_has_prefix().
Signed-off-by: Marc-André Lureau <address@hidden>
---
net/vhost-user.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/vhost-user.c b/net/vhost-user.c
index c4d63e0..2af212b 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -316,7 +316,6 @@ static int net_vhost_check_net(void *opaque, QemuOpts
*opts, Error **errp)
{
const char *name = opaque;
const char *driver, *netdev;
- const char virtio_name[] = "virtio-net-";
driver = qemu_opt_get(opts, "driver");
netdev = qemu_opt_get(opts, "netdev");
@@ -326,7 +325,7 @@ static int net_vhost_check_net(void *opaque, QemuOpts
*opts, Error **errp)
}
if (strcmp(netdev, name) == 0 &&
- strncmp(driver, virtio_name, strlen(virtio_name)) != 0) {
+ !g_str_has_prefix(driver, "virtio-net-")) {
error_setg(errp, "vhost-user requires frontend driver virtio-net-*");
return -1;
}
--
2.9.0
- [Qemu-devel] [PATCH v6 00/33] vhost-user reconnect fixes, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 01/33] misc: indentation, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 02/33] vhost-user: minor simplification,
marcandre . lureau <=
- [Qemu-devel] [PATCH v6 03/33] vhost-user: disconnect on HUP, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 04/33] vhost: don't assume opaque is a fd, use backend cleanup, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 05/33] vhost: make vhost_log_put() idempotent, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 06/33] vhost: assert the log was cleaned up, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 07/33] vhost: fix cleanup on not fully initialized device, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 08/33] vhost: make vhost_dev_cleanup() idempotent, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 09/33] vhost-net: always call vhost_dev_cleanup() on failure, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 10/33] vhost: fix calling vhost_dev_cleanup() after vhost_dev_init(), marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 11/33] vhost: do not assert() on vhost_ops failure, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 12/33] vhost: add missing VHOST_OPS_DEBUG, marcandre . lureau, 2016/07/26