chiark / gitweb /
use #pragma once instead of foo*foo define guards
[elogind.git] / src / core / path.c
index ab1fe2eb6539852f8e27ed0b294bd35381fa74b1..10df80f695bec6150e8b660d3849d1259996a3eb 100644 (file)
@@ -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;
         }
@@ -680,13 +652,13 @@ static int path_deserialize_item(Unit *u, const char *key, const char *value, FD
         return 0;
 }
 
-static UnitActiveState path_active_state(Unit *u) {
+_pure_ static UnitActiveState path_active_state(Unit *u) {
         assert(u);
 
         return state_translation_table[PATH(u)->state];
 }
 
-static const char *path_sub_state_to_string(Unit *u) {
+_pure_ static const char *path_sub_state_to_string(Unit *u) {
         assert(u);
 
         return path_state_to_string(PATH(u)->state);