From 30e628b709fcd30db298878e435e3bc93919c48c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 28 Sep 2012 17:22:48 +0200 Subject: block: add block_job_query Extract it out of the implementation of info block-jobs. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- blockjob.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'blockjob.c') diff --git a/blockjob.c b/blockjob.c index 9737a43b27..dea63f8c1f 100644 --- a/blockjob.c +++ b/blockjob.c @@ -161,3 +161,14 @@ void block_job_sleep_ns(BlockJob *job, QEMUClock *clock, int64_t ns) job->busy = true; } } + +BlockJobInfo *block_job_query(BlockJob *job) +{ + BlockJobInfo *info = g_new0(BlockJobInfo, 1); + info->type = g_strdup(job->job_type->job_type); + info->device = g_strdup(bdrv_get_device_name(job->bs)); + info->len = job->len; + info->offset = job->offset; + info->speed = job->speed; + return info; +} -- cgit v1.2.3