diff mbox

[5/7] qdev: set the object property's description to the qdev property's.

Message ID 1411477717-6988-6-git-send-email-arei.gonglei@huawei.com
State New
Headers show

Commit Message

Gonglei (Arei) Sept. 23, 2014, 1:08 p.m. UTC
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(+)

Comments

Paolo Bonzini Sept. 23, 2014, 5:03 p.m. UTC | #1
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));
>
Gonglei (Arei) Sept. 24, 2014, 12:42 a.m. UTC | #2
> 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));
> >
Paolo Bonzini Sept. 24, 2014, 6:54 a.m. UTC | #3
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
Gonglei (Arei) Sept. 24, 2014, 8:34 a.m. UTC | #4
> 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
Gonglei (Arei) Sept. 24, 2014, 9:12 a.m. UTC | #5
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
Paolo Bonzini Sept. 24, 2014, 11:06 a.m. UTC | #6
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
diff mbox

Patch

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));