All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
	mimu@linux.vnet.ibm.com, qemu-devel@nongnu.org, agraf@suse.de,
	borntraeger@de.ibm.com, bharata@linux.vnet.ibm.com,
	cornelia.huck@de.ibm.com, "Igor Mammedov" <imammedo@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [PATCH v2 1/2] qom: Implement object_property_add_const_link()
Date: Tue, 05 May 2015 18:21:02 +0200	[thread overview]
Message-ID: <5548EDEE.4010100@redhat.com> (raw)
In-Reply-To: <20150505160654.GG25766@thinpad.lan.raisama.net>



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	other threads:[~2015-05-05 16:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 14:09 [Qemu-devel] [PATCH v2 0/2] cpu: Add /machine/cpus[<index>] links Eduardo Habkost
2015-05-01 14:09 ` [Qemu-devel] [PATCH v2 1/2] qom: Implement object_property_add_const_link() Eduardo Habkost
2015-05-01 18:15   ` Paolo Bonzini
2015-05-05 16:06     ` Eduardo Habkost
2015-05-05 16:21       ` Paolo Bonzini [this message]
2015-05-01 14:09 ` [Qemu-devel] [PATCH v2 2/2] cpu: Register QOM links at /machine/cpus[<index>] Eduardo Habkost

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=5548EDEE.4010100@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mimu@linux.vnet.ibm.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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.