diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2013-02-27 22:54:14 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2013-02-28 02:23:21 +0100 |
commit | 49b1d377263f33991a03235779e50f61273ba649 (patch) | |
tree | b4ef93e4504d1c021af76ba6f3af37f40bc8841f /src | |
parent | 6084e22e57afd588ad205697c0af119d93db1e39 (diff) |
core: redefine unit_status_printf()
Take advantage of the fact that almost all callers want to pass unit
description as the last parameter. Those who don't can use the more
flexible manager_status_printf().
Diffstat (limited to 'src')
-rw-r--r-- | src/core/job.c | 16 | ||||
-rw-r--r-- | src/core/unit.c | 6 | ||||
-rw-r--r-- | src/core/unit.h | 3 |
3 files changed, 14 insertions, 11 deletions
diff --git a/src/core/job.c b/src/core/job.c index 677a01d73d..9f792b84fd 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -644,20 +644,20 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) { case JOB_DONE: if (u->condition_result) - unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, format, unit_description(u)); + unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, format); break; case JOB_FAILED: - unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format, unit_description(u)); - unit_status_printf(u, NULL, "See 'systemctl status %s' for details.", u->id); + unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format); + manager_status_printf(u->manager, NULL, "See 'systemctl status %s' for details.", u->id); break; case JOB_DEPENDENCY: - unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF, format, unit_description(u)); + unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF, format); break; case JOB_TIMEOUT: - unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format, unit_description(u)); + unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format); break; default: @@ -673,12 +673,12 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) { switch (result) { case JOB_TIMEOUT: - unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format, unit_description(u)); + unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format); break; case JOB_DONE: case JOB_FAILED: - unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, format, unit_description(u)); + unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, format); break; default: @@ -691,7 +691,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) { * Most likely a DEPEND warning from a requisiting unit will * occur next and it's nice to see what was requisited. */ if (result == JOB_SKIPPED) - unit_status_printf(u, ANSI_HIGHLIGHT_ON " INFO " ANSI_HIGHLIGHT_OFF, "%s is not active.", unit_description(u)); + unit_status_printf(u, ANSI_HIGHLIGHT_ON " INFO " ANSI_HIGHLIGHT_OFF, "%s is not active."); } } diff --git a/src/core/unit.c b/src/core/unit.c index 74b0e47885..6fee0506d8 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -994,7 +994,7 @@ static void unit_status_print_starting_stopping(Unit *u, JobType t) { if (!format) return; - unit_status_printf(u, "", format, unit_description(u)); + unit_status_printf(u, "", format); } #pragma GCC diagnostic push @@ -2535,6 +2535,10 @@ int unit_coldplug(Unit *u) { return 0; } +void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) { + manager_status_printf(u->manager, false, status, unit_status_msg_format, unit_description(u)); +} + bool unit_need_daemon_reload(Unit *u) { struct stat st; diff --git a/src/core/unit.h b/src/core/unit.h index 84aabd5723..9029d6225b 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -520,8 +520,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants); int unit_coldplug(Unit *u); -#define unit_status_printf(u, st, fo, ...) \ - manager_status_printf((u)->manager, st, fo, __VA_ARGS__) +void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format); bool unit_need_daemon_reload(Unit *u); |