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

Method update_range

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

Updates the address range for an existing device.

(
        &self,
        old_base: u64,
        old_len: u64,
        new_base: u64,
        new_len: u64,
    )

Source from the content-addressed store, hash-verified

216
217 /// Updates the address range for an existing device.
218 pub fn update_range(
219 &self,
220 old_base: u64,
221 old_len: u64,
222 new_base: u64,
223 new_len: u64,
224 ) -> Result<()> {
225 // Retrieve the device corresponding to the range
226 let device = if let Some((_, _, dev)) = self.resolve(old_base) {
227 dev.clone()
228 } else {
229 return Err(Error::MissingAddressRange);
230 };
231
232 // Remove the old address range
233 self.remove(old_base, old_len)?;
234
235 // Insert the new address range
236 self.insert(device, new_base, new_len)
237 }
238
239 /// Reads data from the device that owns the range containing `addr` and puts it into `data`.
240 ///

Callers 1

move_barMethod · 0.80

Calls 4

resolveMethod · 0.80
cloneMethod · 0.45
removeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected