static gboolean fd_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)

{

    CharDriverState *chr = opaque;

    FDCharDriver *s = chr->opaque;

    int len;

    uint8_t buf[READ_BUF_LEN];

    GIOStatus status;

    gsize bytes_read;



    len = sizeof(buf);

    if (len > s->max_size) {

        len = s->max_size;

    }

    if (len == 0) {

        return FALSE;

    }



    status = g_io_channel_read_chars(chan, (gchar *)buf,

                                     len, &bytes_read, NULL);

    if (status == G_IO_STATUS_EOF) {

        qemu_chr_be_event(chr, CHR_EVENT_CLOSED);

        return FALSE;

    }

    if (status == G_IO_STATUS_NORMAL) {

        qemu_chr_be_write(chr, buf, bytes_read);

    }



    return TRUE;

}

static gboolean fd_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)

{

    CharDriverState *chr = opaque;

    FDCharDriver *s = chr->opaque;

    int len;

    uint8_t buf[READ_BUF_LEN];

    GIOStatus status;

    gsize bytes_read;



    len = sizeof(buf);

    if (len > s->max_size) {

        len = s->max_size;

    }

    if (len == 0) {

        return FALSE;

    }



    status = g_io_channel_read_chars(chan, (gchar *)buf,

                                     len, &bytes_read, NULL);

    if (status == G_IO_STATUS_EOF) {

        qemu_chr_be_event(chr, CHR_EVENT_CLOSED);

        return FALSE;

    }

    if (status == G_IO_STATUS_NORMAL) {

        qemu_chr_be_write(chr, buf, bytes_read);

    }



    return TRUE;

}

static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, void *opaque)

{

    CharDriverState *chr = opaque;

    FDCharDriver *s = chr->opaque;

    int VAR_0;

    uint8_t buf[READ_BUF_LEN];

    GIOStatus status;

    gsize bytes_read;



    VAR_0 = sizeof(buf);

    if (VAR_0 > s->max_size) {

        VAR_0 = s->max_size;

    }

    if (VAR_0 == 0) {

        return FALSE;

    }



    status = g_io_channel_read_chars(chan, (gchar *)buf,

                                     VAR_0, &bytes_read, NULL);

    if (status == G_IO_STATUS_EOF) {

        qemu_chr_be_event(chr, CHR_EVENT_CLOSED);

        return FALSE;

    }

    if (status == G_IO_STATUS_NORMAL) {

        qemu_chr_be_write(chr, buf, bytes_read);

    }



    return TRUE;

}

static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, void *opaque)
{ CharDriverState *chr = opaque; FDCharDriver *s = chr->opaque; int VAR_0; uint8_t buf[READ_BUF_LEN]; GIOStatus status; gsize bytes_read; VAR_0 = sizeof(buf); if (VAR_0 > s->max_size) { VAR_0 = s->max_size; } if (VAR_0 == 0) { return FALSE; } status = g_io_channel_read_chars(chan, (gchar *)buf,
VAR_0, &bytes_read, NULL); if (status == G_IO_STATUS_EOF) { qemu_chr_be_event(chr, CHR_EVENT_CLOSED); return FALSE; } if (status == G_IO_STATUS_NORMAL) { qemu_chr_be_write(chr, buf, bytes_read); } return TRUE; }