Function devices::virtio::copy_config

source ·
pub fn copy_config(dst: &mut [u8], dst_offset: u64, src: &[u8], src_offset: u64)
Expand description

Copy virtio device configuration data from a subslice of src to a subslice of dst. Unlike std::slice::copy_from_slice(), this function copies as much as possible within the common subset of the two slices, truncating the requested range instead of panicking if the slices do not match in size.

dst_offset and src_offset specify the starting indexes of the dst and src slices, respectively; if either index is out of bounds, this function is a no-op rather than panicking. This makes it safe to call with arbitrary user-controlled inputs.