diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-09-28 17:22:48 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-09-28 19:14:32 +0200 |
commit | 30e628b709fcd30db298878e435e3bc93919c48c (patch) | |
tree | 1d9bcf6a53e2d17de6d8dc659ac68d2a2b78cfc2 /blockdev.c | |
parent | 2f0c9fe64c6a2887047b7eab05cd85b2643234c8 (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 'blockdev.c')
-rw-r--r-- | blockdev.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/blockdev.c b/blockdev.c index d3f91c0aea..9a98ce9c89 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1232,19 +1232,8 @@ static void do_qmp_query_block_jobs_one(void *opaque, BlockDriverState *bs) BlockJob *job = bs->job; if (job) { - BlockJobInfoList *elem; - BlockJobInfo *info = g_new(BlockJobInfo, 1); - *info = (BlockJobInfo){ - .type = g_strdup(job->job_type->job_type), - .device = g_strdup(bdrv_get_device_name(bs)), - .len = job->len, - .offset = job->offset, - .speed = job->speed, - }; - - elem = g_new0(BlockJobInfoList, 1); - elem->value = info; - + BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1); + elem->value = block_job_query(bs->job); (*prev)->next = elem; *prev = elem; } |