aboutsummaryrefslogtreecommitdiff
path: root/buffered_file.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-08-08 10:15:15 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-11-02 18:34:59 +0100
commit9229bf3c2d7afcd1adce7258843d9bc82b066b08 (patch)
tree1fe8611ff775fd8ab4838e5b88dcc6dde0397553 /buffered_file.c
parent5f0ebf1b4d58be0c0bb05beb195b6f42942eeee8 (diff)
migration: consolidate QEMUFile methods in a single QEMUFileOps struct
Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'buffered_file.c')
-rw-r--r--buffered_file.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/buffered_file.c b/buffered_file.c
index ed92df1053..a5c0b128e0 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -234,6 +234,14 @@ static void buffered_rate_tick(void *opaque)
buffered_put_buffer(s, NULL, 0, 0);
}
+static const QEMUFileOps buffered_file_ops = {
+ .put_buffer = buffered_put_buffer,
+ .close = buffered_close,
+ .rate_limit = buffered_rate_limit,
+ .get_rate_limit = buffered_get_rate_limit,
+ .set_rate_limit = buffered_set_rate_limit,
+};
+
QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state)
{
QEMUFileBuffered *s;
@@ -243,10 +251,7 @@ QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state)
s->migration_state = migration_state;
s->xfer_limit = migration_state->bandwidth_limit / 10;
- s->file = qemu_fopen_ops(s, buffered_put_buffer, NULL,
- buffered_close, buffered_rate_limit,
- buffered_set_rate_limit,
- buffered_get_rate_limit);
+ s->file = qemu_fopen_ops(s, &buffered_file_ops);
s->timer = qemu_new_timer_ms(rt_clock, buffered_rate_tick, s);