On 05/18/2018 08:20 AM, Kevin Wolf wrote:
This moves the finalisation of a single job from BlockJob to Job.

Some part of this code depends on job transactions, and job transactions
call this code, we introduce some temporary calls from Job functions to
BlockJob ones. This will be fixed once transactions move to Job, too.

Signed-off-by: Kevin Wolf <kw...@redhat.com>
Reviewed-by: Max Reitz <mre...@redhat.com>
---

+++ b/job.c

@@ -449,6 +451,100 @@ void job_user_resume(Job *job, Error **errp)
      job_resume(job);
  }
+void job_do_dismiss(Job *job)
+{
+    assert(job);
+    job->busy = false;
+    job->paused = false;
+    job->deferred_to_main_loop = true;
+
+    /* TODO Don't assume it's a BlockJob */
+    block_job_txn_del_job((BlockJob*) job);

checkpatch flagged this for style, but it goes away later in the series. But more than just style, this hard-codes the assumption that BlockJob has a Job member at offset 0. So would it be better to use container_of() instead of a bare cast, even though it is transient?

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to