X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftimer.h;h=f5c5c64f2509ceb63d4878395ce6bfdb5ce823ae;hp=69c5609a9c5631fc05e987c5ea0c8ebdc6acc724;hb=d7832d2c6e0ef5f2839a2296c1cc2fc85c7d9632;hpb=871d7de47c13ee6cd78b8eefdf9128be3c740ac0 diff --git a/src/timer.h b/src/timer.h index 69c5609a9..f5c5c64f2 100644 --- a/src/timer.h +++ b/src/timer.h @@ -1,4 +1,4 @@ -/*-*- Mode: C; c-basic-offset: 8 -*-*/ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ #ifndef footimerhfoo #define footimerhfoo @@ -31,7 +31,7 @@ typedef enum TimerState { TIMER_WAITING, TIMER_RUNNING, TIMER_ELAPSED, - TIMER_MAINTAINANCE, + TIMER_FAILED, _TIMER_STATE_MAX, _TIMER_STATE_INVALID = -1 } TimerState; @@ -47,30 +47,34 @@ typedef enum TimerBase { } TimerBase; typedef struct TimerValue { - TimerBase base; usec_t value; - usec_t next_elapse; - bool disabled; - LIST_FIELDS(struct TimerValue, value); + + TimerBase base; + bool disabled; } TimerValue; +typedef enum TimerResult { + TIMER_SUCCESS, + TIMER_FAILURE_RESOURCES, + _TIMER_RESULT_MAX, + _TIMER_RESULT_INVALID = -1 +} TimerResult; + struct Timer { - Meta meta; + Unit meta; LIST_HEAD(TimerValue, values); - - TimerState state, deserialized_state; - usec_t next_elapse; - Unit *unit; + TimerState state, deserialized_state; + UnitRef unit; Watch timer_watch; - bool failure; + TimerResult result; }; void timer_unit_notify(Unit *u, UnitActiveState new_state); @@ -83,4 +87,7 @@ TimerState timer_state_from_string(const char *s); const char *timer_base_to_string(TimerBase i); TimerBase timer_base_from_string(const char *s); +const char* timer_result_to_string(TimerResult i); +TimerResult timer_result_from_string(const char *s); + #endif