aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/job.h
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2022-03-03 10:16:15 -0500
committerKevin Wolf <kwolf@redhat.com>2022-03-04 18:18:26 +0100
commit32498092c486531b9e46a7c13912ce403858c96a (patch)
treef5d0c96ee22e410db2a5104b39df837406803c1d /include/qemu/job.h
parentdc2b15ba086bfe7c9ae67d5c40b72f39d31b59de (diff)
downloadqemu-32498092c486531b9e46a7c13912ce403858c96a.zip
qemu-32498092c486531b9e46a7c13912ce403858c96a.tar.gz
qemu-32498092c486531b9e46a7c13912ce403858c96a.tar.bz2
job.h: split function pointers in JobDriver
The job API will be handled separately in another serie. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20220303151616.325444-31-eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/qemu/job.h')
-rw-r--r--include/qemu/job.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/qemu/job.h b/include/qemu/job.h
index 6e67b69..c105b31 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
@@ -169,6 +169,12 @@ typedef struct Job {
* Callbacks and other information about a Job driver.
*/
struct JobDriver {
+
+ /*
+ * These fields are initialized when this object is created,
+ * and are never changed afterwards
+ */
+
/** Derived Job struct size */
size_t instance_size;
@@ -184,9 +190,18 @@ struct JobDriver {
* aborted. If it returns zero, the job moves into the WAITING state. If it
* is the last job to complete in its transaction, all jobs in the
* transaction move from WAITING to PENDING.
+ *
+ * This callback must be run in the job's context.
*/
int coroutine_fn (*run)(Job *job, Error **errp);
+ /*
+ * Functions run without regard to the BQL that may run in any
+ * arbitrary thread. These functions do not need to be thread-safe
+ * because the caller ensures that they are invoked from one
+ * thread at time.
+ */
+
/**
* If the callback is not NULL, it will be invoked when the job transitions
* into the paused state. Paused jobs must not perform any asynchronous
@@ -201,6 +216,13 @@ struct JobDriver {
*/
void coroutine_fn (*resume)(Job *job);
+ /*
+ * Global state (GS) API. These functions run under the BQL.
+ *
+ * See include/block/block-global-state.h for more information about
+ * the GS API.
+ */
+
/**
* Called when the job is resumed by the user (i.e. user_paused becomes
* false). .user_resume is called before .resume.