blockjob: Wrappers for progress counter access

Block job drivers are not expected to mess with the internals of the
BlockJob object, so provide wrapper functions for one of the cases where
they still do it: Updating the progress counter.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Kevin Wolf 2018-01-18 18:08:22 +01:00
parent 37aa19b63c
commit 05df8a6a2b
6 changed files with 63 additions and 29 deletions

View file

@ -277,6 +277,25 @@ void block_job_finalize(BlockJob *job, Error **errp);
*/
void block_job_dismiss(BlockJob **job, Error **errp);
/**
* block_job_progress_update:
* @job: The job that has made progress
* @done: How much progress the job made
*
* Updates the progress counter of the job.
*/
void block_job_progress_update(BlockJob *job, uint64_t done);
/**
* block_job_progress_set_remaining:
* @job: The job whose expected progress end value is set
* @remaining: Expected end value of the progress counter of the job
*
* Sets the expected end value of the progress counter of a job so that a
* completion percentage can be calculated when the progress is updated.
*/
void block_job_progress_set_remaining(BlockJob *job, uint64_t remaining);
/**
* block_job_query:
* @job: The job to get information about.