[TIMER_WAITING] = UNIT_ACTIVE,
[TIMER_RUNNING] = UNIT_ACTIVE,
[TIMER_ELAPSED] = UNIT_ACTIVE,
- [TIMER_MAINTAINANCE] = UNIT_INACTIVE
+ [TIMER_MAINTENANCE] = UNIT_MAINTENANCE
};
static void timer_init(Unit *u) {
static int timer_verify(Timer *t) {
assert(t);
- if (UNIT(t)->meta.load_state != UNIT_LOADED)
+ if (t->meta.load_state != UNIT_LOADED)
return 0;
if (!t->values) {
if (!success)
t->failure = true;
- timer_set_state(t, t->failure ? TIMER_MAINTAINANCE : TIMER_DEAD);
+ timer_set_state(t, t->failure ? TIMER_MAINTENANCE : TIMER_DEAD);
}
static void timer_enter_waiting(Timer *t, bool initial) {
int r;
assert(t);
- if ((r = manager_add_job(UNIT(t)->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, NULL)) < 0)
+ if ((r = manager_add_job(t->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, NULL)) < 0)
goto fail;
timer_set_state(t, TIMER_RUNNING);
Timer *t = TIMER(u);
assert(t);
- assert(t->state == TIMER_DEAD || t->state == TIMER_MAINTAINANCE);
+ assert(t->state == TIMER_DEAD || t->state == TIMER_MAINTENANCE);
if (t->unit->meta.load_state != UNIT_LOADED)
return -ENOENT;
case TIMER_RUNNING:
- if (new_state == UNIT_INACTIVE) {
+ if (UNIT_IS_INACTIVE_OR_MAINTENANCE(new_state)) {
log_debug("%s got notified about unit deactivation.", t->meta.id);
timer_enter_waiting(t, false);
}
break;
case TIMER_DEAD:
- case TIMER_MAINTAINANCE:
+ case TIMER_MAINTENANCE:
;
default:
[TIMER_WAITING] = "waiting",
[TIMER_RUNNING] = "running",
[TIMER_ELAPSED] = "elapsed",
- [TIMER_MAINTAINANCE] = "maintainance"
+ [TIMER_MAINTENANCE] = "maintenance"
};
DEFINE_STRING_TABLE_LOOKUP(timer_state, TimerState);