summary refs log tree commit diff stats
path: root/include/qemu
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-13 17:19:31 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:49 +0200
commita50c2ab858fe613fb805e53b4f6b970ab936706d (patch)
tree06a64966236166b648e1c5bd1f08c240b34a0c00 /include/qemu
parente7c1d78bbd5867804debeb7159b137fd9a6c44d3 (diff)
downloadfocaccia-qemu-a50c2ab858fe613fb805e53b4f6b970ab936706d.tar.gz
focaccia-qemu-a50c2ab858fe613fb805e53b4f6b970ab936706d.zip
job: Move state transitions to Job
This moves BlockJob.status and the closely related functions
(block_)job_state_transition() and (block_)job_apply_verb to Job. The
two QAPI enums are renamed to JobStatus and JobVerb.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/job.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/qemu/job.h b/include/qemu/job.h
index bae2b0920c..0b78778b9e 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
@@ -41,6 +41,9 @@ typedef struct Job {
     /** The type of this job. */
     const JobDriver *driver;
 
+    /** Current state; See @JobStatus for details. */
+    JobStatus status;
+
     /** Element of the list of jobs */
     QLIST_ENTRY(Job) job_list;
 } Job;
@@ -90,4 +93,14 @@ Job *job_next(Job *job);
  */
 Job *job_get(const char *id);
 
+/**
+ * Check whether the verb @verb can be applied to @job in its current state.
+ * Returns 0 if the verb can be applied; otherwise errp is set and -EPERM
+ * returned.
+ */
+int job_apply_verb(Job *job, JobVerb verb, Error **errp);
+
+/* TODO To be removed from the public interface */
+void job_state_transition(Job *job, JobStatus s1);
+
 #endif