From 661fb50b55d6279d88530ca60b27b9e66426905d Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 30 Mar 2018 04:32:52 +0700 Subject: Add a debug option and refactor the checks. --- src/hypervisor_check.adb | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/hypervisor_check.adb') diff --git a/src/hypervisor_check.adb b/src/hypervisor_check.adb index 4d87cb0..076348b 100644 --- a/src/hypervisor_check.adb +++ b/src/hypervisor_check.adb @@ -1,5 +1,5 @@ ------------------------------------------------------------------------ --- Copyright (C) 2015 Daniil Baturin +-- Copyright (C) 2018 Daniil Baturin -- -- This file is part of hvinfo. -- @@ -186,10 +186,9 @@ package body Hypervisor_Check is return Name; end Get_DMI_Vendor_String; - function Get_DMI_Vendor_Name return US.Unbounded_String is - Vendor_String, Vendor_Name : US.Unbounded_String; + function Get_DMI_Vendor_Name (Vendor_String : US.Unbounded_String) return US.Unbounded_String is + Vendor_Name : US.Unbounded_String; begin - Vendor_String := Get_DMI_Vendor_String; if Contains (Vendor_String, VMWare_DMI_Pattern) then Vendor_Name := US.To_Unbounded_String (VMWare); elsif Contains (Vendor_String, HyperV_DMI_Pattern) then @@ -199,21 +198,12 @@ package body Hypervisor_Check is elsif Contains (Vendor_String, Parallels_DMI_Pattern) then Vendor_Name := US.To_Unbounded_String (Parallels); else - Vendor_Name := US.To_Unbounded_String (""); + Vendor_Name := US.Null_Unbounded_String; end if; + return Vendor_Name; end Get_DMI_Vendor_Name; - function Known_DMI_HV_Vendor (Name : US.Unbounded_String) return Boolean is - use US; - begin - if Name /= US.To_Unbounded_String ("") then - return True; - else - return False; - end if; - end Known_DMI_HV_Vendor; - function VirtualBox_PCI_Present return Boolean is begin if Config.FreeBSD then -- cgit v1.2.3