MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / vfio_id_string

Method vfio_id_string

crates/openshell-vfio/src/sysfs.rs:155–161  ·  view source on GitHub ↗

Read vendor and device IDs from sysfs and format as `"VVVV DDDD"` (no `0x` prefix).

(&self)

Source from the content-addressed store, hash-verified

153
154 /// Read vendor and device IDs from sysfs and format as `"VVVV DDDD"` (no `0x` prefix).
155 pub(crate) fn vfio_id_string(&self) -> Option<String> {
156 let vendor = self.vendor().ok()?;
157 let device = self.device_id().ok()?;
158 let vendor_hex = vendor.strip_prefix("0x").unwrap_or(&vendor);
159 let device_hex = device.strip_prefix("0x").unwrap_or(&device);
160 Some(format!("{vendor_hex} {device_hex}"))
161 }
162}
163
164/// Validate a PCI BDF address (format `DDDD:BB:DD.F`).

Callers 1

vfio_id_stringFunction · 0.80

Calls 2

vendorMethod · 0.80
device_idMethod · 0.80

Tested by

no test coverage detected