diff options
author | Anthony Liguori | 2012-11-02 19:06:28 +0100 |
---|---|---|
committer | Anthony Liguori | 2012-11-02 19:06:28 +0100 |
commit | 2a0dfd004d9fae4adf2ccfcb2e3b1a76906b48a0 (patch) | |
tree | 98dbd8f0ee86efb371da9fa605d87f96b51d55e5 /buffered_file.c | |
parent | Merge remote-tracking branch 'afaerber/qom-cpu' into staging (diff) | |
parent | migration: move process_incoming_migration to a coroutine (diff) | |
download | qemu-2a0dfd004d9fae4adf2ccfcb2e3b1a76906b48a0.tar.gz qemu-2a0dfd004d9fae4adf2ccfcb2e3b1a76906b48a0.tar.xz qemu-2a0dfd004d9fae4adf2ccfcb2e3b1a76906b48a0.zip |
Merge remote-tracking branch 'bonzini/migr-coroutine' into staging
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* bonzini/migr-coroutine:
migration: move process_incoming_migration to a coroutine
migration: handle EAGAIN while reading QEMUFile
migration: move qemu_fclose to process_incoming_migration
migration: close socket QEMUFile from socket_close
migration: xxx_close will only be called once
migration: use closesocket, not close
migration: use migrate_fd_close in migrate_fd_cleanup
migration: clean up server sockets and handlers before invoking process_incoming_migration
migration: replace qemu_stdio_fd with qemu_get_fd
migration: add qemu_get_fd
migration: consolidate QEMUFile methods in a single QEMUFileOps struct
migration: unify stdio-based QEMUFile operations
Diffstat (limited to 'buffered_file.c')
-rw-r--r-- | buffered_file.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/buffered_file.c b/buffered_file.c index ed92df1053..bd0f61d8c9 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -174,6 +174,13 @@ static int buffered_close(void *opaque) * 1: Time to stop * negative: There has been an error */ +static int buffered_get_fd(void *opaque) +{ + QEMUFileBuffered *s = opaque; + + return qemu_get_fd(s->file); +} + static int buffered_rate_limit(void *opaque) { QEMUFileBuffered *s = opaque; @@ -234,6 +241,15 @@ static void buffered_rate_tick(void *opaque) buffered_put_buffer(s, NULL, 0, 0); } +static const QEMUFileOps buffered_file_ops = { + .get_fd = buffered_get_fd, + .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 +259,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); |