Re: [Qemu-devel] [PATCH 1/10] Refactor QEMUFile for live migration

Chris Lalancette
2008-09-10T13:31:09Z

Anthony Liguori wrote:
<snip>
> void qemu_fflush(QEMUFile *f)
> {
> - if (!f->is_writable)
> + if (!f->put_buffer)
> return;
> +
> if (f->buf_index > 0) {
> - if (f->is_file) {
> - fseek(f->outfile, f->buf_offset, SEEK_SET);
> - fwrite(f->buf, 1, f->buf_index, f->outfile);
> - } else {
> - bdrv_pwrite(f->bs, f->base_offset + f->buf_offset,
> - f->buf, f->buf_index);
> - }
> + f->put_buffer(f->opaque, f->buf, f->buf_offset, f->buf_index);

Nit...whitespace damage.

...

Overall, seems to be a good refactoring, and seems to keep the original
semantics of qemu_fopen_bdrv() and qemu_fopen().

Chris Lalancette