]>
Commit | Line | Data |
---|---|---|
5cb5a6ff LP |
1 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ |
2 | ||
3 | #include "name.h" | |
4 | #include "timer.h" | |
5 | ||
034c6ed7 LP |
6 | static void timer_done(Name *n) { |
7 | Timer *t = TIMER(n); | |
8 | ||
9 | assert(t); | |
10 | } | |
11 | ||
5cb5a6ff LP |
12 | static NameActiveState timer_active_state(Name *n) { |
13 | ||
14 | static const NameActiveState table[_TIMER_STATE_MAX] = { | |
15 | [TIMER_DEAD] = NAME_INACTIVE, | |
16 | [TIMER_WAITING] = NAME_ACTIVE, | |
17 | [TIMER_RUNNING] = NAME_ACTIVE | |
18 | }; | |
19 | ||
20 | return table[TIMER(n)->state]; | |
21 | } | |
22 | ||
5cb5a6ff LP |
23 | const NameVTable timer_vtable = { |
24 | .suffix = ".timer", | |
25 | ||
034c6ed7 LP |
26 | .init = name_load_fragment_and_dropin, |
27 | .done = timer_done, | |
5cb5a6ff | 28 | |
034c6ed7 | 29 | .active_state = timer_active_state |
5cb5a6ff | 30 | }; |