mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Fix clippy: for_kv_map
Fix use of a paired map iterator when only the values are cared about. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -3968,7 +3968,7 @@ impl DeviceManager {
|
||||
// Register DMA mapping in IOMMU.
|
||||
// Do not register virtio-mem regions, as they are handled directly by
|
||||
// virtio-mem device itself.
|
||||
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
|
||||
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
|
||||
for region in zone.regions() {
|
||||
// vfio_dma_map is unsound and ought to be marked as unsafe
|
||||
#[allow(unused_unsafe)]
|
||||
@@ -4237,7 +4237,7 @@ impl DeviceManager {
|
||||
.map_err(DeviceManagerError::AddDmaMappingHandlerVirtioMem)?;
|
||||
}
|
||||
|
||||
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
|
||||
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
|
||||
for region in zone.regions() {
|
||||
vfio_user_pci_device
|
||||
.dma_map(region)
|
||||
@@ -4378,7 +4378,7 @@ impl DeviceManager {
|
||||
|
||||
// Do not register virtio-mem regions, as they are handled directly by
|
||||
// virtio-mem devices.
|
||||
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
|
||||
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
|
||||
for region in zone.regions() {
|
||||
let gpa = region.start_addr().0;
|
||||
let size = region.len();
|
||||
@@ -4959,7 +4959,7 @@ impl DeviceManager {
|
||||
if let Some(dma_handler) = dev.dma_handler()
|
||||
&& !iommu_attached
|
||||
{
|
||||
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
|
||||
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
|
||||
for region in zone.regions() {
|
||||
let iova = region.start_addr().0;
|
||||
let size = region.len();
|
||||
@@ -4979,7 +4979,7 @@ impl DeviceManager {
|
||||
}
|
||||
PciDeviceHandle::VfioUser(vfio_user_pci_device) => {
|
||||
let mut dev = vfio_user_pci_device.lock().unwrap();
|
||||
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
|
||||
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
|
||||
for region in zone.regions() {
|
||||
// On error, log, but continue so the loop below removing the mapping from
|
||||
// the devices runs.
|
||||
|
||||
@@ -114,7 +114,7 @@ impl<'a> BftIter<'a> {
|
||||
let mut nodes = Vec::with_capacity(hash_map.len());
|
||||
let mut i = 0;
|
||||
|
||||
for (_, node) in hash_map.iter() {
|
||||
for node in hash_map.values() {
|
||||
if node.parent.is_none() {
|
||||
nodes.push(node);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ impl MsiInterruptGroup {
|
||||
|
||||
fn set_gsi_routes(&self, routes: &HashMap<u32, RoutingEntry>) -> Result<()> {
|
||||
let mut entry_vec: Vec<IrqRoutingEntry> = Vec::new();
|
||||
for (_, entry) in routes.iter() {
|
||||
for entry in routes.values() {
|
||||
if entry.masked {
|
||||
continue;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ impl MsiInterruptGroup {
|
||||
|
||||
impl InterruptSourceGroup for MsiInterruptGroup {
|
||||
fn enable(&self) -> Result<()> {
|
||||
for (_, route) in self.irq_routes.iter() {
|
||||
for route in self.irq_routes.values() {
|
||||
route.lock().unwrap().enable(self.vm.as_ref())?;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ impl InterruptSourceGroup for MsiInterruptGroup {
|
||||
}
|
||||
|
||||
fn disable(&self) -> Result<()> {
|
||||
for (_, route) in self.irq_routes.iter() {
|
||||
for route in self.irq_routes.values() {
|
||||
route.lock().unwrap().disable(self.vm.as_ref())?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user