From patchwork Fri Aug 1 05:27:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Canet?= X-Patchwork-Id: 375550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 10542140140 for ; Fri, 1 Aug 2014 15:33:49 +1000 (EST) Received: from localhost ([::1]:59924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD5TP-00005K-8p for incoming@patchwork.ozlabs.org; Fri, 01 Aug 2014 01:33:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD5OD-0007sM-57 for qemu-devel@nongnu.org; Fri, 01 Aug 2014 01:28:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XD5O2-0003en-NH for qemu-devel@nongnu.org; Fri, 01 Aug 2014 01:28:25 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:59408 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD5O2-0003dK-5w for qemu-devel@nongnu.org; Fri, 01 Aug 2014 01:28:14 -0400 Received: from localhost.localdomain (laure.irqsave.net [192.168.77.2]) by paradis.irqsave.net (Postfix) with ESMTP id ED776C3149; Fri, 1 Aug 2014 07:28:11 +0200 (CEST) From: =?UTF-8?q?Beno=C3=AEt=20Canet?= To: qemu-devel@nongnu.org Date: Fri, 1 Aug 2014 07:27:15 +0200 Message-Id: <1406870842-17988-18-git-send-email-benoit.canet@irqsave.net> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1406870842-17988-1-git-send-email-benoit.canet@irqsave.net> References: <1406870842-17988-1-git-send-email-benoit.canet@irqsave.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 80.12.84.125 Cc: kwolf@redhat.com, =?UTF-8?q?Beno=C3=AEt=20Canet?= , Benoit Canet , mreitz@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v1 17/24] monitor: Move two net functions from monitor.c to monitor-system.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org With this move the monitor.c/monitor-system.c split is complete. Signed-off-by: Benoit Canet --- monitor-system.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ monitor.c | 49 ------------------------------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/monitor-system.c b/monitor-system.c index f8e4a10..d5abf73 100644 --- a/monitor-system.c +++ b/monitor-system.c @@ -2464,3 +2464,52 @@ int monitor_read_block_device_key(Monitor *mon, const char *device, return monitor_read_bdrv_key_start(mon, bs, completion_cb, opaque); } + +void set_link_completion(ReadLineState *rs, int nb_args, const char *str) +{ + size_t len; + + len = strlen(str); + readline_set_completion_index(rs, len); + if (nb_args == 2) { + NetClientState *ncs[255]; + int count, i; + count = qemu_find_net_clients_except(NULL, ncs, + NET_CLIENT_OPTIONS_KIND_NONE, 255); + for (i = 0; i < count; i++) { + const char *name = ncs[i]->name; + if (!strncmp(str, name, len)) { + readline_add_completion(rs, name); + } + } + } else if (nb_args == 3) { + add_completion_option(rs, str, "on"); + add_completion_option(rs, str, "off"); + } +} + +void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) +{ + int len, count, i; + NetClientState *ncs[255]; + + if (nb_args != 2) { + return; + } + + len = strlen(str); + readline_set_completion_index(rs, len); + count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, + 255); + for (i = 0; i < count; i++) { + QemuOpts *opts; + const char *name = ncs[i]->name; + if (strncmp(str, name, len)) { + continue; + } + opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), name); + if (opts) { + readline_add_completion(rs, name); + } + } +} diff --git a/monitor.c b/monitor.c index 79b54e1..3133f62 100644 --- a/monitor.c +++ b/monitor.c @@ -2096,55 +2096,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str) } } -void set_link_completion(ReadLineState *rs, int nb_args, const char *str) -{ - size_t len; - - len = strlen(str); - readline_set_completion_index(rs, len); - if (nb_args == 2) { - NetClientState *ncs[255]; - int count, i; - count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NONE, 255); - for (i = 0; i < count; i++) { - const char *name = ncs[i]->name; - if (!strncmp(str, name, len)) { - readline_add_completion(rs, name); - } - } - } else if (nb_args == 3) { - add_completion_option(rs, str, "on"); - add_completion_option(rs, str, "off"); - } -} - -void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) -{ - int len, count, i; - NetClientState *ncs[255]; - - if (nb_args != 2) { - return; - } - - len = strlen(str); - readline_set_completion_index(rs, len); - count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, - 255); - for (i = 0; i < count; i++) { - QemuOpts *opts; - const char *name = ncs[i]->name; - if (strncmp(str, name, len)) { - continue; - } - opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), name); - if (opts) { - readline_add_completion(rs, name); - } - } -} - void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str) { if (nb_args != 2) {