Revision 11c76741
b/buffered_file.c | ||
---|---|---|
23 | 23 |
|
24 | 24 |
typedef struct QEMUFileBuffered |
25 | 25 |
{ |
26 |
BufferedCloseFunc *close; |
|
27 | 26 |
MigrationState *migration_state; |
28 | 27 |
QEMUFile *file; |
29 | 28 |
int freeze_output; |
... | ... | |
147 | 146 |
migrate_fd_wait_for_unfreeze(s->migration_state); |
148 | 147 |
} |
149 | 148 |
|
150 |
ret = s->close(s->migration_state);
|
|
149 |
ret = migrate_fd_close(s->migration_state);
|
|
151 | 150 |
|
152 | 151 |
qemu_del_timer(s->timer); |
153 | 152 |
qemu_free_timer(s->timer); |
... | ... | |
224 | 223 |
} |
225 | 224 |
|
226 | 225 |
QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state, |
227 |
size_t bytes_per_sec, |
|
228 |
BufferedCloseFunc *close) |
|
226 |
size_t bytes_per_sec) |
|
229 | 227 |
{ |
230 | 228 |
QEMUFileBuffered *s; |
231 | 229 |
|
... | ... | |
233 | 231 |
|
234 | 232 |
s->migration_state = migration_state; |
235 | 233 |
s->xfer_limit = bytes_per_sec / 10; |
236 |
s->close = close; |
|
237 | 234 |
|
238 | 235 |
s->file = qemu_fopen_ops(s, buffered_put_buffer, NULL, |
239 | 236 |
buffered_close, buffered_rate_limit, |
b/buffered_file.h | ||
---|---|---|
17 | 17 |
#include "hw/hw.h" |
18 | 18 |
#include "migration.h" |
19 | 19 |
|
20 |
typedef int (BufferedCloseFunc)(void *opaque); |
|
21 |
|
|
22 | 20 |
QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state, |
23 |
size_t xfer_limit, |
|
24 |
BufferedCloseFunc *close); |
|
21 |
size_t xfer_limit); |
|
25 | 22 |
|
26 | 23 |
#endif |
b/migration.c | ||
---|---|---|
392 | 392 |
} |
393 | 393 |
} |
394 | 394 |
|
395 |
static int migrate_fd_close(void *opaque)
|
|
395 |
int migrate_fd_close(MigrationState *s)
|
|
396 | 396 |
{ |
397 |
MigrationState *s = opaque; |
|
398 |
|
|
399 | 397 |
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); |
400 | 398 |
return s->close(s); |
401 | 399 |
} |
... | ... | |
431 | 429 |
int ret; |
432 | 430 |
|
433 | 431 |
s->state = MIG_STATE_ACTIVE; |
434 |
s->file = qemu_fopen_ops_buffered(s, |
|
435 |
s->bandwidth_limit, |
|
436 |
migrate_fd_close); |
|
432 |
s->file = qemu_fopen_ops_buffered(s, s->bandwidth_limit); |
|
437 | 433 |
|
438 | 434 |
DPRINTF("beginning savevm\n"); |
439 | 435 |
ret = qemu_savevm_state_begin(s->file, &s->params); |
b/migration.h | ||
---|---|---|
82 | 82 |
size_t size); |
83 | 83 |
void migrate_fd_put_ready(MigrationState *s); |
84 | 84 |
void migrate_fd_wait_for_unfreeze(MigrationState *s); |
85 |
int migrate_fd_close(MigrationState *s); |
|
85 | 86 |
|
86 | 87 |
void add_migration_state_change_notifier(Notifier *notify); |
87 | 88 |
void remove_migration_state_change_notifier(Notifier *notify); |
Also available in: Unified diff