[Qemu-devel] [PATCH 3/4] savevm: improve subsections detection on load

2011-10-04 Thread Juan Quintela
We add qemu_peek_buffer, that is identical to qemu_get_buffer, just that it don't update f->buf_index. We add a paramenter to qemu_peek_byte() to be able to peek more than one byte. Once this is done, to see if we have a subsection we look: - 1st byte is QEMU_VM_SUBSECTION - 2nd byte is a length,

Re: [Qemu-devel] [PATCH 3/4] savevm: improve subsections detection on load

2011-10-05 Thread Anthony Liguori
On 10/04/2011 09:38 AM, Juan Quintela wrote: We add qemu_peek_buffer, that is identical to qemu_get_buffer, just that it don't update f->buf_index. We add a paramenter to qemu_peek_byte() to be able to peek more than one byte. Once this is done, to see if we have a subsection we look: - 1st byt

Re: [Qemu-devel] [PATCH 3/4] savevm: improve subsections detection on load

2011-10-06 Thread Paolo Bonzini
On 10/05/2011 09:45 PM, Anthony Liguori wrote: int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1) { int size, l; Can we implement get_buffer in terms of peek_buffer and just increment f->buf_index in get_buffer? No, get_buffer works even if size1 is greater than the size of