From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIbnw-00005K-Vx for qemu-devel@nongnu.org; Thu, 21 Mar 2013 05:29:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIbns-0004Hu-3c for qemu-devel@nongnu.org; Thu, 21 Mar 2013 05:29:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIbnr-0004Hq-Ss for qemu-devel@nongnu.org; Thu, 21 Mar 2013 05:28:56 -0400 Message-ID: <514AD2D1.8060002@redhat.com> Date: Thu, 21 Mar 2013 10:28:49 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1363856971-4601-1-git-send-email-owasserm@redhat.com> <1363856971-4601-5-git-send-email-owasserm@redhat.com> In-Reply-To: <1363856971-4601-5-git-send-email-owasserm@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 04/12] Add stdio_writev_buffer function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Orit Wasserman Cc: mst@redhat.com, chegu_vinod@hp.com, qemu-devel@nongnu.org, quintela@redhat.com Il 21/03/2013 10:09, Orit Wasserman ha scritto: > Signed-off-by: Orit Wasserman > --- > 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