From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [FOR 0.12 PATCH] qdev: improve property error reporting.
Date: Wed, 16 Dec 2009 14:22:11 +0100 [thread overview]
Message-ID: <1260969731-26271-1-git-send-email-kraxel@redhat.com> (raw)
Add a error message in case we fail to parse a qdev property.
Also make qemu not abort() in case setting a global property can't be
set. This used to be a clear programming error. The introduction of
the -global switch changed that though, so better exit instead (after
printing the new error message).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qdev-properties.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index fb07279..217ddc0 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -500,7 +500,12 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
dev->info->name, name);
return -1;
}
- return prop->info->parse(dev, prop, value);
+ if (prop->info->parse(dev, prop, value) != 0) {
+ fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
+ dev->info->name, name, value);
+ return -1;
+ }
+ return 0;
}
void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyType type)
@@ -619,7 +624,7 @@ void qdev_prop_set_globals(DeviceState *dev)
continue;
}
if (qdev_prop_parse(dev, prop->property, prop->value) != 0) {
- abort();
+ exit(1);
}
}
}
--
1.6.5.2
reply other threads:[~2009-12-16 13:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1260969731-26271-1-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.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).