* [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct
@ 2014-09-23 13:08 arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 1/7] qom: add error handler for object_property_print() arei.gonglei
` (7 more replies)
0 siblings, 8 replies; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
PATCH 1 and PATCH 2 are bugfixes. PATCH 3~7 add a description
field in both ObjectProperty and PropertyInfo struct.
The descriptions can serve as documentation in the code,
and they can be used to provide better help. For example:
Before this patch series:
$./qemu-system-x86_64 -device virtio-blk-pci,?
virtio-blk-pci.iothread=link<iothread>
virtio-blk-pci.x-data-plane=bool
virtio-blk-pci.scsi=bool
virtio-blk-pci.config-wce=bool
virtio-blk-pci.serial=str
virtio-blk-pci.secs=uint32
virtio-blk-pci.heads=uint32
virtio-blk-pci.cyls=uint32
virtio-blk-pci.discard_granularity=uint32
virtio-blk-pci.bootindex=int32
virtio-blk-pci.opt_io_size=uint32
virtio-blk-pci.min_io_size=uint16
virtio-blk-pci.physical_block_size=uint16
virtio-blk-pci.logical_block_size=uint16
virtio-blk-pci.drive=str
virtio-blk-pci.virtio-backend=child<virtio-blk-device>
virtio-blk-pci.command_serr_enable=on/off
virtio-blk-pci.multifunction=on/off
virtio-blk-pci.rombar=uint32
virtio-blk-pci.romfile=str
virtio-blk-pci.addr=pci-devfn
virtio-blk-pci.event_idx=on/off
virtio-blk-pci.indirect_desc=on/off
virtio-blk-pci.vectors=uint32
virtio-blk-pci.ioeventfd=on/off
virtio-blk-pci.class=uint32
After:
$./qemu-system-x86_64 -device virtio-blk-pci,?
virtio-blk-pci.iothread=link<iothread>
virtio-blk-pci.x-data-plane=bool (on/off)
virtio-blk-pci.scsi=bool (on/off)
virtio-blk-pci.config-wce=bool (on/off)
virtio-blk-pci.serial=str
virtio-blk-pci.secs=uint32
virtio-blk-pci.heads=uint32
virtio-blk-pci.cyls=uint32
virtio-blk-pci.discard_granularity=uint32
virtio-blk-pci.bootindex=int32
virtio-blk-pci.opt_io_size=uint32
virtio-blk-pci.min_io_size=uint16
virtio-blk-pci.physical_block_size=uint16 (A power of two between 512 and 32768)
virtio-blk-pci.logical_block_size=uint16 (A power of two between 512 and 32768)
virtio-blk-pci.drive=str (ID of a drive to use as a backend)
virtio-blk-pci.virtio-backend=child<virtio-blk-device>
virtio-blk-pci.command_serr_enable=bool (on/off)
virtio-blk-pci.multifunction=bool (on/off)
virtio-blk-pci.rombar=uint32
virtio-blk-pci.romfile=str
virtio-blk-pci.addr=int32 (The slot number of a pci device)
virtio-blk-pci.event_idx=bool (on/off)
virtio-blk-pci.indirect_desc=bool (on/off)
virtio-blk-pci.vectors=uint32
virtio-blk-pci.ioeventfd=bool (on/off)
virtio-blk-pci.class=uint32
Gonglei (7):
qom: add error handler for object_property_print()
qom: add error handler for object alias property
qdev: add description field in PropertyInfo struct
qom: add description field in ObjectProperty struct
qdev: set the object property's description to the qdev property's.
qmp: print descriptions of object properties
qdev: drop legacy_name from qdev properties
hw/core/qdev-properties-system.c | 8 ++++----
hw/core/qdev-properties.c | 12 ++++++------
hw/core/qdev.c | 3 +++
include/hw/qdev-core.h | 2 +-
include/qom/object.h | 15 +++++++++++++++
qmp.c | 19 +++++++++++++++----
qom/object.c | 33 ++++++++++++++++++++++++++++++---
target-ppc/translate_init.c | 2 +-
8 files changed, 75 insertions(+), 19 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH 1/7] qom: add error handler for object_property_print()
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
@ 2014-09-23 13:08 ` arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 2/7] qom: add error handler for object alias property arei.gonglei
` (6 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
Avoid the caller of object_property_print() leaking string
argument's memory, such as qdev_print_props() when
encounter errors.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
qom/object.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index da0919a..74779e6 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1010,11 +1010,19 @@ char *object_property_print(Object *obj, const char *name, bool human,
Error **errp)
{
StringOutputVisitor *mo;
- char *string;
+ char *string = NULL;
+ Error *local_err = NULL;
mo = string_output_visitor_new(human);
- object_property_get(obj, string_output_get_visitor(mo), name, errp);
+ object_property_get(obj, string_output_get_visitor(mo), name, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ goto fail;
+ }
+
string = string_output_get_string(mo);
+
+fail:
string_output_visitor_cleanup(mo);
return string;
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH 2/7] qom: add error handler for object alias property
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 1/7] qom: add error handler for object_property_print() arei.gonglei
@ 2014-09-23 13:08 ` arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct arei.gonglei
` (5 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
object_property_add_alias() is called at some
places at present. And its parameter errp may not NULL,
such as
object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev),"iothread",
&error_abort);
This patch add error handler for security.
Cc: Stefan Hajnoczi <stefanha@redhat.com>
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>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
qom/object.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/qom/object.c b/qom/object.c
index 74779e6..81542fb 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1642,6 +1642,7 @@ void object_property_add_alias(Object *obj, const char *name,
ObjectProperty *op;
ObjectProperty *target_prop;
gchar *prop_type;
+ Error *local_err = NULL;
target_prop = object_property_find(target_obj, target_name, errp);
if (!target_prop) {
@@ -1663,9 +1664,15 @@ void object_property_add_alias(Object *obj, const char *name,
property_get_alias,
property_set_alias,
property_release_alias,
- prop, errp);
+ prop, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ g_free(prop);
+ goto out;
+ }
op->resolve = property_resolve_alias;
+out:
g_free(prop_type);
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 1/7] qom: add error handler for object_property_print() arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 2/7] qom: add error handler for object alias property arei.gonglei
@ 2014-09-23 13:08 ` arei.gonglei
2014-09-24 13:01 ` Paolo Bonzini
2014-09-23 13:08 ` [Qemu-devel] [PATCH 4/7] qom: add description field in ObjectProperty struct arei.gonglei
` (4 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
The descriptions can serve as documentation in the code,
and they can be used to provide better help.
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>
---
hw/core/qdev-properties-system.c | 4 ++++
hw/core/qdev-properties.c | 6 ++++++
include/hw/qdev-core.h | 1 +
target-ppc/translate_init.c | 1 +
4 files changed, 12 insertions(+)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 84caa1d..4c8ea18 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -113,6 +113,7 @@ static void set_drive(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_drive = {
.name = "str",
.legacy_name = "drive",
+ .description = "ID of a drive to use as a backend",
.get = get_drive,
.set = set_drive,
.release = release_drive,
@@ -170,6 +171,7 @@ static void set_chr(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_chr = {
.name = "str",
.legacy_name = "chr",
+ .description = "ID of a chardev to use as a backend",
.get = get_chr,
.set = set_chr,
.release = release_chr,
@@ -249,6 +251,7 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_netdev = {
.name = "str",
.legacy_name = "netdev",
+ .description = "ID of a netdev to use as a backend",
.get = get_netdev,
.set = set_netdev,
};
@@ -329,6 +332,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_vlan = {
.name = "int32",
.legacy_name = "vlan",
+ .description = "The value of vlan id",
.print = print_vlan,
.get = get_vlan,
.set = set_vlan,
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 66556d3..2f7e52b 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -121,6 +121,7 @@ static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_bit = {
.name = "bool",
.legacy_name = "on/off",
+ .description = "on/off",
.get = prop_get_bit,
.set = prop_set_bit,
};
@@ -456,6 +457,7 @@ inval:
PropertyInfo qdev_prop_macaddr = {
.name = "str",
.legacy_name = "macaddr",
+ .description = "Ethernet 6-byte MAC Address, format: AA:BB:CC:DD:EE:FF",
.get = get_mac,
.set = set_mac,
};
@@ -478,6 +480,7 @@ QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
PropertyInfo qdev_prop_bios_chs_trans = {
.name = "BiosAtaTranslation",
.legacy_name = "bios-chs-trans",
+ .description = "Bios ata translation",
.enum_table = BiosAtaTranslation_lookup,
.get = get_enum,
.set = set_enum,
@@ -552,6 +555,7 @@ static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,
PropertyInfo qdev_prop_pci_devfn = {
.name = "int32",
.legacy_name = "pci-devfn",
+ .description = "The slot number of a pci device",
.print = print_pci_devfn,
.get = get_int32,
.set = set_pci_devfn,
@@ -599,6 +603,7 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_blocksize = {
.name = "uint16",
.legacy_name = "blocksize",
+ .description = "A power of two between 512 and 32768",
.get = get_uint16,
.set = set_blocksize,
};
@@ -707,6 +712,7 @@ inval:
PropertyInfo qdev_prop_pci_host_devaddr = {
.name = "str",
.legacy_name = "pci-host-devaddr",
+ .description = "The bdf number of pci on host, such as: 04:10.0",
.get = get_pci_host_devaddr,
.set = set_pci_host_devaddr,
};
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 178fee2..31acbe6 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -233,6 +233,7 @@ struct Property {
struct PropertyInfo {
const char *name;
const char *legacy_name;
+ const char *description;
const char **enum_table;
int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
ObjectPropertyAccessor *get;
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 48177ed..56a9f75 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8045,6 +8045,7 @@ static void powerpc_set_compat(Object *obj, Visitor *v,
static PropertyInfo powerpc_compat_propinfo = {
.name = "str",
.legacy_name = "powerpc-server-compat",
+ .description = "PowerPC server compat",
.get = powerpc_get_compat,
.set = powerpc_set_compat,
};
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH 4/7] qom: add description field in ObjectProperty struct
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
` (2 preceding siblings ...)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct arei.gonglei
@ 2014-09-23 13:08 ` arei.gonglei
2014-09-23 13:38 ` Gonglei (Arei)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's arei.gonglei
` (3 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
The descriptions can serve as documentation in the code,
and they can be used to provide better help.
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 | 12 ++++++++++++
2 files changed, 27 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);
+
+/**
+ * object_property_set_description:
+ * @obj: the object to set a property's description to
+ * @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 81542fb..b889db3 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1676,6 +1676,18 @@ 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;
+ }
+ op->description = description ? g_strdup(description) : NULL;
+}
+
static void object_instance_init(Object *obj)
{
object_property_add_str(obj, "type", qdev_get_type, NULL, NULL);
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's.
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
` (3 preceding siblings ...)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 4/7] qom: add description field in ObjectProperty struct arei.gonglei
@ 2014-09-23 13:08 ` arei.gonglei
2014-09-23 17:03 ` Paolo Bonzini
2014-09-23 13:08 ` [Qemu-devel] [PATCH 6/7] qmp: print descriptions of object properties arei.gonglei
` (2 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
When we call qdev_alias_all_properties() adding alias properties to
the source object all qdev properties on the target DeviceState,
set the object property's description to the qdev property's.
c: 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>
---
hw/core/qdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fcb1638..61d352c 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -796,6 +796,9 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)
object_property_add_alias(source, prop->name,
OBJECT(target), prop->name,
&error_abort);
+ object_property_set_description(source, prop->name,
+ prop->info->description,
+ &error_abort);
}
class = object_class_get_parent(class);
} while (class != object_class_by_name(TYPE_DEVICE));
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH 6/7] qmp: print descriptions of object properties
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
` (4 preceding siblings ...)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's arei.gonglei
@ 2014-09-23 13:08 ` arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 7/7] qdev: drop legacy_name from qdev properties arei.gonglei
2014-09-23 17:03 ` [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct Paolo Bonzini
7 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
The descriptions can serve as documentation in the code,
and they can be used to provide better help. For example:
Before this patch:
$./qemu-system-x86_64 -device virtio-blk-pci,?
virtio-blk-pci.iothread=link<iothread>
virtio-blk-pci.x-data-plane=bool
virtio-blk-pci.scsi=bool
virtio-blk-pci.config-wce=bool
virtio-blk-pci.serial=str
virtio-blk-pci.secs=uint32
virtio-blk-pci.heads=uint32
virtio-blk-pci.cyls=uint32
virtio-blk-pci.discard_granularity=uint32
virtio-blk-pci.bootindex=int32
virtio-blk-pci.opt_io_size=uint32
virtio-blk-pci.min_io_size=uint16
virtio-blk-pci.physical_block_size=uint16
virtio-blk-pci.logical_block_size=uint16
virtio-blk-pci.drive=str
virtio-blk-pci.virtio-backend=child<virtio-blk-device>
virtio-blk-pci.command_serr_enable=on/off
virtio-blk-pci.multifunction=on/off
virtio-blk-pci.rombar=uint32
virtio-blk-pci.romfile=str
virtio-blk-pci.addr=pci-devfn
virtio-blk-pci.event_idx=on/off
virtio-blk-pci.indirect_desc=on/off
virtio-blk-pci.vectors=uint32
virtio-blk-pci.ioeventfd=on/off
virtio-blk-pci.class=uint32
After:
$./qemu-system-x86_64 -device virtio-blk-pci,?
virtio-blk-pci.iothread=link<iothread>
virtio-blk-pci.x-data-plane=bool (on/off)
virtio-blk-pci.scsi=bool (on/off)
virtio-blk-pci.config-wce=bool (on/off)
virtio-blk-pci.serial=str
virtio-blk-pci.secs=uint32
virtio-blk-pci.heads=uint32
virtio-blk-pci.cyls=uint32
virtio-blk-pci.discard_granularity=uint32
virtio-blk-pci.bootindex=int32
virtio-blk-pci.opt_io_size=uint32
virtio-blk-pci.min_io_size=uint16
virtio-blk-pci.physical_block_size=uint16 (A power of two between 512 and 32768)
virtio-blk-pci.logical_block_size=uint16 (A power of two between 512 and 32768)
virtio-blk-pci.drive=str (ID of a drive to use as a backend)
virtio-blk-pci.virtio-backend=child<virtio-blk-device>
virtio-blk-pci.command_serr_enable=bool (on/off)
virtio-blk-pci.multifunction=bool (on/off)
virtio-blk-pci.rombar=uint32
virtio-blk-pci.romfile=str
virtio-blk-pci.addr=int32 (The slot number of a pci device)
virtio-blk-pci.event_idx=bool (on/off)
virtio-blk-pci.indirect_desc=bool (on/off)
virtio-blk-pci.vectors=uint32
virtio-blk-pci.ioeventfd=bool (on/off)
virtio-blk-pci.class=uint32
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>
---
qmp.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/qmp.c b/qmp.c
index c6767c4..20f501b 100644
--- a/qmp.c
+++ b/qmp.c
@@ -442,7 +442,8 @@ ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
*/
static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
const char *name,
- const char *default_type)
+ const char *default_type,
+ const char *description)
{
DevicePropertyInfo *info;
Property *prop;
@@ -465,7 +466,12 @@ static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
info = g_malloc0(sizeof(*info));
info->name = g_strdup(prop->name);
- info->type = g_strdup(prop->info->legacy_name ?: prop->info->name);
+ if (prop->info->description) {
+ info->type = g_strdup_printf("%s (%s)", prop->info->name,
+ prop->info->description);
+ } else {
+ info->type = g_strdup(prop->info->name);
+ }
return info;
}
klass = object_class_get_parent(klass);
@@ -474,7 +480,11 @@ static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
/* Not a qdev property, use the default type */
info = g_malloc0(sizeof(*info));
info->name = g_strdup(name);
- info->type = g_strdup(default_type);
+ if (description) {
+ info->type = g_strdup_printf("%s (%s)", default_type, description);
+ } else {
+ info->type = g_strdup(default_type);
+ }
return info;
}
@@ -521,7 +531,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
continue;
}
- info = make_device_property_info(klass, prop->name, prop->type);
+ info = make_device_property_info(klass, prop->name, prop->type,
+ prop->description);
if (!info) {
continue;
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH 7/7] qdev: drop legacy_name from qdev properties
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
` (5 preceding siblings ...)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 6/7] qmp: print descriptions of object properties arei.gonglei
@ 2014-09-23 13:08 ` arei.gonglei
2014-09-23 17:03 ` [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct Paolo Bonzini
7 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-09-23 13:08 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, aliguori, mst, armbru, luonengjun,
peter.huangpeng, lcapitulino, Gonglei, stefanha, pbonzini,
afaerber
From: Gonglei <arei.gonglei@huawei.com>
The legacy_name is useless now, the better help
information provied by description field of property.
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>
---
hw/core/qdev-properties-system.c | 4 ----
hw/core/qdev-properties.c | 6 ------
include/hw/qdev-core.h | 1 -
target-ppc/translate_init.c | 1 -
4 files changed, 12 deletions(-)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 4c8ea18..15b6567 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -112,7 +112,6 @@ static void set_drive(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_drive = {
.name = "str",
- .legacy_name = "drive",
.description = "ID of a drive to use as a backend",
.get = get_drive,
.set = set_drive,
@@ -170,7 +169,6 @@ static void set_chr(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_chr = {
.name = "str",
- .legacy_name = "chr",
.description = "ID of a chardev to use as a backend",
.get = get_chr,
.set = set_chr,
@@ -250,7 +248,6 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_netdev = {
.name = "str",
- .legacy_name = "netdev",
.description = "ID of a netdev to use as a backend",
.get = get_netdev,
.set = set_netdev,
@@ -331,7 +328,6 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_vlan = {
.name = "int32",
- .legacy_name = "vlan",
.description = "The value of vlan id",
.print = print_vlan,
.get = get_vlan,
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 2f7e52b..a593950 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -120,7 +120,6 @@ static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_bit = {
.name = "bool",
- .legacy_name = "on/off",
.description = "on/off",
.get = prop_get_bit,
.set = prop_set_bit,
@@ -456,7 +455,6 @@ inval:
PropertyInfo qdev_prop_macaddr = {
.name = "str",
- .legacy_name = "macaddr",
.description = "Ethernet 6-byte MAC Address, format: AA:BB:CC:DD:EE:FF",
.get = get_mac,
.set = set_mac,
@@ -479,7 +477,6 @@ QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
PropertyInfo qdev_prop_bios_chs_trans = {
.name = "BiosAtaTranslation",
- .legacy_name = "bios-chs-trans",
.description = "Bios ata translation",
.enum_table = BiosAtaTranslation_lookup,
.get = get_enum,
@@ -554,7 +551,6 @@ static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,
PropertyInfo qdev_prop_pci_devfn = {
.name = "int32",
- .legacy_name = "pci-devfn",
.description = "The slot number of a pci device",
.print = print_pci_devfn,
.get = get_int32,
@@ -602,7 +598,6 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
PropertyInfo qdev_prop_blocksize = {
.name = "uint16",
- .legacy_name = "blocksize",
.description = "A power of two between 512 and 32768",
.get = get_uint16,
.set = set_blocksize,
@@ -711,7 +706,6 @@ inval:
PropertyInfo qdev_prop_pci_host_devaddr = {
.name = "str",
- .legacy_name = "pci-host-devaddr",
.description = "The bdf number of pci on host, such as: 04:10.0",
.get = get_pci_host_devaddr,
.set = set_pci_host_devaddr,
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 31acbe6..7fcd415 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -232,7 +232,6 @@ struct Property {
struct PropertyInfo {
const char *name;
- const char *legacy_name;
const char *description;
const char **enum_table;
int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 56a9f75..35e4ee4 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8044,7 +8044,6 @@ static void powerpc_set_compat(Object *obj, Visitor *v,
static PropertyInfo powerpc_compat_propinfo = {
.name = "str",
- .legacy_name = "powerpc-server-compat",
.description = "PowerPC server compat",
.get = powerpc_get_compat,
.set = powerpc_set_compat,
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 4/7] qom: add description field in ObjectProperty struct
2014-09-23 13:08 ` [Qemu-devel] [PATCH 4/7] qom: add description field in ObjectProperty struct arei.gonglei
@ 2014-09-23 13:38 ` Gonglei (Arei)
0 siblings, 0 replies; 20+ messages in thread
From: Gonglei (Arei) @ 2014-09-23 13:38 UTC (permalink / raw)
To: Gonglei (Arei), qemu-devel
Cc: Huangweidong (C),
aliguori, mst, armbru, Luonengjun, Huangpeng (Peter),
lcapitulino, stefanha, pbonzini, afaerber
> Subject: [PATCH 4/7] qom: add description field in ObjectProperty struct
>
> From: Gonglei <arei.gonglei@huawei.com>
>
> The descriptions can serve as documentation in the code,
> and they can be used to provide better help.
>
> 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 | 12 ++++++++++++
> 2 files changed, 27 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);
>
> +
> +/**
> + * object_property_set_description:
> + * @obj: the object to set a property's description to
> + * @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 81542fb..b889db3 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -1676,6 +1676,18 @@ 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;
> + }
> + op->description = description ? g_strdup(description) : NULL;
> +}
> +
> static void object_instance_init(Object *obj)
> {
> object_property_add_str(obj, "type", qdev_get_type, NULL, NULL);
> --
> 1.7.12.4
>
Oops, I forgot free op->description in object_property_del_all(),
Will fix it in next version.
Best regards,
-Gonglei
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's.
2014-09-23 13:08 ` [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's arei.gonglei
@ 2014-09-23 17:03 ` Paolo Bonzini
2014-09-24 0:42 ` Gonglei (Arei)
0 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2014-09-23 17:03 UTC (permalink / raw)
To: arei.gonglei, qemu-devel
Cc: weidong.huang, stefanha, mst, luonengjun, peter.huangpeng,
armbru, aliguori, lcapitulino, afaerber
Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto:
> From: Gonglei <arei.gonglei@huawei.com>
>
> When we call qdev_alias_all_properties() adding alias properties to
> the source object all qdev properties on the target DeviceState,
> set the object property's description to the qdev property's.
>
> c: 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>
> ---
> hw/core/qdev.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index fcb1638..61d352c 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -796,6 +796,9 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)
> object_property_add_alias(source, prop->name,
> OBJECT(target), prop->name,
> &error_abort);
> + object_property_set_description(source, prop->name,
> + prop->info->description,
> + &error_abort);
Please do this directly in object_property_add_alias.
Paolo
> }
> class = object_class_get_parent(class);
> } while (class != object_class_by_name(TYPE_DEVICE));
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
` (6 preceding siblings ...)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 7/7] qdev: drop legacy_name from qdev properties arei.gonglei
@ 2014-09-23 17:03 ` Paolo Bonzini
2014-09-24 0:44 ` Gonglei (Arei)
7 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2014-09-23 17:03 UTC (permalink / raw)
To: arei.gonglei, qemu-devel
Cc: weidong.huang, stefanha, mst, luonengjun, peter.huangpeng,
armbru, aliguori, lcapitulino, afaerber
Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto:
> From: Gonglei <arei.gonglei@huawei.com>
>
> PATCH 1 and PATCH 2 are bugfixes. PATCH 3~7 add a description
> field in both ObjectProperty and PropertyInfo struct.
> The descriptions can serve as documentation in the code,
> and they can be used to provide better help. For example:
>
> Before this patch series:
>
> $./qemu-system-x86_64 -device virtio-blk-pci,?
>
> virtio-blk-pci.iothread=link<iothread>
> virtio-blk-pci.x-data-plane=bool
> virtio-blk-pci.scsi=bool
> virtio-blk-pci.config-wce=bool
> virtio-blk-pci.serial=str
> virtio-blk-pci.secs=uint32
> virtio-blk-pci.heads=uint32
> virtio-blk-pci.cyls=uint32
> virtio-blk-pci.discard_granularity=uint32
> virtio-blk-pci.bootindex=int32
> virtio-blk-pci.opt_io_size=uint32
> virtio-blk-pci.min_io_size=uint16
> virtio-blk-pci.physical_block_size=uint16
> virtio-blk-pci.logical_block_size=uint16
> virtio-blk-pci.drive=str
> virtio-blk-pci.virtio-backend=child<virtio-blk-device>
> virtio-blk-pci.command_serr_enable=on/off
> virtio-blk-pci.multifunction=on/off
> virtio-blk-pci.rombar=uint32
> virtio-blk-pci.romfile=str
> virtio-blk-pci.addr=pci-devfn
> virtio-blk-pci.event_idx=on/off
> virtio-blk-pci.indirect_desc=on/off
> virtio-blk-pci.vectors=uint32
> virtio-blk-pci.ioeventfd=on/off
> virtio-blk-pci.class=uint32
>
> After:
>
> $./qemu-system-x86_64 -device virtio-blk-pci,?
>
> virtio-blk-pci.iothread=link<iothread>
> virtio-blk-pci.x-data-plane=bool (on/off)
> virtio-blk-pci.scsi=bool (on/off)
> virtio-blk-pci.config-wce=bool (on/off)
> virtio-blk-pci.serial=str
> virtio-blk-pci.secs=uint32
> virtio-blk-pci.heads=uint32
> virtio-blk-pci.cyls=uint32
> virtio-blk-pci.discard_granularity=uint32
> virtio-blk-pci.bootindex=int32
> virtio-blk-pci.opt_io_size=uint32
> virtio-blk-pci.min_io_size=uint16
> virtio-blk-pci.physical_block_size=uint16 (A power of two between 512 and 32768)
> virtio-blk-pci.logical_block_size=uint16 (A power of two between 512 and 32768)
> virtio-blk-pci.drive=str (ID of a drive to use as a backend)
> virtio-blk-pci.virtio-backend=child<virtio-blk-device>
> virtio-blk-pci.command_serr_enable=bool (on/off)
> virtio-blk-pci.multifunction=bool (on/off)
> virtio-blk-pci.rombar=uint32
> virtio-blk-pci.romfile=str
> virtio-blk-pci.addr=int32 (The slot number of a pci device)
> virtio-blk-pci.event_idx=bool (on/off)
> virtio-blk-pci.indirect_desc=bool (on/off)
> virtio-blk-pci.vectors=uint32
> virtio-blk-pci.ioeventfd=bool (on/off)
> virtio-blk-pci.class=uint32
>
> Gonglei (7):
> qom: add error handler for object_property_print()
> qom: add error handler for object alias property
> qdev: add description field in PropertyInfo struct
> qom: add description field in ObjectProperty struct
> qdev: set the object property's description to the qdev property's.
> qmp: print descriptions of object properties
> qdev: drop legacy_name from qdev properties
>
> hw/core/qdev-properties-system.c | 8 ++++----
> hw/core/qdev-properties.c | 12 ++++++------
> hw/core/qdev.c | 3 +++
> include/hw/qdev-core.h | 2 +-
> include/qom/object.h | 15 +++++++++++++++
> qmp.c | 19 +++++++++++++++----
> qom/object.c | 33 ++++++++++++++++++++++++++++++---
> target-ppc/translate_init.c | 2 +-
> 8 files changed, 75 insertions(+), 19 deletions(-)
>
Just one comment on patch 5. The description can be improved, I can do
it tomorrow.
Thanks!
Paolo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's.
2014-09-23 17:03 ` Paolo Bonzini
@ 2014-09-24 0:42 ` Gonglei (Arei)
2014-09-24 6:54 ` Paolo Bonzini
0 siblings, 1 reply; 20+ messages in thread
From: Gonglei (Arei) @ 2014-09-24 0:42 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
Cc: Huangweidong (C), stefanha, mst, Luonengjun, Huangpeng (Peter),
armbru, aliguori, lcapitulino, afaerber
> Subject: Re: [PATCH 5/7] qdev: set the object property's description to the qdev
> property's.
>
> Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > When we call qdev_alias_all_properties() adding alias properties to
> > the source object all qdev properties on the target DeviceState,
> > set the object property's description to the qdev property's.
> >
> > c: 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>
> > ---
> > hw/core/qdev.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> > index fcb1638..61d352c 100644
> > --- a/hw/core/qdev.c
> > +++ b/hw/core/qdev.c
> > @@ -796,6 +796,9 @@ void qdev_alias_all_properties(DeviceState *target,
> Object *source)
> > object_property_add_alias(source, prop->name,
> > OBJECT(target),
> prop->name,
> > &error_abort);
> > + object_property_set_description(source, prop->name,
> > +
> prop->info->description,
> > + &error_abort);
>
> Please do this directly in object_property_add_alias.
>
OK.
This way I have to add a description string parametet to
object_property_add_alias function. Will do in the next version. :)
Best regards,
-Gonglei
> Paolo
>
> > }
> > class = object_class_get_parent(class);
> > } while (class != object_class_by_name(TYPE_DEVICE));
> >
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct
2014-09-23 17:03 ` [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct Paolo Bonzini
@ 2014-09-24 0:44 ` Gonglei (Arei)
2014-09-24 12:36 ` Gonglei
0 siblings, 1 reply; 20+ messages in thread
From: Gonglei (Arei) @ 2014-09-24 0:44 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
Cc: Huangweidong (C), stefanha, mst, Luonengjun, Huangpeng (Peter),
armbru, aliguori, lcapitulino, afaerber
> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> Bonzini
> Sent: Wednesday, September 24, 2014 1:04 AM
> Subject: Re: [PATCH 0/7] add description field in ObjectProperty and
> PropertyInfo struct
>
> Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > PATCH 1 and PATCH 2 are bugfixes. PATCH 3~7 add a description
> > field in both ObjectProperty and PropertyInfo struct.
> > The descriptions can serve as documentation in the code,
> > and they can be used to provide better help. For example:
> >
> > Before this patch series:
> >
> > $./qemu-system-x86_64 -device virtio-blk-pci,?
> >
> > virtio-blk-pci.iothread=link<iothread>
> > virtio-blk-pci.x-data-plane=bool
> > virtio-blk-pci.scsi=bool
> > virtio-blk-pci.config-wce=bool
> > virtio-blk-pci.serial=str
> > virtio-blk-pci.secs=uint32
> > virtio-blk-pci.heads=uint32
> > virtio-blk-pci.cyls=uint32
> > virtio-blk-pci.discard_granularity=uint32
> > virtio-blk-pci.bootindex=int32
> > virtio-blk-pci.opt_io_size=uint32
> > virtio-blk-pci.min_io_size=uint16
> > virtio-blk-pci.physical_block_size=uint16
> > virtio-blk-pci.logical_block_size=uint16
> > virtio-blk-pci.drive=str
> > virtio-blk-pci.virtio-backend=child<virtio-blk-device>
> > virtio-blk-pci.command_serr_enable=on/off
> > virtio-blk-pci.multifunction=on/off
> > virtio-blk-pci.rombar=uint32
> > virtio-blk-pci.romfile=str
> > virtio-blk-pci.addr=pci-devfn
> > virtio-blk-pci.event_idx=on/off
> > virtio-blk-pci.indirect_desc=on/off
> > virtio-blk-pci.vectors=uint32
> > virtio-blk-pci.ioeventfd=on/off
> > virtio-blk-pci.class=uint32
> >
> > After:
> >
> > $./qemu-system-x86_64 -device virtio-blk-pci,?
> >
> > virtio-blk-pci.iothread=link<iothread>
> > virtio-blk-pci.x-data-plane=bool (on/off)
> > virtio-blk-pci.scsi=bool (on/off)
> > virtio-blk-pci.config-wce=bool (on/off)
> > virtio-blk-pci.serial=str
> > virtio-blk-pci.secs=uint32
> > virtio-blk-pci.heads=uint32
> > virtio-blk-pci.cyls=uint32
> > virtio-blk-pci.discard_granularity=uint32
> > virtio-blk-pci.bootindex=int32
> > virtio-blk-pci.opt_io_size=uint32
> > virtio-blk-pci.min_io_size=uint16
> > virtio-blk-pci.physical_block_size=uint16 (A power of two between 512 and
> 32768)
> > virtio-blk-pci.logical_block_size=uint16 (A power of two between 512 and
> 32768)
> > virtio-blk-pci.drive=str (ID of a drive to use as a backend)
> > virtio-blk-pci.virtio-backend=child<virtio-blk-device>
> > virtio-blk-pci.command_serr_enable=bool (on/off)
> > virtio-blk-pci.multifunction=bool (on/off)
> > virtio-blk-pci.rombar=uint32
> > virtio-blk-pci.romfile=str
> > virtio-blk-pci.addr=int32 (The slot number of a pci device)
> > virtio-blk-pci.event_idx=bool (on/off)
> > virtio-blk-pci.indirect_desc=bool (on/off)
> > virtio-blk-pci.vectors=uint32
> > virtio-blk-pci.ioeventfd=bool (on/off)
> > virtio-blk-pci.class=uint32
> >
> > Gonglei (7):
> > qom: add error handler for object_property_print()
> > qom: add error handler for object alias property
> > qdev: add description field in PropertyInfo struct
> > qom: add description field in ObjectProperty struct
> > qdev: set the object property's description to the qdev property's.
> > qmp: print descriptions of object properties
> > qdev: drop legacy_name from qdev properties
> >
> > hw/core/qdev-properties-system.c | 8 ++++----
> > hw/core/qdev-properties.c | 12 ++++++------
> > hw/core/qdev.c | 3 +++
> > include/hw/qdev-core.h | 2 +-
> > include/qom/object.h | 15 +++++++++++++++
> > qmp.c | 19 +++++++++++++++----
> > qom/object.c | 33
> ++++++++++++++++++++++++++++++---
> > target-ppc/translate_init.c | 2 +-
> > 8 files changed, 75 insertions(+), 19 deletions(-)
> >
>
> Just one comment on patch 5. The description can be improved, I can do
> it tomorrow.
>
Great! I'm looking forward to your reply. :)
Best regards,
-Gonglei
> Thanks!
>
> Paolo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's.
2014-09-24 0:42 ` Gonglei (Arei)
@ 2014-09-24 6:54 ` Paolo Bonzini
2014-09-24 8:34 ` Gonglei (Arei)
2014-09-24 9:12 ` Gonglei (Arei)
0 siblings, 2 replies; 20+ messages in thread
From: Paolo Bonzini @ 2014-09-24 6:54 UTC (permalink / raw)
To: Gonglei (Arei), qemu-devel
Cc: Huangweidong (C),
aliguori, mst, Luonengjun, armbru, Huangpeng (Peter),
stefanha, lcapitulino, afaerber
Il 24/09/2014 02:42, Gonglei (Arei) ha scritto:
> OK.
>
> This way I have to add a description string parametet to
> object_property_add_alias function. Will do in the next version. :)
No, just take it from the original property. So if you alias A.X to
B.Y, you copy the description of B.Y.
Paolo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's.
2014-09-24 6:54 ` Paolo Bonzini
@ 2014-09-24 8:34 ` Gonglei (Arei)
2014-09-24 9:12 ` Gonglei (Arei)
1 sibling, 0 replies; 20+ messages in thread
From: Gonglei (Arei) @ 2014-09-24 8:34 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
Cc: Huangweidong (C),
aliguori, mst, Luonengjun, armbru, Huangpeng (Peter),
stefanha, lcapitulino, afaerber
> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> Bonzini
> Sent: Wednesday, September 24, 2014 2:54 PM
> Subject: Re: [PATCH 5/7] qdev: set the object property's description to the qdev
> property's.
>
> Il 24/09/2014 02:42, Gonglei (Arei) ha scritto:
> > OK.
> >
> > This way I have to add a description string parametet to
> > object_property_add_alias function. Will do in the next version. :)
>
> No, just take it from the original property. So if you alias A.X to
> B.Y, you copy the description of B.Y.
>
But the description of B.Y wasn't set. Only qdev_alias_all_properties()
call object_property_set_description() to set the description filed of
ObjectProerty at present.
Best regards,
-Gonglei
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's.
2014-09-24 6:54 ` Paolo Bonzini
2014-09-24 8:34 ` Gonglei (Arei)
@ 2014-09-24 9:12 ` Gonglei (Arei)
2014-09-24 11:06 ` Paolo Bonzini
1 sibling, 1 reply; 20+ messages in thread
From: Gonglei (Arei) @ 2014-09-24 9:12 UTC (permalink / raw)
To: Gonglei (Arei), Paolo Bonzini, qemu-devel
Cc: Huangweidong (C),
aliguori, mst, Luonengjun, armbru, Huangpeng (Peter),
stefanha, lcapitulino, afaerber
Hi,
> >
> > Il 24/09/2014 02:42, Gonglei (Arei) ha scritto:
> > > OK.
> > >
> > > This way I have to add a description string parametet to
> > > object_property_add_alias function. Will do in the next version. :)
> >
> > No, just take it from the original property. So if you alias A.X to
> > B.Y, you copy the description of B.Y.
> >
>
> But the description of B.Y wasn't set. Only qdev_alias_all_properties()
> call object_property_set_description() to set the description filed of
> ObjectProerty at present.
>
I should set description at qdev_property_add_static(), then
everything will be well. :) Thanks!
Best regards,
-Gonglei
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's.
2014-09-24 9:12 ` Gonglei (Arei)
@ 2014-09-24 11:06 ` Paolo Bonzini
0 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2014-09-24 11:06 UTC (permalink / raw)
To: Gonglei (Arei), qemu-devel
Cc: Huangweidong (C),
aliguori, mst, Luonengjun, armbru, Huangpeng (Peter),
stefanha, lcapitulino, afaerber
Il 24/09/2014 11:12, Gonglei (Arei) ha scritto:
>> > But the description of B.Y wasn't set. Only qdev_alias_all_properties()
>> > call object_property_set_description() to set the description filed of
>> > ObjectProerty at present.
>> >
> I should set description at qdev_property_add_static(), then
> everything will be well. :) Thanks!
Yes. :)
Paolo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct
2014-09-24 0:44 ` Gonglei (Arei)
@ 2014-09-24 12:36 ` Gonglei
0 siblings, 0 replies; 20+ messages in thread
From: Gonglei @ 2014-09-24 12:36 UTC (permalink / raw)
To: 'Gonglei (Arei)', 'Paolo Bonzini', qemu-devel
Cc: 'Huangweidong (C)', aliguori, mst, 'Luonengjun',
armbru, 'Huangpeng (Peter)',
stefanha, lcapitulino, afaerber
> > From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> > Bonzini
> > Sent: Wednesday, September 24, 2014 1:04 AM
> > Subject: Re: [PATCH 0/7] add description field in ObjectProperty and
> > PropertyInfo struct
> >
> > Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto:
> > > From: Gonglei <arei.gonglei@huawei.com>
> > >
> > > PATCH 1 and PATCH 2 are bugfixes. PATCH 3~7 add a description
> > > field in both ObjectProperty and PropertyInfo struct.
> > > The descriptions can serve as documentation in the code,
> > > and they can be used to provide better help. For example:
> > >
> > > Before this patch series:
> > >
> > > $./qemu-system-x86_64 -device virtio-blk-pci,?
> > >
> > > virtio-blk-pci.iothread=link<iothread>
> > > virtio-blk-pci.x-data-plane=bool
> > > virtio-blk-pci.scsi=bool
> > > virtio-blk-pci.config-wce=bool
> > > virtio-blk-pci.serial=str
> > > virtio-blk-pci.secs=uint32
> > > virtio-blk-pci.heads=uint32
> > > virtio-blk-pci.cyls=uint32
> > > virtio-blk-pci.discard_granularity=uint32
> > > virtio-blk-pci.bootindex=int32
> > > virtio-blk-pci.opt_io_size=uint32
> > > virtio-blk-pci.min_io_size=uint16
> > > virtio-blk-pci.physical_block_size=uint16
> > > virtio-blk-pci.logical_block_size=uint16
> > > virtio-blk-pci.drive=str
> > > virtio-blk-pci.virtio-backend=child<virtio-blk-device>
> > > virtio-blk-pci.command_serr_enable=on/off
> > > virtio-blk-pci.multifunction=on/off
> > > virtio-blk-pci.rombar=uint32
> > > virtio-blk-pci.romfile=str
> > > virtio-blk-pci.addr=pci-devfn
> > > virtio-blk-pci.event_idx=on/off
> > > virtio-blk-pci.indirect_desc=on/off
> > > virtio-blk-pci.vectors=uint32
> > > virtio-blk-pci.ioeventfd=on/off
> > > virtio-blk-pci.class=uint32
> > >
> > > After:
> > >
> > > $./qemu-system-x86_64 -device virtio-blk-pci,?
> > >
> > > virtio-blk-pci.iothread=link<iothread>
> > > virtio-blk-pci.x-data-plane=bool (on/off)
> > > virtio-blk-pci.scsi=bool (on/off)
> > > virtio-blk-pci.config-wce=bool (on/off)
> > > virtio-blk-pci.serial=str
> > > virtio-blk-pci.secs=uint32
> > > virtio-blk-pci.heads=uint32
> > > virtio-blk-pci.cyls=uint32
> > > virtio-blk-pci.discard_granularity=uint32
> > > virtio-blk-pci.bootindex=int32
> > > virtio-blk-pci.opt_io_size=uint32
> > > virtio-blk-pci.min_io_size=uint16
> > > virtio-blk-pci.physical_block_size=uint16 (A power of two between 512 and
> > 32768)
> > > virtio-blk-pci.logical_block_size=uint16 (A power of two between 512 and
> > 32768)
> > > virtio-blk-pci.drive=str (ID of a drive to use as a backend)
> > > virtio-blk-pci.virtio-backend=child<virtio-blk-device>
> > > virtio-blk-pci.command_serr_enable=bool (on/off)
> > > virtio-blk-pci.multifunction=bool (on/off)
> > > virtio-blk-pci.rombar=uint32
> > > virtio-blk-pci.romfile=str
> > > virtio-blk-pci.addr=int32 (The slot number of a pci device)
> > > virtio-blk-pci.event_idx=bool (on/off)
> > > virtio-blk-pci.indirect_desc=bool (on/off)
> > > virtio-blk-pci.vectors=uint32
> > > virtio-blk-pci.ioeventfd=bool (on/off)
> > > virtio-blk-pci.class=uint32
> > >
> > > Gonglei (7):
> > > qom: add error handler for object_property_print()
> > > qom: add error handler for object alias property
> > > qdev: add description field in PropertyInfo struct
> > > qom: add description field in ObjectProperty struct
> > > qdev: set the object property's description to the qdev property's.
> > > qmp: print descriptions of object properties
> > > qdev: drop legacy_name from qdev properties
> > >
> > > hw/core/qdev-properties-system.c | 8 ++++----
> > > hw/core/qdev-properties.c | 12 ++++++------
> > > hw/core/qdev.c | 3 +++
> > > include/hw/qdev-core.h | 2 +-
> > > include/qom/object.h | 15 +++++++++++++++
> > > qmp.c | 19 +++++++++++++++----
> > > qom/object.c | 33
> > ++++++++++++++++++++++++++++++---
> > > target-ppc/translate_init.c | 2 +-
> > > 8 files changed, 75 insertions(+), 19 deletions(-)
> > >
> >
> > Just one comment on patch 5. The description can be improved, I can do
> > it tomorrow.
> >
Hi, Paolo
Do you have any time to improve those description information?
I want to post v2 after your answer. :) Thanks!
Best regards,
-Gonglei
>
> Great! I'm looking forward to your reply. :)
>
> Best regards,
> -Gonglei
>
> > Thanks!
> >
> > Paolo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct
2014-09-23 13:08 ` [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct arei.gonglei
@ 2014-09-24 13:01 ` Paolo Bonzini
2014-09-24 13:56 ` Gonglei
0 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2014-09-24 13:01 UTC (permalink / raw)
To: arei.gonglei, qemu-devel
Cc: weidong.huang, stefanha, mst, luonengjun, peter.huangpeng,
armbru, aliguori, lcapitulino, afaerber
Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto:
> From: Gonglei <arei.gonglei@huawei.com>
>
> The descriptions can serve as documentation in the code,
> and they can be used to provide better help.
>
> 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>
> ---
> hw/core/qdev-properties-system.c | 4 ++++
> hw/core/qdev-properties.c | 6 ++++++
> include/hw/qdev-core.h | 1 +
> target-ppc/translate_init.c | 1 +
> 4 files changed, 12 insertions(+)
>
> diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
> index 84caa1d..4c8ea18 100644
> --- a/hw/core/qdev-properties-system.c
> +++ b/hw/core/qdev-properties-system.c
> @@ -113,6 +113,7 @@ static void set_drive(Object *obj, Visitor *v, void *opaque,
> PropertyInfo qdev_prop_drive = {
> .name = "str",
> .legacy_name = "drive",
> + .description = "ID of a drive to use as a backend",
> .get = get_drive,
> .set = set_drive,
> .release = release_drive,
> @@ -170,6 +171,7 @@ static void set_chr(Object *obj, Visitor *v, void *opaque,
> PropertyInfo qdev_prop_chr = {
> .name = "str",
> .legacy_name = "chr",
> + .description = "ID of a chardev to use as a backend",
> .get = get_chr,
> .set = set_chr,
> .release = release_chr,
> @@ -249,6 +251,7 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque,
> PropertyInfo qdev_prop_netdev = {
> .name = "str",
> .legacy_name = "netdev",
> + .description = "ID of a netdev to use as a backend",
> .get = get_netdev,
> .set = set_netdev,
> };
> @@ -329,6 +332,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
> PropertyInfo qdev_prop_vlan = {
> .name = "int32",
> .legacy_name = "vlan",
> + .description = "The value of vlan id",
Integer VLAN id to connect to
> .print = print_vlan,
> .get = get_vlan,
> .set = set_vlan,
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 66556d3..2f7e52b 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -121,6 +121,7 @@ static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
> PropertyInfo qdev_prop_bit = {
> .name = "bool",
> .legacy_name = "on/off",
> + .description = "on/off",
> .get = prop_get_bit,
> .set = prop_set_bit,
> };
> @@ -456,6 +457,7 @@ inval:
> PropertyInfo qdev_prop_macaddr = {
> .name = "str",
> .legacy_name = "macaddr",
> + .description = "Ethernet 6-byte MAC Address, format: AA:BB:CC:DD:EE:FF",
Perhaps replace "format: .." with "example: 52:54:00:12:34:56" which is
also the default.
> .get = get_mac,
> .set = set_mac,
> };
> @@ -478,6 +480,7 @@ QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
> PropertyInfo qdev_prop_bios_chs_trans = {
> .name = "BiosAtaTranslation",
> .legacy_name = "bios-chs-trans",
> + .description = "Bios ata translation",
Logical CHS translation algorithm, auto/none/lba/large/rechs
> .enum_table = BiosAtaTranslation_lookup,
> .get = get_enum,
> .set = set_enum,
> @@ -552,6 +555,7 @@ static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,
> PropertyInfo qdev_prop_pci_devfn = {
> .name = "int32",
> .legacy_name = "pci-devfn",
> + .description = "The slot number of a pci device",
"Slot and function number, example: 06.0"
> .print = print_pci_devfn,
> .get = get_int32,
> .set = set_pci_devfn,
> @@ -599,6 +603,7 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
> PropertyInfo qdev_prop_blocksize = {
> .name = "uint16",
> .legacy_name = "blocksize",
> + .description = "A power of two between 512 and 32768",
> .get = get_uint16,
> .set = set_blocksize,
> };
> @@ -707,6 +712,7 @@ inval:
> PropertyInfo qdev_prop_pci_host_devaddr = {
> .name = "str",
> .legacy_name = "pci-host-devaddr",
> + .description = "The bdf number of pci on host, such as: 04:10.0",
"Address (bus/device/function) of the host device, example: 04:10.0"
> .get = get_pci_host_devaddr,
> .set = set_pci_host_devaddr,
> };
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 178fee2..31acbe6 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -233,6 +233,7 @@ struct Property {
> struct PropertyInfo {
> const char *name;
> const char *legacy_name;
> + const char *description;
> const char **enum_table;
> int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
> ObjectPropertyAccessor *get;
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 48177ed..56a9f75 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -8045,6 +8045,7 @@ static void powerpc_set_compat(Object *obj, Visitor *v,
> static PropertyInfo powerpc_compat_propinfo = {
> .name = "str",
> .legacy_name = "powerpc-server-compat",
> + .description = "PowerPC server compat",
"compatibility mode, power6/power7/power8"
Thanks!
Paolo
> .get = powerpc_get_compat,
> .set = powerpc_set_compat,
> };
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct
2014-09-24 13:01 ` Paolo Bonzini
@ 2014-09-24 13:56 ` Gonglei
0 siblings, 0 replies; 20+ messages in thread
From: Gonglei @ 2014-09-24 13:56 UTC (permalink / raw)
To: 'Paolo Bonzini', arei.gonglei, qemu-devel
Cc: weidong.huang, aliguori, mst, luonengjun, armbru,
peter.huangpeng, stefanha, lcapitulino, afaerber
> Subject: Re: [Qemu-devel] [PATCH 3/7] qdev: add description field in
> PropertyInfo struct
>
> Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > The descriptions can serve as documentation in the code,
> > and they can be used to provide better help.
> >
> > 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>
> > ---
> > hw/core/qdev-properties-system.c | 4 ++++
> > hw/core/qdev-properties.c | 6 ++++++
> > include/hw/qdev-core.h | 1 +
> > target-ppc/translate_init.c | 1 +
> > 4 files changed, 12 insertions(+)
> >
> > diff --git a/hw/core/qdev-properties-system.c
> b/hw/core/qdev-properties-system.c
> > index 84caa1d..4c8ea18 100644
> > --- a/hw/core/qdev-properties-system.c
> > +++ b/hw/core/qdev-properties-system.c
> > @@ -113,6 +113,7 @@ static void set_drive(Object *obj, Visitor *v, void
> *opaque,
> > PropertyInfo qdev_prop_drive = {
> > .name = "str",
> > .legacy_name = "drive",
> > + .description = "ID of a drive to use as a backend",
> > .get = get_drive,
> > .set = set_drive,
> > .release = release_drive,
> > @@ -170,6 +171,7 @@ static void set_chr(Object *obj, Visitor *v, void
> *opaque,
> > PropertyInfo qdev_prop_chr = {
> > .name = "str",
> > .legacy_name = "chr",
> > + .description = "ID of a chardev to use as a backend",
> > .get = get_chr,
> > .set = set_chr,
> > .release = release_chr,
> > @@ -249,6 +251,7 @@ static void set_netdev(Object *obj, Visitor *v, void
> *opaque,
> > PropertyInfo qdev_prop_netdev = {
> > .name = "str",
> > .legacy_name = "netdev",
> > + .description = "ID of a netdev to use as a backend",
> > .get = get_netdev,
> > .set = set_netdev,
> > };
> > @@ -329,6 +332,7 @@ static void set_vlan(Object *obj, Visitor *v, void
> *opaque,
> > PropertyInfo qdev_prop_vlan = {
> > .name = "int32",
> > .legacy_name = "vlan",
> > + .description = "The value of vlan id",
>
> Integer VLAN id to connect to
>
> > .print = print_vlan,
> > .get = get_vlan,
> > .set = set_vlan,
> > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> > index 66556d3..2f7e52b 100644
> > --- a/hw/core/qdev-properties.c
> > +++ b/hw/core/qdev-properties.c
> > @@ -121,6 +121,7 @@ static void prop_set_bit(Object *obj, Visitor *v, void
> *opaque,
> > PropertyInfo qdev_prop_bit = {
> > .name = "bool",
> > .legacy_name = "on/off",
> > + .description = "on/off",
> > .get = prop_get_bit,
> > .set = prop_set_bit,
> > };
> > @@ -456,6 +457,7 @@ inval:
> > PropertyInfo qdev_prop_macaddr = {
> > .name = "str",
> > .legacy_name = "macaddr",
> > + .description = "Ethernet 6-byte MAC Address, format:
> AA:BB:CC:DD:EE:FF",
>
> Perhaps replace "format: .." with "example: 52:54:00:12:34:56" which is
> also the default.
>
> > .get = get_mac,
> > .set = set_mac,
> > };
> > @@ -478,6 +480,7 @@
> QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
> > PropertyInfo qdev_prop_bios_chs_trans = {
> > .name = "BiosAtaTranslation",
> > .legacy_name = "bios-chs-trans",
> > + .description = "Bios ata translation",
>
> Logical CHS translation algorithm, auto/none/lba/large/rechs
>
> > .enum_table = BiosAtaTranslation_lookup,
> > .get = get_enum,
> > .set = set_enum,
> > @@ -552,6 +555,7 @@ static int print_pci_devfn(DeviceState *dev, Property
> *prop, char *dest,
> > PropertyInfo qdev_prop_pci_devfn = {
> > .name = "int32",
> > .legacy_name = "pci-devfn",
> > + .description = "The slot number of a pci device",
>
> "Slot and function number, example: 06.0"
>
> > .print = print_pci_devfn,
> > .get = get_int32,
> > .set = set_pci_devfn,
> > @@ -599,6 +603,7 @@ static void set_blocksize(Object *obj, Visitor *v, void
> *opaque,
> > PropertyInfo qdev_prop_blocksize = {
> > .name = "uint16",
> > .legacy_name = "blocksize",
> > + .description = "A power of two between 512 and 32768",
> > .get = get_uint16,
> > .set = set_blocksize,
> > };
> > @@ -707,6 +712,7 @@ inval:
> > PropertyInfo qdev_prop_pci_host_devaddr = {
> > .name = "str",
> > .legacy_name = "pci-host-devaddr",
> > + .description = "The bdf number of pci on host, such as: 04:10.0",
>
> "Address (bus/device/function) of the host device, example: 04:10.0"
>
> > .get = get_pci_host_devaddr,
> > .set = set_pci_host_devaddr,
> > };
> > diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> > index 178fee2..31acbe6 100644
> > --- a/include/hw/qdev-core.h
> > +++ b/include/hw/qdev-core.h
> > @@ -233,6 +233,7 @@ struct Property {
> > struct PropertyInfo {
> > const char *name;
> > const char *legacy_name;
> > + const char *description;
> > const char **enum_table;
> > int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
> > ObjectPropertyAccessor *get;
> > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> > index 48177ed..56a9f75 100644
> > --- a/target-ppc/translate_init.c
> > +++ b/target-ppc/translate_init.c
> > @@ -8045,6 +8045,7 @@ static void powerpc_set_compat(Object *obj,
> Visitor *v,
> > static PropertyInfo powerpc_compat_propinfo = {
> > .name = "str",
> > .legacy_name = "powerpc-server-compat",
> > + .description = "PowerPC server compat",
>
> "compatibility mode, power6/power7/power8"
>
OK, good. I will change them as your suggestion.
v2 will cover those changes. :)
Thanks a lot! Paolo.
Best regards,
-Gonglei
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2014-09-24 13:58 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 1/7] qom: add error handler for object_property_print() arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 2/7] qom: add error handler for object alias property arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct arei.gonglei
2014-09-24 13:01 ` Paolo Bonzini
2014-09-24 13:56 ` Gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 4/7] qom: add description field in ObjectProperty struct arei.gonglei
2014-09-23 13:38 ` Gonglei (Arei)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's arei.gonglei
2014-09-23 17:03 ` Paolo Bonzini
2014-09-24 0:42 ` Gonglei (Arei)
2014-09-24 6:54 ` Paolo Bonzini
2014-09-24 8:34 ` Gonglei (Arei)
2014-09-24 9:12 ` Gonglei (Arei)
2014-09-24 11:06 ` Paolo Bonzini
2014-09-23 13:08 ` [Qemu-devel] [PATCH 6/7] qmp: print descriptions of object properties arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 7/7] qdev: drop legacy_name from qdev properties arei.gonglei
2014-09-23 17:03 ` [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct Paolo Bonzini
2014-09-24 0:44 ` Gonglei (Arei)
2014-09-24 12:36 ` Gonglei
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.