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

@ -810,6 +810,16 @@ int block_job_complete_sync(BlockJob *job, Error **errp)
return block_job_finish_sync(job, &block_job_complete, errp);
}
void block_job_progress_update(BlockJob *job, uint64_t done)
{
job->offset += done;
}
void block_job_progress_set_remaining(BlockJob *job, uint64_t remaining)
{
job->len = job->offset + remaining;
}
BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
{
BlockJobInfo *info;