summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-08 18:11:09 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-08 18:12:45 +0100
commit9588bc32096fc8342bfd8b989689717186d7d86e (patch)
tree774cf93f0544add18f8307714062cc18f97838da /src/core/unit.c
parentf842cd74eacc2960ac849766eb786059317415ee (diff)
Remove dead code and unexport some calls
"make check-api-unused" informs us about code that is not used anymore or that is exported but only used internally. Fix these all over the place.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c100
1 files changed, 39 insertions, 61 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index e19d281aa7..201329fc86 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -946,6 +946,44 @@ static int unit_add_default_dependencies(Unit *u) {
return 0;
}
+static int unit_add_mount_links(Unit *u) {
+ char **i;
+ int r;
+
+ assert(u);
+
+ STRV_FOREACH(i, u->requires_mounts_for) {
+ char prefix[strlen(*i) + 1];
+
+ PATH_FOREACH_PREFIX_MORE(prefix, *i) {
+ Unit *m;
+
+ r = manager_get_unit_by_path(u->manager, prefix, ".mount", &m);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ continue;
+ if (m == u)
+ continue;
+
+ if (m->load_state != UNIT_LOADED)
+ continue;
+
+ r = unit_add_dependency(u, UNIT_AFTER, m, true);
+ if (r < 0)
+ return r;
+
+ if (m->fragment_path) {
+ r = unit_add_dependency(u, UNIT_REQUIRES, m, true);
+ if (r < 0)
+ return r;
+ }
+ }
+ }
+
+ return 0;
+}
+
int unit_load(Unit *u) {
int r;
@@ -1015,7 +1053,7 @@ fail:
return r;
}
-bool unit_condition_test(Unit *u) {
+static bool unit_condition_test(Unit *u) {
assert(u);
dual_timestamp_get(&u->condition_timestamp);
@@ -2118,28 +2156,6 @@ int unit_load_related_unit(Unit *u, const char *type, Unit **_found) {
return r;
}
-int unit_get_related_unit(Unit *u, const char *type, Unit **_found) {
- _cleanup_free_ char *t = NULL;
- Unit *found;
-
- assert(u);
- assert(type);
- assert(_found);
-
- t = unit_name_change_suffix(u->id, type);
- if (!t)
- return -ENOMEM;
-
- assert(!unit_has_name(u, t));
-
- found = manager_get_unit(u->manager, t);
- if (!found)
- return -ENOENT;
-
- *_found = found;
- return 0;
-}
-
int unit_watch_bus_name(Unit *u, const char *name) {
assert(u);
assert(name);
@@ -2684,44 +2700,6 @@ void unit_ref_unset(UnitRef *ref) {
ref->unit = NULL;
}
-int unit_add_mount_links(Unit *u) {
- char **i;
- int r;
-
- assert(u);
-
- STRV_FOREACH(i, u->requires_mounts_for) {
- char prefix[strlen(*i) + 1];
-
- PATH_FOREACH_PREFIX_MORE(prefix, *i) {
- Unit *m;
-
- r = manager_get_unit_by_path(u->manager, prefix, ".mount", &m);
- if (r < 0)
- return r;
- if (r == 0)
- continue;
- if (m == u)
- continue;
-
- if (m->load_state != UNIT_LOADED)
- continue;
-
- r = unit_add_dependency(u, UNIT_AFTER, m, true);
- if (r < 0)
- return r;
-
- if (m->fragment_path) {
- r = unit_add_dependency(u, UNIT_REQUIRES, m, true);
- if (r < 0)
- return r;
- }
- }
- }
-
- return 0;
-}
-
int unit_exec_context_defaults(Unit *u, ExecContext *c) {
unsigned i;
int r;