chiark / gitweb /
detect-virt: use /proc/device-tree
authorAndrew Jones <drjones@redhat.com>
Tue, 31 Mar 2015 09:08:11 +0000 (11:08 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 31 Mar 2015 13:36:53 +0000 (15:36 +0200)
Kernel doc Documentation/ABI/testing/sysfs-firmware-ofw says that
the /proc/device-tree symlink should be used, as opposed to
directly accessing /sys/firmware/devicetree/base. The former is
ABI, but not the later.

src/shared/virt.c

index 7c1381f4b81147134062afe66059708da0bf3978..aa3501f42916c70e2137124a20d59ef5dca66aed 100644 (file)
@@ -106,7 +106,7 @@ static int detect_vm_devicetree(const char **_id) {
         _cleanup_free_ char *hvtype = NULL;
         int r;
 
-        r = read_one_line_file("/sys/firmware/devicetree/base/hypervisor/compatible", &hvtype);
+        r = read_one_line_file("/proc/device-tree/hypervisor/compatible", &hvtype);
         if (r >= 0) {
                 if (streq(hvtype, "linux,kvm")) {
                         *_id = "kvm";