summaryrefslogtreecommitdiffstats
path: root/src/core/automount.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/automount.c')
-rw-r--r--src/core/automount.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index c15520c1e5..0ecacc12c8 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -164,9 +164,7 @@ static int automount_verify(Automount *a) {
int r;
assert(a);
-
- if (UNIT(a)->load_state != UNIT_LOADED)
- return 0;
+ assert(UNIT(a)->load_state == UNIT_LOADED);
if (path_equal(a->where, "/")) {
log_unit_error(UNIT(a), "Cannot have an automount unit for the root directory. Refusing.");
@@ -201,6 +199,24 @@ static int automount_set_where(Automount *a) {
return 1;
}
+static int automount_add_extras(Automount *a) {
+ int r;
+
+ r = automount_set_where(a);
+ if (r < 0)
+ return r;
+
+ r = automount_add_trigger_dependencies(a);
+ if (r < 0)
+ return r;
+
+ r = automount_add_mount_dependencies(a);
+ if (r < 0)
+ return r;
+
+ return automount_add_default_dependencies(a);
+}
+
static int automount_load(Unit *u) {
Automount *a = AUTOMOUNT(u);
int r;
@@ -213,23 +229,12 @@ static int automount_load(Unit *u) {
if (r < 0)
return r;
- if (u->load_state == UNIT_LOADED) {
- r = automount_set_where(a);
- if (r < 0)
- return r;
-
- r = automount_add_trigger_dependencies(a);
- if (r < 0)
- return r;
-
- r = automount_add_mount_dependencies(a);
- if (r < 0)
- return r;
+ if (u->load_state != UNIT_LOADED)
+ return 0;
- r = automount_add_default_dependencies(a);
- if (r < 0)
- return r;
- }
+ r = automount_add_extras(a);
+ if (r < 0)
+ return r;
return automount_verify(a);
}