All of lore.kernel.org
 help / color / mirror / Atom feed
From: <arei.gonglei@huawei.com>
To: qemu-devel@nongnu.org
Cc: weidong.huang@huawei.com, aliguori@amazon.com, mst@redhat.com,
	armbru@redhat.com, luonengjun@huawei.com,
	peter.huangpeng@huawei.com, lcapitulino@redhat.com,
	Gonglei <arei.gonglei@huawei.com>,
	stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct
Date: Tue, 23 Sep 2014 21:08:33 +0800	[thread overview]
Message-ID: <1411477717-6988-4-git-send-email-arei.gonglei@huawei.com> (raw)
In-Reply-To: <1411477717-6988-1-git-send-email-arei.gonglei@huawei.com>

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

  parent reply	other threads:[~2014-09-23 13:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-09-24 13:01   ` [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct 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

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=1411477717-6988-4-git-send-email-arei.gonglei@huawei.com \
    --to=arei.gonglei@huawei.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.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.