X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fpath.c;h=10df80f695bec6150e8b660d3849d1259996a3eb;hb=86198b2788e56fd05959c2dce670d1646bf99bcd;hp=8a09deb4ff5bbc3fc48ec0c6d49f981141052e23;hpb=44a6b1b68029833893f6e9cee35aa27a974038f6;p=elogind.git diff --git a/src/core/path.c b/src/core/path.c index 8a09deb4f..10df80f69 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -241,10 +241,6 @@ static bool path_spec_check_good(PathSpec *s, bool initial) { return good; } -static bool path_spec_startswith(PathSpec *s, const char *what) { - return path_startswith(s->path, what); -} - static void path_spec_mkdir(PathSpec *s, mode_t mode) { int r; @@ -287,7 +283,7 @@ void path_free_specs(Path *p) { while ((s = p->specs)) { path_spec_unwatch(s, UNIT(p)); - LIST_REMOVE(PathSpec, spec, p->specs, s); + LIST_REMOVE(spec, p->specs, s); path_spec_done(s); free(s); } @@ -301,38 +297,14 @@ static void path_done(Unit *u) { path_free_specs(p); } -int path_add_one_mount_link(Path *p, Mount *m) { +static int path_add_mount_links(Path *p) { PathSpec *s; int r; assert(p); - assert(m); - - if (UNIT(p)->load_state != UNIT_LOADED || - UNIT(m)->load_state != UNIT_LOADED) - return 0; LIST_FOREACH(spec, s, p->specs) { - if (!path_spec_startswith(s, m->where)) - continue; - - r = unit_add_two_dependencies(UNIT(p), UNIT_AFTER, UNIT_REQUIRES, - UNIT(m), true); - if (r < 0) - return r; - } - - return 0; -} - -static int path_add_mount_links(Path *p) { - Unit *other; - int r; - - assert(p); - - LIST_FOREACH(units_by_type, other, UNIT(p)->manager->units_by_type[UNIT_MOUNT]) { - r = path_add_one_mount_link(p, MOUNT(other)); + r = unit_require_mounts_for(UNIT(p), s->path); if (r < 0) return r; }