From a202a4c001fd35b50d99abcc329bc9e666eb8eed Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 13 Aug 2015 11:51:33 +0100 Subject: migration: size_t'ify some of qemu-file This is a start on using size_t more in qemu-file and friends; it fixes up QEMUFilePutBufferFunc and QEMUFileGetBufferFunc to take size_t lengths and return ssize_t return values (like read(2)) and fixes up all the different implementations of them. Note that I've not yet followed this deeply into bdrv_ implementations. Signed-off-by: Dr. David Alan Gilbert Message-Id: <1439463094-5394-5-git-send-email-dgilbert@redhat.com> Reviewed-by: zhanghailiang Reviewed-by: Amit Shah Signed-off-by: Amit Shah --- migration/qemu-file-buf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'migration/qemu-file-buf.c') diff --git a/migration/qemu-file-buf.c b/migration/qemu-file-buf.c index 2de9330ca5..1d9528e674 100644 --- a/migration/qemu-file-buf.c +++ b/migration/qemu-file-buf.c @@ -372,7 +372,8 @@ typedef struct QEMUBuffer { bool qsb_allocated; } QEMUBuffer; -static int buf_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) +static ssize_t buf_get_buffer(void *opaque, uint8_t *buf, int64_t pos, + size_t size) { QEMUBuffer *s = opaque; ssize_t len = qsb_get_length(s->qsb) - pos; @@ -387,8 +388,8 @@ static int buf_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) return qsb_get_buffer(s->qsb, pos, len, buf); } -static int buf_put_buffer(void *opaque, const uint8_t *buf, - int64_t pos, int size) +static ssize_t buf_put_buffer(void *opaque, const uint8_t *buf, + int64_t pos, size_t size) { QEMUBuffer *s = opaque; -- cgit 1.4.1