From patchwork Mon Feb 2 07:06:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 435372 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 C723314017D for ; Mon, 2 Feb 2015 18:08:52 +1100 (AEDT) Received: from localhost ([::1]:53287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIB7q-0001p5-VS for incoming@patchwork.ozlabs.org; Mon, 02 Feb 2015 02:08:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIB62-0007Ga-1h for qemu-devel@nongnu.org; Mon, 02 Feb 2015 02:07:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIB61-0001eO-B0 for qemu-devel@nongnu.org; Mon, 02 Feb 2015 02:06:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIB61-0001e8-4m for qemu-devel@nongnu.org; Mon, 02 Feb 2015 02:06:57 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1276tgx031828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 2 Feb 2015 02:06:55 -0500 Received: from jason-ThinkPad-T430s.nay.redhat.com (dhcp-66-71-84.eng.nay.redhat.com [10.66.71.84] (may be forged)) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1276fOg021598; Mon, 2 Feb 2015 02:06:52 -0500 From: Jason Wang To: aliguori@amazon.com, stefanha@redhat.com, qemu-devel@nongnu.org Date: Mon, 2 Feb 2015 15:06:38 +0800 Message-Id: <1422860798-17495-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1422860798-17495-1-git-send-email-jasowang@redhat.com> References: <1422860798-17495-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jason Wang , Luiz Capitulino Subject: [Qemu-devel] [PATCH 4/4] monitor: more accurate completion for host_net_remove() 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 Current completion for host_net_remove will show hub ports and clients that were not peered with hub ports. Fix this. Cc: Luiz Capitulino Signed-off-by: Jason Wang --- monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/monitor.c b/monitor.c index 7e4f605..e6dc50a 100644 --- a/monitor.c +++ b/monitor.c @@ -4597,8 +4597,13 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, 255); for (i = 0; i < count; i++) { + int id; const char *name; + if (ncs[i]->info->type == NET_CLIENT_OPTIONS_KIND_HUBPORT || + net_hub_id_for_client(ncs[i], &id)) { + continue; + } name = ncs[i]->name; if (!strncmp(str, name, len)) { readline_add_completion(rs, name);