diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-10-07 14:33:21 +0800 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-10-15 05:03:15 +0200 |
commit | 8074264203db3351a4017ea0371c2c5eeb86df82 (patch) | |
tree | 55ce63d7421b38fc40eade1084c1189a7b50b462 /qom | |
parent | 51b2e8c331c1e3de5463bd7fe13676c2a9ec52fe (diff) |
qom: Add description field in ObjectProperty struct
The descriptions can serve as documentation in the code,
and they can be used to provide better help.
Copy property descriptions when copying alias properties.
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qom')
-rw-r--r-- | qom/object.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c index 575291f109..a751367e61 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); |