summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-27 23:02:54 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-27 23:02:54 -0400
commit127d5fd1563a74411aaceeadd251f98fd52216d7 (patch)
tree03ee9e52fc3027e46bab315a132cba4c9cac0a91 /src/core
parent2de51fdc5218d6c4f148989f8907cf0fc842abea (diff)
manager: convert ephemeral to enum
In preparation for subsequent changes.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/job.c2
-rw-r--r--src/core/manager.c12
-rw-r--r--src/core/manager.h7
-rw-r--r--src/core/unit.c3
4 files changed, 15 insertions, 9 deletions
diff --git a/src/core/job.c b/src/core/job.c
index aa205ba781..eaa4bb17fc 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -639,7 +639,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
manager_flip_auto_status(u->manager, true);
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format);
- manager_status_printf(u->manager, false, NULL,
+ manager_status_printf(u->manager, STATUS_TYPE_NORMAL, NULL,
"See \"systemctl status %s%s%s\" for details.",
quotes ? "'" : "", u->id, quotes ? "'" : "");
break;
diff --git a/src/core/manager.c b/src/core/manager.c
index 7a5ecb76d6..859631d3f6 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -194,7 +194,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
if (job_get_timeout(j, &x) > 0)
format_timespan(limit, sizeof(limit), x - j->begin_usec, 1*USEC_PER_SEC);
- manager_status_printf(m, true, cylon,
+ manager_status_printf(m, STATUS_TYPE_EPHEMERAL, cylon,
"%sA %s job is running for %s (%s / %s)",
strempty(job_of_n),
job_type_to_string(j->type),
@@ -2931,7 +2931,7 @@ void manager_set_show_status(Manager *m, ShowStatus mode) {
unlink("/run/systemd/show-status");
}
-static bool manager_get_show_status(Manager *m) {
+static bool manager_get_show_status(Manager *m, StatusType type) {
assert(m);
if (m->running_as != SYSTEMD_SYSTEM)
@@ -2969,19 +2969,19 @@ void manager_set_first_boot(Manager *m, bool b) {
unlink("/run/systemd/first-boot");
}
-void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) {
+void manager_status_printf(Manager *m, StatusType type, const char *status, const char *format, ...) {
va_list ap;
- if (!manager_get_show_status(m))
+ if (!manager_get_show_status(m, type))
return;
/* XXX We should totally drop the check for ephemeral here
* and thus effectively make 'Type=idle' pointless. */
- if (ephemeral && m->n_on_console > 0)
+ if (type == STATUS_TYPE_EPHEMERAL && m->n_on_console > 0)
return;
va_start(ap, format);
- status_vprintf(status, true, ephemeral, format, ap);
+ status_vprintf(status, true, type == STATUS_TYPE_EPHEMERAL, format, ap);
va_end(ap);
}
diff --git a/src/core/manager.h b/src/core/manager.h
index 782b85da00..d0c0f58d0b 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -60,6 +60,11 @@ typedef enum ManagerExitCode {
_MANAGER_EXIT_CODE_INVALID = -1
} ManagerExitCode;
+typedef enum StatusType {
+ STATUS_TYPE_EPHEMERAL,
+ STATUS_TYPE_NORMAL,
+} StatusType;
+
#include "unit.h"
#include "job.h"
#include "hashmap.h"
@@ -349,7 +354,7 @@ void manager_recheck_journal(Manager *m);
void manager_set_show_status(Manager *m, ShowStatus mode);
void manager_set_first_boot(Manager *m, bool b);
-void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_(4,5);
+void manager_status_printf(Manager *m, StatusType type, const char *status, const char *format, ...) _printf_(4,5);
void manager_flip_auto_status(Manager *m, bool enable);
Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path);
diff --git a/src/core/unit.c b/src/core/unit.c
index afb760d4a3..489ea1e502 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2768,7 +2768,8 @@ int unit_coldplug(Unit *u) {
void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) {
DISABLE_WARNING_FORMAT_NONLITERAL;
- manager_status_printf(u->manager, false, status, unit_status_msg_format, unit_description(u));
+ manager_status_printf(u->manager, STATUS_TYPE_NORMAL,
+ status, unit_status_msg_format, unit_description(u));
REENABLE_WARNING;
}