blob: 29346204f808a7a4927bf78f9911b6a32b77a16b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*-*- 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
};
|