From daa7f2f9467bc5624f04f28d4b01b88f08c6589c Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 17 Apr 2018 12:56:07 +0200 Subject: job: Move cancelled to Job We cannot yet move the whole logic around job cancelling to Job because it depends on quite a few other things that are still only in BlockJob, but we can move the cancelled field at least. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: John Snow --- include/block/blockjob.h | 8 -------- include/block/blockjob_int.h | 8 -------- include/qemu/job.h | 11 +++++++++++ 3 files changed, 11 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 087e7820f5..1e708f468a 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -56,14 +56,6 @@ typedef struct BlockJob { */ Coroutine *co; - /** - * Set to true if the job should cancel itself. The flag must - * always be tested just before toggling the busy flag from false - * to true. After a job has been cancelled, it should only yield - * if #aio_poll will ("sooner or later") reenter the coroutine. - */ - bool cancelled; - /** * Set to true if the job should abort immediately without waiting * for data to be in sync. diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h index 6f0fe3c48d..d64f30e6b0 100644 --- a/include/block/blockjob_int.h +++ b/include/block/blockjob_int.h @@ -195,14 +195,6 @@ void block_job_early_fail(BlockJob *job); */ void block_job_completed(BlockJob *job, int ret); -/** - * block_job_is_cancelled: - * @job: The job being queried. - * - * Returns whether the job is scheduled for cancellation. - */ -bool block_job_is_cancelled(BlockJob *job); - /** * block_job_pause_point: * @job: The job that is ready to pause. diff --git a/include/qemu/job.h b/include/qemu/job.h index 0751e2afab..5dfbec5d69 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -47,6 +47,14 @@ typedef struct Job { /** Current state; See @JobStatus for details. */ JobStatus status; + /** + * Set to true if the job should cancel itself. The flag must + * always be tested just before toggling the busy flag from false + * to true. After a job has been cancelled, it should only yield + * if #aio_poll will ("sooner or later") reenter the coroutine. + */ + bool cancelled; + /** Element of the list of jobs */ QLIST_ENTRY(Job) job_list; } Job; @@ -93,6 +101,9 @@ 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); +/** Returns whether the job is scheduled for cancellation. */ +bool job_is_cancelled(Job *job); + /** * Get the next element from the list of block jobs after @job, or the * first one if @job is %NULL. -- cgit 1.4.1