[libvirt PATCH] Revert "Also look for dmi information in /sys/class"

Ján Tomko posted 1 patch 3 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/352f7fdeb0a6c290cea3d88a0cca168d42071644.1601566027.git.jtomko@redhat.com
src/node_device/node_device_udev.c | 13 +++++--------
src/node_device/node_device_udev.h |  1 -
2 files changed, 5 insertions(+), 9 deletions(-)
[libvirt PATCH] Revert "Also look for dmi information in /sys/class"
Posted by Ján Tomko 3 years, 5 months ago
Assume nobody runs current libvirt on kernels such as 2.6.26.

Kernel commit 9f9c9cbb60576a1518d0bf93fb8e499cffccf377 (released
in 3.8) mentions the new path and I believe it was added by:
commit 948af1f0bbc8526448e8cbe3f8d3bf211bdf5181
    firmware: Basic dmi-sysfs support
(released in 2.6.39), but I cannot figure out how all that
kernel automagic works.

This reverts commit 4c81b0fdc57b23d80b1b4752cd6143d15c02e9c8

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/node_device/node_device_udev.c | 13 +++++--------
 src/node_device/node_device_udev.h |  1 -
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 2d0ca27fc6..29a7eaa07c 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1731,14 +1731,11 @@ udevGetDMIData(virNodeDevCapSystemPtr syscap)
 
     device = udev_device_new_from_syspath(udev, DMI_DEVPATH);
     if (device == NULL) {
-        device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
-        if (device == NULL) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to get udev device for syspath '%s' or '%s'"),
-                           DMI_DEVPATH, DMI_DEVPATH_FALLBACK);
-            virObjectUnlock(priv);
-            return;
-        }
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get udev device for syspath '%s'"),
+                       DMI_DEVPATH);
+        virObjectUnlock(priv);
+        return;
     }
     virObjectUnlock(priv);
 
diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_device_udev.h
index 996677dfe0..eab22a9182 100644
--- a/src/node_device/node_device_udev.h
+++ b/src/node_device/node_device_udev.h
@@ -24,4 +24,3 @@
 
 #define SYSFS_DATA_SIZE 4096
 #define DMI_DEVPATH "/sys/devices/virtual/dmi/id"
-#define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id"
-- 
2.26.2

Re: [libvirt PATCH] Revert "Also look for dmi information in /sys/class"
Posted by Michal Prívozník 3 years, 5 months ago
On 10/1/20 5:27 PM, Ján Tomko wrote:
> Assume nobody runs current libvirt on kernels such as 2.6.26.
> 
> Kernel commit 9f9c9cbb60576a1518d0bf93fb8e499cffccf377 (released
> in 3.8) mentions the new path and I believe it was added by:
> commit 948af1f0bbc8526448e8cbe3f8d3bf211bdf5181
>      firmware: Basic dmi-sysfs support
> (released in 2.6.39), but I cannot figure out how all that
> kernel automagic works.
> 
> This reverts commit 4c81b0fdc57b23d80b1b4752cd6143d15c02e9c8
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>   src/node_device/node_device_udev.c | 13 +++++--------
>   src/node_device/node_device_udev.h |  1 -
>   2 files changed, 5 insertions(+), 9 deletions(-)

Yeah, it's not very easy to find the code that corresponds to a sysfs 
file or a directory in the path to the file.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal