runtime-rs: remove useless get_host_guest_map and its test case

Fixes: #8665

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
alex.lyn 2023-12-21 11:07:56 +08:00
parent d916da15dd
commit 275de453d5
2 changed files with 2 additions and 15 deletions

View File

@ -12,8 +12,8 @@ mod virtio_net;
mod virtio_vsock; mod virtio_vsock;
pub use vfio::{ pub use vfio::{
bind_device_to_host, bind_device_to_vfio, get_host_guest_map, get_vfio_device, HostDevice, bind_device_to_host, bind_device_to_vfio, get_vfio_device, HostDevice, VfioBusMode, VfioConfig,
VfioBusMode, VfioConfig, VfioDevice, VfioDevice,
}; };
pub use virtio_blk::{ pub use virtio_blk::{
BlockConfig, BlockDevice, KATA_BLK_DEV_TYPE, KATA_MMIO_BLK_DEV_TYPE, KATA_NVDIMM_DEV_TYPE, BlockConfig, BlockDevice, KATA_BLK_DEV_TYPE, KATA_MMIO_BLK_DEV_TYPE, KATA_NVDIMM_DEV_TYPE,
@ -207,11 +207,4 @@ mod tests {
assert!(root_slot.is_some()); assert!(root_slot.is_some());
assert_eq!(root_slot.unwrap().0, 1); assert_eq!(root_slot.unwrap().0, 1);
} }
#[test]
fn test_get_host_guest_map() {
// test unwrap is fine, no panic occurs.
let hg_map = get_host_guest_map("".to_owned());
assert!(hg_map.is_none());
}
} }

View File

@ -70,12 +70,6 @@ pub fn generate_guest_pci_path(bdf: String) -> Result<PciPath> {
}) })
} }
// get host/guest mapping for info
pub fn get_host_guest_map(host_bdf: String) -> Option<String> {
// safe, just do unwrap as `HOST_GUEST_MAP` is always valid.
HOST_GUEST_MAP.read().unwrap().get(&host_bdf).cloned()
}
pub fn do_check_iommu_on() -> Result<bool> { pub fn do_check_iommu_on() -> Result<bool> {
let element = std::fs::read_dir(SYS_CLASS_IOMMU)? let element = std::fs::read_dir(SYS_CLASS_IOMMU)?
.filter_map(|e| e.ok()) .filter_map(|e| e.ok())