From patchwork Wed Apr 1 08:14:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 457131 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 5959B14008F for ; Wed, 1 Apr 2015 19:20:28 +1100 (AEDT) Received: from localhost ([::1]:42103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdDsw-0004EH-84 for incoming@patchwork.ozlabs.org; Wed, 01 Apr 2015 04:20:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdDoc-0004SD-I6 for qemu-devel@nongnu.org; Wed, 01 Apr 2015 04:15:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdDoV-0002ZV-Bk for qemu-devel@nongnu.org; Wed, 01 Apr 2015 04:15:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdDoV-0002ZH-5K for qemu-devel@nongnu.org; Wed, 01 Apr 2015 04:15:51 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t318FlLN021682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 1 Apr 2015 04:15:47 -0400 Received: from jason-ThinkPad-T430s.redhat.com (vpn1-6-136.pek2.redhat.com [10.72.6.136]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t318FExg006923; Wed, 1 Apr 2015 04:15:44 -0400 From: Jason Wang To: qemu-devel@nongnu.org Date: Wed, 1 Apr 2015 16:14:59 +0800 Message-Id: <1427876112-12615-6-git-send-email-jasowang@redhat.com> In-Reply-To: <1427876112-12615-1-git-send-email-jasowang@redhat.com> References: <1427876112-12615-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: cornelia.huck@de.ibm.com, Jason Wang , Luiz Capitulino , mst@redhat.com Subject: [Qemu-devel] [PATCH V5 05/18] monitor: replace the magic number 255 with MAX_QUEUE_NUM 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 This patch replace the magic number 255, and increase it to MAX_QUEUE_NUM which is maximum number of queues supported by a nic. Cc: Luiz Capitulino Signed-off-by: Jason Wang --- monitor.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/monitor.c b/monitor.c index 68873ec..a039edf 100644 --- a/monitor.c +++ b/monitor.c @@ -4472,10 +4472,11 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str) len = strlen(str); readline_set_completion_index(rs, len); if (nb_args == 2) { - NetClientState *ncs[255]; + NetClientState *ncs[MAX_QUEUE_NUM]; int count, i; count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NONE, 255); + NET_CLIENT_OPTIONS_KIND_NONE, + MAX_QUEUE_NUM); for (i = 0; i < count; i++) { const char *name = ncs[i]->name; if (!strncmp(str, name, len)) { @@ -4491,7 +4492,7 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str) void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) { int len, count, i; - NetClientState *ncs[255]; + NetClientState *ncs[MAX_QUEUE_NUM]; if (nb_args != 2) { return; @@ -4500,7 +4501,7 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) len = strlen(str); readline_set_completion_index(rs, len); count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, - 255); + MAX_QUEUE_NUM); for (i = 0; i < count; i++) { QemuOpts *opts; const char *name = ncs[i]->name; @@ -4566,14 +4567,15 @@ void host_net_add_completion(ReadLineState *rs, int nb_args, const char *str) void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) { - NetClientState *ncs[255]; + NetClientState *ncs[MAX_QUEUE_NUM]; int count, i, len; len = strlen(str); readline_set_completion_index(rs, len); if (nb_args == 2) { count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NONE, 255); + NET_CLIENT_OPTIONS_KIND_NONE, + MAX_QUEUE_NUM); for (i = 0; i < count; i++) { int id; char name[16]; @@ -4589,7 +4591,8 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) return; } else if (nb_args == 3) { count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NIC, 255); + NET_CLIENT_OPTIONS_KIND_NIC, + MAX_QUEUE_NUM); for (i = 0; i < count; i++) { int id; const char *name;