(&mut self, offset: u32, data: &[u8])
| 417 | } |
| 418 | |
| 419 | fn set_config(&mut self, offset: u32, data: &[u8]) -> result::Result<(), io::Error> { |
| 420 | let config_slice = self.config.as_mut_slice(); |
| 421 | let data_len = data.len() as u32; |
| 422 | let config_len = config_slice.len() as u32; |
| 423 | let end = offset |
| 424 | .checked_add(data_len) |
| 425 | .ok_or_else(|| io::Error::from_raw_os_error(libc::EINVAL))?; |
| 426 | if end > config_len { |
| 427 | error!("Failed to write config space: offset {offset} + len {data_len} > {config_len}"); |
| 428 | return Err(io::Error::from_raw_os_error(libc::EINVAL)); |
| 429 | } |
| 430 | config_slice[offset as usize..end as usize].copy_from_slice(data); |
| 431 | self.update_writeback(); |
| 432 | Ok(()) |
| 433 | } |
| 434 | |
| 435 | fn exit_event(&self, thread_index: usize) -> Option<(EventConsumer, EventNotifier)> { |
| 436 | let kill_evt = &self.threads[thread_index].lock().unwrap().kill_evt; |
no test coverage detected