]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/SysFSTools.pm
Tools.pm: do not ignore "0" in split_list
[pve-common.git] / src / PVE / SysFSTools.pm
index 4b23668538dca39293917e80e623f2a08f9cfbd0..e83d1630f3be9cef930b9013a2da73d76f381672 100644 (file)
@@ -11,16 +11,17 @@ my $pcisysfs = "/sys/bus/pci";
 my $pciregex = "([a-f0-9]{4}):([a-f0-9]{2}):([a-f0-9]{2})\.([a-f0-9])";
 
 sub lspci {
-    my ($filter) = @_;
+    my ($id_filter) = @_;
 
     my $devices = {};
 
     dir_glob_foreach("$pcisysfs/devices", $pciregex, sub {
             my (undef, undef, $bus, $slot, $function) = @_;
+
            my $id = "$bus:$slot";
-           return if defined($filter) && $id ne $filter;
-           my $res = { id => $id, function => $function};
-           push @{$devices->{$id}}, $res;
+           return if defined($id_filter) && $id_filter ne $id;
+
+           push @{$devices->{$id}}, { id => $id, function => $function };
     });
 
     # Entries should be sorted by functions.
@@ -33,7 +34,7 @@ sub lspci {
 }
 
 sub check_iommu_support{
-    # iommu support if there is anything in /sys/class/iommu besides . or ..
+    # we have IOMMU support if /sys/class/iommu/ is populated
     return PVE::Tools::dir_glob_regex('/sys/class/iommu/', "[^\.].*");
 }