@@ -349,6 +349,7 @@ BlockJobInfo *block_job_query_locked(BlockJob *job, Error **errp)
{
BlockJobInfo *info;
uint64_t progress_current, progress_total;
+ const BlockJobDriver *drv = block_job_driver(job);
GLOBAL_STATE_CODE();
@@ -378,6 +379,9 @@ BlockJobInfo *block_job_query_locked(BlockJob *job, Error **errp)
g_strdup(error_get_pretty(job->job.err)) :
g_strdup(strerror(-job->job.ret));
}
+ if (drv->query) {
+ drv->query(job, info);
+ }
return info;
}
@@ -72,6 +72,11 @@ struct BlockJobDriver {
* Change the @job's options according to @opts.
*/
void (*change)(BlockJob *job, BlockJobChangeOptions *opts, Error **errp);
+
+ /*
+ * Query information specific to this kind of block job.
+ */
+ void (*query)(BlockJob *job, BlockJobInfo *info);
};
/*
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> --- blockjob.c | 4 ++++ include/block/blockjob_int.h | 5 +++++ 2 files changed, 9 insertions(+)