aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/block/blockjob.h3
-rw-r--r--include/qemu/job.h19
2 files changed, 19 insertions, 3 deletions
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 640e649034..10bd9f7059 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -105,9 +105,6 @@ typedef struct BlockJob {
*/
bool deferred_to_main_loop;
- /** Element of the list of block jobs */
- QLIST_ENTRY(BlockJob) job_list;
-
/** Status that is published by the query-block-jobs QMP API */
BlockDeviceIoStatus iostatus;
diff --git a/include/qemu/job.h b/include/qemu/job.h
index 43dc2e4a7d..bae2b0920c 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
@@ -27,6 +27,7 @@
#define JOB_H
#include "qapi/qapi-types-block-core.h"
+#include "qemu/queue.h"
typedef struct JobDriver JobDriver;
@@ -39,6 +40,9 @@ typedef struct Job {
/** The type of this job. */
const JobDriver *driver;
+
+ /** Element of the list of jobs */
+ QLIST_ENTRY(Job) job_list;
} Job;
/**
@@ -71,4 +75,19 @@ JobType job_type(const Job *job);
/** Returns the enum string for the JobType of a given Job. */
const char *job_type_str(const Job *job);
+/**
+ * Get the next element from the list of block jobs after @job, or the
+ * first one if @job is %NULL.
+ *
+ * Returns the requested job, or %NULL if there are no more jobs left.
+ */
+Job *job_next(Job *job);
+
+/**
+ * Get the job identified by @id (which must not be %NULL).
+ *
+ * Returns the requested job, or %NULL if it doesn't exist.
+ */
+Job *job_get(const char *id);
+
#endif