1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

tree-wide: set description for device manager

This commit is contained in:
Yu Watanabe 2022-10-19 04:46:24 +09:00
parent 9b784d7c16
commit 17bf3c550d
4 changed files with 18 additions and 6 deletions

View File

@ -870,6 +870,8 @@ static int make_security_device_monitor(
if (r < 0)
return log_error_errno(r, "Failed to allocate device monitor: %m");
(void) sd_device_monitor_set_description(monitor, "security-device");
r = sd_device_monitor_filter_add_match_tag(monitor, "security-device");
if (r < 0)
return log_error_errno(r, "Failed to configure device monitor: %m");
@ -1369,6 +1371,8 @@ static int make_tpm2_device_monitor(
if (r < 0)
return log_error_errno(r, "Failed to allocate device monitor: %m");
(void) sd_device_monitor_set_description(monitor, "tpmrm");
r = sd_device_monitor_filter_add_match_subsystem_devtype(monitor, "tpmrm", NULL);
if (r < 0)
return log_error_errno(r, "Failed to configure device monitor: %m");

View File

@ -809,7 +809,7 @@ static int manager_connect_udev(Manager *m) {
if (r < 0)
return r;
(void) sd_event_source_set_description(sd_device_monitor_get_event_source(m->device_seat_monitor), "logind-seat-monitor");
(void) sd_device_monitor_set_description(m->device_seat_monitor, "seat");
r = sd_device_monitor_new(&m->device_monitor);
if (r < 0)
@ -835,7 +835,7 @@ static int manager_connect_udev(Manager *m) {
if (r < 0)
return r;
(void) sd_event_source_set_description(sd_device_monitor_get_event_source(m->device_monitor), "logind-device-monitor");
(void) sd_device_monitor_set_description(m->device_monitor, "input,graphics,drm");
/* Don't watch keys if nobody cares */
if (!manager_all_buttons_ignored(m)) {
@ -859,7 +859,7 @@ static int manager_connect_udev(Manager *m) {
if (r < 0)
return r;
(void) sd_event_source_set_description(sd_device_monitor_get_event_source(m->device_button_monitor), "logind-button-monitor");
(void) sd_device_monitor_set_description(m->device_button_monitor, "button");
}
/* Don't bother watching VCSA devices, if nobody cares */
@ -881,7 +881,7 @@ static int manager_connect_udev(Manager *m) {
if (r < 0)
return r;
(void) sd_event_source_set_description(sd_device_monitor_get_event_source(m->device_vcsa_monitor), "logind-vcsa-monitor");
(void) sd_device_monitor_set_description(m->device_vcsa_monitor, "vcsa");
}
return 0;

View File

@ -237,6 +237,15 @@ static int device_wait_for_initialization_internal(
return log_error_errno(r, "Failed to add %s subsystem match to monitor: %m", subsystem);
}
_cleanup_free_ char *desc = NULL;
const char *sysname = NULL;
if (device)
(void) sd_device_get_sysname(device, &sysname);
desc = strjoin(sysname ?: subsystem, devlink ? ":" : ":initialization", devlink);
if (desc)
(void) sd_device_monitor_set_description(monitor, desc);
r = sd_device_monitor_attach_event(monitor, event);
if (r < 0)
return log_error_errno(r, "Failed to attach event to device monitor: %m");

View File

@ -91,8 +91,7 @@ static int setup_monitor(MonitorNetlinkGroup sender, sd_event *event, sd_device_
if (r < 0)
return log_error_errno(r, "Failed to start device monitor: %m");
(void) sd_event_source_set_description(sd_device_monitor_get_event_source(monitor),
sender == MONITOR_GROUP_UDEV ? "device-monitor-udev" : "device-monitor-kernel");
(void) sd_device_monitor_set_description(monitor, sender == MONITOR_GROUP_UDEV ? "udev" : "kernel");
*ret = TAKE_PTR(monitor);
return 0;