summaryrefslogtreecommitdiff
path: root/src/automount.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/automount.c
parent21d21ea42eadd742873c2bddfd474e3b34510431 (diff)
mount: add automatic start ordering dependencies for mounts
Diffstat (limited to 'src/automount.c')
-rw-r--r--src/automount.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/automount.c b/src/automount.c
index 934aa5f35d..00f3736b2f 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -146,6 +146,23 @@ static int automount_add_mount_links(Automount *a) {
return 0;
}
+static int automount_add_default_dependencies(Automount *a) {
+ int r;
+
+ assert(a);
+
+ if (a->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(a), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static int automount_verify(Automount *a) {
bool b;
char *e;
@@ -201,9 +218,8 @@ static int automount_load(Unit *u) {
if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0)
return r;
- if (a->meta.default_dependencies &&
- a->meta.manager->running_as == MANAGER_SYSTEM)
- if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ if (a->meta.default_dependencies)
+ if ((r = automount_add_default_dependencies(a)) < 0)
return r;
}