From: "Andreas Färber" <afaerber@suse.de>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 7/8] qom: add a object_property_add_enum helper method
Date: Fri, 19 Jun 2015 18:26:44 +0200 [thread overview]
Message-ID: <558442C4.8010307@suse.de> (raw)
In-Reply-To: <55843F7A.5050404@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1872 bytes --]
Am 19.06.2015 um 18:12 schrieb Eric Blake:
> On 05/27/2015 09:07 AM, Daniel P. Berrange wrote:
>> A QOM property can be parsed as enum using the visit_type_enum()
>> helper method, but this forces callers to use the more complex
>> generic object_property_add() method when registering it. It
>> also requires that users of that object have access to the
>> string map when they want to read the property value.
>>
>> This patch introduces a specialized object_property_add_enum()
>> method which simplifies the use of enum properties, so the
>> setters/getters directly get passed the int value.
>>
>> typedef enum {
>
>> /**
>> + * object_property_add_enum:
>> + * @obj: the object to add a property to
>> + * @name: the name of the property
>> + * @typename: the name of the enum data type
>> + * @get: the getter or %NULL if the property is write-only.
>> + * @set: the setter or %NULL if the property is read-only
>> + * @errp: if an error occurs, a pointer to an area to store the error
>> + *
>> + * Add a enum property using getters/setters. This function will add a
>
> s/a enum/an enum/
Thanks, fixed on https://github.com/afaerber/qemu-cpu/commits/qom-next
>> +static void property_release_enum(Object *obj, const char *name,
>> + void *opaque)
>> +{
>> + EnumProperty *prop = opaque;
>> + g_free(prop);
>
> Could also be written as g_free(opaque), but that's a little less
> readable, so I don't see a point in changing it.
I prefer it this way. Consuming opaques directly broke a few call sites
when I refactored the CPU structs, so the savings of one line is not
really worth it IMO.
Regards,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton; HRB
21284 (AG Nürnberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-06-19 16:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-27 15:07 [Qemu-devel] [PATCH v5 0/8] qom: misc fixes & enhancements to support TLS work Daniel P. Berrange
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 1/8] backends: fix typename of 'policy' enum property in hostmem obj Daniel P. Berrange
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 2/8] doc: document user creatable object types in help text Daniel P. Berrange
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 3/8] vl: create (most) objects before creating chardev backends Daniel P. Berrange
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 4/8] qom: add helper method for getting user objects root Daniel P. Berrange
2015-06-19 16:41 ` Andreas Färber
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 5/8] qom: add object_new_with_props / object_new_withpropv constructors Daniel P. Berrange
2015-06-19 16:04 ` Eric Blake
2015-06-19 16:08 ` Andreas Färber
2015-06-19 16:17 ` Eric Blake
2015-06-19 16:43 ` Andreas Färber
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 6/8] qom: make enum string tables const-correct Daniel P. Berrange
2015-06-19 16:05 ` Eric Blake
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 7/8] qom: add a object_property_add_enum helper method Daniel P. Berrange
2015-06-19 16:12 ` Eric Blake
2015-06-19 16:26 ` Andreas Färber [this message]
2015-06-19 16:38 ` Eric Blake
2015-06-19 16:44 ` Andreas Färber
2015-05-27 15:07 ` [Qemu-devel] [PATCH v5 8/8] qom: don't pass string table to object_get_enum method Daniel P. Berrange
2015-06-19 15:15 ` Andreas Färber
2015-06-19 16:15 ` Eric Blake
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=558442C4.8010307@suse.de \
--to=afaerber@suse.de \
--cc=eblake@redhat.com \
--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).