Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102031
b: refs/heads/staging
c: c3d6b96
h: refs/heads/master
i:
  102029: 2a97ecb
  102027: b1e7dd2
  102023: 07b9d49
  102015: 5c7afed
  • Loading branch information
jwrdegoede authored and kraxel committed Apr 16, 2013
1 parent 22cd4aa commit e225673
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ refs/heads/stable-0.14: 56a60dd6d619877e9957ba06b92d2f276e3c229d
refs/heads/stable-0.15: 82b2b32a323bbb5824b4fbe63a3bca50f827e28e
refs/heads/stable-1.0: 3ffb4001c2e28624cd59a2b3598858784d0718d0
refs/heads/stable-1.1: 4ce5bc2dd1914a706725186c6563e8f92eedfc84
refs/heads/staging: f9fb0532fb0c7155c0616614dc12ecccf93f8afb
refs/heads/staging: c3d6b96ebba18d016be26ffa475feea0d81801a2
refs/tags/v0.5.1: be26a5288e43d3177908a92251c526d54fbb936d
refs/tags/v0.6.0: ea4b3c0748638ccebd8903f0dd2a8b32c69ab6fe
"refs/tags/release_0_10_0": 25c4fde17775821182a76fb8ea2ba2223c5729b9
Expand Down
24 changes: 22 additions & 2 deletions branches/staging/hw/char/virtio-console.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
typedef struct VirtConsole {
VirtIOSerialPort port;
CharDriverState *chr;
guint watch;
} VirtConsole;

/*
Expand All @@ -29,6 +30,7 @@ static gboolean chr_write_unblocked(GIOChannel *chan, GIOCondition cond,
{
VirtConsole *vcon = opaque;

vcon->watch = 0;
virtio_serial_throttle_port(&vcon->port, false);
return FALSE;
}
Expand Down Expand Up @@ -61,8 +63,10 @@ static ssize_t flush_buf(VirtIOSerialPort *port,
ret = 0;
if (!k->is_console) {
virtio_serial_throttle_port(port, true);
qemu_chr_fe_add_watch(vcon->chr, G_IO_OUT, chr_write_unblocked,
vcon);
if (!vcon->watch) {
vcon->watch = qemu_chr_fe_add_watch(vcon->chr, G_IO_OUT,
chr_write_unblocked, vcon);
}
}
}
return ret;
Expand Down Expand Up @@ -106,6 +110,10 @@ static void chr_event(void *opaque, int event)
virtio_serial_open(&vcon->port);
break;
case CHR_EVENT_CLOSED:
if (vcon->watch) {
g_source_remove(vcon->watch);
vcon->watch = 0;
}
virtio_serial_close(&vcon->port);
break;
}
Expand All @@ -130,6 +138,17 @@ static int virtconsole_initfn(VirtIOSerialPort *port)
return 0;
}

static int virtconsole_exitfn(VirtIOSerialPort *port)
{
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);

if (vcon->watch) {
g_source_remove(vcon->watch);
}

return 0;
}

static Property virtconsole_properties[] = {
DEFINE_PROP_CHR("chardev", VirtConsole, chr),
DEFINE_PROP_END_OF_LIST(),
Expand All @@ -142,6 +161,7 @@ static void virtconsole_class_init(ObjectClass *klass, void *data)

k->is_console = true;
k->init = virtconsole_initfn;
k->exit = virtconsole_exitfn;
k->have_data = flush_buf;
k->set_guest_connected = set_guest_connected;
dc->props = virtconsole_properties;
Expand Down

0 comments on commit e225673

Please sign in to comment.