mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-24 10:52:50 +07:00
31 lines
661 B
C
31 lines
661 B
C
/*-*- Mode: C; c-basic-offset: 8 -*-*/
|
|
|
|
#include "unit.h"
|
|
#include "timer.h"
|
|
|
|
static void timer_done(Unit *u) {
|
|
Timer *t = TIMER(u);
|
|
|
|
assert(t);
|
|
}
|
|
|
|
static UnitActiveState timer_active_state(Unit *u) {
|
|
|
|
static const UnitActiveState table[_TIMER_STATE_MAX] = {
|
|
[TIMER_DEAD] = UNIT_INACTIVE,
|
|
[TIMER_WAITING] = UNIT_ACTIVE,
|
|
[TIMER_RUNNING] = UNIT_ACTIVE
|
|
};
|
|
|
|
return table[TIMER(u)->state];
|
|
}
|
|
|
|
const UnitVTable timer_vtable = {
|
|
.suffix = ".timer",
|
|
|
|
.init = unit_load_fragment_and_dropin,
|
|
.done = timer_done,
|
|
|
|
.active_state = timer_active_state
|
|
};
|