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

2011-10-09 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,

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

2011-10-07 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 4/5] savevm: improve subsections detection on load

2011-10-06 Thread Paolo Bonzini
On 10/07/2011 12:42 AM, Juan Quintela wrote: > This changes semantics for reads above 32KB. It should be in the > commit message, or preferably v1 could be committed instead.:) how it changes? My understanding is that we read the same, only change that I can think of is the one that I have j

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

2011-10-06 Thread Juan Quintela
Paolo Bonzini wrote: > On 10/06/2011 06:21 PM, Juan Quintela wrote: >> + >> +int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size) >> +{ >> +int pending = size; >> +int done = 0; >> + >> +while (pending> 0) { >> +int res; >> + >> +res = qemu_peek_buffer(f, buf, pend

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

2011-10-06 Thread Paolo Bonzini
On 10/06/2011 06:21 PM, Juan Quintela wrote: + +int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size) +{ +int pending = size; +int done = 0; + +while (pending> 0) { +int res; + +res = qemu_peek_buffer(f, buf, pending, 0); +if (res == 0) { +retur

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

2011-10-06 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,