chiark / gitweb /
units: split fsck.target from sysinit.target for suse compat
[elogind.git] / src / swap.c
index de468a0434ee0e0e4dfcaace2ff6cfa8111168ee..6765a4ae30a48246db2a8d67b3f0566cde57e960 100644 (file)
@@ -542,14 +542,6 @@ static void swap_shutdown(Manager *m) {
         }
 }
 
-static const char* const swap_state_table[_SWAP_STATE_MAX] = {
-        [SWAP_DEAD] = "dead",
-        [SWAP_ACTIVE] = "active",
-        [SWAP_MAINTENANCE] = "maintenance"
-};
-
-DEFINE_STRING_TABLE_LOOKUP(swap_state, SwapState);
-
 static int swap_enumerate(Manager *m) {
         int r;
         assert(m);
@@ -564,6 +556,23 @@ static int swap_enumerate(Manager *m) {
         return r;
 }
 
+static void swap_reset_maintenance(Unit *u) {
+        Swap *s = SWAP(u);
+
+        assert(s);
+
+        if (s->state == SWAP_MAINTENANCE)
+                swap_set_state(s, SWAP_DEAD);
+}
+
+static const char* const swap_state_table[_SWAP_STATE_MAX] = {
+        [SWAP_DEAD] = "dead",
+        [SWAP_ACTIVE] = "active",
+        [SWAP_MAINTENANCE] = "maintenance"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(swap_state, SwapState);
+
 const UnitVTable swap_vtable = {
         .suffix = ".swap",
 
@@ -592,6 +601,8 @@ const UnitVTable swap_vtable = {
 
         .bus_message_handler = bus_swap_message_handler,
 
+        .reset_maintenance = swap_reset_maintenance,
+
         .enumerate = swap_enumerate,
         .shutdown = swap_shutdown
 };