diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-13 03:07:56 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-13 03:07:56 +0000 |
commit | 871d2f079661323a7645b388eb5ae8d7eeb3117c (patch) | |
tree | e7f554ea48fd462199e312911d391061e2762fdb /hw/hw.h | |
parent | 7526aa2d0082558bc4e89dab9f7a37b0d509a71a (diff) | |
download | qemu-871d2f079661323a7645b388eb5ae8d7eeb3117c.tar.gz qemu-871d2f079661323a7645b388eb5ae8d7eeb3117c.tar.bz2 qemu-871d2f079661323a7645b388eb5ae8d7eeb3117c.zip |
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 <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5474 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/hw.h')
-rw-r--r-- | hw/hw.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 |