Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- blockjob.c | 3 +++ blockjob.h | 6 ++++++ qapi-schema.json | 21 ++++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/blockjob.c b/blockjob.c index 562e0b5..651ee8d 100644 --- a/blockjob.c +++ b/blockjob.c @@ -197,6 +197,9 @@ BlockJobInfo *block_job_query(BlockJob *job) info->offset = job->offset; info->speed = job->speed; info->io_status = job->iostatus; + if (job->job_type->query) { + job->job_type->query(job, info); + } return info; } diff --git a/blockjob.h b/blockjob.h index 8f0b93b..6dec489 100644 --- a/blockjob.h +++ b/blockjob.h @@ -43,6 +43,12 @@ typedef struct BlockJobType { /** Optional callback for job types that support setting a speed limit */ void (*set_speed)(BlockJob *job, int64_t speed, Error **errp); + + /** + * Optional callback for job types that can fill the target member + * of BlockJobInfo. + */ + void (*query)(BlockJob *job, BlockJobInfo *info); } BlockJobType; /** diff --git a/qapi-schema.json b/qapi-schema.json index 93205af..4524c54 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -920,6 +920,21 @@ 'data': ['report', 'ignore', 'enospc', 'stop'] } ## +# @BlockJobTargetInfo: +# +# Information about the target device for a long-running block device +# operation. +# +# @info: information on the target device +# +# @stats: statistics about a target device +# +# Since: 1.2 +## +{ 'type': 'BlockJobTargetInfo', + 'data': {'info': 'BlockInfo', 'stats': 'BlockStats'} } + +## # @BlockJobInfo: # # Information about a long-running block device operation. @@ -938,12 +953,16 @@ # # @io-status: the status of the job # +# @target: the target device, if applicable to this particular type of +# job. +# # Since: 1.1 ## { 'type': 'BlockJobInfo', 'data': {'type': 'str', 'device': 'str', 'len': 'int', 'offset': 'int', 'paused': 'bool', 'speed': 'int', - 'io-status': 'BlockDeviceIoStatus'} } + 'io-status': 'BlockDeviceIoStatus', + '*target': 'BlockJobTargetInfo'} } ## # @query-block-jobs: -- 1.7.10.2