mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-19 08:02:15 -06:00
buffered_file: unfold migrate_fd_put_ready
We only use it once, just remove the callback indirection. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c87b015bc7
commit
2c9adcb850
4 changed files with 3 additions and 9 deletions
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
typedef struct QEMUFileBuffered
|
typedef struct QEMUFileBuffered
|
||||||
{
|
{
|
||||||
BufferedPutReadyFunc *put_ready;
|
|
||||||
BufferedWaitForUnfreezeFunc *wait_for_unfreeze;
|
BufferedWaitForUnfreezeFunc *wait_for_unfreeze;
|
||||||
BufferedCloseFunc *close;
|
BufferedCloseFunc *close;
|
||||||
MigrationState *migration_state;
|
MigrationState *migration_state;
|
||||||
|
@ -128,7 +127,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
|
||||||
DPRINTF("file is ready\n");
|
DPRINTF("file is ready\n");
|
||||||
if (!s->freeze_output && s->bytes_xfer < s->xfer_limit) {
|
if (!s->freeze_output && s->bytes_xfer < s->xfer_limit) {
|
||||||
DPRINTF("notifying client\n");
|
DPRINTF("notifying client\n");
|
||||||
s->put_ready(s->migration_state);
|
migrate_fd_put_ready(s->migration_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +226,6 @@ static void buffered_rate_tick(void *opaque)
|
||||||
|
|
||||||
QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
|
QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
|
||||||
size_t bytes_per_sec,
|
size_t bytes_per_sec,
|
||||||
BufferedPutReadyFunc *put_ready,
|
|
||||||
BufferedWaitForUnfreezeFunc *wait_for_unfreeze,
|
BufferedWaitForUnfreezeFunc *wait_for_unfreeze,
|
||||||
BufferedCloseFunc *close)
|
BufferedCloseFunc *close)
|
||||||
{
|
{
|
||||||
|
@ -237,7 +235,6 @@ QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
|
||||||
|
|
||||||
s->migration_state = migration_state;
|
s->migration_state = migration_state;
|
||||||
s->xfer_limit = bytes_per_sec / 10;
|
s->xfer_limit = bytes_per_sec / 10;
|
||||||
s->put_ready = put_ready;
|
|
||||||
s->wait_for_unfreeze = wait_for_unfreeze;
|
s->wait_for_unfreeze = wait_for_unfreeze;
|
||||||
s->close = close;
|
s->close = close;
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,11 @@
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "migration.h"
|
#include "migration.h"
|
||||||
|
|
||||||
typedef void (BufferedPutReadyFunc)(void *opaque);
|
|
||||||
typedef void (BufferedWaitForUnfreezeFunc)(void *opaque);
|
typedef void (BufferedWaitForUnfreezeFunc)(void *opaque);
|
||||||
typedef int (BufferedCloseFunc)(void *opaque);
|
typedef int (BufferedCloseFunc)(void *opaque);
|
||||||
|
|
||||||
QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
|
QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
|
||||||
size_t xfer_limit,
|
size_t xfer_limit,
|
||||||
BufferedPutReadyFunc *put_ready,
|
|
||||||
BufferedWaitForUnfreezeFunc *wait_for_unfreeze,
|
BufferedWaitForUnfreezeFunc *wait_for_unfreeze,
|
||||||
BufferedCloseFunc *close);
|
BufferedCloseFunc *close);
|
||||||
|
|
||||||
|
|
|
@ -318,9 +318,8 @@ ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void migrate_fd_put_ready(void *opaque)
|
void migrate_fd_put_ready(MigrationState *s)
|
||||||
{
|
{
|
||||||
MigrationState *s = opaque;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (s->state != MIG_STATE_ACTIVE) {
|
if (s->state != MIG_STATE_ACTIVE) {
|
||||||
|
@ -435,7 +434,6 @@ void migrate_fd_connect(MigrationState *s)
|
||||||
s->state = MIG_STATE_ACTIVE;
|
s->state = MIG_STATE_ACTIVE;
|
||||||
s->file = qemu_fopen_ops_buffered(s,
|
s->file = qemu_fopen_ops_buffered(s,
|
||||||
s->bandwidth_limit,
|
s->bandwidth_limit,
|
||||||
migrate_fd_put_ready,
|
|
||||||
migrate_fd_wait_for_unfreeze,
|
migrate_fd_wait_for_unfreeze,
|
||||||
migrate_fd_close);
|
migrate_fd_close);
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ void migrate_fd_connect(MigrationState *s);
|
||||||
|
|
||||||
ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data,
|
ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data,
|
||||||
size_t size);
|
size_t size);
|
||||||
|
void migrate_fd_put_ready(MigrationState *s);
|
||||||
|
|
||||||
void add_migration_state_change_notifier(Notifier *notify);
|
void add_migration_state_change_notifier(Notifier *notify);
|
||||||
void remove_migration_state_change_notifier(Notifier *notify);
|
void remove_migration_state_change_notifier(Notifier *notify);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue