qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/2] qom: Implement object_property_add_const


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 1/2] qom: Implement object_property_add_const_link()
Date: Tue, 05 May 2015 18:21:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 05/05/2015 18:06, Eduardo Habkost wrote:
> On Fri, May 01, 2015 at 08:15:24PM +0200, Paolo Bonzini wrote:
>> > On 01/05/2015 16:09, Eduardo Habkost wrote:
>>> > > +void object_property_add_const_link(Object *obj, const char *name,
>>> > > +                                       const char *type, Object *child,
>>> > > +                                       ObjectPropertyLinkFlags flags,
>>> > > +                                       Error **errp)
>>> > > +{
>>> > > +    Object **childp = g_new0(Object*, 1);
>>> > > +
>>> > > +    *childp = child;
>>> > > +    object_property_add_link(obj, name, type, childp, NULL,
>>> > > +                             flags | OBJ_PROP_LINK_FREE_CHILD_POINTER, 
>>> > > errp);
>>> > > +}
>>> > > +
>> > 
>> > This works, but is the extra functionality needed, compared to
>> > an alias?  Namely, when is flags going to be != 0?
> Flags is going to be != 0 if the caller grabs a reference to the target
> object (to ensure it won't disappear) and wants it to be automatically
> dropped when the property is removed. It is not strictly necessary, but
> I thought it could be useful.
> 
> But to be honest, I don't love the flags argument in
> object_property_add_link(), either. I mean: why do we need flags in
> object_property_add_link() and not in object_property_add_alias()?
> 
>> > 
>> > FWIW, here is my ./.. patch.  I'm all for adding a helper like
>> > object_property_add_const_link on top if we go for it.
> Looks good to me.
> 
>> > 
>> > Another possibility is to not introduce any of our patches and reuse
>> > the child<> getter and resolve functions in
>> > object_property_add_const_link.
> Using the "." property would allow object_property_add_const_link() to
> be a one-liner, so it sounds better to me.
> 

You don't need this function anymore though, right?  So I'll just adjust
my series to use object_property_add_const_link().

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]