summaryrefslogtreecommitdiff
path: root/src/swap.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-12 22:55:27 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-12 22:55:27 +0200
commit2edd4434e5bc6e5c7948df742d82f4bcd6c415f3 (patch)
tree4b283b03dbf3b58a533a6fa2077e931bdf686f4e /src/swap.c
parent21d21ea42eadd742873c2bddfd474e3b34510431 (diff)
mount: add automatic start ordering dependencies for mounts
Diffstat (limited to 'src/swap.c')
-rw-r--r--src/swap.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/swap.c b/src/swap.c
index 92035144ba..de468a0434 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -120,6 +120,24 @@ static int swap_add_target_links(Swap *s) {
return unit_add_dependency(UNIT(s), UNIT_BEFORE, tu, true);
}
+static int swap_add_default_dependencies(Swap *s) {
+ int r;
+
+ assert(s);
+
+ if (s->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ /* Note that by default we don't disable swap devices
+ * on shutdown. i.e. there is no umount.target
+ * conflicts here. */
+ }
+
+ return 0;
+}
+
static int swap_verify(Swap *s) {
bool b;
char *e;
@@ -185,6 +203,10 @@ static int swap_load(Unit *u) {
if ((r = swap_add_target_links(s)) < 0)
return r;
+
+ if (s->meta.default_dependencies)
+ if ((r = swap_add_default_dependencies(s)) < 0)
+ return r;
}
return swap_verify(s);