[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 3/6] Use QemuSupportState for mach
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 3/6] Use QemuSupportState for machine types. |
Date: |
Thu, 29 Nov 2018 18:48:49 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Gerd Hoffmann <address@hidden> writes:
> Switch over the current deprecation_reason users to use
> the QemuSupportState field in ObjectClass instead.
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> include/hw/boards.h | 3 ---
> hw/i386/pc_piix.c | 5 ++++-
> hw/ppc/prep.c | 5 ++++-
> vl.c | 7 ++++---
> 4 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index f82f28468b..b7bb181fc8 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -106,8 +106,6 @@ typedef struct {
>
> /**
> * MachineClass:
> - * @deprecation_reason: If set, the machine is marked as deprecated. The
> - * string should provide some clear information about what to use instead.
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified.
> Default: 1
> @@ -167,7 +165,6 @@ struct MachineClass {
> char *name;
> const char *alias;
> const char *desc;
> - const char *deprecation_reason;
>
> void (*init)(MachineState *state);
> void (*reset)(void);
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index dc09466b3e..407f4503a3 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -955,9 +955,12 @@ DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
>
> static void pc_i440fx_0_11_machine_options(MachineClass *m)
> {
> + ObjectClass *oc = OBJECT_CLASS(m);
> +
> pc_i440fx_0_12_machine_options(m);
> m->hw_version = "0.11";
> - m->deprecation_reason = "use a newer machine type instead";
> + oc->supported.state = SUPPORT_STATE_DEPRECATED;
> + oc->supported.help = "use a newer machine type instead";
> SET_MACHINE_COMPAT(m, PC_COMPAT_0_11);
> }
>
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index 2afb7f437e..260700847b 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -588,7 +588,10 @@ static void ppc_prep_init(MachineState *machine)
>
> static void prep_machine_init(MachineClass *mc)
> {
> - mc->deprecation_reason = "use 40p machine type instead";
> + ObjectClass *oc = OBJECT_CLASS(mc);
> +
> + oc->supported.state = SUPPORT_STATE_DEPRECATED;
> + oc->supported.help = "use 40p machine type instead";
> mc->desc = "PowerPC PREP platform";
> mc->init = ppc_prep_init;
> mc->block_default_type = IF_IDE;
> diff --git a/vl.c b/vl.c
> index 1fcacc5caa..ba81fefb66 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2573,7 +2573,7 @@ static gint machine_class_cmp(gconstpointer a,
> gconstpointer b)
> }
> printf("%-20s %s%s%s\n", mc->name, mc->desc,
> mc->is_default ? " (default)" : "",
> - mc->deprecation_reason ? " (deprecated)" : "");
> + qemu_is_deprecated(OBJECT_CLASS(mc)) ? " (deprecated)" :
> "");
> }
> }
>
> @@ -4290,9 +4290,10 @@ int main(int argc, char **argv, char **envp)
>
> configure_accelerator(current_machine);
>
> - if (!qtest_enabled() && machine_class->deprecation_reason) {
> + if (!qtest_enabled() && qemu_is_deprecated(OBJECT_CLASS(machine_class)))
> {
> error_report("Machine type '%s' is deprecated: %s",
> - machine_class->name, machine_class->deprecation_reason);
> + machine_class->name,
> + OBJECT_CLASS(machine_class)->supported.help);
> }
>
> /*
Let's switch to warn_report() while we're touching it.
- [Qemu-ppc] [PATCH v2 0/6] Introducing QemuSupportState, Gerd Hoffmann, 2018/11/06
- [Qemu-ppc] [PATCH v2 4/6] Warn on obsolete and deprecated devices., Gerd Hoffmann, 2018/11/06
- [Qemu-ppc] [PATCH v2 1/6] move ObjectClass to typedefs.h, Gerd Hoffmann, 2018/11/06
- [Qemu-ppc] [PATCH v2 5/6] tag cirrus as obsolete, Gerd Hoffmann, 2018/11/06
- [Qemu-ppc] [PATCH v2 3/6] Use QemuSupportState for machine types., Gerd Hoffmann, 2018/11/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 3/6] Use QemuSupportState for machine types.,
Markus Armbruster <=
- [Qemu-ppc] [PATCH v2 2/6] add QemuSupportState, Gerd Hoffmann, 2018/11/06
- [Qemu-ppc] [PATCH v2 6/6] add UsageHints to QemuSupportState, Gerd Hoffmann, 2018/11/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 0/6] Introducing QemuSupportState, Markus Armbruster, 2018/11/29