static int spice_chr_write(CharDriverState *chr, const uint8_t *buf, int len)

{

    SpiceCharDriver *s = chr->opaque;



    vmc_register_interface(s);

    assert(s->datalen == 0);

    if (s->bufsize < len) {

        s->bufsize = len;

        s->buffer = g_realloc(s->buffer, s->bufsize);

    }

    memcpy(s->buffer, buf, len);

    s->datapos = s->buffer;

    s->datalen = len;

    spice_server_char_device_wakeup(&s->sin);

    return len;

}

static int spice_chr_write(CharDriverState *chr, const uint8_t *buf, int len)

{

    SpiceCharDriver *s = chr->opaque;



    vmc_register_interface(s);

    assert(s->datalen == 0);

    if (s->bufsize < len) {

        s->bufsize = len;

        s->buffer = g_realloc(s->buffer, s->bufsize);

    }

    memcpy(s->buffer, buf, len);

    s->datapos = s->buffer;

    s->datalen = len;

    spice_server_char_device_wakeup(&s->sin);

    return len;

}

static int FUNC_0(CharDriverState *VAR_0, const uint8_t *VAR_1, int VAR_2)

{

    SpiceCharDriver *s = VAR_0->opaque;



    vmc_register_interface(s);

    assert(s->datalen == 0);

    if (s->bufsize < VAR_2) {

        s->bufsize = VAR_2;

        s->buffer = g_realloc(s->buffer, s->bufsize);

    }

    memcpy(s->buffer, VAR_1, VAR_2);

    s->datapos = s->buffer;

    s->datalen = VAR_2;

    spice_server_char_device_wakeup(&s->sin);

    return VAR_2;

}

static int FUNC_0(CharDriverState *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ SpiceCharDriver *s = VAR_0->opaque; vmc_register_interface(s); assert(s->datalen == 0); if (s->bufsize < VAR_2) { s->bufsize = VAR_2; s->buffer = g_realloc(s->buffer, s->bufsize); } memcpy(s->buffer, VAR_1, VAR_2); s->datapos = s->buffer; s->datalen = VAR_2; spice_server_char_device_wakeup(&s->sin); return VAR_2; }