[pve-devel] applied: [PATCH common 1/3] SysFSTools: add verbose flag to pci_device_info
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Jun 21 17:31:23 CEST 2021
On 21.06.21 15:55, Dominik Csapak wrote:
> to also get the subsystem_vendor and device, as well as the
> iommu group and mediated device support
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> src/PVE/SysFSTools.pm | 29 +++++++++++++++++++++++++----
> 1 file changed, 25 insertions(+), 4 deletions(-)
>
applied, thanks - one question below though.
> @@ -225,6 +227,25 @@ sub pci_device_info {
> has_fl_reset => -f "$pcisysfs/devices/$name/reset" || 0,
> };
>
> + if ($verbose) {
> + my $sub_vendor = file_read_firstline("$devdir/subsystem_vendor");
> + $sub_vendor =~ s/^0x// if defined($sub_vendor);
> + my $sub_device = file_read_firstline("$devdir/subsystem_device");
> + $sub_device =~ s/^0x// if defined($sub_device);
> +
> + $res->{subsystem_vendor} = $sub_vendor if defined($sub_vendor);
> + $res->{subsystem_device} = $sub_device if defined($sub_device);
> +
> + if (-e "$devdir/iommu_group") {
> + my ($iommugroup) = (readlink("$devdir/iommu_group") =~ m/\/(\d+)$/);
> + $res->{iommugroup} = int($iommugroup);
just to be sure: int() warns if it gets an undefined value, but I'd guess that once
"$devdir/iommu_group" exists it's basically guaranteed that we get the integer match
at end-of-string above?
More information about the pve-devel
mailing list