diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-19 01:35:32 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-22 07:27:06 +0100 |
commit | 37cf83d9bfdd9f6859b6f2654d8ec3bbb17873b2 (patch) | |
tree | a54017deab9377c616263f5255d97150b3ccfa10 | |
parent | sd-device-enumerator: introduce device_enumerator_add_prioritized_subsystem() (diff) | |
download | systemd-37cf83d9bfdd9f6859b6f2654d8ec3bbb17873b2.tar.xz systemd-37cf83d9bfdd9f6859b6f2654d8ec3bbb17873b2.zip |
sd-device-enumerator: drop /sys/subsystem support
This addresses the comment by Lennart
https://github.com/systemd/systemd/pull/22662#discussion_r829799863:
> /sys/subsystem is preparation for a future that never came.
> And given that the main proponent of this left Linux kernel
> development (Kay), I doubt this will ever come. So maybe we
> should start dropping references to /sys/subsystem/ given it's
> unlikely to materialize anytime soon.
-rw-r--r-- | src/libsystemd/sd-device/device-enumerator.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c index 3878bdde70..668a92ca0c 100644 --- a/src/libsystemd/sd-device/device-enumerator.c +++ b/src/libsystemd/sd-device/device-enumerator.c @@ -838,26 +838,17 @@ static int enumerator_scan_devices_children(sd_device_enumerator *enumerator) { } static int enumerator_scan_devices_all(sd_device_enumerator *enumerator) { - int r = 0; + int k, r = 0; log_debug("sd-device-enumerator: Scan all dirs"); - if (access("/sys/subsystem", F_OK) >= 0) { - /* we have /subsystem/, forget all the old stuff */ - r = enumerator_scan_dir(enumerator, "subsystem", "devices", NULL); - if (r < 0) - return log_debug_errno(r, "sd-device-enumerator: Failed to scan /sys/subsystem: %m"); - } else { - int k; - - k = enumerator_scan_dir(enumerator, "bus", "devices", NULL); - if (k < 0) - r = log_debug_errno(k, "sd-device-enumerator: Failed to scan /sys/bus: %m"); + k = enumerator_scan_dir(enumerator, "bus", "devices", NULL); + if (k < 0) + r = log_debug_errno(k, "sd-device-enumerator: Failed to scan /sys/bus: %m"); - k = enumerator_scan_dir(enumerator, "class", NULL, NULL); - if (k < 0) - r = log_debug_errno(k, "sd-device-enumerator: Failed to scan /sys/class: %m"); - } + k = enumerator_scan_dir(enumerator, "class", NULL, NULL); + if (k < 0) + r = log_debug_errno(k, "sd-device-enumerator: Failed to scan /sys/class: %m"); return r; } @@ -923,7 +914,6 @@ _public_ sd_device *sd_device_enumerator_get_device_next(sd_device_enumerator *e } int device_enumerator_scan_subsystems(sd_device_enumerator *enumerator) { - const char *subsysdir; int r = 0, k; assert(enumerator); @@ -941,21 +931,16 @@ int device_enumerator_scan_subsystems(sd_device_enumerator *enumerator) { r = log_debug_errno(k, "sd-device-enumerator: Failed to scan modules: %m"); } - if (access("/sys/subsystem", F_OK) >= 0) - subsysdir = "subsystem"; - else - subsysdir = "bus"; - /* subsystems (only buses support coldplug) */ if (match_subsystem(enumerator, "subsystem")) { - k = enumerator_scan_dir_and_add_devices(enumerator, subsysdir, NULL, NULL); + k = enumerator_scan_dir_and_add_devices(enumerator, "bus", NULL, NULL); if (k < 0) r = log_debug_errno(k, "sd-device-enumerator: Failed to scan subsystems: %m"); } /* subsystem drivers */ if (match_subsystem(enumerator, "drivers")) { - k = enumerator_scan_dir(enumerator, subsysdir, "drivers", "drivers"); + k = enumerator_scan_dir(enumerator, "bus", "drivers", "drivers"); if (k < 0) r = log_debug_errno(k, "sd-device-enumerator: Failed to scan drivers: %m"); } |