On Thu, Jan 9, 2020 at 11:30 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> As we want to remove the global current_machine,
> replace MACHINE_GET_CLASS(current_machine) by
> MACHINE_GET_CLASS(qdev_get_machine()).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> migration/savevm.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 59efc1981d..0e8b6a4715 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -292,7 +292,8 @@ static uint32_t get_validatable_capabilities_count(void)
> static int configuration_pre_save(void *opaque)
> {
> SaveState *state = opaque;
> - const char *current_name = MACHINE_GET_CLASS(current_machine)->name;
> + MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
> + const char *current_name = mc->name;
> MigrationState *s = migrate_get_current();
> int i, j;
>
> @@ -362,7 +363,8 @@ static bool configuration_validate_capabilities(SaveState *state)
> static int configuration_post_load(void *opaque, int version_id)
> {
> SaveState *state = opaque;
> - const char *current_name = MACHINE_GET_CLASS(current_machine)->name;
> + MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
> + const char *current_name = mc->name;
>
> if (strncmp(state->name, current_name, state->len) != 0) {
> error_report("Machine type received is '%.*s' and local is '%s'",
> @@ -615,9 +617,7 @@ static void dump_vmstate_vmsd(FILE *out_file,
>
> static void dump_machine_type(FILE *out_file)
> {
> - MachineClass *mc;
> -
> - mc = MACHINE_GET_CLASS(current_machine);
> + MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
>
> fprintf(out_file, " \"vmschkmachine\": {\n");
> fprintf(out_file, " \"Name\": \"%s\"\n", mc->name);
> --
> 2.21.1
>
>