core: add combined status unit format

[zjs: actual implementation is stripped out and will be added in subsequent
commits.]
This commit is contained in:
Paweł Marciniak 2021-06-26 17:50:16 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 2e9ee9cf15
commit 580e198a50
5 changed files with 14 additions and 8 deletions

View File

@ -257,10 +257,12 @@
<varlistentry>
<term><varname>StatusUnitFormat=</varname></term>
<listitem><para>Takes either <option>name</option> or <option>description</option> as the value. If
<option>name</option>, the system manager will use unit names in status messages, instead of the
longer and more informative descriptions set with <varname>Description=</varname>, see
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
<listitem><para>Takes <option>name</option>, <option>description</option> or
<option>combined</option> as the value. If <option>name</option>, the system manager will use unit
names in status messages, instead of the longer and more informative descriptions set with
<varname>Description=</varname>, see
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
<option>combined</option>, the system manager will use unit names and description in status messages.
</para></listitem>
</varlistentry>

View File

@ -840,9 +840,11 @@
<varlistentry>
<term><varname>systemd.status_unit_format=</varname></term>
<listitem><para>Takes either <option>name</option> or <option>description</option> as the value. If
<option>name</option>, the system manager will use unit names in status messages. If specified,
overrides the system manager configuration file option <option>StatusUnitFormat=</option>, see
<listitem><para>Takes <option>name</option>, <option>description</option> or
<option>combined</option> as the value. If <option>name</option>, the system manager will use unit
names in status messages. If <option>combined</option>, the system manager will use unit names and
description in status messages. When specified, overrides the system manager configuration file
option <option>StatusUnitFormat=</option>, see
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
</varlistentry>

View File

@ -200,7 +200,7 @@ option('default-net-naming-scheme', type : 'combo',
choices : ['latest', 'v238', 'v239', 'v240'],
description : 'default net.naming-scheme= value')
option('status-unit-format-default', type : 'combo',
choices : ['description', 'name'],
choices : ['description', 'name', 'combined'],
description : 'use unit name or description in messages by default')
option('time-epoch', type : 'integer', value : '-1',
description : 'time epoch for time clients')

View File

@ -123,6 +123,7 @@ int status_printf(const char *status, ShowStatusFlags flags, const char *format,
static const char* const status_unit_format_table[_STATUS_UNIT_FORMAT_MAX] = {
[STATUS_UNIT_FORMAT_NAME] = "name",
[STATUS_UNIT_FORMAT_DESCRIPTION] = "description",
[STATUS_UNIT_FORMAT_COMBINED] = "combined",
};
DEFINE_STRING_TABLE_LOOKUP(status_unit_format, StatusUnitFormat);

View File

@ -25,6 +25,7 @@ typedef enum ShowStatusFlags {
typedef enum StatusUnitFormat {
STATUS_UNIT_FORMAT_NAME,
STATUS_UNIT_FORMAT_DESCRIPTION,
STATUS_UNIT_FORMAT_COMBINED,
_STATUS_UNIT_FORMAT_MAX,
_STATUS_UNIT_FORMAT_INVALID = -EINVAL,
} StatusUnitFormat;