aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
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 /blockjob.c
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 'blockjob.c')
-rw-r--r--blockjob.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/blockjob.c b/blockjob.c
index 63e1669..0ca7672 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -481,24 +481,6 @@ int64_t block_job_ratelimit_get_delay(BlockJob *job, uint64_t n)
return ratelimit_calculate_delay(&job->limit, n);
}
-void block_job_complete(BlockJob *job, Error **errp)
-{
- /* Should not be reachable via external interface for internal jobs */
- assert(job->job.id);
- if (job_apply_verb(&job->job, JOB_VERB_COMPLETE, errp)) {
- return;
- }
- if (job->job.pause_count || job_is_cancelled(&job->job) ||
- !job->driver->complete)
- {
- error_setg(errp, "The active block job '%s' cannot be completed",
- job->job.id);
- return;
- }
-
- job->driver->complete(job, errp);
-}
-
void block_job_finalize(BlockJob *job, Error **errp)
{
assert(job && job->job.id);
@@ -571,6 +553,11 @@ void block_job_cancel_sync_all(void)
}
}
+static void block_job_complete(BlockJob *job, Error **errp)
+{
+ job_complete(&job->job, errp);
+}
+
int block_job_complete_sync(BlockJob *job, Error **errp)
{
return block_job_finish_sync(job, &block_job_complete, errp);