Skip to content

Commit

Permalink
blockjob: Add "completed" and "ret" in BlockJob
Browse files Browse the repository at this point in the history
They are set when block_job_completed is called.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: John Snow <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
  • Loading branch information
Fam Zheng authored and kevmw committed Nov 12, 2015
1 parent 57901ec commit a689dbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions blockjob.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,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);
}
Expand Down
9 changes: 9 additions & 0 deletions include/block/blockjob.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,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;

};

/**
Expand Down

0 comments on commit a689dbf

Please sign in to comment.