File tree Expand file tree Collapse file tree 3 files changed +15
-10
lines changed
Expand file tree Collapse file tree 3 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -1254,7 +1254,7 @@ static int status_welcome(void) {
12541254 _cleanup_free_ char * pretty_name = NULL , * ansi_color = NULL ;
12551255 int r ;
12561256
1257- if (IN_SET (arg_show_status , SHOW_STATUS_NO , SHOW_STATUS_AUTO ))
1257+ if (! show_status_on (arg_show_status ))
12581258 return 0 ;
12591259
12601260 r = parse_os_release (NULL ,
Original file line number Diff line number Diff line change @@ -4083,12 +4083,14 @@ void manager_set_show_status(Manager *m, ShowStatus mode) {
40834083 if (!MANAGER_IS_SYSTEM (m ))
40844084 return ;
40854085
4086- if (m -> show_status != mode )
4087- log_debug ("%s showing of status." ,
4088- mode == SHOW_STATUS_NO ? "Disabling" : "Enabling" );
4086+ bool enabled = show_status_on (mode );
4087+ if (mode != m -> show_status )
4088+ log_debug ("%s showing of status (%s)." ,
4089+ enabled ? "Enabling" : "Disabling" ,
4090+ strna (show_status_to_string (mode )));
40894091 m -> show_status = mode ;
40904092
4091- if (IN_SET ( mode , SHOW_STATUS_TEMPORARY , SHOW_STATUS_YES ) )
4093+ if (enabled )
40924094 (void ) touch ("/run/systemd/show-status" );
40934095 else
40944096 (void ) unlink ("/run/systemd/show-status" );
@@ -4110,7 +4112,7 @@ static bool manager_get_show_status(Manager *m, StatusType type) {
41104112 if (type != STATUS_TYPE_EMERGENCY && manager_check_ask_password (m ) > 0 )
41114113 return false;
41124114
4113- return IN_SET (m -> show_status , SHOW_STATUS_TEMPORARY , SHOW_STATUS_YES );
4115+ return show_status_on (m -> show_status );
41144116}
41154117
41164118const char * manager_get_confirm_spawn (Manager * m ) {
Original file line number Diff line number Diff line change 88/* Manager status */
99
1010typedef enum ShowStatus {
11- SHOW_STATUS_NO ,
12- SHOW_STATUS_AUTO ,
13- SHOW_STATUS_TEMPORARY ,
14- SHOW_STATUS_YES ,
11+ SHOW_STATUS_NO , /* printing of status is disabled */
12+ SHOW_STATUS_AUTO , /* disabled but may flip to _TEMPORARY */
13+ SHOW_STATUS_TEMPORARY , /* enabled temporarily, may flip back to _AUTO */
14+ SHOW_STATUS_YES , /* printing of status is enabled */
1515 _SHOW_STATUS_MAX ,
1616 _SHOW_STATUS_INVALID = -1 ,
1717} ShowStatus ;
@@ -28,6 +28,9 @@ typedef enum StatusUnitFormat {
2828 _STATUS_UNIT_FORMAT_INVALID = -1 ,
2929} StatusUnitFormat ;
3030
31+ static inline bool show_status_on (ShowStatus s ) {
32+ return IN_SET (s , SHOW_STATUS_TEMPORARY , SHOW_STATUS_YES );
33+ }
3134ShowStatus show_status_from_string (const char * v ) _const_ ;
3235const char * show_status_to_string (ShowStatus s ) _pure_ ;
3336int parse_show_status (const char * v , ShowStatus * ret );
You can’t perform that action at this time.
0 commit comments