Skip to main content

parse_sysfs_pci_id

Function parse_sysfs_pci_id 

Source
pub fn parse_sysfs_pci_id(path: &Path) -> Option<u16>
Expand description

Parse a sysfs PCI ID file (/sys/.../device/vendor or device/device). These files contain a single line like 0x8086\n. Returns None on any read or parse failure — non-PCI interfaces (lo, veth*, bond masters, WireGuard) have no such file and that’s not an error.

Lives here so the xe and net plugins (and any future PCI-backed hardware plugin) read PCI IDs through one helper instead of three near-duplicate inline parses.