From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEz8e-00005l-1x for qemu-devel@nongnu.org; Wed, 06 Aug 2014 07:12:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEz8W-00006S-L5 for qemu-devel@nongnu.org; Wed, 06 Aug 2014 07:12:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEz8W-00006J-CW for qemu-devel@nongnu.org; Wed, 06 Aug 2014 07:12:04 -0400 Date: Wed, 6 Aug 2014 12:11:53 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20140806111152.GE2368@work-vm> References: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> <1406302776-2306-2-git-send-email-sanidhya.iiith@gmail.com> <53D6C189.8090309@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53D6C189.8090309@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC v2 01/12] QEMUSizedBuffer/QEMUFile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Joel Schopp , Stefan Berger , qemu list , Juan Quintela , Sanidhya Kashyap * Eric Blake (eblake@redhat.com) wrote: > On 07/25/2014 09:39 AM, Sanidhya Kashyap wrote: > > From: "Dr. David Alan Gilbert" > > > > Stefan Berger's to create a QEMUFile that goes to a memory buffer; > > Missing something. Maybe you meant: > > This is based on Stefan Berger's patch to create ... I'll update that in my version. > > from: > > > > http://lists.gnu.org/archive/html/qemu-devel/2013-03/msg05036.html > > > > Using the QEMUFile interface, this patch adds support functions for > > operating > > on in-memory sized buffers that can be written to or read from. > > Odd line breaking. > > > > > Signed-off-by: Stefan Berger > > Signed-off-by: Joel Schopp > > Still looks weird to have David as author but not listed in S-o-B. I'm thinking of trying to put this code in via a stand-alone patch (with a testcase use); since we've got 3+ users of this code in unmerged things and at least 3 implementations of something similar, it would be best to get it in before someone writes a 4th. > > --- > > include/migration/qemu-file.h | 27 +++ > > qemu-file.c | 411 ++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 438 insertions(+) > > > > > +/** > > + * Set the length of the buffer; The primary usage of this > > s/The/the/ > > + * function is to truncate the number of used bytes in the buffer. > > + * The size will not be extended beyond the current number of > > no need for double space > > > + * allocated bytes in the QEMUSizedBuffer. > > + * > > + * @qsb: A QEMUSizedBuffer > > + * @new_len : The new length of bytes in the buffer > > + * > > + * Returns the number of bytes the buffer was trucated or extended > > s/trucated/truncated/ I've picked up these typos in my world. Thanks. > > + > > +QEMUFile *qemu_bufopen(const char *mode, QEMUSizedBuffer *input) > > +{ > > + QEMUBuffer *s; > > + > > + if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) { > > + fprintf(stderr, "qemu_bufopen: Argument validity check failed\n"); > > Should this function be directly printing to stderr, or should it be > converted to use Error **errp semantics? It's consistent with the open functions for other file types ( qemu_fdopen, qemu_popen_cmd, qemu_fopen ). Dave > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK