summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-04-06 19:01:50 +0600
committerDaniil Baturin <daniil@baturin.org>2015-04-06 19:01:50 +0600
commit736dae9f47ab085e8897e1398ad02dfb4cefd3d9 (patch)
treeea678a2876d05a15775eff1d0c883b28ac1fa2a9
parent29a9fc9af63a4c897ac718894f8f01bb50a38104 (diff)
downloadhvinfo-736dae9f47ab085e8897e1398ad02dfb4cefd3d9.tar.gz
hvinfo-736dae9f47ab085e8897e1398ad02dfb4cefd3d9.zip
License headers, formatting cleanup.
-rw-r--r--Makefile17
-rwxr-xr-xmkconfig.sh16
-rw-r--r--src/config.ads.in19
-rw-r--r--src/hvinfo.adb27
-rw-r--r--src/hvinfo_util.adb19
-rw-r--r--src/hvinfo_util.ads19
-rw-r--r--src/hypervisor_check.adb41
-rw-r--r--src/hypervisor_check.ads19
8 files changed, 162 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 7dc7697..1c2d848 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,20 @@
+# Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+#
+# This file is part of hvinfo.
+#
+# hvinfo is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# hvinfo is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
+
PREFIX = /usr
BINDIR = bin
diff --git a/mkconfig.sh b/mkconfig.sh
index d3bb56a..d8d0eaf 100755
--- a/mkconfig.sh
+++ b/mkconfig.sh
@@ -1,4 +1,20 @@
#!/bin/sh
+# Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+#
+# This file is part of hvinfo.
+#
+# hvinfo is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# hvinfo is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
HVINFO_LINUX=False
HVINFO_FREEBSD=False
diff --git a/src/config.ads.in b/src/config.ads.in
index 386ad60..3726357 100644
--- a/src/config.ads.in
+++ b/src/config.ads.in
@@ -1,3 +1,22 @@
+------------------------------------------------------------------------
+-- Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+--
+-- This file is part of hvinfo.
+--
+-- hvinfo is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- hvinfo is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
+------------------------------------------------------------------------
+
package Config is
Linux : constant Boolean := $LINUX;
diff --git a/src/hvinfo.adb b/src/hvinfo.adb
index e15c75d..ac65516 100644
--- a/src/hvinfo.adb
+++ b/src/hvinfo.adb
@@ -1,3 +1,22 @@
+------------------------------------------------------------------------
+-- Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+--
+-- This file is part of hvinfo.
+--
+-- hvinfo is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- hvinfo is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
+------------------------------------------------------------------------
+
with Ada.Strings.Unbounded;
with Ada.Text_IO;
with Ada.Text_IO.Unbounded_IO;
@@ -49,10 +68,10 @@ begin
if Xen_Present then
if Hypervisor_Present then
-- This is Xen HVM
- IO.Put_Line(Xen_HVM);
+ IO.Put_Line (Xen_HVM);
else
-- Xen present and no CPUID leaf means Xen PV
- IO.Put_Line(Xen_PV);
+ IO.Put_Line (Xen_PV);
end if;
elsif Hypervisor_Present then
-- This covers KVM, VMware, and other hypervisors
@@ -67,10 +86,10 @@ begin
-- Sadly, this will give a wrong result on systems without
-- DMI reading API accessible to unprivileged users
SMBIOS_HV_Name := Get_DMI_Vendor_Name;
- if Known_DMI_HV_Vendor(SMBIOS_HV_Name) then
+ if Known_DMI_HV_Vendor (SMBIOS_HV_Name) then
UIO.Put_Line (SMBIOS_HV_Name);
else
- IO.Put_Line(IO.Standard_Error, "No hypervisor detected");
+ IO.Put_Line (IO.Standard_Error, "No hypervisor detected");
CL.Set_Exit_Status (1);
end if;
elsif VirtualBox_PCI_Present then
diff --git a/src/hvinfo_util.adb b/src/hvinfo_util.adb
index d4e3f20..1c69e13 100644
--- a/src/hvinfo_util.adb
+++ b/src/hvinfo_util.adb
@@ -1,3 +1,22 @@
+------------------------------------------------------------------------
+-- Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+--
+-- This file is part of hvinfo.
+--
+-- hvinfo is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- hvinfo is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
+------------------------------------------------------------------------
+
package body HVInfo_Util is
procedure Print_Help is
diff --git a/src/hvinfo_util.ads b/src/hvinfo_util.ads
index b2530e9..3545ae5 100644
--- a/src/hvinfo_util.ads
+++ b/src/hvinfo_util.ads
@@ -1,3 +1,22 @@
+------------------------------------------------------------------------
+-- Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+--
+-- This file is part of hvinfo.
+--
+-- hvinfo is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- hvinfo is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
+------------------------------------------------------------------------
+
with Ada.Command_line;
with Ada.Text_IO;
diff --git a/src/hypervisor_check.adb b/src/hypervisor_check.adb
index df8391b..2de7030 100644
--- a/src/hypervisor_check.adb
+++ b/src/hypervisor_check.adb
@@ -1,3 +1,22 @@
+------------------------------------------------------------------------
+-- Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+--
+-- This file is part of hvinfo.
+--
+-- hvinfo is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- hvinfo is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
+------------------------------------------------------------------------
+
package body Hypervisor_Check is
function CPUID (Arg : Unsigned_32) return CPUID_Registers is
@@ -43,7 +62,7 @@ package body Hypervisor_Check is
File : IO.File_Type;
Result : US.Unbounded_String;
begin
- IO.Open(File => File, Name => Path, Mode => IO.In_File);
+ IO.Open (File => File, Name => Path, Mode => IO.In_File);
UIO.Get_Line (File, Result);
IO.Close(File);
return Result;
@@ -56,13 +75,13 @@ package body Hypervisor_Check is
function Xen_Present return Boolean is
begin
if Config.Linux then
- if Contains(Head_Of_File(Linux_Sys_HV_Type_File), "xen") then
+ if Contains (Head_Of_File (Linux_Sys_HV_Type_File), "xen") then
return True;
else
return False;
end if;
elsif Config.FreeBSD then
- return Command_Succeeds(Interfaces.C.To_C(FreeBSD_Xen_Present_Command));
+ return Command_Succeeds (Interfaces.C.To_C (FreeBSD_Xen_Present_Command));
else
raise OS_Not_Supported;
end if;
@@ -85,11 +104,11 @@ package body Hypervisor_Check is
function Command_Succeeds (Command : Interfaces.C.Char_Array) return Boolean is
use Interfaces.C;
function Sys (Arg : Char_Array) return Integer;
- pragma Import(C, Sys, "system");
+ pragma Import (C, Sys, "system");
Ret_Val : Integer;
begin
- Ret_Val := Sys(Command);
+ Ret_Val := Sys (Command);
if Ret_Val > 0 then
return False;
else
@@ -140,7 +159,7 @@ package body Hypervisor_Check is
if Config.Linux then
-- Linux provides DMI info via sysfs, but on systems
-- without SMBIOS it's not available
- if Ada.Directories.Exists("/sys/class/dmi") then
+ if Ada.Directories.Exists ("/sys/class/dmi") then
return True;
else
return False;
@@ -167,13 +186,13 @@ package body Hypervisor_Check is
Vendor_String, Vendor_Name : US.Unbounded_String;
begin
Vendor_String := Get_DMI_Vendor_String;
- if Contains(Vendor_String, VMWare_DMI_Pattern) then
+ if Contains (Vendor_String, VMWare_DMI_Pattern) then
Vendor_Name := US.To_Unbounded_String (VMWare);
- elsif Contains(Vendor_String, HyperV_DMI_Pattern) then
+ elsif Contains (Vendor_String, HyperV_DMI_Pattern) then
Vendor_Name := US.To_Unbounded_String (HyperV);
- elsif Contains(Vendor_String, VirtualBox_DMI_Pattern) then
+ elsif Contains (Vendor_String, VirtualBox_DMI_Pattern) then
Vendor_Name := US.To_Unbounded_String (VirtualBox);
- elsif Contains(Vendor_String, Parallels_DMI_Pattern) then
+ elsif Contains (Vendor_String, Parallels_DMI_Pattern) then
Vendor_Name := US.To_Unbounded_String (Parallels);
else
Vendor_Name := US.To_Unbounded_String ("");
@@ -184,7 +203,7 @@ package body Hypervisor_Check is
function Known_DMI_HV_Vendor (Name : US.Unbounded_String) return Boolean is
use US;
begin
- if Name /= US.To_Unbounded_String("") then
+ if Name /= US.To_Unbounded_String ("") then
return True;
else
return False;
diff --git a/src/hypervisor_check.ads b/src/hypervisor_check.ads
index 3941f8f..71a9463 100644
--- a/src/hypervisor_check.ads
+++ b/src/hypervisor_check.ads
@@ -1,3 +1,22 @@
+------------------------------------------------------------------------
+-- Copyright (C) 2015 Daniil Baturin <daniil@baturin.org>
+--
+-- This file is part of hvinfo.
+--
+-- hvinfo is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- hvinfo is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with hvinfo. If not, see <http://www.gnu.org/licenses/>.
+------------------------------------------------------------------------
+
with Interfaces; use Interfaces;
with Interfaces.C;
with System.Machine_Code; use System.Machine_Code;