Updates the address range for an existing device.
(
&self,
old_base: u64,
old_len: u64,
new_base: u64,
new_len: u64,
)
| 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 | /// |