Skip to main content

normalize_pci_bus_id

Function normalize_pci_bus_id 

Source
pub fn normalize_pci_bus_id(raw: &str) -> Result<String, String>
Expand description

Normalize a PCI bus ID string.

Strips leading 0000: domain prefix, lowercases the input, and validates the result matches the pattern XX:XX.X (where X is a hex digit and the function number is 0–7).

§Examples

use rusty_stack::installers::common::benchmark_common::normalize_pci_bus_id;

assert_eq!(normalize_pci_bus_id("0000:01:00.0"), Ok("01:00.0".to_string()));
assert_eq!(normalize_pci_bus_id("01:00.0"), Ok("01:00.0".to_string()));
assert_eq!(normalize_pci_bus_id("03:00.0"), Ok("03:00.0".to_string()));

§Validation

  • VAL-INFRA-013: PCI bus normalization (0000:01:00.0 → 01:00.0)