aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-01-18 18:08:22 +0100
committerKevin Wolf <kwolf@redhat.com>2018-05-15 16:11:49 +0200
commit05df8a6a2b4e36e8d69de2130e616d5ac28e8837 (patch)
tree69a1ee332e3b77767f2df4ced3066b08e9baae7b /blockjob.c
parent37aa19b63c46d933f1e4ea944cfccee54e2caf4a (diff)
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>
Diffstat (limited to 'blockjob.c')
-rw-r--r--blockjob.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/blockjob.c b/blockjob.c
index 0ebc5ab178..ebc26a5245 100644
--- a/blockjob.c
+++ b/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;