From 0121d1f28d0c8beb7c3145306189d5fcac1317cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 5 Jul 2019 13:34:54 +0200 Subject: [PATCH] pid1: shorten dump output a bit by not repeating unit id twice Most units have just one name, but we'd print it twice: -> Unit systemd-sysctl.service: ... Name: systemd-sysctl.service Let's only print the "main" name once, and call the other names Aliases. --- src/core/unit.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index d880e70..a6a95f0 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1143,7 +1143,14 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { prefix2 = strjoina(prefix, "\t"); fprintf(f, - "%s-> Unit %s:\n" + "%s-> Unit %s:\n", + prefix, u->id); + + SET_FOREACH(t, u->names, i) + if (!streq(t, u->id)) + fprintf(f, "%s\tAlias: %s\n", prefix, t); + + fprintf(f, "%s\tDescription: %s\n" "%s\tInstance: %s\n" "%s\tUnit Load State: %s\n" @@ -1161,7 +1168,6 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { "%s\tSlice: %s\n" "%s\tCGroup: %s\n" "%s\tCGroup realized: %s\n", - prefix, u->id, prefix, unit_description(u), prefix, strna(u->instance), prefix, unit_load_state_to_string(u->load_state), @@ -1213,9 +1219,6 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { fprintf(f, "%s\tCGroup delegate mask: %s\n", prefix, strnull(s)); } - SET_FOREACH(t, u->names, i) - fprintf(f, "%s\tName: %s\n", prefix, t); - if (!sd_id128_is_null(u->invocation_id)) fprintf(f, "%s\tInvocation ID: " SD_ID128_FORMAT_STR "\n", prefix, SD_ID128_FORMAT_VAL(u->invocation_id)); -- 2.7.4