mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
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:
parent
37aa19b63c
commit
05df8a6a2b
6 changed files with 63 additions and 29 deletions
10
blockjob.c
10
blockjob.c
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue