diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2012-04-25 16:51:00 +0100 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-04-27 11:44:50 -0300 |
commit | fd7f8c65377ee918479e43b38d44f54f13aa6548 (patch) | |
tree | 14676280cfffb57a80fe9bfd1058fbbb87ba9050 /block.c | |
parent | be5ea8ed4481f0ffa4ea0f7ba13e465701536001 (diff) |
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.c')
-rw-r--r-- | block.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -4083,11 +4083,13 @@ out: } void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) + BlockDriverCompletionFunc *cb, void *opaque, + Error **errp) { BlockJob *job; if (bs->job || bdrv_in_use(bs)) { + error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs)); return NULL; } bdrv_set_in_use(bs, 1); |