From patchwork Tue Mar 12 08:56:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 226836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CFC0B2C0296 for ; Tue, 12 Mar 2013 19:57:18 +1100 (EST) Received: from localhost ([::1]:43251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFL1I-0005u7-WF for incoming@patchwork.ozlabs.org; Tue, 12 Mar 2013 04:57:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFL0e-0005oC-5c for qemu-devel@nongnu.org; Tue, 12 Mar 2013 04:56:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFL0b-0003zX-VT for qemu-devel@nongnu.org; Tue, 12 Mar 2013 04:56:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFL0b-0003yo-Kz for qemu-devel@nongnu.org; Tue, 12 Mar 2013 04:56:33 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2C8uWvI014914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Mar 2013 04:56:33 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2C8uVMj004041; Tue, 12 Mar 2013 04:56:32 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 16CF641522; Tue, 12 Mar 2013 09:56:30 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2013 09:56:19 +0100 Message-Id: <1363078589-15233-10-git-send-email-kraxel@redhat.com> In-Reply-To: <1363078589-15233-1-git-send-email-kraxel@redhat.com> References: <1363078589-15233-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 09/19] chardev: switch parallel init to qapi 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 switches over the parallel chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann --- qemu-char.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 8bedabb..2bc1021 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3121,22 +3121,6 @@ fail: return NULL; } -#ifdef HAVE_CHARDEV_PARPORT - -static CharDriverState *qemu_chr_open_pp(QemuOpts *opts) -{ - const char *filename = qemu_opt_get(opts, "path"); - int fd; - - fd = qemu_open(filename, O_RDWR); - if (fd < 0) { - return NULL; - } - return qemu_chr_open_pp_fd(fd); -} - -#endif - static void qemu_chr_parse_file_out(QemuOpts *opts, ChardevBackend *backend, Error **errp) { @@ -3172,6 +3156,19 @@ static void qemu_chr_parse_serial(QemuOpts *opts, ChardevBackend *backend, backend->serial->device = g_strdup(device); } +static void qemu_chr_parse_parallel(QemuOpts *opts, ChardevBackend *backend, + Error **errp) +{ + const char *device = qemu_opt_get(opts, "path"); + + if (device == NULL) { + error_setg(errp, "chardev: parallel: no device path given"); + return; + } + backend->parallel = g_new0(ChardevHostdev, 1); + backend->parallel->device = g_strdup(device); +} + typedef struct CharDriver { const char *name; /* old, pre qapi */ @@ -3751,6 +3748,10 @@ static void register_types(void) qemu_chr_parse_serial); register_char_driver_qapi("tty", CHARDEV_BACKEND_KIND_SERIAL, qemu_chr_parse_serial); + register_char_driver_qapi("parallel", CHARDEV_BACKEND_KIND_PARALLEL, + qemu_chr_parse_parallel); + register_char_driver_qapi("parport", CHARDEV_BACKEND_KIND_PARALLEL, + qemu_chr_parse_parallel); #ifdef _WIN32 register_char_driver("pipe", qemu_chr_open_win_pipe); register_char_driver("console", qemu_chr_open_win_con); @@ -3760,10 +3761,6 @@ static void register_types(void) #ifdef HAVE_CHARDEV_TTY register_char_driver("pty", qemu_chr_open_pty); #endif -#ifdef HAVE_CHARDEV_PARPORT - register_char_driver("parallel", qemu_chr_open_pp); - register_char_driver("parport", qemu_chr_open_pp); -#endif } type_init(register_types);