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

Method set_config

vhost_user_block/src/lib.rs:419–433  ·  view source on GitHub ↗
(&mut self, offset: u32, data: &[u8])

Source from the content-addressed store, hash-verified

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;

Callers 4

newMethod · 0.80
write_configMethod · 0.80
write_configMethod · 0.80
write_configMethod · 0.80

Calls 3

as_mut_sliceMethod · 0.80
update_writebackMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected