qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC][PATCH v3 05/21] virtproxy, add vp_channel_send_al


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC][PATCH v3 05/21] virtproxy, add vp_channel_send_all
Date: Thu, 18 Nov 2010 10:08:12 +0000

> +static int vp_channel_send_all(VPDriver *drv, uint8_t *buf, int count)
> +{
> +    int ret;
> +    CharDriverState *chr = drv->chr;
> +
> +    if (drv->chr != NULL) {
> +        /* send data to guest via channel device's read handler */
> +        vp_chr_read(chr, buf, count);
> +        /* TODO: we assume here the full buffer was written to device
> +         * due to the dev write handler being a void function.
> +         * can we confirm? Do we need to?
> +         */
> +        ret = count;
> +    } else if (drv->channel_fd != -1) {
> +        /* send data to host via channel fd */
> +        ret = vp_send_all(drv->channel_fd, buf, count);
> +        if (ret == -1) {
> +            LOG("error sending data");
> +            goto out_bad;
> +        }
> +    } else {
> +        LOG("driver in unknown state");
> +        goto out_bad;
> +    }
> +
> +    return ret;
> +out_bad:
> +    LOG("unable to send to channel");
> +    return -1;
> +}
> +

Propagate the error return value?  Currently this function discards
the specific error and also doesn't LOG() its value.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]