[5474] Fix some issues with QEMUFile
Revision: 5474
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5474 Author: aliguori Date: 2008-10-13 03:07:56 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
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 <[email protected]>
Modified Paths:
--------------
trunk/hw/hw.h
trunk/vl.c
Modified: trunk/hw/hw.h
===================================================================
hw/hw.h +3 -2
@@ -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_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
Modified: trunk/vl.c
===================================================================
vl.c +79 -43
260 lines not on this page · raw message