Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Jonathan Austin <jonathan.austin@arm.com>
To: kvm@vger.kernel.org
Cc: penberg@kernel.org, marc.zyngier@arm.com, will.deacon@arm.com,
	Matt.Evans@arm.com, Jonathan Austin <jonathan.austin@arm.com>
Subject: [PATCH v2 1/3] kvm tools: use #define for maximum number of terminal devices
Date: Wed,  4 Sep 2013 14:25:46 +0100	[thread overview]
Message-ID: <1378301148-18823-2-git-send-email-jonathan.austin@arm.com> (raw)
In-Reply-To: <1378301148-18823-1-git-send-email-jonathan.austin@arm.com>

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 <jonathan.austin@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
---
 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 @@
 
 #define TERM_FD_IN      0
 #define TERM_FD_OUT     1
+#define TERM_MAX_DEVS	4
 
 static struct termios	orig_term;
 
 int term_escape_char	= 0x01; /* ctrl-a is used for escape */
 bool term_got_escape	= false;
 
-int term_fds[4][2];
+int term_fds[TERM_MAX_DEVS][2];
 
 int term_getc(struct kvm *kvm, int term)
 {
@@ -94,7 +95,7 @@ static void term_cleanup(void)
 {
 	int i;
 
-	for (i = 0; i < 4; i++)
+	for (i = 0; i < TERM_MAX_DEVS; i++)
 		tcsetattr(term_fds[i][TERM_FD_IN], TCSANOW, &orig_term);
 }
 
@@ -140,7 +141,7 @@ int term_init(struct kvm *kvm)
 	struct termios term;
 	int i, r;
 
-	for (i = 0; i < 4; i++)
+	for (i = 0; i < TERM_MAX_DEVS; i++)
 		if (term_fds[i][TERM_FD_IN] == 0) {
 			term_fds[i][TERM_FD_IN] = STDIN_FILENO;
 			term_fds[i][TERM_FD_OUT] = STDOUT_FILENO;
-- 
1.7.9.5



  reply	other threads:[~2013-09-04 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 13:25 [PATCH v2 0/3] kvm tools: remove periodic tick Jonathan Austin
2013-09-04 13:25 ` Jonathan Austin [this message]
2013-09-04 13:25 ` [PATCH v2 2/3] kvm tools: remove periodic tick in favour of a polling thread Jonathan Austin
2013-09-04 15:58   ` Pekka Enberg
2013-09-04 17:40     ` Jonathan Austin
2013-09-04 17:48       ` Pekka Enberg
2013-09-04 18:01         ` Sasha Levin
2013-09-05 16:39           ` Jonathan Austin
2013-09-07 17:21             ` Sasha Levin
2013-09-04 13:25 ` [PATCH v2 3/3] kvm tools: stop virtio console doing unnecessary input handling Jonathan Austin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378301148-18823-2-git-send-email-jonathan.austin@arm.com \
    --to=jonathan.austin@arm.com \
    --cc=Matt.Evans@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=penberg@kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox