From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfY7Q-0004Ik-JZ for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:07:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfY7G-00054x-KO for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:07:24 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:47190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfY7G-0004gs-9q for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:07:14 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so5648793pbb.4 for ; Fri, 15 Jun 2012 08:07:13 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 15 Jun 2012 17:05:42 +0200 Message-Id: <1339772759-31004-20-git-send-email-pbonzini@redhat.com> In-Reply-To: <1339772759-31004-1-git-send-email-pbonzini@redhat.com> References: <1339772759-31004-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [RFC PATCH 19/36] block: add target info to QMP query-blockjobs command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com, lcapitulino@redhat.com Signed-off-by: Paolo Bonzini --- 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