mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
e7c1d78bbd
commit
a50c2ab858
8 changed files with 123 additions and 112 deletions
|
@ -147,9 +147,6 @@ typedef struct BlockJob {
|
|||
*/
|
||||
QEMUTimer sleep_timer;
|
||||
|
||||
/** Current state; See @BlockJobStatus for details. */
|
||||
BlockJobStatus status;
|
||||
|
||||
/** True if this job should automatically finalize itself */
|
||||
bool auto_finalize;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue