diff mbox

[01/16] qemu-char: Allocate CharDriverState in qemu_chr_new_from_opts

Message ID 52E11FF6.1070405@suse.de
State New
Headers show

Commit Message

Andreas Färber Jan. 23, 2014, 1:58 p.m. UTC
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 <cminyard@mvista.com>
> [...]
>> 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 mbox

Patch

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;