From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Austin Subject: [PATCH v2 1/3] kvm tools: use #define for maximum number of terminal devices Date: Wed, 4 Sep 2013 14:25:46 +0100 Message-ID: <1378301148-18823-2-git-send-email-jonathan.austin@arm.com> References: <1378301148-18823-1-git-send-email-jonathan.austin@arm.com> Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Cc: penberg@kernel.org, marc.zyngier@arm.com, will.deacon@arm.com, Matt.Evans@arm.com, Jonathan Austin To: kvm@vger.kernel.org Return-path: Received: from service87.mimecast.com ([91.220.42.44]:49554 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762611Ab3IDN00 (ORCPT ); Wed, 4 Sep 2013 09:26:26 -0400 In-Reply-To: <1378301148-18823-1-git-send-email-jonathan.austin@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: Though there may be no near-term plans to change the number of terminal devices in the future, using TERM_MAX_DEVS instead of '4' makes reading some of the loops over terminal devices clearer. This patch makes the this substitution where required. Signed-off-by: Jonathan Austin Acked-by: Marc Zyngier --- tools/kvm/term.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/kvm/term.c b/tools/kvm/term.c index fa85e4a..ac9c7cc 100644 --- a/tools/kvm/term.c +++ b/tools/kvm/term.c @@ -16,13 +16,14 @@ =20 #define TERM_FD_IN 0 #define TERM_FD_OUT 1 +#define TERM_MAX_DEVS=094 =20 static struct termios=09orig_term; =20 int term_escape_char=09=3D 0x01; /* ctrl-a is used for escape */ bool term_got_escape=09=3D false; =20 -int term_fds[4][2]; +int term_fds[TERM_MAX_DEVS][2]; =20 int term_getc(struct kvm *kvm, int term) { @@ -94,7 +95,7 @@ static void term_cleanup(void) { =09int i; =20 -=09for (i =3D 0; i < 4; i++) +=09for (i =3D 0; i < TERM_MAX_DEVS; i++) =09=09tcsetattr(term_fds[i][TERM_FD_IN], TCSANOW, &orig_term); } =20 @@ -140,7 +141,7 @@ int term_init(struct kvm *kvm) =09struct termios term; =09int i, r; =20 -=09for (i =3D 0; i < 4; i++) +=09for (i =3D 0; i < TERM_MAX_DEVS; i++) =09=09if (term_fds[i][TERM_FD_IN] =3D=3D 0) { =09=09=09term_fds[i][TERM_FD_IN] =3D STDIN_FILENO; =09=09=09term_fds[i][TERM_FD_OUT] =3D STDOUT_FILENO; --=20 1.7.9.5