Skip to content

Commit

Permalink
spice-qemu-char: keep a list of spice chardev
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
elmarco authored and kraxel committed Dec 17, 2012
1 parent 5a49d3e commit 7a5448c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spice-qemu-char.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ typedef struct SpiceCharDriver {
uint8_t *datapos;
ssize_t bufsize, datalen;
uint32_t debug;
QLIST_ENTRY(SpiceCharDriver) next;
} SpiceCharDriver;

static QLIST_HEAD(, SpiceCharDriver) spice_chars =
QLIST_HEAD_INITIALIZER(spice_chars);

static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
{
SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin);
Expand Down Expand Up @@ -179,6 +183,7 @@ static void spice_chr_close(struct CharDriverState *chr)

printf("%s\n", __func__);
vmc_unregister_interface(s);
QLIST_REMOVE(s, next);
g_free(s);
}

Expand Down Expand Up @@ -229,6 +234,8 @@ static CharDriverState *chr_open(QemuOpts *opts, const char *subtype)
chr->chr_guest_open = spice_chr_guest_open;
chr->chr_guest_close = spice_chr_guest_close;

QLIST_INSERT_HEAD(&spice_chars, s, next);

return chr;
}

Expand Down

0 comments on commit 7a5448c

Please sign in to comment.