diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-08 18:11:09 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-08 18:12:45 +0100 |
commit | 9588bc32096fc8342bfd8b989689717186d7d86e (patch) | |
tree | 774cf93f0544add18f8307714062cc18f97838da /src/core | |
parent | f842cd74eacc2960ac849766eb786059317415ee (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')
-rw-r--r-- | src/core/execute.c | 2 | ||||
-rw-r--r-- | src/core/execute.h | 1 | ||||
-rw-r--r-- | src/core/job.c | 2 | ||||
-rw-r--r-- | src/core/job.h | 2 | ||||
-rw-r--r-- | src/core/manager.c | 51 | ||||
-rw-r--r-- | src/core/manager.h | 4 | ||||
-rw-r--r-- | src/core/unit.c | 100 | ||||
-rw-r--r-- | src/core/unit.h | 5 |
8 files changed, 67 insertions, 100 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 3ae28ee080..1e571da69c 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -155,7 +155,7 @@ _pure_ static const char *tty_path(const ExecContext *context) { return "/dev/console"; } -void exec_context_tty_reset(const ExecContext *context) { +static void exec_context_tty_reset(const ExecContext *context) { assert(context); if (context->tty_vhangup) diff --git a/src/core/execute.h b/src/core/execute.h index c1e9717dc8..368c9f00bb 100644 --- a/src/core/execute.h +++ b/src/core/execute.h @@ -194,7 +194,6 @@ void exec_context_init(ExecContext *c); void exec_context_done(ExecContext *c, bool reloading_or_reexecuting); void exec_context_tmp_dirs_done(ExecContext *c); void exec_context_dump(ExecContext *c, FILE* f, const char *prefix); -void exec_context_tty_reset(const ExecContext *context); int exec_context_load_environment(const ExecContext *c, char ***l); diff --git a/src/core/job.c b/src/core/job.c index e5dcef7cf4..fc446fbc42 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -416,7 +416,7 @@ int job_type_merge_and_collapse(JobType *a, JobType b, Unit *u) { return 0; } -bool job_is_runnable(Job *j) { +static bool job_is_runnable(Job *j) { Iterator i; Unit *other; diff --git a/src/core/job.h b/src/core/job.h index d90bc96b76..be9d278b0c 100644 --- a/src/core/job.h +++ b/src/core/job.h @@ -206,8 +206,6 @@ void job_type_collapse(JobType *t, Unit *u); int job_type_merge_and_collapse(JobType *a, JobType b, Unit *u); -bool job_is_runnable(Job *j); - void job_add_to_run_queue(Job *j); void job_add_to_dbus_queue(Job *j); diff --git a/src/core/manager.c b/src/core/manager.c index c75c1e1a4e..07ca4c92f7 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -800,7 +800,7 @@ int manager_enumerate(Manager *m) { return r; } -int manager_coldplug(Manager *m) { +static int manager_coldplug(Manager *m) { int r = 0, q; Iterator i; Unit *u; @@ -880,6 +880,29 @@ fail: m->unit_path_cache = NULL; } + +static int manager_distribute_fds(Manager *m, FDSet *fds) { + Unit *u; + Iterator i; + int r; + + assert(m); + + HASHMAP_FOREACH(u, m->units, i) { + + if (fdset_size(fds) <= 0) + break; + + if (UNIT_VTABLE(u)->distribute_fds) { + r = UNIT_VTABLE(u)->distribute_fds(u, fds); + if (r < 0) + return r; + } + } + + return 0; +} + int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { int r, q; @@ -1187,7 +1210,7 @@ void manager_clear_jobs(Manager *m) { job_finish_and_invalidate(j, JOB_CANCELED, false); } -unsigned manager_dispatch_run_queue(Manager *m) { +static unsigned manager_dispatch_run_queue(Manager *m) { Job *j; unsigned n = 0; @@ -1215,7 +1238,7 @@ unsigned manager_dispatch_run_queue(Manager *m) { return n; } -unsigned manager_dispatch_dbus_queue(Manager *m) { +static unsigned manager_dispatch_dbus_queue(Manager *m) { Job *j; Unit *u; unsigned n = 0; @@ -2298,28 +2321,6 @@ finish: return r; } -int manager_distribute_fds(Manager *m, FDSet *fds) { - Unit *u; - Iterator i; - int r; - - assert(m); - - HASHMAP_FOREACH(u, m->units, i) { - - if (fdset_size(fds) <= 0) - break; - - if (UNIT_VTABLE(u)->distribute_fds) { - r = UNIT_VTABLE(u)->distribute_fds(u, fds); - if (r < 0) - return r; - } - } - - return 0; -} - int manager_reload(Manager *m) { int r, q; _cleanup_fclose_ FILE *f = NULL; diff --git a/src/core/manager.h b/src/core/manager.h index f83c008a2e..150525ee13 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -265,7 +265,6 @@ int manager_new(SystemdRunningAs running_as, bool reexecuting, Manager **m); void manager_free(Manager *m); int manager_enumerate(Manager *m); -int manager_coldplug(Manager *m); int manager_startup(Manager *m, FILE *serialization, FDSet *fds); Job *manager_get_job(Manager *m, uint32_t id); @@ -288,8 +287,6 @@ void manager_dump_jobs(Manager *s, FILE *f, const char *prefix); void manager_clear_jobs(Manager *m); unsigned manager_dispatch_load_queue(Manager *m); -unsigned manager_dispatch_run_queue(Manager *m); -unsigned manager_dispatch_dbus_queue(Manager *m); int manager_environment_add(Manager *m, char **environment); int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit); @@ -303,7 +300,6 @@ int manager_open_serialization(Manager *m, FILE **_f); int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root); int manager_deserialize(Manager *m, FILE *f, FDSet *fds); -int manager_distribute_fds(Manager *m, FDSet *fds); int manager_reload(Manager *m); 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; diff --git a/src/core/unit.h b/src/core/unit.h index 6971048a9b..1a558423f7 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -545,7 +545,6 @@ int set_unit_path(const char *p); char *unit_dbus_path(Unit *u); int unit_load_related_unit(Unit *u, const char *type, Unit **_found); -int unit_get_related_unit(Unit *u, const char *type, Unit **_found); bool unit_can_serialize(Unit *u) _pure_; int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs); @@ -580,8 +579,6 @@ int unit_following_set(Unit *u, Set **s); void unit_start_on_failure(Unit *u); void unit_trigger_notify(Unit *u); -bool unit_condition_test(Unit *u); - UnitFileState unit_get_unit_file_state(Unit *u); Unit* unit_ref_set(UnitRef *ref, Unit *u); @@ -590,8 +587,6 @@ void unit_ref_unset(UnitRef *ref); #define UNIT_DEREF(ref) ((ref).unit) #define UNIT_ISSET(ref) (!!(ref).unit) -int unit_add_mount_links(Unit *u); - int unit_exec_context_defaults(Unit *u, ExecContext *c); ExecContext *unit_get_exec_context(Unit *u) _pure_; |