Introduce a buffered file wrapper for QEMUFile

This patch introduces a buffered QEMUFile wrapper.  This allows QEMUFile's to be
rate limited.  It also makes it easier to implement a QEMUFile that is
asynchronous since the current QEMUFile API requires that all reads and writes
be synchronous.

The only real non-obvious part of the API is the "frozen" concept.  If the
backend returns EAGAIN, the QEMUFile is said to be "frozen".  This means no
additional output will be sent to the backend until the file is unfrozen.
qemu_file_put_notify can be used to unfreeze a frozen file.

A synchronous interface is also provided to wait for an unfreeze event.  This is
used during the final part of live migration when the VM is no longer running.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5475 c046a42c-6fe2-441c-8c8c-71466251a162
3 files changed
tree: 105b3e3f51cc09e4e940c695d2053e5eeb61e9b5
  1. audio/
  2. darwin-user/
  3. fpu/
  4. gdb-xml/
  5. hw/
  6. keymaps/
  7. linux-user/
  8. pc-bios/
  9. slirp/
  10. target-alpha/
  11. target-arm/
  12. target-cris/
  13. target-i386/
  14. target-m68k/
  15. target-mips/
  16. target-ppc/
  17. target-sh4/
  18. target-sparc/
  19. tcg/
  20. tests/
  21. .gitignore
  22. a.out.h
  23. aes.c
  24. aes.h
  25. aio.c
  26. alpha-dis.c
  27. alpha.ld
  28. arm-dis.c
  29. arm-semi.c
  30. arm.ld
  31. block-bochs.c
  32. block-cloop.c
  33. block-cow.c
  34. block-dmg.c
  35. block-nbd.c
  36. block-parallels.c
  37. block-qcow.c
  38. block-qcow2.c
  39. block-raw-posix.c
  40. block-raw-win32.c
  41. block-vmdk.c
  42. block-vpc.c
  43. block-vvfat.c
  44. block.c
  45. block.h
  46. block_int.h
  47. bswap.h
  48. bt-host.c
  49. bt-vhci.c
  50. buffered_file.c
  51. buffered_file.h
  52. Changelog
  53. check_ops.sh
  54. cocoa.m
  55. configure
  56. console.c
  57. console.h
  58. COPYING
  59. COPYING.LIB
  60. cpu-all.h
  61. cpu-defs.h
  62. cpu-exec.c
  63. cris-dis.c
  64. curses.c
  65. curses_keys.h
  66. cutils.c
  67. d3des.c
  68. d3des.h
  69. dis-asm.h
  70. disas.c
  71. disas.h
  72. dyngen-exec.h
  73. dyngen.c
  74. elf.h
  75. elf_ops.h
  76. exec-all.h
  77. exec.c
  78. feature_to_c.sh
  79. gdbstub.c
  80. gdbstub.h
  81. gen-icount.h
  82. host-utils.c
  83. host-utils.h
  84. hostregs_helper.h
  85. hpet.h
  86. hppa-dis.c
  87. hppa.ld
  88. i386-dis.c
  89. i386.ld
  90. ia64.ld
  91. keymaps.c
  92. kqemu.c
  93. kqemu.h
  94. LICENSE
  95. loader.c
  96. m68k-dis.c
  97. m68k-semi.c
  98. m68k.ld
  99. MAINTAINERS
  100. Makefile
  101. Makefile.target
  102. mips-dis.c
  103. mips.ld
  104. mipsel.ld
  105. monitor.c
  106. nbd.c
  107. nbd.h
  108. net-checksum.c
  109. net.h
  110. osdep.c
  111. osdep.h
  112. ppc-dis.c
  113. ppc.ld
  114. ppc64.ld
  115. qemu-aio.h
  116. qemu-binfmt-conf.sh
  117. qemu-char.h
  118. qemu-common.h
  119. qemu-doc.texi
  120. qemu-img.c
  121. qemu-img.texi
  122. qemu-lock.h
  123. qemu-log.h
  124. qemu-malloc.c
  125. qemu-nbd.c
  126. qemu-nbd.texi
  127. qemu-tech.texi
  128. qemu-timer.h
  129. qemu-tool.c
  130. qemu_socket.h
  131. readline.c
  132. README
  133. s390-dis.c
  134. s390.ld
  135. sdl.c
  136. sdl_keysym.h
  137. sh4-dis.c
  138. softmmu-semi.h
  139. softmmu_defs.h
  140. softmmu_exec.h
  141. softmmu_header.h
  142. softmmu_template.h
  143. sparc-dis.c
  144. sparc.ld
  145. sparc64.ld
  146. sys-queue.h
  147. sysemu.h
  148. tap-win32.c
  149. texi2pod.pl
  150. thunk.c
  151. thunk.h
  152. TODO
  153. translate-all.c
  154. uboot_image.h
  155. usb-linux.c
  156. VERSION
  157. vgafont.h
  158. vl.c
  159. vnc.c
  160. vnc_keysym.h
  161. vnchextile.h
  162. x86_64.ld
  163. x_keymap.c