diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/block/blockjob.h | 9 | ||||
-rw-r--r-- | include/qemu/job.h | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/block/blockjob.h b/include/block/blockjob.h index f9aaaaa835..aef06295f6 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -82,6 +82,15 @@ typedef struct BlockJob { /** Block other operations when block job is running */ Error *blocker; + /** Called when a cancelled job is finalised. */ + Notifier finalize_cancelled_notifier; + + /** Called when a successfully completed job is finalised. */ + Notifier finalize_completed_notifier; + + /** Called when the job transitions to PENDING */ + Notifier pending_notifier; + /** BlockDriverStates that are involved in this block job */ GSList *nodes; diff --git a/include/qemu/job.h b/include/qemu/job.h index 9783e4049b..14d93778f3 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -105,6 +105,15 @@ typedef struct Job { /** True if this job should automatically dismiss itself */ bool auto_dismiss; + /** Notifiers called when a cancelled job is finalised */ + NotifierList on_finalize_cancelled; + + /** Notifiers called when a successfully completed job is finalised */ + NotifierList on_finalize_completed; + + /** Notifiers called when the job transitions to PENDING */ + NotifierList on_pending; + /** Element of the list of jobs */ QLIST_ENTRY(Job) job_list; } Job; @@ -182,6 +191,15 @@ void job_ref(Job *job); */ void job_unref(Job *job); +/** To be called when a cancelled job is finalised. */ +void job_event_cancelled(Job *job); + +/** To be called when a successfully completed job is finalised. */ +void job_event_completed(Job *job); + +/** To be called when the job transitions to PENDING */ +void job_event_pending(Job *job); + /** * Conditionally enter the job coroutine if the job is ready to run, not * already busy and fn() returns true. fn() is called while under the job_lock |