chiark / gitweb /
units: connect shutdown scripts explicitly with the tty, because native units now...
[elogind.git] / src / swap.c
index 663c568961b38519bf87c6b8c119da5c6296a37c..92035144ba8055db464f021a913c0cc330ed8fb5 100644 (file)
@@ -38,7 +38,7 @@
 static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
         [SWAP_DEAD] = UNIT_INACTIVE,
         [SWAP_ACTIVE] = UNIT_ACTIVE,
-        [SWAP_MAINTENANCE] = UNIT_INACTIVE
+        [SWAP_MAINTENANCE] = UNIT_MAINTENANCE
 };
 
 static void swap_init(Unit *u) {
@@ -77,10 +77,7 @@ int swap_add_one_mount_link(Swap *s, Mount *m) {
         if (!path_startswith(s->what, m->where))
                 return 0;
 
-        if ((r = unit_add_dependency(UNIT(m), UNIT_BEFORE, UNIT(s), true)) < 0)
-                return r;
-
-        if ((r = unit_add_dependency(UNIT(s), UNIT_REQUIRES, UNIT(m), true)) < 0)
+        if ((r = unit_add_two_dependencies(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, UNIT(m), true)) < 0)
                 return r;
 
         return 0;
@@ -113,7 +110,7 @@ static int swap_add_target_links(Swap *s) {
         else
                 return 0;
 
-        if ((r = manager_load_unit(s->meta.manager, SPECIAL_SWAP_TARGET, NULL, &tu)) < 0)
+        if ((r = manager_load_unit(s->meta.manager, SPECIAL_SWAP_TARGET, NULL, NULL, &tu)) < 0)
                 return r;
 
         if (!p->noauto && p->handle && s->meta.manager->running_as == MANAGER_SYSTEM)
@@ -550,6 +547,7 @@ const UnitVTable swap_vtable = {
 
         .no_instances = true,
         .no_isolate = true,
+        .show_status = true,
 
         .init = swap_init,
         .load = swap_load,