pub fn region_read(&self, index: u32, buf: &mut [u8], addr: u64) {
        let region: &VfioRegion = match self.regions.get(index as usize) {
            Some(v) => v,
            None => {
                warn!("region read with invalid index: {}", index);
                return;
            }
        };

        let size = buf.len() as u64;
        if size > region.size || addr + size > region.size {
            warn!(
                "region read with invalid parameter, add: {}, size: {}",
                addr, size
            );
            return;
        }

        if let Err(e) = self.device.read_exact_at(buf, region.offset + addr) {
            warn!(
                "Failed to read region in index: {}, addr: {}, error: {}",
                index, addr, e
            );
        }
    }
/// Read region's data from VFIO device into buf
///
/// # Arguments
/// * `index`: region num
/// * `buf`: data destination and buf length is read size
/// * `addr`: offset in the region
Read region's data from VFIO device into buf
Read region ' s data from VFIO device into buf
pub fn region_read(&self, index: u32, buf: &mut [u8], addr: u64) {
        let region: &VfioRegion = match self.regions.get(index as usize) {
            Some(v) => v,
            None => {
                warn!("region read with invalid index: {}", index);
                return;
            }
        };
        let size = buf.len() as u64;
        if size > region.size || addr + size > region.size {
            warn!(
                "region read with invalid parameter, add: {}, size: {}",
                addr, size
            );
            return;
        }
        if let Err(e) = self.device.read_exact_at(buf, region.offset + addr) {
            warn!(
                "Failed to read region in index: {}, addr: {}, error: {}",
                index, addr, e
            );
        }
    }
pub fn region_read ( & self , index : u32 , buf : & mut [ u8 ] , addr : u64 ) { let region : & VfioRegion = match self . regions . get ( index as usize ) { Some ( v ) => v , None => { warn ! ( " " index ) ; return ; } } ; let size = buf . len ( ) as u64 ; if size > region . size || addr + size > region . size { warn ! ( " " addr size ) ; return ; } if let Err ( e ) = self . device . read_exact_at ( buf , region . offset + addr ) { warn ! ( " " index addr e ) ; } }
Read region's data from VFIO device into buf
Read region ' s data from VFIO device into buf
&self
index
u32
buf
&mut [u8]
addr
u64