From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWn4r-0007nh-T4 for qemu-devel@nongnu.org; Wed, 24 Sep 2014 09:58:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWn4l-0007f2-7N for qemu-devel@nongnu.org; Wed, 24 Sep 2014 09:57:53 -0400 Received: from blu004-omc1s38.hotmail.com ([65.55.116.49]:58817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWn4l-0007e2-2r for qemu-devel@nongnu.org; Wed, 24 Sep 2014 09:57:47 -0400 Message-ID: From: Gonglei References: <1411477717-6988-1-git-send-email-arei.gonglei@huawei.com> <1411477717-6988-4-git-send-email-arei.gonglei@huawei.com> <5422C097.3030609@redhat.com> In-Reply-To: <5422C097.3030609@redhat.com> Date: Wed, 24 Sep 2014 21:56:49 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Subject: Re: [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Paolo Bonzini' , arei.gonglei@huawei.com, qemu-devel@nongnu.org Cc: weidong.huang@huawei.com, aliguori@amazon.com, mst@redhat.com, luonengjun@huawei.com, armbru@redhat.com, peter.huangpeng@huawei.com, stefanha@redhat.com, lcapitulino@redhat.com, afaerber@suse.de > Subject: Re: [Qemu-devel] [PATCH 3/7] qdev: add description field in > PropertyInfo struct >=20 > Il 23/09/2014 15:08, arei.gonglei@huawei.com ha scritto: > > From: Gonglei > > > > The descriptions can serve as documentation in the code, > > and they can be used to provide better help. > > > > Cc: Paolo Bonzini > > Cc: Michael S. Tsirkin > > Cc: Markus Armbruster > > Signed-off-by: Gonglei > > --- > > 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 =3D { > > .name =3D "str", > > .legacy_name =3D "drive", > > + .description =3D "ID of a drive to use as a backend", > > .get =3D get_drive, > > .set =3D set_drive, > > .release =3D release_drive, > > @@ -170,6 +171,7 @@ static void set_chr(Object *obj, Visitor *v, = void > *opaque, > > PropertyInfo qdev_prop_chr =3D { > > .name =3D "str", > > .legacy_name =3D "chr", > > + .description =3D "ID of a chardev to use as a backend", > > .get =3D get_chr, > > .set =3D set_chr, > > .release =3D release_chr, > > @@ -249,6 +251,7 @@ static void set_netdev(Object *obj, Visitor *v, = void > *opaque, > > PropertyInfo qdev_prop_netdev =3D { > > .name =3D "str", > > .legacy_name =3D "netdev", > > + .description =3D "ID of a netdev to use as a backend", > > .get =3D get_netdev, > > .set =3D set_netdev, > > }; > > @@ -329,6 +332,7 @@ static void set_vlan(Object *obj, Visitor *v, = void > *opaque, > > PropertyInfo qdev_prop_vlan =3D { > > .name =3D "int32", > > .legacy_name =3D "vlan", > > + .description =3D "The value of vlan id", >=20 > Integer VLAN id to connect to >=20 > > .print =3D print_vlan, > > .get =3D get_vlan, > > .set =3D 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 =3D { > > .name =3D "bool", > > .legacy_name =3D "on/off", > > + .description =3D "on/off", > > .get =3D prop_get_bit, > > .set =3D prop_set_bit, > > }; > > @@ -456,6 +457,7 @@ inval: > > PropertyInfo qdev_prop_macaddr =3D { > > .name =3D "str", > > .legacy_name =3D "macaddr", > > + .description =3D "Ethernet 6-byte MAC Address, format: > AA:BB:CC:DD:EE:FF", >=20 > Perhaps replace "format: .." with "example: 52:54:00:12:34:56" which = is > also the default. >=20 > > .get =3D get_mac, > > .set =3D set_mac, > > }; > > @@ -478,6 +480,7 @@ > QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) !=3D sizeof(int)); > > PropertyInfo qdev_prop_bios_chs_trans =3D { > > .name =3D "BiosAtaTranslation", > > .legacy_name =3D "bios-chs-trans", > > + .description =3D "Bios ata translation", >=20 > Logical CHS translation algorithm, auto/none/lba/large/rechs >=20 > > .enum_table =3D BiosAtaTranslation_lookup, > > .get =3D get_enum, > > .set =3D set_enum, > > @@ -552,6 +555,7 @@ static int print_pci_devfn(DeviceState *dev, = Property > *prop, char *dest, > > PropertyInfo qdev_prop_pci_devfn =3D { > > .name =3D "int32", > > .legacy_name =3D "pci-devfn", > > + .description =3D "The slot number of a pci device", >=20 > "Slot and function number, example: 06.0" >=20 > > .print =3D print_pci_devfn, > > .get =3D get_int32, > > .set =3D set_pci_devfn, > > @@ -599,6 +603,7 @@ static void set_blocksize(Object *obj, Visitor = *v, void > *opaque, > > PropertyInfo qdev_prop_blocksize =3D { > > .name =3D "uint16", > > .legacy_name =3D "blocksize", > > + .description =3D "A power of two between 512 and 32768", > > .get =3D get_uint16, > > .set =3D set_blocksize, > > }; > > @@ -707,6 +712,7 @@ inval: > > PropertyInfo qdev_prop_pci_host_devaddr =3D { > > .name =3D "str", > > .legacy_name =3D "pci-host-devaddr", > > + .description =3D "The bdf number of pci on host, such as: = 04:10.0", >=20 > "Address (bus/device/function) of the host device, example: 04:10.0" >=20 > > .get =3D get_pci_host_devaddr, > > .set =3D 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 =3D { > > .name =3D "str", > > .legacy_name =3D "powerpc-server-compat", > > + .description =3D "PowerPC server compat", >=20 > "compatibility mode, power6/power7/power8" >=20 OK, good. I will change them as your suggestion.=20 v2 will cover those changes. :) Thanks a lot! Paolo. Best regards, -Gonglei