From patchwork Thu Feb 28 07:50:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 223829 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 76F552C008E for ; Thu, 28 Feb 2013 19:44:23 +1100 (EST) Received: from localhost ([::1]:48968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAz6D-00059Q-N3 for incoming@patchwork.ozlabs.org; Thu, 28 Feb 2013 03:44:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAz5x-00057a-Ns for qemu-devel@nongnu.org; Thu, 28 Feb 2013 03:44:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAz5v-0006sk-SY for qemu-devel@nongnu.org; Thu, 28 Feb 2013 03:44:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAz5v-0006sU-IZ for qemu-devel@nongnu.org; Thu, 28 Feb 2013 03:44:03 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1S7oF3H017284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Feb 2013 02:50:16 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r1S7oDJV018495; Thu, 28 Feb 2013 02:50:13 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 87D79452B6; Thu, 28 Feb 2013 08:50:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 28 Feb 2013 08:50:01 +0100 Message-Id: <1362037809-27836-10-git-send-email-kraxel@redhat.com> In-Reply-To: <1362037809-27836-1-git-send-email-kraxel@redhat.com> References: <1362037809-27836-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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/17] 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 2cb1471..2832e48 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2915,22 +2915,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) { @@ -2966,6 +2950,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); +} + static const struct { const char *name; /* old, pre qapi */ @@ -2988,6 +2985,10 @@ static const struct { .parse = qemu_chr_parse_serial }, { .name = "tty", .kind = CHARDEV_BACKEND_KIND_SERIAL, .parse = qemu_chr_parse_serial }, + { .name = "parallel", .kind = CHARDEV_BACKEND_KIND_PARALLEL, + .parse = qemu_chr_parse_parallel }, + { .name = "parport", .kind = CHARDEV_BACKEND_KIND_PARALLEL, + .parse = qemu_chr_parse_parallel }, #ifdef _WIN32 { .name = "pipe", .open = qemu_chr_open_win_pipe }, { .name = "console", .open = qemu_chr_open_win_con }, @@ -2998,10 +2999,6 @@ static const struct { #ifdef HAVE_CHARDEV_TTY { .name = "pty", .open = qemu_chr_open_pty }, #endif -#ifdef HAVE_CHARDEV_PARPORT - { .name = "parallel", .open = qemu_chr_open_pp }, - { .name = "parport", .open = qemu_chr_open_pp }, -#endif #ifdef CONFIG_SPICE { .name = "spicevmc", .open = qemu_chr_open_spice }, #if SPICE_SERVER_VERSION >= 0x000c02