[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 04/12] Add stdio_writev_buffer function
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC 04/12] Add stdio_writev_buffer function |
Date: |
Thu, 21 Mar 2013 10:28:49 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
Il 21/03/2013 10:09, Orit Wasserman ha scritto:
> Signed-off-by: Orit Wasserman <address@hidden>
> ---
> savevm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/savevm.c b/savevm.c
> index 41dc87f..fa07a86 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -241,6 +241,11 @@ static int stdio_get_fd(void *opaque)
> return fileno(s->stdio_file);
> }
>
> +static int stdio_writev_buffer(void *opaque, struct iovec *iov, int iovcnt)
> +{
> + return iov_writev(stdio_get_fd(opaque), iov, iovcnt);
> +}
> +
> static int stdio_put_buffer(void *opaque, const uint8_t *buf, int64_t pos,
> int size)
> {
> QEMUFileStdio *s = opaque;
> @@ -321,6 +326,7 @@ static const QEMUFileOps stdio_pipe_read_ops = {
> static const QEMUFileOps stdio_pipe_write_ops = {
> .get_fd = stdio_get_fd,
> .put_buffer = stdio_put_buffer,
> + .writev_buffer = stdio_writev_buffer,
> .close = stdio_pclose
> };
>
>
This may cause subtle bugs if the FILE* is written before opening the
QEMUFile, but not flushed. It doesn't happen in QEMU, but it is not too
clean. If you let qemu_fflush pick one of stdio_put_buffer or
stdio_writev_buffer, the problem disappears.
Paolo
[Qemu-devel] [RFC 04/12] Add stdio_writev_buffer function, Orit Wasserman, 2013/03/21
- Re: [Qemu-devel] [RFC 04/12] Add stdio_writev_buffer function,
Paolo Bonzini <=
[Qemu-devel] [RFC 05/12] Add block_writev_buffer function, Orit Wasserman, 2013/03/21
[Qemu-devel] [RFC 06/12] Update bytes_xfer in qemu_put_byte, Orit Wasserman, 2013/03/21
[Qemu-devel] [RFC 07/12] Store the data to send also in iovec, Orit Wasserman, 2013/03/21
[Qemu-devel] [RFC 08/12] Use writev ops instead of put_buffer ops, Orit Wasserman, 2013/03/21
[Qemu-devel] [RFC 09/12] More optimized qemu_put_be64/32/16, Orit Wasserman, 2013/03/21