aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-23 12:24:16 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:50 +0200
commit3453d97243c72988c89a0105fa9546890eae7bd4 (patch)
treeb1319fc9423528d2bcb84e8378e877f25e6bd248 /tests
parentb69f777dd9ba992fdd35828a90eefcd88c0ec332 (diff)
downloadqemu-3453d97243c72988c89a0105fa9546890eae7bd4.zip
qemu-3453d97243c72988c89a0105fa9546890eae7bd4.tar.gz
qemu-3453d97243c72988c89a0105fa9546890eae7bd4.tar.bz2
job: Move .complete callback to Job
This moves the .complete callback that tells a READY job to complete from BlockJobDriver to JobDriver. The wrapper function job_complete() doesn't require anything block job specific any more and can be moved to Job. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-bdrv-drain.c6
-rw-r--r--tests/test-blockjob.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index 58ea566..b428aac 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -514,9 +514,9 @@ static void coroutine_fn test_job_start(void *opaque)
job_defer_to_main_loop(&s->common.job, test_job_completed, NULL);
}
-static void test_job_complete(BlockJob *job, Error **errp)
+static void test_job_complete(Job *job, Error **errp)
{
- TestBlockJob *s = container_of(job, TestBlockJob, common);
+ TestBlockJob *s = container_of(job, TestBlockJob, common.job);
s->should_complete = true;
}
@@ -527,8 +527,8 @@ BlockJobDriver test_job_driver = {
.user_resume = block_job_user_resume,
.drain = block_job_drain,
.start = test_job_start,
+ .complete = test_job_complete,
},
- .complete = test_job_complete,
};
static void test_blockjob_common(enum drain_type drain_type)
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
index 592a136..e44c608 100644
--- a/tests/test-blockjob.c
+++ b/tests/test-blockjob.c
@@ -171,9 +171,9 @@ static void cancel_job_completed(Job *job, void *opaque)
block_job_completed(bjob, 0);
}
-static void cancel_job_complete(BlockJob *job, Error **errp)
+static void cancel_job_complete(Job *job, Error **errp)
{
- CancelJob *s = container_of(job, CancelJob, common);
+ CancelJob *s = container_of(job, CancelJob, common.job);
s->should_complete = true;
}
@@ -204,8 +204,8 @@ static const BlockJobDriver test_cancel_driver = {
.user_resume = block_job_user_resume,
.drain = block_job_drain,
.start = cancel_job_start,
+ .complete = cancel_job_complete,
},
- .complete = cancel_job_complete,
};
static CancelJob *create_common(BlockJob **pjob)
@@ -333,7 +333,7 @@ static void test_cancel_pending(void)
block_job_enter(job);
assert(job->job.status == JOB_STATUS_READY);
- block_job_complete(job, &error_abort);
+ job_complete(&job->job, &error_abort);
block_job_enter(job);
while (!s->completed) {
aio_poll(qemu_get_aio_context(), true);
@@ -357,7 +357,7 @@ static void test_cancel_concluded(void)
block_job_enter(job);
assert(job->job.status == JOB_STATUS_READY);
- block_job_complete(job, &error_abort);
+ job_complete(&job->job, &error_abort);
block_job_enter(job);
while (!s->completed) {
aio_poll(qemu_get_aio_context(), true);