From: "Michael S. Tsirkin" <mst@redhat.com>
To: arei.gonglei@huawei.com
Cc: weidong.huang@huawei.com, aliguori@amazon.com, armbru@redhat.com,
luonengjun@huawei.com, peter.huangpeng@huawei.com,
qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com,
lcapitulino@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v4 2/5] qom: add description field in ObjectProperty struct
Date: Tue, 30 Sep 2014 14:48:13 +0300 [thread overview]
Message-ID: <20140930114813.GH7089@redhat.com> (raw)
In-Reply-To: <1412046159-5144-3-git-send-email-arei.gonglei@huawei.com>
On Tue, Sep 30, 2014 at 11:02:36AM +0800, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> The descriptions can serve as documentation in the code,
> and they can be used to provide better help.
>
> When we call object_property_add_alias() adding alias properties to
> the source object on the target Object, set the object property's
> description to the source object property's.
I think by the above you mean "Copy property descriptions when copying alias
properties"?
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> include/qom/object.h | 15 +++++++++++++++
> qom/object.c | 20 ++++++++++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/include/qom/object.h b/include/qom/object.h
> index 8a05a81..ddc600d 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -338,6 +338,7 @@ typedef struct ObjectProperty
> {
> gchar *name;
> gchar *type;
> + gchar *description;
> ObjectPropertyAccessor *get;
> ObjectPropertyAccessor *set;
> ObjectPropertyResolve *resolve;
> @@ -1274,6 +1275,20 @@ void object_property_add_alias(Object *obj, const char *name,
> Object *target_obj, const char *target_name,
> Error **errp);
>
> +
Avoid duplicate empty lines please.
> +/**
> + * object_property_set_description:
> + * @obj: the object to set a property's description to
do you mean "the object owning the property"?
> + * @name: the name of the property
> + * @description: the description of the property on the object
> + * @errp: if an error occurs, a pointer to an area to store the error
> + *
> + * Set an object property's description.
> + *
> + */
> +void object_property_set_description(Object *obj, const char *name,
> + const char *description, Error **errp);
> +
> /**
> * object_child_foreach:
> * @obj: the object whose children will be navigated
> diff --git a/qom/object.c b/qom/object.c
> index 575291f..a751367 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -369,6 +369,7 @@ static void object_property_del_all(Object *obj)
>
> g_free(prop->name);
> g_free(prop->type);
> + g_free(prop->description);
> g_free(prop);
> }
> }
> @@ -803,6 +804,7 @@ void object_property_del(Object *obj, const char *name, Error **errp)
>
> g_free(prop->name);
> g_free(prop->type);
> + g_free(prop->description);
> g_free(prop);
> }
>
> @@ -1672,10 +1674,28 @@ void object_property_add_alias(Object *obj, const char *name,
> }
> op->resolve = property_resolve_alias;
>
> + object_property_set_description(obj, name,
> + target_prop->description,
> + &error_abort);
> +
> out:
> g_free(prop_type);
> }
>
> +void object_property_set_description(Object *obj, const char *name,
> + const char *description, Error **errp)
> +{
> + ObjectProperty *op;
> +
> + op = object_property_find(obj, name, errp);
> + if (!op) {
> + return;
> + }
> +
> + g_free(op->description);
> + op->description = g_strdup(description);
> +}
> +
> static void object_instance_init(Object *obj)
> {
> object_property_add_str(obj, "type", qdev_get_type, NULL, NULL);
> --
> 2.0.4
>
next prev parent reply other threads:[~2014-09-30 11:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-30 3:02 [Qemu-devel] [PATCH v4 0/5] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
2014-09-30 3:02 ` [Qemu-devel] [PATCH v4 1/5] qdev: add description field in " arei.gonglei
2014-09-30 11:42 ` Michael S. Tsirkin
2014-09-30 13:14 ` Gonglei
2014-09-30 13:33 ` Michael S. Tsirkin
2014-09-30 13:36 ` Paolo Bonzini
2014-09-30 13:55 ` Michael S. Tsirkin
2014-09-30 13:53 ` Paolo Bonzini
2014-09-30 14:01 ` Michael S. Tsirkin
2014-09-30 14:02 ` Paolo Bonzini
2014-10-01 4:05 ` Gonglei
2014-09-30 14:01 ` Gonglei
2014-09-30 3:02 ` [Qemu-devel] [PATCH v4 2/5] qom: add description field in ObjectProperty struct arei.gonglei
2014-09-30 11:48 ` Michael S. Tsirkin [this message]
2014-09-30 13:18 ` Gonglei
2014-09-30 3:02 ` [Qemu-devel] [PATCH v4 3/5] qdev: set the object property's description to the qdev property's arei.gonglei
2014-09-30 3:02 ` [Qemu-devel] [PATCH v4 4/5] qmp: print descriptions of object properties arei.gonglei
2014-09-30 15:38 ` Eric Blake
2014-09-30 3:02 ` [Qemu-devel] [PATCH v4 5/5] qdev: drop legacy_name from qdev properties arei.gonglei
2014-09-30 11:43 ` Michael S. Tsirkin
2014-09-30 13:15 ` Gonglei
2014-09-30 8:54 ` [Qemu-devel] [PATCH v4 0/5] add description field in ObjectProperty and PropertyInfo struct Paolo Bonzini
2014-09-30 11:35 ` Michael S. Tsirkin
2014-09-30 11:53 ` Paolo Bonzini
2014-09-30 12:09 ` Markus Armbruster
2014-09-30 13:05 ` Gonglei
2014-09-30 13:32 ` Michael S. Tsirkin
2014-09-30 14:05 ` Gonglei
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=20140930114813.GH7089@redhat.com \
--to=mst@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=luonengjun@huawei.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=weidong.huang@huawei.com \
/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.