-/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
static void swap_enter_dead(Swap *s, bool success) {
assert(s);
- swap_set_state(s, success ? SWAP_MAINTENANCE : SWAP_DEAD);
+ swap_set_state(s, success ? SWAP_DEAD : SWAP_MAINTENANCE);
}
static int swap_start(Unit *u) {
}
}
-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);
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",
.check_gc = swap_check_gc,
+ .bus_interface = "org.freedesktop.systemd1.Swap",
.bus_message_handler = bus_swap_message_handler,
+ .bus_invalidating_properties = bus_swap_invalidating_properties,
+
+ .reset_maintenance = swap_reset_maintenance,
.enumerate = swap_enumerate,
.shutdown = swap_shutdown