From 871d2f079661323a7645b388eb5ae8d7eeb3117c Mon Sep 17 00:00:00 2001 From: aliguori Date: Mon, 13 Oct 2008 03:07:56 +0000 Subject: Fix some issues with QEMUFile This patch allows QEMUFile's read and write operations to return negative error codes. This is necessary to detect things like closed streams during live migration. It also removes unused code for QEMUFileFD write path. Finally, it makes sure to avoid attempting to flush an output buffer if the file is only being used for input. This was spotted by Uri Lublin. Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5474 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/hw.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'hw/hw.h') diff --git a/hw/hw.h b/hw/hw.h index e130355079..8edd7887c3 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -11,8 +11,8 @@ * The pos argument can be ignored if the file is only being used for * streaming. The handler should try to write all of the data it can. */ -typedef void (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf, - int64_t pos, int size); +typedef int (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf, + int64_t pos, int size); /* Read a chunk of data from a file at the given position. The pos argument * can be ignored if the file is only be used for streaming. The number of @@ -64,6 +64,7 @@ unsigned int qemu_get_be16(QEMUFile *f); unsigned int qemu_get_be32(QEMUFile *f); uint64_t qemu_get_be64(QEMUFile *f); int qemu_file_rate_limit(QEMUFile *f); +int qemu_file_has_error(QEMUFile *f); /* Try to send any outstanding data. This function is useful when output is * halted due to rate limiting or EAGAIN errors occur as it can be used to -- cgit v1.2.3