diff options
author | Daniil Baturin <daniil@baturin.org> | 2015-04-04 16:08:04 +0600 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-04-04 16:08:04 +0600 |
commit | 577ffc85192f1d445fe42c8f1665b2136c3df575 (patch) | |
tree | 7f13fd0572bae75a8bf400c5826307aa608aad3d | |
parent | c7653cc0c52a7fe30ab95a98a2e750e535c7e1c9 (diff) | |
download | hvinfo-577ffc85192f1d445fe42c8f1665b2136c3df575.tar.gz hvinfo-577ffc85192f1d445fe42c8f1665b2136c3df575.zip |
Add a function to check if DMI is available on Linux.
This is useful for Xen PV vs. HVM detection.
-rw-r--r-- | src/hypervisor_check.adb | 13 | ||||
-rw-r--r-- | src/hypervisor_check.ads | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/hypervisor_check.adb b/src/hypervisor_check.adb index a8bf9a6..113f5f3 100644 --- a/src/hypervisor_check.adb +++ b/src/hypervisor_check.adb @@ -96,6 +96,19 @@ package body Hypervisor_Check is return Vendor_Name; end Get_Vendor_Name; + function DMI_Available return Boolean is + begin + if Config.Linux then + if Directories.Exists("/sys/class/dmi") then + return True; + else + return False; + end if; + else + raise OS_Not_Supported; + end if; + end DMI_Available; + function Get_DMI_Vendor_String return US.Unbounded_String is Name : US.Unbounded_String; begin diff --git a/src/hypervisor_check.ads b/src/hypervisor_check.ads index ebb16cc..86ca5a2 100644 --- a/src/hypervisor_check.ads +++ b/src/hypervisor_check.ads @@ -18,6 +18,8 @@ package Hypervisor_Check is function Hypervisor_Present return Boolean; + function DMI_Available return Boolean; + function Get_DMI_Vendor_Name return US.Unbounded_String; private |