From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG5jV-0001sk-9o for qemu-devel@nongnu.org; Thu, 14 Mar 2013 06:50:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UG5jQ-0004ow-Jn for qemu-devel@nongnu.org; Thu, 14 Mar 2013 06:50:01 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:55224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG5jQ-0004oo-Fq for qemu-devel@nongnu.org; Thu, 14 Mar 2013 06:49:56 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Mar 2013 06:49:55 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id BD56DC9001E for ; Thu, 14 Mar 2013 06:49:51 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2EAnpIo61145178 for ; Thu, 14 Mar 2013 06:49:51 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2EAno4U013224 for ; Thu, 14 Mar 2013 07:49:51 -0300 Message-ID: <5141AB4E.6040005@linux.vnet.ibm.com> Date: Thu, 14 Mar 2013 06:49:50 -0400 From: Stefan Berger MIME-Version: 1.0 References: <1363200988-17865-1-git-send-email-jschopp@linux.vnet.ibm.com> <1363200988-17865-4-git-send-email-jschopp@linux.vnet.ibm.com> <5140E9CE.7080902@redhat.com> In-Reply-To: <5140E9CE.7080902@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/9] two new file wrappers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Joel Schopp , qemu-devel@nongnu.org, Michael Tsirkin On 03/13/2013 05:04 PM, Eric Blake wrote: > On 03/13/2013 12:56 PM, Joel Schopp wrote: >> Add a 3 very short file wrapper functions to make code that follows more > s/a 3/3/ > >> readable. Also export an existing function that is currently static. >> >> Cc: Michael Tsirkin >> Signed-off-by: Stefan Berger >> Signed-off-by: Joel Schopp >> --- >> include/migration/qemu-file.h | 3 +++ >> util/qemu-file.c | 30 ++++++++++++++++++++++++++++++ >> 2 files changed, 33 insertions(+) >> >> + >> +int qemu_peek_bytes(QEMUFile *f, uint8_t *buf, int size, size_t offset) > Should we be using off_t instead of size_t for offset; and size_t > instead of int for size (which implies ssize_t for return value)? > Good question. Existing functions have signatures like this: void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size) static void qemu_file_skip(QEMUFile *f, int size) static int qemu_peek_buffer(QEMUFile *f, uint8_t *buf, int size, size_t offset) static int qemu_peek_byte(QEMUFile *f, int offset) So it's better if we line up behind them... Stefan