/// Creates a new MSHV vCPU file descriptor
Creates a new MSHV vCPU file descriptor
Creates a new MSHV vCPU file descriptor
pub fn create_vcpu(&self, id: u8) -> Result<VcpuFd> {
        let vp_arg = mshv_create_vp {
            vp_index: id as __u32,
        };
        // SAFETY: IOCTL with correct types
        let vcpu_fd = unsafe { ioctl_with_ref(&self.vm, MSHV_CREATE_VP(), &vp_arg) };
        if vcpu_fd < 0 {
            return Err(errno::Error::last());
        }
        // Wrap the vCPU now in case the following ? returns early. This is safe because we verified
        // the value of the fd and we own the fd.
        // SAFETY: we're sure vcpu_fd is valid.
        let vcpu = unsafe { File::from_raw_fd(vcpu_fd) };
        Ok(new_vcpu(vcpu))
    }
pub fn create_vcpu ( & self , id : u8 ) -> Result < VcpuFd > { let vp_arg = mshv_create_vp { vp_index : id as __u32 , } ; // SAFETY: IOCTL with correct types let vcpu_fd = unsafe { ioctl_with_ref ( & self . vm , MSHV_CREATE_VP ( ) , & vp_arg ) } ; if vcpu_fd < 0 { return Err ( errno :: Error :: last ( ) ) ; } // Wrap the vCPU now in case the following ? returns early. This is safe because we verified // the value of the fd and we own the fd. // SAFETY: we're sure vcpu_fd is valid. let vcpu = unsafe { File :: from_raw_fd ( vcpu_fd ) } ; Ok ( new_vcpu ( vcpu ) ) }
Creates a new MSHV vCPU file descriptor
Creates a new MSHV vCPU file descriptor
&self
id
u8