summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorWenchao Xia <wenchaoqemu@gmail.com>2014-06-18 08:43:47 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2014-06-23 11:12:28 -0400
commitbcada37b19e79329c47a956c4c2dd5c81727e8c8 (patch)
treedd6891d7cfda07168a47bc27aaffac34e810e7ee /blockdev.c
parentc120f0fa14cd763d57270933713dbb25de5446fd (diff)
qapi event: convert other BLOCK_JOB events
Since BLOCK_JOB_COMPLETED, BLOCK_JOB_CANCELLED, BLOCK_JOB_READY are related, convert them in one patch. The block_job_event_* functions are used to keep encapsulation of BlockJob structure. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/blockdev.c b/blockdev.c
index 9b0f8ac45e..03ab153d01 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1847,23 +1847,21 @@ void qmp_block_resize(bool has_device, const char *device,
static void block_job_cb(void *opaque, int ret)
{
BlockDriverState *bs = opaque;
- QObject *obj;
+ const char *msg = NULL;
trace_block_job_cb(bs, bs->job, ret);
assert(bs->job);
- obj = qobject_from_block_job(bs->job);
+
if (ret < 0) {
- QDict *dict = qobject_to_qdict(obj);
- qdict_put(dict, "error", qstring_from_str(strerror(-ret)));
+ msg = strerror(-ret);
}
if (block_job_is_cancelled(bs->job)) {
- monitor_protocol_event(QEVENT_BLOCK_JOB_CANCELLED, obj);
+ block_job_event_cancelled(bs->job);
} else {
- monitor_protocol_event(QEVENT_BLOCK_JOB_COMPLETED, obj);
+ block_job_event_completed(bs->job, msg);
}
- qobject_decref(obj);
bdrv_put_ref_bh_schedule(bs);
}