From patchwork Fri Mar 26 08:07:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 48620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5632BB7CC2 for ; Fri, 26 Mar 2010 19:28:47 +1100 (EST) Received: from localhost ([127.0.0.1]:43036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv4uK-0003To-IL for incoming@patchwork.ozlabs.org; Fri, 26 Mar 2010 04:28:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nv4Zi-0003RX-K5 for qemu-devel@nongnu.org; Fri, 26 Mar 2010 04:07:26 -0400 Received: from [140.186.70.92] (port=55339 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv4Ze-0003Qn-9r for qemu-devel@nongnu.org; Fri, 26 Mar 2010 04:07:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nv4ZW-0003EK-Sl for qemu-devel@nongnu.org; Fri, 26 Mar 2010 04:07:22 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:53757) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nv4ZW-0003Dr-JU for qemu-devel@nongnu.org; Fri, 26 Mar 2010 04:07:14 -0400 Received: from blackfin.pond.sub.org (pD9E38AC7.dip.t-dialin.net [217.227.138.199]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 4A9D7276D13 for ; Fri, 26 Mar 2010 09:07:12 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id B9362DE; Fri, 26 Mar 2010 09:07:11 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 26 Mar 2010 09:07:10 +0100 Message-Id: <1269590831-26185-4-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1269590831-26185-1-git-send-email-armbru@redhat.com> References: <1269590831-26185-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v2 3/4] monitor: Use argument type 'b' for set_link X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Second argument is now "on" or "off" instead of "up" or "down". Signed-off-by: Markus Armbruster --- net.c | 10 ++-------- qemu-monitor.hx | 8 ++++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/net.c b/net.c index ae971ff..830021d 100644 --- a/net.c +++ b/net.c @@ -1288,7 +1288,7 @@ void do_set_link(Monitor *mon, const QDict *qdict) VLANState *vlan; VLANClientState *vc = NULL; const char *name = qdict_get_str(qdict, "name"); - const char *up_or_down = qdict_get_str(qdict, "up_or_down"); + int up = qdict_get_bool(qdict, "up"); QTAILQ_FOREACH(vlan, &vlans, next) { QTAILQ_FOREACH(vc, &vlan->clients, next) { @@ -1305,13 +1305,7 @@ done: return; } - if (strcmp(up_or_down, "up") == 0) - vc->link_down = 0; - else if (strcmp(up_or_down, "down") == 0) - vc->link_down = 1; - else - monitor_printf(mon, "invalid link status '%s'; only 'up' or 'down' " - "valid\n", up_or_down); + vc->link_down = !up; if (vc->info->link_status_changed) { vc->info->link_status_changed(vc); diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 8c9a41c..7b7dcf5 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -986,16 +986,16 @@ ETEXI { .name = "set_link", - .args_type = "name:s,up_or_down:s", - .params = "name up|down", + .args_type = "name:s,up:b", + .params = "name on|off", .help = "change the link status of a network adapter", .mhandler.cmd = do_set_link, }, STEXI -@item set_link @var{name} [up|down] +@item set_link @var{name} [on|off] @findex set_link -Set link @var{name} up or down. +Switch link @var{name} on (i.e. up) or off (i.e. down). ETEXI {