summaryrefslogtreecommitdiff
path: root/src/swap.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-18 04:58:01 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-19 04:08:07 +0200
commit5632e3743db350a67478acc107d76cdf648a1f99 (patch)
treee7efad268223470ca3053db650a2c7b3ad9c90c4 /src/swap.c
parentb9975629f03a43d4c6b14fdb42eb8dd5a30af28f (diff)
systemctl: introduce reset-maintenance command
Diffstat (limited to 'src/swap.c')
-rw-r--r--src/swap.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/swap.c b/src/swap.c
index de468a0434..6765a4ae30 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -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
};