From: Lennart Poettering Date: Wed, 21 May 2025 17:47:57 +0000 (+0200) Subject: logind: rename EnableWallMessages= configuration knob to WallMessages= (#37553) X-Git-Tag: v258-rc1~533 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfc9fd0147354f9b7c06a0cd8887431db754cf27;p=thirdparty%2Fsystemd.git logind: rename EnableWallMessages= configuration knob to WallMessages= (#37553) We generally frown on config options that are called EnableXYZ=/DisableXYZ=, hence drop this here too. Note that the original sin was that the pre-existing D-Bus property already used the prefix. But given that D-Bus properties are substantially more low-level (i.e. developer focused) than the config knobs, let's bite the bullet and name the configuration option cleanly, even if the dbus property carries the damn prefix. The knob was added post v257, hence this is not a compat break. Follow-up for: 130698dc20df9438c3f5b79ddf2c1a1b16c3f8fc --- diff --git a/man/logind.conf.xml b/man/logind.conf.xml index ff3ab5422a4..d62605e5ccc 100644 --- a/man/logind.conf.xml +++ b/man/logind.conf.xml @@ -411,13 +411,16 @@ - EnableWallMessages= + WallMessages= + Controls whether - wall1 - messages should be sent to the terminals of all currently logged in users upon shutdown or + wall1 messages + should be sent to the terminals of all currently logged in users upon shutdown or reboot. Defaults to yes, and can be changed at runtime via the DBus EnableWallMessages and WallMessagePrefix properties. diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 6a1ddf9ddee..3c51bc4a40a 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -42,7 +42,7 @@ void manager_reset_config(Manager *m) { m->remove_ipc = true; m->inhibit_delay_max = 5 * USEC_PER_SEC; m->user_stop_delay = 10 * USEC_PER_SEC; - m->enable_wall_messages = true; + m->wall_messages = true; m->handle_action_sleep_mask = HANDLE_ACTION_SLEEP_MASK_DEFAULT; diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index ad7646ab473..61c434c9848 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2595,7 +2595,7 @@ static int update_schedule_file(Manager *m) { (void) fchmod(fileno(f), 0644); serialize_usec(f, "USEC", m->scheduled_shutdown_timeout); - serialize_item_format(f, "WARN_WALL", "%s", one_zero(m->enable_wall_messages)); + serialize_item_format(f, "WARN_WALL", "%s", one_zero(m->wall_messages)); serialize_item_format(f, "MODE", "%s", handle_action_to_string(m->scheduled_shutdown_action)); serialize_item_format(f, "UID", UID_FMT, m->scheduled_shutdown_uid); @@ -2747,7 +2747,7 @@ void manager_load_scheduled_shutdown(Manager *m) { if (r < 0) log_debug_errno(r, "Failed to parse enabling wall messages"); else - m->enable_wall_messages = r; + m->wall_messages = r; } if (wall_message) { @@ -2876,7 +2876,7 @@ static int method_cancel_scheduled_shutdown(sd_bus_message *message, void *userd if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ - if (m->enable_wall_messages) { + if (m->wall_messages) { _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; const char *tty = NULL; uid_t uid = 0; @@ -3745,7 +3745,7 @@ static int method_set_wall_message( /* Short-circuit the operation if the desired state is already in place, to * avoid an unnecessary polkit permission check. */ if (streq_ptr(m->wall_message, empty_to_null(wall_message)) && - m->enable_wall_messages == enable_wall_messages) + m->wall_messages == enable_wall_messages) goto done; r = bus_verify_polkit_async( @@ -3763,7 +3763,7 @@ static int method_set_wall_message( if (r < 0) return log_oom(); - m->enable_wall_messages = enable_wall_messages; + m->wall_messages = enable_wall_messages; done: return sd_bus_reply_method_return(message, NULL); @@ -3902,7 +3902,7 @@ static int method_inhibit(sd_bus_message *message, void *userdata, sd_bus_error static const sd_bus_vtable manager_vtable[] = { SD_BUS_VTABLE_START(0), - SD_BUS_WRITABLE_PROPERTY("EnableWallMessages", "b", bus_property_get_bool, bus_property_set_bool, offsetof(Manager, enable_wall_messages), 0), + SD_BUS_WRITABLE_PROPERTY("EnableWallMessages", "b", bus_property_get_bool, bus_property_set_bool, offsetof(Manager, wall_messages), 0), SD_BUS_WRITABLE_PROPERTY("WallMessage", "s", NULL, NULL, offsetof(Manager, wall_message), 0), SD_BUS_PROPERTY("NAutoVTs", "u", NULL, offsetof(Manager, n_autovts), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/login/logind-gperf.gperf b/src/login/logind-gperf.gperf index bd64b8352ed..d32be829bdc 100644 --- a/src/login/logind-gperf.gperf +++ b/src/login/logind-gperf.gperf @@ -56,4 +56,4 @@ Login.SessionsMax, config_parse_uint64, 0, offse Login.DesignatedMaintenanceTime, config_parse_calendar, 0, offsetof(Manager, maintenance_time) Login.UserTasksMax, config_parse_compat_user_tasks_max, 0, 0 Login.StopIdleSessionSec, config_parse_sec_fix_0, 0, offsetof(Manager, stop_idle_session_usec) -Login.EnableWallMessages, config_parse_bool, 0, offsetof(Manager, enable_wall_messages) +Login.WallMessages, config_parse_bool, 0, offsetof(Manager, wall_messages) diff --git a/src/login/logind-wall.c b/src/login/logind-wall.c index ac5e593d3f5..dabedbdea06 100644 --- a/src/login/logind-wall.c +++ b/src/login/logind-wall.c @@ -81,7 +81,7 @@ static int warn_wall(Manager *m, usec_t n) { LOG_MESSAGE_ID(SD_MESSAGE_SHUTDOWN_SCHEDULED_STR), username ? "OPERATOR=%s" : NULL, username); - if (m->enable_wall_messages) + if (m->wall_messages) (void) wall(l, username, m->scheduled_shutdown_tty, logind_wall_tty_filter, m); return 1; diff --git a/src/login/logind.conf.in b/src/login/logind.conf.in index 8adf4393c7e..5cf8afec85f 100644 --- a/src/login/logind.conf.in +++ b/src/login/logind.conf.in @@ -52,4 +52,4 @@ #SessionsMax=8192 #StopIdleSessionSec=infinity #DesignatedMaintenanceTime= -#EnableWallMessages=yes +#WallMessages=yes diff --git a/src/login/logind.h b/src/login/logind.h index c3119166476..d7b5b248541 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -71,7 +71,7 @@ typedef struct Manager { bool unlink_nologin; char *wall_message; - bool enable_wall_messages; + bool wall_messages; sd_event_source *wall_message_timeout_source; bool shutdown_dry_run;