BufferedCloseFunc *close;
void *opaque;
QEMUFile *file;
- int has_error;
int freeze_output;
size_t bytes_xfer;
size_t xfer_limit;
{
size_t offset = 0;
- if (s->has_error) {
+ if (qemu_file_has_error(s->file)) {
DPRINTF("flush when error, bailing\n");
return;
}
if (ret <= 0) {
DPRINTF("error flushing data, %zd\n", ret);
- s->has_error = 1;
+ qemu_file_set_error(s->file);
break;
} else {
DPRINTF("flushed %zd byte(s)\n", ret);
DPRINTF("putting %d bytes at %" PRId64 "\n", size, pos);
- if (s->has_error) {
+ if (qemu_file_has_error(s->file)) {
DPRINTF("flush when error, bailing\n");
return -EINVAL;
}
if (ret <= 0) {
DPRINTF("error putting\n");
- s->has_error = 1;
+ qemu_file_set_error(s->file);
offset = -EINVAL;
break;
}
DPRINTF("closing\n");
- while (!s->has_error && s->buffer_size) {
+ while (!qemu_file_has_error(s->file) && s->buffer_size) {
buffered_flush(s);
if (s->freeze_output)
s->wait_for_unfreeze(s->opaque);
{
QEMUFileBuffered *s = opaque;
- if (s->has_error) {
+ if (qemu_file_has_error(s->file)) {
return -1;
}
if (s->freeze_output)
static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
{
QEMUFileBuffered *s = opaque;
- if (s->has_error)
+ if (qemu_file_has_error(s->file))
goto out;
if (new_rate > SIZE_MAX) {
{
QEMUFileBuffered *s = opaque;
- if (s->has_error) {
+ if (qemu_file_has_error(s->file)) {
buffered_close(s);
return;
}