mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
job: Move cancelled to Job
We cannot yet move the whole logic around job cancelling to Job because it depends on quite a few other things that are still only in BlockJob, but we can move the cancelled field at least. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
@@ -29,7 +29,7 @@ static void test_block_job_complete(BlockJob *job, void *opaque)
|
||||
BlockDriverState *bs = blk_bs(job->blk);
|
||||
int rc = (intptr_t)opaque;
|
||||
|
||||
if (block_job_is_cancelled(job)) {
|
||||
if (job_is_cancelled(&job->job)) {
|
||||
rc = -ECANCELED;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ static void coroutine_fn test_block_job_run(void *opaque)
|
||||
block_job_yield(job);
|
||||
}
|
||||
|
||||
if (block_job_is_cancelled(job)) {
|
||||
if (job_is_cancelled(&job->job)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ typedef struct {
|
||||
static void test_block_job_cb(void *opaque, int ret)
|
||||
{
|
||||
TestBlockJobCBData *data = opaque;
|
||||
if (!ret && block_job_is_cancelled(&data->job->common)) {
|
||||
if (!ret && job_is_cancelled(&data->job->common.job)) {
|
||||
ret = -ECANCELED;
|
||||
}
|
||||
*data->result = ret;
|
||||
|
||||
@@ -179,7 +179,7 @@ static void coroutine_fn cancel_job_start(void *opaque)
|
||||
CancelJob *s = opaque;
|
||||
|
||||
while (!s->should_complete) {
|
||||
if (block_job_is_cancelled(&s->common)) {
|
||||
if (job_is_cancelled(&s->common.job)) {
|
||||
goto defer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user