[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 06/15] set_property(): extend signature with Erro
From: |
Laszlo Ersek |
Subject: |
[Qemu-devel] [PATCH v2 06/15] set_property(): extend signature with Error |
Date: |
Tue, 5 Feb 2013 21:39:19 +0100 |
Signed-off-by: Laszlo Ersek <address@hidden>
---
hw/qdev-monitor.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index cf96046..545e66c 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -100,9 +100,14 @@ static void qdev_print_devinfo(ObjectClass *klass, void
*opaque)
error_printf("\n");
}
+typedef struct {
+ DeviceState *dev;
+ Error **errp;
+} PropertyContext;
+
static int set_property(const char *name, const char *value, void *opaque)
{
- DeviceState *dev = opaque;
+ PropertyContext *ctx = opaque;
Error *err = NULL;
if (strcmp(name, "driver") == 0)
@@ -110,7 +115,7 @@ static int set_property(const char *name, const char
*value, void *opaque)
if (strcmp(name, "bus") == 0)
return 0;
- qdev_prop_parse(dev, name, value, &err);
+ qdev_prop_parse(ctx->dev, name, value, &err);
if (error_is_set(&err)) {
qerror_report_err(err);
error_free(err);
@@ -481,10 +486,16 @@ DeviceState *qdev_device_add(QemuOpts *opts)
if (id) {
qdev->id = id;
}
- if (qemu_opt_foreach(opts, set_property, qdev, 1) != 0) {
- qdev_free(qdev);
- return NULL;
+
+ {
+ PropertyContext ctx = { .dev = qdev, .errp = NULL };
+
+ if (qemu_opt_foreach(opts, set_property, &ctx, 1) != 0) {
+ qdev_free(qdev);
+ return NULL;
+ }
}
+
if (qdev->id) {
object_property_add_child(qdev_get_peripheral(), qdev->id,
OBJECT(qdev), NULL);
--
1.7.1
- Re: [Qemu-devel] [PATCH v2 02/15] do_device_add(): look up "device" opts list with qemu_find_opts_err(), (continued)
[Qemu-devel] [PATCH v2 03/15] qdev_prop_parse(): extend signature with Error, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 04/15] qdev_prop_parse(): push error handling to callers, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 05/15] qdev_prop_parse(): change return type to void, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 06/15] set_property(): extend signature with Error,
Laszlo Ersek <=
[Qemu-devel] [PATCH v2 07/15] set_property(): push error handling to callers, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 12/15] qbus_find(): propagate error handling / consumption to callers, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 11/15] qbus_find(): extend signature with Error, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 15/15] qdev_device_add(): beautify "driver not found" error message, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 09/15] qbus_find_recursive(): extend signature with Error, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 08/15] qbus_find_recursive(): reorganize, Laszlo Ersek, 2013/02/05
[Qemu-devel] [PATCH v2 13/15] qdev_device_add(): extend signature with Error, Laszlo Ersek, 2013/02/05