buffered_file: unfold migrate_fd_close

We only used it once, just remove the callback indirection.

Signed-off-by: Juan Quintela <quintela@redhat.com>
buffered_file: We can access directly to bandwidth_limit

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
buffered_file: callers of buffered_flush() already check for errors

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
buffered_file: make buffered_flush return the error code

Or the amount of data written if there is no error.  Adjust all callers.

Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: make migrate_fd_wait_for_unfreeze() return errors

Adjust all callers

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: unexport qemu_fflush

It is not used outside of savevm.c

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
virtio-net: use qemu_get_buffer() in a temp buffer

qemu_fseek() is known to be wrong.  Would be removed on the next
commit.  This code should never been used (value has been
MAC_TABLE_ENTRIES since 2009).

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: Remove qemu_fseek()

It has no users, and is only half implemented.

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: make qemu_fflush() return an error code

Adjust all the callers.  We moved the set of last_error from inside
qemu_fflush() to all the callers.

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: unfold qemu_fclose_internal()

It was used only one, and was only one if.  It makes error handling
saner.

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: unexport qemu_ftell()

It was unused out of savevm.c.

Signed-off-by: Juan Quintela <quintela@redhat.com>
savevm: make qemu_fill_buffer() be consistent

It was setting last_error directly once, and with the helper the other time.

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: Only qemu_fflush() can generate errors

Move the error check to the beggining of the callers.  Once this is fixed
qemu_file_set_if_error() is not used anymore, so remove it.

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
buffered_file: buffered_put_buffer() don't need to set last_error

Callers on savevm.c:qemu_fflush() will set it.

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
block-migration: make flush_blks() return errors

This means we don't need to pass through qemu_file to get the errors.
Adjust all callers.

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
block-migration:  Switch meaning of return value

Make consistent the result of blk_mig_save_dirty_block() and
mig_save_device_dirty()

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
block-migration: handle errors with the return codes correctly

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: un-export qemu_file_set_error()

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: make qemu_file_put_notify() return errors

Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
cpus: create qemu_in_vcpu_thread()

Old code used !io_thread to know if a thread was an vcpu or not.  That
fails when we introduce the iothread.

Signed-off-by: Juan Quintela <quintela@redhat.com>