From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSP2q-0002Gn-PZ for qemu-devel@nongnu.org; Sun, 28 Oct 2012 05:20:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TSP2p-0004Sw-CM for qemu-devel@nongnu.org; Sun, 28 Oct 2012 05:20:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45456) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSP2p-0004Sj-33 for qemu-devel@nongnu.org; Sun, 28 Oct 2012 05:20:35 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9S9KYcX021297 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 28 Oct 2012 05:20:34 -0400 Message-ID: <508D14FA.2090905@redhat.com> Date: Sun, 28 Oct 2012 13:20:26 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <1350555758-29988-1-git-send-email-pbonzini@redhat.com> <1350555758-29988-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1350555758-29988-2-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 01/12] migration: unify stdio-based QEMUFile operations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, quintela@redhat.com On 10/18/2012 12:22 PM, Paolo Bonzini wrote: > Now that qemu_fseek does not exist anymore, there is no reason to do > an fseek before fread/fwrite when operating on an stdio file. > Thus, unify the get/put_buffer callbacks used by qemu_fopen > with those used for pipes. > > Signed-off-by: Paolo Bonzini > --- > savevm.c | 19 ++----------------- > 1 file modificato, 2 inserzioni(+), 17 rimozioni(-) > > diff --git a/savevm.c b/savevm.c > index b080d37..7068390 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -342,21 +342,6 @@ QEMUFile *qemu_fopen_socket(int fd) > return s->file; > } > > -static int file_put_buffer(void *opaque, const uint8_t *buf, > - int64_t pos, int size) > -{ > - QEMUFileStdio *s = opaque; > - fseek(s->stdio_file, pos, SEEK_SET); > - return fwrite(buf, 1, size, s->stdio_file); > -} > - > -static int file_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) > -{ > - QEMUFileStdio *s = opaque; > - fseek(s->stdio_file, pos, SEEK_SET); > - return fread(buf, 1, size, s->stdio_file); > -} > - > QEMUFile *qemu_fopen(const char *filename, const char *mode) > { > QEMUFileStdio *s; > @@ -375,10 +360,10 @@ QEMUFile *qemu_fopen(const char *filename, const char *mode) > goto fail; > > if(mode[0] == 'w') { > - s->file = qemu_fopen_ops(s, file_put_buffer, NULL, stdio_fclose, > + s->file = qemu_fopen_ops(s, stdio_put_buffer, NULL, stdio_fclose, > NULL, NULL, NULL); > } else { > - s->file = qemu_fopen_ops(s, NULL, file_get_buffer, stdio_fclose, > + s->file = qemu_fopen_ops(s, NULL, stdio_get_buffer, stdio_fclose, > NULL, NULL, NULL); > } > return s->file; > Reviewed-by: Orit Wasserman