From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Subject: [Qemu-devel] [PULL 6/9] blkdebug: Simplify passing of Error through qemu_opts_foreach()
Date: Mon, 8 Jun 2015 20:02:14 +0200 [thread overview]
Message-ID: <1433786537-30874-7-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1433786537-30874-1-git-send-email-armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
---
block/blkdebug.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/block/blkdebug.c b/block/blkdebug.c
index be0d273..1e92607 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -216,7 +216,6 @@ static int get_event_by_name(const char *name, BlkDebugEvent *event)
struct add_rule_data {
BDRVBlkdebugState *s;
int action;
- Error **errp;
};
static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
@@ -230,10 +229,10 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
/* Find the right event for the rule */
event_name = qemu_opt_get(opts, "event");
if (!event_name) {
- error_setg(d->errp, "Missing event name for rule");
+ error_setg(errp, "Missing event name for rule");
return -1;
} else if (get_event_by_name(event_name, &event) < 0) {
- error_setg(d->errp, "Invalid event name \"%s\"", event_name);
+ error_setg(errp, "Invalid event name \"%s\"", event_name);
return -1;
}
@@ -319,8 +318,7 @@ static int read_config(BDRVBlkdebugState *s, const char *filename,
d.s = s;
d.action = ACTION_INJECT_ERROR;
- d.errp = &local_err;
- qemu_opts_foreach(&inject_error_opts, add_rule, &d, NULL);
+ qemu_opts_foreach(&inject_error_opts, add_rule, &d, &local_err);
if (local_err) {
error_propagate(errp, local_err);
ret = -EINVAL;
@@ -328,7 +326,7 @@ static int read_config(BDRVBlkdebugState *s, const char *filename,
}
d.action = ACTION_SET_STATE;
- qemu_opts_foreach(&set_state_opts, add_rule, &d, NULL);
+ qemu_opts_foreach(&set_state_opts, add_rule, &d, &local_err);
if (local_err) {
error_propagate(errp, local_err);
ret = -EINVAL;
--
1.9.3
next prev parent reply other threads:[~2015-06-08 18:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 18:02 [Qemu-devel] [PULL 0/9] Error reporting patches Markus Armbruster
2015-06-08 18:02 ` [Qemu-devel] [PULL 1/9] vl: Report failure to sandbox at most once Markus Armbruster
2015-06-08 18:02 ` [Qemu-devel] [PULL 2/9] vl: Print -device help " Markus Armbruster
2015-06-08 18:02 ` [Qemu-devel] [PULL 3/9] vl: Fail right after first bad -object Markus Armbruster
2015-06-08 18:02 ` [Qemu-devel] [PULL 4/9] QemuOpts: Drop qemu_opts_foreach() parameter abort_on_failure Markus Armbruster
2015-06-08 18:02 ` [Qemu-devel] [PULL 5/9] QemuOpts: Convert qemu_opts_foreach() to Error Markus Armbruster
2015-06-08 18:02 ` Markus Armbruster [this message]
2015-06-08 18:02 ` [Qemu-devel] [PULL 7/9] QemuOpts: Drop qemu_opt_foreach() parameter abort_on_failure Markus Armbruster
2015-06-08 18:02 ` [Qemu-devel] [PULL 8/9] QemuOpts: Convert qemu_opt_foreach() to Error Markus Armbruster
2015-06-08 18:02 ` [Qemu-devel] [PULL 9/9] vhost-user: Improve -netdev/netdev_add/-net/... error reporting Markus Armbruster
2015-06-08 18:52 ` [Qemu-devel] [PULL 0/9] Error reporting patches Peter Maydell
2015-06-09 5:47 ` Markus Armbruster
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=1433786537-30874-7-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.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 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).