From: Yu Watanabe Date: Tue, 9 Nov 2021 01:21:23 +0000 (+0900) Subject: hostnamed: use /proc/device-tree to get chassis type X-Git-Tag: v250-rc1~309^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e6cbe6970f8e642a2229e0631eaa743fa86fcd29;p=thirdparty%2Fsystemd.git hostnamed: use /proc/device-tree to get chassis type From https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw --- Userspace must not use the /sys/firmware/devicetree/base path directly, but instead should follow /proc/device-tree symlink. It is possible that the absolute path will change in the future, but the symlink is the stable ABI. --- Addresses the comment https://github.com/systemd/systemd/pull/20731#discussion_r744095262. --- diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index bcd24498619..e2c9f8ab677 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -302,7 +302,7 @@ try_acpi: } try_devicetree: - r = read_one_line_file("/sys/firmware/devicetree/base/chassis-type", &type); + r = read_one_line_file("/proc/device-tree/chassis-type", &type); if (r < 0) { log_debug_errno(r, "Failed to read device-tree chassis type, ignoring: %m"); return NULL;