aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-09-28 17:22:48 +0200
committerKevin Wolf <kwolf@redhat.com>2012-09-28 19:14:32 +0200
commit30e628b709fcd30db298878e435e3bc93919c48c (patch)
tree1d9bcf6a53e2d17de6d8dc659ac68d2a2b78cfc2 /blockjob.c
parent2f0c9fe64c6a2887047b7eab05cd85b2643234c8 (diff)
block: add block_job_query
Extract it out of the implementation of info block-jobs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockjob.c')
-rw-r--r--blockjob.c11
1 files changed, 11 insertions, 0 deletions
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;
+}