chiark / gitweb /
util: move all to shared/ and split external dependencies in separate internal libraries
[elogind.git] / src / timer.h
index 814d9b203752876432698c7c754ae39d654c6c27..f5c5c64f2509ceb63d4878395ce6bfdb5ce823ae 100644 (file)
@@ -31,7 +31,7 @@ typedef enum TimerState {
         TIMER_WAITING,
         TIMER_RUNNING,
         TIMER_ELAPSED,
-        TIMER_MAINTENANCE,
+        TIMER_FAILED,
         _TIMER_STATE_MAX,
         _TIMER_STATE_INVALID = -1
 } TimerState;
@@ -56,18 +56,25 @@ typedef struct TimerValue {
         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);
         usec_t next_elapse;
 
         TimerState state, deserialized_state;
-        Unit *unit;
+        UnitRef unit;
 
         Watch timer_watch;
 
-        bool failure;
+        TimerResult result;
 };
 
 void timer_unit_notify(Unit *u, UnitActiveState new_state);
@@ -80,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