From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Gg7-0006vH-AE for qemu-devel@nongnu.org; Tue, 14 Aug 2012 08:57:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Gg6-0005sc-42 for qemu-devel@nongnu.org; Tue, 14 Aug 2012 08:56:59 -0400 Received: from e2.ny.us.ibm.com ([32.97.182.142]:57064) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Gg5-0005sS-WD for qemu-devel@nongnu.org; Tue, 14 Aug 2012 08:56:58 -0400 Received: from /spool/local by e2.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Aug 2012 08:56:53 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 714346E8061 for ; Tue, 14 Aug 2012 08:52:40 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7ECqdvG132274 for ; Tue, 14 Aug 2012 08:52:39 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7ECosV0008171 for ; Tue, 14 Aug 2012 08:50:54 -0400 From: Anthony Liguori In-Reply-To: <1344925665-24626-1-git-send-email-peter.crosthwaite@petalogix.com> References: <1344925665-24626-1-git-send-email-peter.crosthwaite@petalogix.com> Date: Tue, 14 Aug 2012 07:50:49 -0500 Message-ID: <87r4r9bpsm.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [RFC v0] HACK: qom: object_property_set: abort on failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Peter A. G. Crosthwaite" , qemu-devel@nongnu.org, pbonzini@redhat.com "Peter A. G. Crosthwaite" writes: > Hi All. A couple of times now ive had debug issues due to silent failure of > object_property_set. This function silently fails if the requested property > does not exist for the target object. To trap this error I applied the patch > below to my tree, but I am assuming that this is not mergeable as is as im > guessing there are clients out there that are speculatively trying to set props. > > Could someone confirm the expected policy here? is setting a non-existant > property supposed to be a no-op (as it currently is) or should it fail > gracefully? Are you calling set via object_property_set_[str,int,bool,...]? Why don't you add a terminal error to those functions if setting fails and errp is NULL. Regards, Anthony Liguori > > Whats the best meachinism for creating a no_fail version of object_property_set, > for the 90% case where a non-existant property is an error in machine model > development? > > Signed-off-by: Peter A. G. Crosthwaite > --- > qom/object.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/qom/object.c b/qom/object.c > index a552be2..6e875a8 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -687,7 +687,7 @@ void object_property_set(Object *obj, Visitor *v, const char *name, > { > ObjectProperty *prop = object_property_find(obj, name, errp); > if (prop == NULL) { > - return; > + abort(); > } > > if (!prop->set) { > -- > 1.7.0.4