From patchwork Tue Nov 17 09:38:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 38599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 62CA4B7063 for ; Tue, 17 Nov 2009 20:44:21 +1100 (EST) Received: from localhost ([127.0.0.1]:41925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAKbh-0003uy-6W for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2009 04:44:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAKW9-00026W-P2 for qemu-devel@nongnu.org; Tue, 17 Nov 2009 04:38:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAKW3-00024P-Pg for qemu-devel@nongnu.org; Tue, 17 Nov 2009 04:38:33 -0500 Received: from [199.232.76.173] (port=51748 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAKW3-00024F-Kl for qemu-devel@nongnu.org; Tue, 17 Nov 2009 04:38:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15514) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NAKW3-0007BN-5U for qemu-devel@nongnu.org; Tue, 17 Nov 2009 04:38:27 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAH9cPxU019909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Nov 2009 04:38:25 -0500 Received: from zweiblum.home.kraxel.org (vpn1-7-195.ams2.redhat.com [10.36.7.195]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id nAH9cLqH014640; Tue, 17 Nov 2009 04:38:22 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id A086D7005F; Tue, 17 Nov 2009 10:38:20 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 17 Nov 2009 10:38:11 +0100 Message-Id: <1258450699-24445-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1258450699-24445-1-git-send-email-kraxel@redhat.com> References: <1258450699-24445-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 1/9] chardev: add greeting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a greeting string to CharDriverState which is printed after initialization. Used to have the qemu vc consoles labeled. This way we can avoid walking all the chardevs a second time after initialization just to print the greeting. Signed-off-by: Gerd Hoffmann --- qemu-char.c | 2 ++ qemu-char.h | 1 + vl.c | 36 ++++++++++++------------------------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 40bd7e8..19be58f 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -132,6 +132,8 @@ void qemu_chr_initial_reset(void) QTAILQ_FOREACH(chr, &chardevs, next) { qemu_chr_reset(chr); + if (chr->greeting) + qemu_chr_printf(chr, "%s", chr->greeting); } } diff --git a/qemu-char.h b/qemu-char.h index 05fe15d..e50a4f3 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -66,6 +66,7 @@ struct CharDriverState { QEMUBH *bh; char *label; char *filename; + char *greeting; QTAILQ_ENTRY(CharDriverState) next; }; diff --git a/vl.c b/vl.c index fff8e8d..095aff6 100644 --- a/vl.c +++ b/vl.c @@ -5657,6 +5657,10 @@ int main(int argc, char **argv, char **envp) devname, strerror(errno)); exit(1); } + if (strstart(devname, "vc", 0)) { + snprintf(label, sizeof(label), "serial%d console\r\n", i); + serial_hds[i]->greeting = qemu_strdup(label); + } } } @@ -5671,6 +5675,10 @@ int main(int argc, char **argv, char **envp) devname, strerror(errno)); exit(1); } + if (strstart(devname, "vc", 0)) { + snprintf(label, sizeof(label), "parallel%d console\r\n", i); + parallel_hds[i]->greeting = qemu_strdup(label); + } } } @@ -5685,6 +5693,10 @@ int main(int argc, char **argv, char **envp) devname, strerror(errno)); exit(1); } + if (strstart(devname, "vc", 0)) { + snprintf(label, sizeof(label), "virtio console%d\r\n", i); + virtcon_hds[i]->greeting = qemu_strdup(label); + } } } @@ -5800,30 +5812,6 @@ int main(int argc, char **argv, char **envp) } } - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - const char *devname = serial_devices[i]; - if (devname && strcmp(devname, "none")) { - if (strstart(devname, "vc", 0)) - qemu_chr_printf(serial_hds[i], "serial%d console\r\n", i); - } - } - - for(i = 0; i < MAX_PARALLEL_PORTS; i++) { - const char *devname = parallel_devices[i]; - if (devname && strcmp(devname, "none")) { - if (strstart(devname, "vc", 0)) - qemu_chr_printf(parallel_hds[i], "parallel%d console\r\n", i); - } - } - - for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { - const char *devname = virtio_consoles[i]; - if (virtcon_hds[i] && devname) { - if (strstart(devname, "vc", 0)) - qemu_chr_printf(virtcon_hds[i], "virtio console%d\r\n", i); - } - } - if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) { fprintf(stderr, "qemu: could not open gdbserver on device '%s'\n", gdbstub_dev);