From 05df8a6a2b4e36e8d69de2130e616d5ac28e8837 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 18 Jan 2018 18:08:22 +0100 Subject: 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 Reviewed-by: Eric Blake Reviewed-by: Max Reitz Reviewed-by: John Snow --- include/block/blockjob.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/block/blockjob.h b/include/block/blockjob.h index fc645da..a2cc522 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -278,6 +278,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. * -- cgit v1.1