mirror of
https://github.com/systemd/systemd.git
synced 2025-02-03 17:47:28 +03:00
Use unit->id instead of description in messages
v2: - rename unit_identifier to unit_status_string
This commit is contained in:
parent
36cf45078c
commit
2a8f53c67b
2
TODO
2
TODO
@ -524,8 +524,6 @@ Features:
|
||||
|
||||
* maybe add support for specifier expansion in user.conf, specifically DefaultEnvironment=
|
||||
|
||||
* consider showing the unit names during boot up in the status output, not just the unit descriptions
|
||||
|
||||
* maybe allow timer units with an empty Units= setting, so that they
|
||||
can be used for resuming the system but nothing else.
|
||||
|
||||
|
@ -579,7 +579,7 @@ static void job_log_begin_status_message(Unit *u, uint32_t job_id, JobType t) {
|
||||
format = job_get_begin_status_message_format(u, t);
|
||||
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
(void) snprintf(buf, sizeof buf, format, unit_description(u));
|
||||
(void) snprintf(buf, sizeof buf, format, unit_status_string(u));
|
||||
REENABLE_WARNING;
|
||||
|
||||
mid = t == JOB_START ? "MESSAGE_ID=" SD_MESSAGE_UNIT_STARTING_STR :
|
||||
@ -889,7 +889,7 @@ static void job_log_done_status_message(Unit *u, uint32_t job_id, JobType t, Job
|
||||
/* Show condition check message if the job did not actually do anything due to failed condition. */
|
||||
if (t == JOB_START && result == JOB_DONE && !u->condition_result) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE=Condition check resulted in %s being skipped.", unit_description(u),
|
||||
"MESSAGE=Condition check resulted in %s being skipped.", unit_status_string(u),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
@ -909,7 +909,7 @@ static void job_log_done_status_message(Unit *u, uint32_t job_id, JobType t, Job
|
||||
* xsprintf() on purpose here: we are fine with truncation and don't
|
||||
* consider that an error. */
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
(void) snprintf(buf, sizeof(buf), format, unit_description(u));
|
||||
(void) snprintf(buf, sizeof(buf), format, unit_status_string(u));
|
||||
REENABLE_WARNING;
|
||||
|
||||
switch (t) {
|
||||
|
@ -231,7 +231,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
|
||||
"%sA %s job is running for %s (%s / %s)",
|
||||
strempty(job_of_n),
|
||||
job_type_to_string(j->type),
|
||||
unit_description(j->unit),
|
||||
unit_status_string(j->unit),
|
||||
time, limit);
|
||||
}
|
||||
|
||||
|
@ -1067,6 +1067,15 @@ const char *unit_description(Unit *u) {
|
||||
return strna(u->id);
|
||||
}
|
||||
|
||||
const char *unit_status_string(Unit *u) {
|
||||
assert(u);
|
||||
|
||||
if (u->manager->status_unit_format == STATUS_UNIT_FORMAT_NAME && u->id)
|
||||
return u->id;
|
||||
|
||||
return unit_description(u);
|
||||
}
|
||||
|
||||
static void print_unit_dependency_mask(FILE *f, const char *kind, UnitDependencyMask mask, bool *space) {
|
||||
const struct {
|
||||
UnitDependencyMask mask;
|
||||
@ -1644,7 +1653,7 @@ static bool unit_test_assert(Unit *u) {
|
||||
void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) {
|
||||
const char *d;
|
||||
|
||||
d = unit_description(u);
|
||||
d = unit_status_string(u);
|
||||
if (log_get_show_color())
|
||||
d = strjoina(ANSI_HIGHLIGHT, d, ANSI_NORMAL);
|
||||
|
||||
|
@ -671,6 +671,7 @@ int unit_set_slice(Unit *u, Unit *slice);
|
||||
int unit_set_default_slice(Unit *u);
|
||||
|
||||
const char *unit_description(Unit *u) _pure_;
|
||||
const char *unit_status_string(Unit *u) _pure_;
|
||||
|
||||
bool unit_has_name(const Unit *u, const char *name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user