From 4b37156c40c3d7d63ac332e3bb9f85a66c3f5e5e Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Wed, 23 Nov 2011 13:11:55 -0200 Subject: qapi: Convert set_link Signed-off-by: Anthony Liguori Signed-off-by: Luiz Capitulino --- net.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'net.c') diff --git a/net.c b/net.c index cb52050..f7bebf8 100644 --- a/net.c +++ b/net.c @@ -34,6 +34,7 @@ #include "monitor.h" #include "qemu-common.h" #include "qemu_socket.h" +#include "qmp-commands.h" #include "hw/qdev.h" #include "iov.h" @@ -1258,12 +1259,10 @@ void do_info_network(Monitor *mon) } } -int do_set_link(Monitor *mon, const QDict *qdict, QObject **ret_data) +void qmp_set_link(const char *name, bool up, Error **errp) { VLANState *vlan; VLANClientState *vc = NULL; - const char *name = qdict_get_str(qdict, "name"); - int up = qdict_get_bool(qdict, "up"); QTAILQ_FOREACH(vlan, &vlans, next) { QTAILQ_FOREACH(vc, &vlan->clients, next) { @@ -1280,8 +1279,8 @@ int do_set_link(Monitor *mon, const QDict *qdict, QObject **ret_data) done: if (!vc) { - qerror_report(QERR_DEVICE_NOT_FOUND, name); - return -1; + error_set(errp, QERR_DEVICE_NOT_FOUND, name); + return; } vc->link_down = !up; @@ -1300,7 +1299,6 @@ done: if (vc->peer && vc->peer->info->link_status_changed) { vc->peer->info->link_status_changed(vc->peer); } - return 0; } void net_cleanup(void) -- cgit v1.1