fix and simplify kvm_version()

This was never actually used, but we want to use it as
alternative to checking /proc/cpuinfo for 'hvm' on ARM.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2018-11-12 14:10:33 +01:00 committed by Thomas Lamprecht
parent c701be3243
commit 646f2df43c

View File

@ -1331,19 +1331,15 @@ for (my $i = 0; $i < $MAX_UNUSED_DISKS; $i++) {
my $kvm_api_version = 0;
sub kvm_version {
return $kvm_api_version if $kvm_api_version;
my $fh = IO::File->new("</dev/kvm") ||
return 0;
open my $fh, '<', '/dev/kvm'
or return undef;
if (my $v = $fh->ioctl(KVM_GET_API_VERSION(), 0)) {
$kvm_api_version = $v;
}
# 0xae00 => KVM_GET_API_VERSION
$kvm_api_version = ioctl($fh, 0xae00, 0);
$fh->close();
return $kvm_api_version;
return $kvm_api_version;
}
my $kvm_user_version;