From: Markus Armbruster <armbru@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, "Eduardo Habkost" <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alexander Graf" <agraf@suse.de>,
"Hervé Poussineau" <hpoussin@reactos.org>,
qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Andreas Färber" <afaerber@suse.de>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH v2 3/6] Use QemuSupportState for machine types.
Date: Thu, 29 Nov 2018 18:48:49 +0100 [thread overview]
Message-ID: <87in0f6agu.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20181106102335.20027-4-kraxel@redhat.com> (Gerd Hoffmann's message of "Tue, 6 Nov 2018 11:23:32 +0100")
Gerd Hoffmann <kraxel@redhat.com> writes:
> Switch over the current deprecation_reason users to use
> the QemuSupportState field in ObjectClass instead.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> 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.
next prev parent reply other threads:[~2018-11-29 17:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 10:23 [Qemu-devel] [PATCH v2 0/6] Introducing QemuSupportState Gerd Hoffmann
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 1/6] move ObjectClass to typedefs.h Gerd Hoffmann
2018-11-06 22:45 ` David Gibson
2018-11-07 9:53 ` Philippe Mathieu-Daudé
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 2/6] add QemuSupportState Gerd Hoffmann
2018-11-06 14:26 ` Eduardo Habkost
2018-11-06 23:12 ` Paolo Bonzini
2018-11-07 8:15 ` Gerd Hoffmann
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 3/6] Use QemuSupportState for machine types Gerd Hoffmann
2018-11-29 17:48 ` Markus Armbruster [this message]
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 4/6] Warn on obsolete and deprecated devices Gerd Hoffmann
2018-11-06 14:36 ` Michael S. Tsirkin
2018-11-07 8:06 ` Gerd Hoffmann
2018-11-29 17:56 ` Markus Armbruster
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 5/6] tag cirrus as obsolete Gerd Hoffmann
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 6/6] add UsageHints to QemuSupportState Gerd Hoffmann
2018-11-29 19:10 ` Markus Armbruster
2018-11-29 19:14 ` [Qemu-devel] [PATCH v2 0/6] Introducing QemuSupportState Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87in0f6agu.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=ehabkost@redhat.com \
--cc=hpoussin@reactos.org \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.