They are set when block_job_completed is called.

Signed-off-by: Fam Zheng <f...@redhat.com>
Reviewed-by: John Snow <js...@redhat.com>
Reviewed-by: Max Reitz <mre...@redhat.com>
---
 blockjob.c               | 3 +++
 include/block/blockjob.h | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/blockjob.c b/blockjob.c
index ec12887..293b62a 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -95,6 +95,9 @@ void block_job_completed(BlockJob *job, int ret)
     BlockDriverState *bs = job->bs;
 
     assert(bs->job == job);
+    assert(!job->completed);
+    job->completed = true;
+    job->ret = ret;
     job->cb(job->opaque, ret);
     block_job_unref(job);
 }
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index aee39a4..a77799f 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -145,6 +145,15 @@ struct BlockJob {
 
     /** Reference count of the block job */
     int refcnt;
+
+    /* True if this job has reported completion by calling block_job_completed.
+     */
+    bool completed;
+
+    /* ret code passed to block_job_completed.
+     */
+    int ret;
+
 };
 
 /**
-- 
2.4.3


Reply via email to