diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-04-25 14:56:09 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-05-23 14:30:51 +0200 |
commit | 2e1795b58131427719c7cd11f8b9b6984b3f24f8 (patch) | |
tree | d9e0c9842af8c71f9aa40c56599c880a88ca7535 /include | |
parent | df956ae2014340bf7de0190edb1d09be55d9eadf (diff) |
job: Add job_transition_to_ready()
The transition to the READY state was still performed in the BlockJob
layer, in the same function that sent the BLOCK_JOB_READY QMP event.
This patch brings the state transition to the Job layer and implements
the QMP event using a notifier called from the Job layer, like we
already do for other events related to state transitions.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/block/blockjob.h | 3 | ||||
-rw-r--r-- | include/block/blockjob_int.h | 8 | ||||
-rw-r--r-- | include/qemu/job.h | 9 |
3 files changed, 9 insertions, 11 deletions
diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 8e1e1ee0de..4fca45f6a1 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -76,6 +76,9 @@ typedef struct BlockJob { /** Called when the job transitions to PENDING */ Notifier pending_notifier; + /** Called when the job transitions to READY */ + Notifier ready_notifier; + /** BlockDriverStates that are involved in this block job */ GSList *nodes; } BlockJob; diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h index 806ac64d87..5cd50c6639 100644 --- a/include/block/blockjob_int.h +++ b/include/block/blockjob_int.h @@ -116,14 +116,6 @@ void block_job_drain(Job *job); int64_t block_job_ratelimit_get_delay(BlockJob *job, uint64_t n); /** - * block_job_event_ready: - * @job: The job which is now ready to be completed. - * - * Send a BLOCK_JOB_READY event for the specified job. - */ -void block_job_event_ready(BlockJob *job); - -/** * block_job_error_action: * @job: The job to signal an error for. * @on_err: The error action setting. diff --git a/include/qemu/job.h b/include/qemu/job.h index 487f9d9a32..bfc2bc5611 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -132,6 +132,9 @@ typedef struct Job { /** Notifiers called when the job transitions to PENDING */ NotifierList on_pending; + /** Notifiers called when the job transitions to READY */ + NotifierList on_ready; + /** Element of the list of jobs */ QLIST_ENTRY(Job) job_list; @@ -426,6 +429,9 @@ int job_apply_verb(Job *job, JobVerb verb, Error **errp); /** The @job could not be started, free it. */ void job_early_fail(Job *job); +/** Moves the @job from RUNNING to READY */ +void job_transition_to_ready(Job *job); + /** * @job: The job being completed. * @ret: The status code. @@ -522,7 +528,4 @@ void job_defer_to_main_loop(Job *job, JobDeferToMainLoopFn *fn, void *opaque); */ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp); -/* TODO To be removed from the public interface */ -void job_state_transition(Job *job, JobStatus s1); - #endif |