block: vhdx - log parsing, replay, and flush support

This adds support for VHDX v0 logs, as specified in Microsoft's
VHDX Specification Format v1.00:
https://www.microsoft.com/en-us/download/details.aspx?id=34750

The following support is added:

* Log parsing, and validation - validate that an existing log
  is correct.

* Log search - search through an existing log, to find any valid
  sequence of entries.

* Log replay and flush - replay an existing log, and flush/clear
  the log when complete.

The VHDX log is a circular buffer, with elements (sectors) of 4KB.

A log entry is a variably-length number of sectors, that is
comprised of a header and 'descriptors', that describe each sector.

A log may contain multiple entries, know as a log sequence.  In a log
sequence, each log entry immediately follows the previous entry, with an
incrementing sequence number.  There can only ever be one active and
valid sequence in the log.

Each log entry must match the file log GUID in order to be valid (along
with other criteria).  Once we have flushed all valid log entries, we
marked the file log GUID to be zero, which indicates a buffer with no
valid entries.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4 files changed
tree: 9167c27dbc1f182482aa3fd645962aefa3f0b3c9
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. default-configs/
  6. disas/
  7. docs/
  8. fpu/
  9. fsdev/
  10. gdb-xml/
  11. hw/
  12. include/
  13. libcacard/
  14. linux-headers/
  15. linux-user/
  16. net/
  17. pc-bios/
  18. po/
  19. qapi/
  20. qga/
  21. qobject/
  22. qom/
  23. roms/
  24. scripts/
  25. slirp/
  26. stubs/
  27. sysconfigs/
  28. target-alpha/
  29. target-arm/
  30. target-cris/
  31. target-i386/
  32. target-lm32/
  33. target-m68k/
  34. target-microblaze/
  35. target-mips/
  36. target-moxie/
  37. target-openrisc/
  38. target-ppc/
  39. target-s390x/
  40. target-sh4/
  41. target-sparc/
  42. target-unicore32/
  43. target-xtensa/
  44. tcg/
  45. tests/
  46. trace/
  47. ui/
  48. util/
  49. .exrc
  50. .gitignore
  51. .gitmodules
  52. .mailmap
  53. aio-posix.c
  54. aio-win32.c
  55. arch_init.c
  56. async.c
  57. balloon.c
  58. block-migration.c
  59. block.c
  60. blockdev-nbd.c
  61. blockdev.c
  62. blockjob.c
  63. bt-host.c
  64. bt-vhci.c
  65. Changelog
  66. CODING_STYLE
  67. configure
  68. COPYING
  69. COPYING.LIB
  70. coroutine-gthread.c
  71. coroutine-sigaltstack.c
  72. coroutine-ucontext.c
  73. coroutine-win32.c
  74. cpu-exec.c
  75. cpus.c
  76. cputlb.c
  77. device-hotplug.c
  78. device_tree.c
  79. disas.c
  80. dma-helpers.c
  81. dump.c
  82. exec.c
  83. gdbstub.c
  84. HACKING
  85. hmp-commands.hx
  86. hmp.c
  87. hmp.h
  88. iohandler.c
  89. ioport.c
  90. kvm-all.c
  91. kvm-stub.c
  92. LICENSE
  93. main-loop.c
  94. MAINTAINERS
  95. Makefile
  96. Makefile.objs
  97. Makefile.target
  98. memory.c
  99. memory_mapping.c
  100. migration-exec.c
  101. migration-fd.c
  102. migration-rdma.c
  103. migration-tcp.c
  104. migration-unix.c
  105. migration.c
  106. monitor.c
  107. nbd.c
  108. os-posix.c
  109. os-win32.c
  110. page_cache.c
  111. qapi-schema.json
  112. qdev-monitor.c
  113. qdict-test-data.txt
  114. qemu-bridge-helper.c
  115. qemu-char.c
  116. qemu-coroutine-io.c
  117. qemu-coroutine-lock.c
  118. qemu-coroutine-sleep.c
  119. qemu-coroutine.c
  120. qemu-doc.texi
  121. qemu-img-cmds.hx
  122. qemu-img.c
  123. qemu-img.texi
  124. qemu-io-cmds.c
  125. qemu-io.c
  126. qemu-log.c
  127. qemu-nbd.c
  128. qemu-nbd.texi
  129. qemu-options-wrapper.h
  130. qemu-options.h
  131. qemu-options.hx
  132. qemu-seccomp.c
  133. qemu-tech.texi
  134. qemu-timer.c
  135. qemu.nsi
  136. qemu.sasl
  137. qmp-commands.hx
  138. qmp.c
  139. qtest.c
  140. readline.c
  141. README
  142. rules.mak
  143. savevm.c
  144. spice-qemu-char.c
  145. tcg-runtime.c
  146. tci.c
  147. thread-pool.c
  148. thunk.c
  149. tpm.c
  150. trace-events
  151. translate-all.c
  152. translate-all.h
  153. user-exec.c
  154. VERSION
  155. version.rc
  156. vl.c
  157. xbzrle.c
  158. xen-all.c
  159. xen-mapcache.c
  160. xen-stub.c