aboutsummaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-19 13:04:01 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:50 +0200
commitdbe5e6c1f73b41282624b78a2375a5c3ee59e905 (patch)
treeec2cad34f5b7d8a067166b251ab7743c86a595a1 /job.c
parentb15de82867975e0b4acf644b5ee36d84904b6612 (diff)
job: Replace BlockJob.completed with job_is_completed()
Since we introduced an explicit status to block job, BlockJob.completed is redundant because it can be derived from the status. Remove the field from BlockJob and add a function to derive it from the status at the Job level. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'job.c')
-rw-r--r--job.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/job.c b/job.c
index fd10b1d267..aaacfcc93f 100644
--- a/job.c
+++ b/job.c
@@ -121,6 +121,28 @@ bool job_is_cancelled(Job *job)
return job->cancelled;
}
+bool job_is_completed(Job *job)
+{
+ switch (job->status) {
+ case JOB_STATUS_UNDEFINED:
+ case JOB_STATUS_CREATED:
+ case JOB_STATUS_RUNNING:
+ case JOB_STATUS_PAUSED:
+ case JOB_STATUS_READY:
+ case JOB_STATUS_STANDBY:
+ return false;
+ case JOB_STATUS_WAITING:
+ case JOB_STATUS_PENDING:
+ case JOB_STATUS_ABORTING:
+ case JOB_STATUS_CONCLUDED:
+ case JOB_STATUS_NULL:
+ return true;
+ default:
+ g_assert_not_reached();
+ }
+ return false;
+}
+
bool job_started(Job *job)
{
return job->co;