summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-04-25 16:51:00 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2012-04-27 11:44:50 -0300
commitfd7f8c65377ee918479e43b38d44f54f13aa6548 (patch)
tree14676280cfffb57a80fe9bfd1058fbbb87ba9050 /block
parentbe5ea8ed4481f0ffa4ea0f7ba13e465701536001 (diff)
downloadhqemu-fd7f8c65377ee918479e43b38d44f54f13aa6548.zip
hqemu-fd7f8c65377ee918479e43b38d44f54f13aa6548.tar.gz
block: use Error mechanism instead of -errno for block_job_create()
The block job API uses -errno return values internally and we convert these to Error in the QMP functions. This is ugly because the Error should be created at the point where we still have all the relevant information. More importantly, it is hard to add new error cases to this case since we quickly run out of -errno values without losing information. Go ahead and use Error directly and don't convert later. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/stream.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/block/stream.c b/block/stream.c
index 0efe1ad..7002dc8 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -280,16 +280,16 @@ static BlockJobType stream_job_type = {
.set_speed = stream_set_speed,
};
-int stream_start(BlockDriverState *bs, BlockDriverState *base,
- const char *base_id, BlockDriverCompletionFunc *cb,
- void *opaque)
+void stream_start(BlockDriverState *bs, BlockDriverState *base,
+ const char *base_id, BlockDriverCompletionFunc *cb,
+ void *opaque, Error **errp)
{
StreamBlockJob *s;
Coroutine *co;
- s = block_job_create(&stream_job_type, bs, cb, opaque);
+ s = block_job_create(&stream_job_type, bs, cb, opaque, errp);
if (!s) {
- return -EBUSY; /* bs must already be in use */
+ return;
}
s->base = base;
@@ -300,5 +300,4 @@ int stream_start(BlockDriverState *bs, BlockDriverState *base,
co = qemu_coroutine_create(stream_run);
trace_stream_start(bs, base, s, co, opaque);
qemu_coroutine_enter(co, s);
- return 0;
}
OpenPOWER on IntegriCloud