pub fn new(
        sysfspath: &Path,
        container: Arc<VfioContainer>,
        #[cfg(feature = "vftoken")] vf_token: &uuid::Uuid,
    ) -> Result<Self> {
        let group_id = Self::get_group_id_from_path(sysfspath)?;
        let group = container.get_group(group_id)?;
        #[cfg(not(feature = "vftoken"))]
        let device_info = group.get_device(sysfspath)?;
        #[cfg(feature = "vftoken")]
        let device_info = group.get_device(sysfspath, vf_token)?;
        let regions = device_info.get_regions()?;
        let irqs = device_info.get_irqs()?;

        Ok(VfioDevice {
            device: ManuallyDrop::new(device_info.device),
            flags: device_info.flags,
            regions,
            irqs,
            group,
            container,
        })
    }
/// Create a new vfio device, then guest read/write on this device could be transferred into kernel vfio.
///
/// # Parameters
/// * `sysfspath`: specify the vfio device path in sys file system.
/// * `container`: the new VFIO device object will bind to this container object.
Create a new vfio device, then guest read/write on this device could be transferred into kernel vfio.
Create a new vfio device then guest read / write on this device could be transferred into kernel vfio .
pub fn new(
        sysfspath: &Path,
        container: Arc<VfioContainer>,
        #[cfg(feature = "vftoken")] vf_token: &uuid::Uuid,
    ) -> Result<Self> {
        let group_id = Self::get_group_id_from_path(sysfspath)?;
        let group = container.get_group(group_id)?;
        #[cfg(not(feature = "vftoken"))]
        let device_info = group.get_device(sysfspath)?;
        #[cfg(feature = "vftoken")]
        let device_info = group.get_device(sysfspath, vf_token)?;
        let regions = device_info.get_regions()?;
        let irqs = device_info.get_irqs()?;
        Ok(VfioDevice {
            device: ManuallyDrop::new(device_info.device),
            flags: device_info.flags,
            regions,
            irqs,
            group,
            container,
        })
    }
pub fn new ( sysfspath : & Path , container : Arc < VfioContainer > , # [ cfg ( feature " " ) ] vf_token : & uuid :: Uuid , ) -> Result < Self > { let group_id = Self :: get_group_id_from_path ( sysfspath ) ? ; let group = container . get_group ( group_id ) ? ; # [ cfg ( not ( feature " " ) ) ] let device_info = group . get_device ( sysfspath ) ? ; # [ cfg ( feature " " ) ] let device_info = group . get_device ( sysfspath , vf_token ) ? ; let regions = device_info . get_regions ( ) ? ; let irqs = device_info . get_irqs ( ) ? ; Ok ( VfioDevice { device : ManuallyDrop :: new ( device_info . device ) , flags : device_info . flags , regions , irqs , group , container , } ) }
Create a new vfio device, then guest read/write on this device could be transferred into kernel vfio.
Create a new vfio device then guest read / write on this device could be transferred into kernel vfio .
sysfspath
&Path
container
Arc<VfioContainer>
vf_token
&uuid::Uuid