diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-12 22:55:27 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-12 22:55:27 +0200 |
commit | 2edd4434e5bc6e5c7948df742d82f4bcd6c415f3 (patch) | |
tree | 4b283b03dbf3b58a533a6fa2077e931bdf686f4e /src/mount.c | |
parent | 21d21ea42eadd742873c2bddfd474e3b34510431 (diff) |
mount: add automatic start ordering dependencies for mounts
Diffstat (limited to 'src/mount.c')
-rw-r--r-- | src/mount.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/mount.c b/src/mount.c index 30390de99d..5b0bc6bdf0 100644 --- a/src/mount.c +++ b/src/mount.c @@ -274,6 +274,24 @@ static int mount_add_target_links(Mount *m) { } } +static int mount_add_default_dependencies(Mount *m) { + int r; + + assert(m); + + if (m->meta.manager->running_as == MANAGER_SYSTEM) { + + if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0) + return r; + + if (!path_equal(m->where, "/")) + if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0) + return r; + } + + return 0; +} + static int mount_verify(Mount *m) { bool b; char *e; @@ -368,10 +386,8 @@ static int mount_load(Unit *u) { if ((r = unit_add_default_cgroup(u)) < 0) return r; - if (m->meta.default_dependencies && - m->meta.manager->running_as == MANAGER_SYSTEM && - !path_equal(m->where, "/")) - if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0) + if (m->meta.default_dependencies) + if ((r = mount_add_default_dependencies(m)) < 0) return r; } |