aboutsummaryrefslogtreecommitdiff
path: root/include/qemu
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-23 18:04:57 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:50 +0200
commit139a9f020d49e9f863e0d46fd3d0b440dfb3b9d7 (patch)
tree2d38eb4bfd2f2f8beb1b9fdc0ea6180b06e9a092 /include/qemu
parent5d4f376998bc6b01402b90634385b082b2eb5c5b (diff)
downloadqemu-139a9f020d49e9f863e0d46fd3d0b440dfb3b9d7.zip
qemu-139a9f020d49e9f863e0d46fd3d0b440dfb3b9d7.tar.gz
qemu-139a9f020d49e9f863e0d46fd3d0b440dfb3b9d7.tar.bz2
job: Add job_event_*()
Go through the Job layer in order to send QMP events. For the moment, these functions only call a notifier in the BlockJob layer that sends the existing commands. This uses notifiers rather than JobDriver callbacks because internal users of jobs won't receive QMP events, but might still be interested in getting notified for the events. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/job.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/qemu/job.h b/include/qemu/job.h
index 9783e40..14d9377 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