qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 32/33] crypto: delegate permission functions to JobDriver


From: Paolo Bonzini
Subject: Re: [PATCH v6 32/33] crypto: delegate permission functions to JobDriver .pre_run
Date: Mon, 24 Jan 2022 15:41:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

On 1/21/22 18:05, Emanuele Giuseppe Esposito wrote:
diff --git a/job.c b/job.c
index 39bf511949..cf0dc9325a 100644
--- a/job.c
+++ b/job.c
@@ -967,11 +967,24 @@ static void coroutine_fn job_co_entry(void *opaque)
      aio_bh_schedule_oneshot(qemu_get_aio_context(), job_exit, job);
  }
+static int job_pre_run(Job *job)
+{
+    assert(qemu_in_main_thread());
+    if (job->driver->pre_run) {
+        return job->driver->pre_run(job, &job->err);
+    }
+
+    return 0;
+}
+
  void job_start(Job *job)
  {
      assert(job && !job_started(job) && job->paused &&
             job->driver && job->driver->run);
      job->co = qemu_coroutine_create(job_co_entry, job);
+    if (job_pre_run(job)) {
+        return;
+    }
      job->pause_count--;
      job->busy = true;
      job->paused = false;
-- 2.31.1

This should have been in patch 31. Might not need a respin, unless someone wants to have these three patches reorganized(*), still worth pointing out.

Paolo

(*) for example I would have done:
- first job->pre_run()
- then blockdev_amend_pre_run/blockdev_amend_clean and block_crypto_amend_pre_run/clean together



reply via email to

[Prev in Thread] Current Thread [Next in Thread]