From: Yu Watanabe Date: Mon, 28 Mar 2022 19:04:54 +0000 (+0900) Subject: sd-device: drop /sys/subsystem support X-Git-Tag: v251-rc2~243^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a43129b0a0cb5d0e86a0086aa277e99282855d14;p=thirdparty%2Fsystemd.git sd-device: drop /sys/subsystem support Follow-ups for 37cf83d9bfdd9f6859b6f2654d8ec3bbb17873b2. --- diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index f22088db57d..e7d398dbb0a 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -340,7 +340,7 @@ _public_ int sd_device_new_from_subsystem_sysname( assert_return(path_is_normalized(sysname), -EINVAL); if (streq(subsystem, "subsystem")) { - FOREACH_STRING(s, "/sys/subsystem/", "/sys/bus/", "/sys/class/") { + FOREACH_STRING(s, "/sys/bus/", "/sys/class/") { r = device_strjoin_new(s, sysname, NULL, NULL, ret); if (r < 0) return r; @@ -364,13 +364,11 @@ _public_ int sd_device_new_from_subsystem_sysname( const char *subsys = memdupa_suffix0(sysname, sep - sysname); sep++; - FOREACH_STRING(s, "/sys/subsystem/", "/sys/bus/") { - r = device_strjoin_new(s, subsys, "/drivers/", sep, ret); - if (r < 0) - return r; - if (r > 0) - return 0; - } + r = device_strjoin_new("/sys/bus/", subsys, "/drivers/", sep, ret); + if (r < 0) + return r; + if (r > 0) + return 0; } } @@ -380,13 +378,11 @@ _public_ int sd_device_new_from_subsystem_sysname( if (name[i] == '/') name[i] = '!'; - FOREACH_STRING(s, "/sys/subsystem/", "/sys/bus/") { - r = device_strjoin_new(s, subsystem, "/devices/", name, ret); - if (r < 0) - return r; - if (r > 0) - return 0; - } + r = device_strjoin_new("/sys/bus/", subsystem, "/devices/", name, ret); + if (r < 0) + return r; + if (r > 0) + return 0; r = device_strjoin_new("/sys/class/", subsystem, "/", name, ret); if (r < 0) @@ -869,9 +865,7 @@ _public_ int sd_device_get_subsystem(sd_device *device, const char **ret) { r = device_set_subsystem(device, "module"); else if (strstr(syspath, "/drivers/")) r = device_set_drivers_subsystem(device); - else if (PATH_STARTSWITH_SET(device->devpath, "/subsystem/", - "/class/", - "/bus/")) + else if (PATH_STARTSWITH_SET(device->devpath, "/class/", "/bus/")) r = device_set_subsystem(device, "subsystem"); else { device->subsystem_set = true;