X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=automount.c;h=c28472da769106f1ff61f6d633094f257d3552b5;hp=a45cd9650558ba6105fe1c2caad72de9f7cb7b18;hb=2fa086a8e02b1b2d62a9a424b41944f3a2251e60;hpb=a7334b0952ab66c17ee787e36e6d2c5ceb387de6 diff --git a/automount.c b/automount.c index a45cd9650..c28472da7 100644 --- a/automount.c +++ b/automount.c @@ -26,7 +26,7 @@ #include "load-fragment.h" #include "load-dropin.h" -static int automount_init(Unit *u) { +static int automount_init(Unit *u, UnitLoadState *new_state) { int r; Automount *a = AUTOMOUNT(u); @@ -35,13 +35,28 @@ static int automount_init(Unit *u) { exec_context_init(&a->exec_context); /* Load a .automount file */ - if ((r = unit_load_fragment(u)) < 0) + if ((r = unit_load_fragment(u, new_state)) < 0) return r; + if (*new_state == UNIT_STUB) + *new_state = UNIT_LOADED; + /* Load drop-in directory data */ - if ((r = unit_load_dropin(u)) < 0) + if ((r = unit_load_dropin(unit_follow_merge(u))) < 0) return r; + if (*new_state == UNIT_LOADED) { + + if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount))) < 0) + return r; + + if ((r = unit_add_exec_dependencies(u, &a->exec_context)) < 0) + return r; + + if ((r = unit_add_default_cgroup(u)) < 0) + return r; + } + return 0; }