[libvirt] [PATCH] look for DMI information in /sys/class too
Daniel Veillard
veillard at redhat.com
Fri Jan 8 10:50:17 UTC 2010
On Fri, Jan 08, 2010 at 09:35:36AM +0100, Guido Günther wrote:
> Hi,
> attached patch looks for the DMI information in /sys/class since older
> kernels (e.g. 2.6.26) have it there.
> Cheers,
> -- Guido
> From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
> Date: Thu, 7 Jan 2010 10:13:51 +0100
> Subject: [PATCH] Also look for dmi information in /sys/class
>
> older kernels such as 2.6.26 have it there.
> ---
> src/node_device/node_device_udev.c | 7 ++++++-
> src/node_device/node_device_udev.h | 1 +
> 2 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index 22c5f2b..7a9c1e5 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -1407,7 +1407,12 @@ static int udevSetupSystemDev(void)
> device = udev_device_new_from_syspath(udev, DMI_DEVPATH);
> if (device == NULL) {
> VIR_ERROR("Failed to get udev device for syspath '%s'\n", DMI_DEVPATH);
> - goto out;
> +
> + device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
> + if (device == NULL) {
> + VIR_ERROR("Failed to get udev device for syspath '%s'\n", DMI_DEVPATH_FALLBACK);
> + goto out;
> + }
> }
>
> data = &def->caps->data;
> diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_device_udev.h
> index 0fd39ae..6c83412 100644
> --- a/src/node_device/node_device_udev.h
> +++ b/src/node_device/node_device_udev.h
> @@ -26,6 +26,7 @@
> #define SYSFS_DATA_SIZE 4096
> #define DRV_STATE_UDEV_MONITOR(ds) ((struct udev_monitor *)((ds)->privateData))
> #define DMI_DEVPATH "/sys/devices/virtual/dmi/id"
> +#define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id"
> #define PROPERTY_FOUND 0
> #define PROPERTY_MISSING 1
> #define PROPERTY_ERROR -1
> --
Looks safe to me, assuming the kernel information are exported in the
same way,
ACK
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list