/// ioeventfd: Passes in an eventfd which the kernel would signal when
/// an mmio region is written into.
Passes in an eventfd which the kernel would signal when
an mmio region is written into.
Passes in an eventfd which the kernel would signal when an mmio region is written into .
fn ioeventfd<T: Into<u64>>(
        &self,
        fd: &EventFd,
        addr: &IoEventAddress,
        datamatch: T,
        mut flags: u32,
    ) -> Result<()> {
        //
        // mshv doesn't support PIO ioeventfds now.
        //
        let mmio_addr = match addr {
            IoEventAddress::Pio(_) => {
                return Err(errno::Error::new(libc::ENOTSUP));
            }
            IoEventAddress::Mmio(ref m) => *m,
        };
        if std::mem::size_of::<T>() > 0 {
            flags |= 1 << mshv_ioeventfd_flag_nr_datamatch
        }
        let ioeventfd = mshv_ioeventfd {
            datamatch: datamatch.into(),
            len: std::mem::size_of::<T>() as u32,
            addr: mmio_addr,
            fd: fd.as_raw_fd(),
            flags,
            ..Default::default()
        };
        // SAFETY: we know that our file is a VM fd, we know the kernel will only read the
        // correct amount of memory from our pointer, and we verify the return result.
        let ret = unsafe { ioctl_with_ref(self, MSHV_IOEVENTFD(), &ioeventfd) };
        if ret == 0 {
            Ok(())
        } else {
            Err(errno::Error::last())
        }
    }
fn ioeventfd < T : Into < u64 > > ( & self , fd : & EventFd , addr : & IoEventAddress , datamatch : T , mut flags : u32 , ) -> Result < ( ) > { // // mshv doesn't support PIO ioeventfds now. // let mmio_addr = match addr { IoEventAddress :: Pio ( _ ) => { return Err ( errno :: Error :: new ( libc :: ENOTSUP ) ) ; } IoEventAddress :: Mmio ( ref m ) => * m , } ; if std :: mem :: size_of :: < T > ( ) > 0 { flags |= 1 << mshv_ioeventfd_flag_nr_datamatch } let ioeventfd = mshv_ioeventfd { datamatch : datamatch . into ( ) , len : std :: mem :: size_of :: < T > ( ) as u32 , addr : mmio_addr , fd : fd . as_raw_fd ( ) , flags , .. Default :: default ( ) } ; // SAFETY: we know that our file is a VM fd, we know the kernel will only read the // correct amount of memory from our pointer, and we verify the return result. let ret = unsafe { ioctl_with_ref ( self , MSHV_IOEVENTFD ( ) , & ioeventfd ) } ; if ret == 0 { Ok ( ( ) ) } else { Err ( errno :: Error :: last ( ) ) } }
ioeventfd: Passes in an eventfd which the kernel would signal when
an mmio region is written into.
ioeventfd : Passes in an eventfd which the kernel would signal when an mmio region is written into .
&self
fd
&EventFd
addr
&IoEventAddress
datamatch
T
flags
u32