diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-02-28 22:49:19 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-03-01 11:42:12 +0100 |
commit | 5ca02bfc39685ffa62aa46533f951bd8ede89082 (patch) | |
tree | c72384aa4ce86dbf51277da7438aa1f4c0bac8a1 /src/core/show-status.h | |
parent | 07336a067216f3e5d7551b090c5972c120805d0e (diff) | |
download | systemd-5ca02bfc39685ffa62aa46533f951bd8ede89082.tar.gz |
core: fix message about show status state
We would say "Enabling" also for SHOW_STATUS_AUTO, which is actually
"soft off". So just print the exact state to make things easier to understand.
Also add a helper function to avoid repeating the enum value list.
For #14814.
Diffstat (limited to 'src/core/show-status.h')
-rw-r--r-- | src/core/show-status.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/show-status.h b/src/core/show-status.h index 247caec77c..0686b60d74 100644 --- a/src/core/show-status.h +++ b/src/core/show-status.h @@ -8,10 +8,10 @@ /* Manager status */ typedef enum ShowStatus { - SHOW_STATUS_NO, - SHOW_STATUS_AUTO, - SHOW_STATUS_TEMPORARY, - SHOW_STATUS_YES, + SHOW_STATUS_NO, /* printing of status is disabled */ + SHOW_STATUS_AUTO, /* disabled but may flip to _TEMPORARY */ + SHOW_STATUS_TEMPORARY, /* enabled temporarily, may flip back to _AUTO */ + SHOW_STATUS_YES, /* printing of status is enabled */ _SHOW_STATUS_MAX, _SHOW_STATUS_INVALID = -1, } ShowStatus; @@ -28,6 +28,9 @@ typedef enum StatusUnitFormat { _STATUS_UNIT_FORMAT_INVALID = -1, } StatusUnitFormat; +static inline bool show_status_on(ShowStatus s) { + return IN_SET(s, SHOW_STATUS_TEMPORARY, SHOW_STATUS_YES); +} ShowStatus show_status_from_string(const char *v) _const_; const char* show_status_to_string(ShowStatus s) _pure_; int parse_show_status(const char *v, ShowStatus *ret); |