mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
pci: Implementing Debug for PciBdf to aid with debugging
Signed-off-by: Arvind Vasudev <avasudev@crusoeenergy.com>
This commit is contained in:
parent
2f9436bc12
commit
8c07294691
@ -16,7 +16,7 @@ mod msix;
|
||||
mod vfio;
|
||||
mod vfio_user;
|
||||
|
||||
use std::fmt::{self, Display};
|
||||
use std::fmt::{self, Debug, Display};
|
||||
use std::num::ParseIntError;
|
||||
use std::str::FromStr;
|
||||
|
||||
@ -152,6 +152,19 @@ impl From<&PciBdf> for u16 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for PciBdf {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{:04x}:{:02x}:{:02x}.{:01x}",
|
||||
self.segment(),
|
||||
self.bus(),
|
||||
self.device(),
|
||||
self.function()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for PciBdf {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
|
Loading…
x
Reference in New Issue
Block a user