From patchwork Fri May 16 15:30:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 349661 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 EF755140086 for ; Sat, 17 May 2014 01:38:47 +1000 (EST) Received: from localhost ([::1]:36409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlKDd-0008MC-UY for incoming@patchwork.ozlabs.org; Fri, 16 May 2014 11:38:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlK6G-0003ae-7m for qemu-devel@nongnu.org; Fri, 16 May 2014 11:31:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WlK65-0006Ex-3D for qemu-devel@nongnu.org; Fri, 16 May 2014 11:31:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlK64-0006Em-Pa for qemu-devel@nongnu.org; Fri, 16 May 2014 11:30:57 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFUqjY011454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 May 2014 11:30:53 -0400 Received: from localhost (ovpn-113-132.phx2.redhat.com [10.3.113.132]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFUqEI006903; Fri, 16 May 2014 11:30:52 -0400 From: Luiz Capitulino To: peter.maydell@linaro.org Date: Fri, 16 May 2014 11:30:33 -0400 Message-Id: <1400254235-9435-19-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1400254235-9435-1-git-send-email-lcapitulino@redhat.com> References: <1400254235-9435-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws Subject: [Qemu-devel] [PULL 18/20] monitor: Add netdev_add type argument completion. 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 From: Hani Benhabiles Also update the command's documentation. Signed-off-by: Hani Benhabiles Reviewed-by: Stefan Hajnoczi Signed-off-by: Luiz Capitulino --- hmp-commands.hx | 3 ++- hmp.h | 1 + monitor.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 3e7b29c..a7f9b2f 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1234,9 +1234,10 @@ ETEXI { .name = "netdev_add", .args_type = "netdev:O", - .params = "[user|tap|socket|hubport|netmap],id=str[,prop=value][,...]", + .params = "[user|tap|socket|vde|bridge|hubport|netmap],id=str[,prop=value][,...]", .help = "add host network device", .mhandler.cmd = hmp_netdev_add, + .command_completion = netdev_add_completion, }, STEXI diff --git a/hmp.h b/hmp.h index 91c9c85..bcecd0d 100644 --- a/hmp.h +++ b/hmp.h @@ -101,5 +101,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str); void chardev_remove_completion(ReadLineState *rs, int nb_args, const char *str); void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str); void set_link_completion(ReadLineState *rs, int nb_args, const char *str); +void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str); #endif diff --git a/monitor.c b/monitor.c index fd50c2d..a3dd361 100644 --- a/monitor.c +++ b/monitor.c @@ -4303,6 +4303,21 @@ void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str) qapi_free_ChardevBackendInfoList(start); } +void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str) +{ + size_t len; + int i; + + if (nb_args != 2) { + return; + } + len = strlen(str); + readline_set_completion_index(rs, len); + for (i = 0; NetClientOptionsKind_lookup[i]; i++) { + add_completion_option(rs, str, NetClientOptionsKind_lookup[i]); + } +} + void device_add_completion(ReadLineState *rs, int nb_args, const char *str) { GSList *list, *elt;