From patchwork Thu Jan 23 13:58:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 313618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F23572C008F for ; Fri, 24 Jan 2014 00:58:49 +1100 (EST) Received: from localhost ([::1]:41295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6Knw-0001Er-07 for incoming@patchwork.ozlabs.org; Thu, 23 Jan 2014 08:58:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6Kna-0001Dz-Qo for qemu-devel@nongnu.org; Thu, 23 Jan 2014 08:58:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6KnR-0003wc-BD for qemu-devel@nongnu.org; Thu, 23 Jan 2014 08:58:26 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39461 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6KnR-0003wW-5q for qemu-devel@nongnu.org; Thu, 23 Jan 2014 08:58:17 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 45844AC56; Thu, 23 Jan 2014 13:58:16 +0000 (UTC) Message-ID: <52E11FF6.1070405@suse.de> Date: Thu, 23 Jan 2014 14:58:14 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= Organization: SUSE LINUX Products GmbH User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Corey Minyard , qemu-devel@nongnu.org References: <1384273995-16486-1-git-send-email-cminyard@mvista.com> <1384273995-16486-2-git-send-email-cminyard@mvista.com> <52E11A00.3060109@suse.de> In-Reply-To: <52E11A00.3060109@suse.de> X-Enigmail-Version: 1.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.135.220.15 Cc: Bret Ketchum , Corey Minyard , "Michael S. Tsirkin" Subject: Re: [Qemu-devel] [PATCH 01/16] qemu-char: Allocate CharDriverState in qemu_chr_new_from_opts 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 Am 23.01.2014 14:32, schrieb Andreas Färber: > Am 12.11.2013 17:33, schrieb Corey Minyard: >> This allocates the CharDriverState structure and passes it in to the >> open routine. This allows a coming option to automatically attempt to >> reconnect a chardev if the connection fails. The chardev has to be >> kept around so a reconnect can be done on it. >> >> Signed-off-by: Corey Minyard > [...] >> diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h >> index 86c75c7..eadb9c9 100644 >> --- a/include/ui/qemu-spice.h >> +++ b/include/ui/qemu-spice.h >> @@ -46,9 +46,11 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port, >> void do_info_spice_print(Monitor *mon, const QObject *data); >> void do_info_spice(Monitor *mon, QObject **ret_data); >> >> -CharDriverState *qemu_chr_open_spice_vmc(const char *type); >> +CharDriverState *qemu_chr_open_spice_vmc(CharDriverState *chr, >> + const char *type); >> #if SPICE_SERVER_VERSION >= 0x000c02 >> -CharDriverState *qemu_chr_open_spice_port(const char *name); >> +CharDriverState *qemu_chr_open_spice_port(CharDriverSTate *chr, > > This needs to be CharDriverState. > >> + const char *name); >> void qemu_spice_register_ports(void); >> #else >> static inline CharDriverState *qemu_chr_open_spice_port(const char *name) > [snip] I also needed the following: /* defer OPENED events until our vc is fully initialized */ chr->explicit_be_open = true; Andreas diff --git a/ui/gtk.c b/ui/gtk.c index 6316f5b..c2210a2 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1113,11 +1113,8 @@ static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len) static int nb_vcs; static CharDriverState *vcs[MAX_VCS]; -static CharDriverState *gd_vc_handler(ChardevVC *unused) +static CharDriverState *gd_vc_handler(CharDriverState *chr, ChardevVC *unused) { - CharDriverState *chr; - - chr = g_malloc0(sizeof(*chr)); chr->chr_write = gd_vc_chr_write;