示例#1
0
static int virtconsole_exitfn(VirtIOSerialDevice *dev)
{
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
    VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);

    if (vcon->chr) {
        port->info->have_data = NULL;
        qemu_chr_close(vcon->chr);
    }

    return 0;
}
static void
charbuffer_close( CharDriverState*  cs )
{
    CharBuffer*  cbuf = cs->opaque;

    while (cbuf->bip_first) {
        BipBuffer*  bip = cbuf->bip_first;
        cbuf->bip_first = bip->next;
        bip_buffer_free(bip);
    }
    cbuf->bip_last = NULL;
    cbuf->endpoint = NULL;

    if (cbuf->endpoint != NULL) {
        qemu_chr_close(cbuf->endpoint);
        cbuf->endpoint = NULL;
    }
}