From b69f777dd9ba992fdd35828a90eefcd88c0ec332 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 20 Apr 2018 17:00:29 +0200 Subject: job: Add job_drain() block_job_drain() contains a blk_drain() call which cannot be moved to Job, so add a new JobDriver callback JobDriver.drain which has a common implementation for all BlockJobs. In addition to this we keep the existing BlockJobDriver.drain callback that is called by the common drain implementation for all block jobs. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- include/block/blockjob_int.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/block/blockjob_int.h') diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h index bf2b762808..38fe22d7e0 100644 --- a/include/block/blockjob_int.h +++ b/include/block/blockjob_int.h @@ -65,6 +65,10 @@ struct BlockJobDriver { * If the callback is not NULL, it will be invoked when the job has to be * synchronously cancelled or completed; it should drain BlockDriverStates * as required to ensure progress. + * + * Block jobs must use the default implementation for job_driver.drain, + * which will in turn call this callback after doing generic block job + * stuff. */ void (*drain)(BlockJob *job); }; @@ -111,6 +115,14 @@ void block_job_free(Job *job); */ void block_job_user_resume(Job *job); +/** + * block_job_drain: + * Callback to be used for JobDriver.drain in all block jobs. Drains the main + * block node associated with the block jobs and calls BlockJobDriver.drain for + * job-specific actions. + */ +void block_job_drain(Job *job); + /** * block_job_yield: * @job: The job that calls the function. -- cgit v1.2.3