From: Anthony Liguori <anthony@codemonkey.ws>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 7/8] qom: distinguish "legacy" property type name from QOM type name
Date: Fri, 16 Dec 2011 11:03:19 -0600 [thread overview]
Message-ID: <4EEB79D7.60401@codemonkey.ws> (raw)
In-Reply-To: <1324054053-20484-8-git-send-email-pbonzini@redhat.com>
On 12/16/2011 10:47 AM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Regards,
Anthony Liguori
> ---
> hw/qdev-properties.c | 12 ++++++++----
> hw/qdev.c | 9 ++++++---
> hw/qdev.h | 1 +
> 3 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index f7aa3cb..dd41e5a 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -86,7 +86,8 @@ static void set_bit(DeviceState *dev, Visitor *v, void *opaque,
> }
>
> PropertyInfo qdev_prop_bit = {
> - .name = "on/off",
> + .name = "boolean",
> + .legacy_name = "on/off",
> .type = PROP_TYPE_BIT,
> .size = sizeof(uint32_t),
> .parse = parse_bit,
> @@ -189,7 +190,8 @@ static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len)
> }
>
> PropertyInfo qdev_prop_hex8 = {
> - .name = "hex8",
> + .name = "uint8",
> + .legacy_name = "hex8",
> .type = PROP_TYPE_UINT8,
> .size = sizeof(uint8_t),
> .parse = parse_hex8,
> @@ -397,7 +399,8 @@ static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
> }
>
> PropertyInfo qdev_prop_hex32 = {
> - .name = "hex32",
> + .name = "uint32",
> + .legacy_name = "hex32",
> .type = PROP_TYPE_UINT32,
> .size = sizeof(uint32_t),
> .parse = parse_hex32,
> @@ -485,7 +488,8 @@ static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len)
> }
>
> PropertyInfo qdev_prop_hex64 = {
> - .name = "hex64",
> + .name = "uint64",
> + .legacy_name = "hex64",
> .type = PROP_TYPE_UINT64,
> .size = sizeof(uint64_t),
> .parse = parse_hex64,
> diff --git a/hw/qdev.c b/hw/qdev.c
> index c8ab7b7..426ea71 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -218,13 +218,15 @@ int qdev_device_help(QemuOpts *opts)
> if (!prop->info->parse) {
> continue; /* no way to set it, don't show */
> }
> - error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> + error_printf("%s.%s=%s\n", info->name, prop->name,
> + prop->info->legacy_name ?: prop->info->name);
> }
> for (prop = info->bus_info->props; prop&& prop->name; prop++) {
> if (!prop->info->parse) {
> continue; /* no way to set it, don't show */
> }
> - error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> + error_printf("%s.%s=%s\n", info->name, prop->name,
> + prop->info->legacy_name ?: prop->info->name);
> }
> return 1;
> }
> @@ -1182,7 +1184,8 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
> {
> gchar *type;
>
> - type = g_strdup_printf("legacy<%s>", prop->info->name);
> + type = g_strdup_printf("legacy<%s>",
> + prop->info->legacy_name ?: prop->info->name);
>
> qdev_property_add(dev, prop->name, type,
> prop->info->print ? qdev_get_legacy_property : NULL,
> diff --git a/hw/qdev.h b/hw/qdev.h
> index a1cce37..8002644 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -156,6 +156,7 @@ enum PropertyType {
>
> struct PropertyInfo {
> const char *name;
> + const char *legacy_name;
> size_t size;
> enum PropertyType type;
> int64_t min;
next prev parent reply other threads:[~2011-12-16 17:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 16:47 [Qemu-devel] [PATCH v2 0/8] qom: introduce non-legacy static properties Paolo Bonzini
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 1/8] qapi: protect against NULL QObject in qmp_input_get_object Paolo Bonzini
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 2/8] qom: fix swapped parameters Paolo Bonzini
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 3/8] qom: push permission checks up into qdev_property_add_legacy Paolo Bonzini
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 4/8] qom: interpret the return value when setting legacy properties Paolo Bonzini
2011-12-16 17:00 ` Anthony Liguori
2011-12-16 17:19 ` Paolo Bonzini
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 5/8] qom: introduce QERR_PROPERTY_VALUE_OUT_OF_RANGE Paolo Bonzini
2011-12-16 17:00 ` Anthony Liguori
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 6/8] qom: introduce get/set methods for Property Paolo Bonzini
2011-12-16 17:02 ` Anthony Liguori
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 7/8] qom: distinguish "legacy" property type name from QOM type name Paolo Bonzini
2011-12-16 17:03 ` Anthony Liguori [this message]
2011-12-16 16:47 ` [Qemu-devel] [PATCH v2 8/8] qom: register qdev properties also as non-legacy properties Paolo Bonzini
2011-12-16 17:05 ` Anthony Liguori
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=4EEB79D7.60401@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).