From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> This patch-pair adds the QEMUSizedBuffer based in-memory QEMUFile written by Stefan Berger and Joel Schopp. I've made some fixes and modified the existing test-vmstate to use it for some test cases.
While there's nothing other than test cases using it yet, I think it's worth going in by itself, since I'm using it in two separate patchsets (postcopy and visitor/BER) and Sanidhya uses it in the periodic vmstate test world. In addition both microcheckpointing and COLO have similar but independent implementations (although they both have some extra-gotcha's so it might not be possible to reuse it), and there was another implementation of the same thing in the Yabusame Postcopy world. Thus it seems best to put in, if only to stop people writing yet another implementation. Dave v5: Fixes from Eric's comments; including a memory leak in an error path v4: Fix very silly mistake in qsb_grow ENOMEM check v3: Mostly addressing comments from Eric and Gonglei rewrote qsb_grow to always use _try_ for memory allocation also made it use MAX_CHUNK_SIZE as needed made QSB_MAX_CHUNK_SIZE 16x rather than 10x CHUNK_SIZE reworked qsb_get_buffer to always take an allocated buffer qsb_create: Cope with 0 length but passed buffer Rework so it can fail on memory allocation failures qsb_write_at return -EINVAL for invalid position qsb_clone Cope with qsb_write_at failing Typo: 'of of' in comment 'withing' Reword qsb_clone 'exact copy'->'deep copy' Dr. David Alan Gilbert (2): QEMUSizedBuffer based QEMUFile Tests: QEMUSizedBuffer/QEMUBuffer include/migration/qemu-file.h | 28 +++ include/qemu/typedefs.h | 1 + qemu-file.c | 456 ++++++++++++++++++++++++++++++++++++++++++ tests/Makefile | 2 +- tests/test-vmstate.c | 74 +++---- 5 files changed, 524 insertions(+), 37 deletions(-) -- 1.9.3