(&mut self, offset: u64, data: &[u8])
| 1258 | } |
| 1259 | |
| 1260 | fn write_config(&mut self, offset: u64, data: &[u8]) { |
| 1261 | // The "bypass" field is the only mutable field |
| 1262 | let bypass_offset = |
| 1263 | (&raw const self.config.bypass as u64) - (&raw const self.config as u64); |
| 1264 | if offset != bypass_offset || data.len() != std::mem::size_of_val(&self.config.bypass) { |
| 1265 | error!( |
| 1266 | "Attempt to write to read-only field: offset {:x} length {}", |
| 1267 | offset, |
| 1268 | data.len() |
| 1269 | ); |
| 1270 | return; |
| 1271 | } |
| 1272 | |
| 1273 | // virtio spec says ignore bits 1-7 and that the device must |
| 1274 | // never present a value other than 0 or 1. |
| 1275 | self.config.bypass = data[0] & 1; |
| 1276 | |
| 1277 | self.update_bypass(); |
| 1278 | } |
| 1279 | |
| 1280 | fn activate(&mut self, context: crate::device::ActivationContext) -> ActivateResult { |
| 1281 | let crate::device::ActivationContext { |
nothing calls this directly
no test coverage detected