chiark / gitweb /
first attempt at proper service/socket logic
[elogind.git] / timer.c
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 #include "name.h"
4 #include "timer.h"
5
6 static void timer_done(Name *n) {
7         Timer *t = TIMER(n);
8
9         assert(t);
10 }
11
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
23 const NameVTable timer_vtable = {
24         .suffix = ".timer",
25
26         .init = name_load_fragment_and_dropin,
27         .done = timer_done,
28
29         .active_state = timer_active_state
30 };