fn bar_region_info(&mut self) -> Result<Vec<VfioBar>> {
        let mut vfio_bars: Vec<VfioBar> = Vec::new();
        let mut infos = self
            .vfio_device
            .get_regions_info()
            .chain_err(|| "Failed get vfio device regions info")?;

        for i in 0..PCI_ROM_SLOT {
            let mut data = vec![0_u8; 4];
            self.vfio_device.read_region(
                data.as_mut_slice(),
                self.config_offset,
                (BAR_0 + (REG_SIZE as u8) * i) as u64,
            )?;
            let mut region_type = RegionType::Mem32Bit;
            let pci_bar = LittleEndian::read_u32(&data);
            if pci_bar & BAR_IO_SPACE as u32 != 0 {
                region_type = RegionType::Io;
            } else if pci_bar & BAR_MEM_64BIT as u32 != 0 {
                region_type = RegionType::Mem64Bit;
            }
            let vfio_region = infos.remove(0);
            let size = vfio_region.size;

            vfio_bars.push(VfioBar {
                vfio_region,
                region_type,
                size,
            });
        }

        self.fixup_msix_region(&mut vfio_bars)?;

        Ok(vfio_bars)
    }
/// Get vfio bars information. Vfio device won't allow to mmap the MSI-X table area,
/// we need to separate MSI-X table area and region mmap area.
Get vfio bars information. Vfio device won't allow to mmap the MSI-X table area,
we need to separate MSI-X table area and region mmap area.
Get vfio bars information . Vfio device won ' t allow to mmap the MSI - X table area we need to separate MSI - X table area and region mmap area .
fn bar_region_info(&mut self) -> Result<Vec<VfioBar>> {
        let mut vfio_bars: Vec<VfioBar> = Vec::new();
        let mut infos = self
            .vfio_device
            .get_regions_info()
            .chain_err(|| "Failed get vfio device regions info")?;
        for i in 0..PCI_ROM_SLOT {
            let mut data = vec![0_u8; 4];
            self.vfio_device.read_region(
                data.as_mut_slice(),
                self.config_offset,
                (BAR_0 + (REG_SIZE as u8) * i) as u64,
            )?;
            let mut region_type = RegionType::Mem32Bit;
            let pci_bar = LittleEndian::read_u32(&data);
            if pci_bar & BAR_IO_SPACE as u32 != 0 {
                region_type = RegionType::Io;
            } else if pci_bar & BAR_MEM_64BIT as u32 != 0 {
                region_type = RegionType::Mem64Bit;
            }
            let vfio_region = infos.remove(0);
            let size = vfio_region.size;
            vfio_bars.push(VfioBar {
                vfio_region,
                region_type,
                size,
            });
        }
        self.fixup_msix_region(&mut vfio_bars)?;
        Ok(vfio_bars)
    }
fn bar_region_info ( & mut self ) -> Result < Vec < VfioBar > > { let mut vfio_bars : Vec < VfioBar > = Vec :: new ( ) ; let mut infos = self . vfio_device . get_regions_info ( ) . chain_err ( | | " " ) ? ; for i in 0 .. PCI_ROM_SLOT { let mut data = vec ! [ 0_u8 4 ] ; self . vfio_device . read_region ( data . as_mut_slice ( ) , self . config_offset , ( BAR_0 + ( REG_SIZE as u8 ) * i ) as u64 , ) ? ; let mut region_type = RegionType :: Mem32Bit ; let pci_bar = LittleEndian :: read_u32 ( & data ) ; if pci_bar & BAR_IO_SPACE as u32 != 0 { region_type = RegionType :: Io ; } else if pci_bar & BAR_MEM_64BIT as u32 != 0 { region_type = RegionType :: Mem64Bit ; } let vfio_region = infos . remove ( 0 ) ; let size = vfio_region . size ; vfio_bars . push ( VfioBar { vfio_region , region_type , size , } ) ; } self . fixup_msix_region ( & mut vfio_bars ) ? ; Ok ( vfio_bars ) }
Get vfio bars information.
Get vfio bars information .
&mut self
&mut self