diff options
-rw-r--r-- | src/core/manager.c | 14 | ||||
-rw-r--r-- | src/core/manager.h | 1 | ||||
-rw-r--r-- | src/core/unit.c | 17 | ||||
-rw-r--r-- | src/core/unit.h | 3 |
4 files changed, 17 insertions, 18 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index a578813617..d6c6e2de6d 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2494,6 +2494,20 @@ bool manager_get_show_status(Manager *m) { return plymouth_running(); } +void manager_status_printf(Manager *m, const char *status, const char *format, ...) { + va_list ap; + + if (!manager_get_show_status(m)) + return; + + if (!manager_is_booting_or_shutting_down(m)) + return; + + va_start(ap, format); + status_vprintf(status, true, format, ap); + va_end(ap); +} + void watch_init(Watch *w) { assert(w); diff --git a/src/core/manager.h b/src/core/manager.h index 0bd7a6d48b..3ec8d707d2 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -295,6 +295,7 @@ void manager_undo_generators(Manager *m); void manager_recheck_journal(Manager *m); void manager_set_show_status(Manager *m, bool b); +void manager_status_printf(Manager *m, const char *status, const char *format, ...); bool manager_get_show_status(Manager *m); void watch_init(Watch *w); diff --git a/src/core/unit.c b/src/core/unit.c index 370ad67e59..74b0e47885 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2535,23 +2535,6 @@ int unit_coldplug(Unit *u) { return 0; } -void unit_status_printf(Unit *u, const char *status, const char *format, ...) { - va_list ap; - - assert(u); - assert(format); - - if (!manager_get_show_status(u->manager)) - return; - - if (!manager_is_booting_or_shutting_down(u->manager)) - return; - - va_start(ap, format); - status_vprintf(status, true, format, ap); - va_end(ap); -} - bool unit_need_daemon_reload(Unit *u) { struct stat st; diff --git a/src/core/unit.h b/src/core/unit.h index 17a5a5f0d9..84aabd5723 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -520,7 +520,8 @@ int unit_add_node_link(Unit *u, const char *what, bool wants); int unit_coldplug(Unit *u); -void unit_status_printf(Unit *u, const char *status, const char *format, ...); +#define unit_status_printf(u, st, fo, ...) \ + manager_status_printf((u)->manager, st, fo, __VA_ARGS__) bool unit_need_daemon_reload(Unit *u); |