diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-06 02:39:16 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-06 02:39:16 +0200 |
commit | 593fbdd21e52c8c0ac249c5b6163761005af8463 (patch) | |
tree | a1e3612fc7df9f5d392918db048473a479ed2617 /job.c | |
parent | 101d8e630eab1281a0e126a78433cf6d5bed4cb4 (diff) |
job: define job_type_is_redundant() to idenity unnecessary jobs
Diffstat (limited to 'job.c')
-rw-r--r-- | job.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -265,6 +265,45 @@ bool job_type_is_conflicting(JobType a, JobType b) { return (a == JOB_STOP) != (b == JOB_STOP); } +bool job_type_is_redundant(JobType a, UnitActiveState b) { + switch (a) { + + case JOB_START: + return + b == UNIT_ACTIVE || + b == UNIT_ACTIVE_RELOADING; + + case JOB_STOP: + return + b == UNIT_INACTIVE; + + case JOB_VERIFY_ACTIVE: + return + b == UNIT_ACTIVE || + b == UNIT_ACTIVE_RELOADING; + + case JOB_RELOAD: + return + b == UNIT_ACTIVE_RELOADING; + + case JOB_RELOAD_OR_START: + return + b == UNIT_ACTIVATING || + b == UNIT_ACTIVE_RELOADING; + + case JOB_RESTART: + return + b == UNIT_ACTIVATING; + + case JOB_TRY_RESTART: + return + b == UNIT_ACTIVATING; + + default: + assert_not_reached("Invalid job type"); + } +} + bool job_is_runnable(Job *j) { Iterator i; Unit *other; |