qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: "Peter A. G. Crosthwaite" <peter.crosthwaite@petalogix.com>,
	qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RFC v0] HACK: qom: object_property_set: abort on failure
Date: Tue, 14 Aug 2012 07:50:49 -0500	[thread overview]
Message-ID: <87r4r9bpsm.fsf@codemonkey.ws> (raw)
In-Reply-To: <1344925665-24626-1-git-send-email-peter.crosthwaite@petalogix.com>

"Peter A. G. Crosthwaite" <peter.crosthwaite@petalogix.com> 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 <peter.crosthwaite@petalogix.com>
> ---
>  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

  reply	other threads:[~2012-08-14 12:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14  6:27 [Qemu-devel] [RFC v0] HACK: qom: object_property_set: abort on failure Peter A. G. Crosthwaite
2012-08-14 12:50 ` Anthony Liguori [this message]
2012-08-20  2:18   ` Peter Crosthwaite
2012-08-20 11:02     ` Andreas Färber
2012-08-21  0:34       ` Peter Crosthwaite

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=87r4r9bpsm.fsf@codemonkey.ws \
    --to=aliguori@us.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@petalogix.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).