summaryrefslogtreecommitdiff
path: root/src/core/mount.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-04-29 14:26:07 +0200
committerLennart Poettering <lennart@poettering.net>2012-04-30 10:52:07 +0200
commit7c8fa05c4d5d01748ff2a04edb882afb3119b7d7 (patch)
treea3dc4d052ac25915fa0b23bf695891d5989aff7e /src/core/mount.c
parenta8ad0f89286b878cbe1f330f72abd2d22813f8ea (diff)
unit: add new dependency type RequiresMountsFor=
RequiresMountsFor= is a shortcut for adding requires and after dependencies to all mount units neeed for the specified paths. This solves a couple of issues regarding dep loop cycles for encrypted swap.
Diffstat (limited to 'src/core/mount.c')
-rw-r--r--src/core/mount.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 3357b7df5b..5f50d9557a 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -263,6 +263,21 @@ static int mount_add_socket_links(Mount *m) {
return 0;
}
+static int mount_add_requires_mounts_links(Mount *m) {
+ Unit *other;
+ int r;
+
+ assert(m);
+
+ LIST_FOREACH(has_requires_mounts_for, other, UNIT(m)->manager->has_requires_mounts_for) {
+ r = unit_add_one_mount_link(other, m);
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static char* mount_test_option(const char *haystack, const char *needle) {
struct mntent me;
@@ -614,6 +629,10 @@ static int mount_load(Unit *u) {
if ((r = mount_add_path_links(m)) < 0)
return r;
+ r = mount_add_requires_mounts_links(m);
+ if (r < 0)
+ return r;
+
if ((r = mount_add_automount_links(m)) < 0)
return r;