MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / remove_by_device

Method remove_by_device

vm-device/src/bus.rs:199–215  ·  view source on GitHub ↗

Removes all entries referencing the given device.

(&self, device: &dyn BusDeviceSync)

Source from the content-addressed store, hash-verified

197
198 /// Removes all entries referencing the given device.
199 pub fn remove_by_device(&self, device: &dyn BusDeviceSync) -> Result<()> {
200 let mut device_list = self.devices.write().unwrap();
201 let mut remove_key_list = Vec::new();
202
203 for (key, value) in device_list.iter() {
204 let value = value.upgrade().unwrap();
205 if core::ptr::eq(Arc::as_ptr(&value), device) {
206 remove_key_list.push(*key);
207 }
208 }
209
210 for key in remove_key_list.iter() {
211 device_list.remove(key);
212 }
213
214 Ok(())
215 }
216
217 /// Updates the address range for an existing device.
218 pub fn update_range(

Callers 1

eject_deviceMethod · 0.45

Calls 5

newFunction · 0.85
iterMethod · 0.80
writeMethod · 0.45
pushMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected