[pve-devel] [PATCH qemu-server v2 3/5] implement filter in lspci
Dominik Csapak
d.csapak at proxmox.com
Wed Nov 14 10:44:26 CET 2018
use the first parameter as a filter for devices, since it is used that way
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v2
PVE/QemuServer/PCI.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
index 4d75028..4de781e 100644
--- a/PVE/QemuServer/PCI.pm
+++ b/PVE/QemuServer/PCI.pm
@@ -162,12 +162,14 @@ 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 $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;
});
--
2.11.0
More information about the pve-devel
mailing list