Struct swap::uffd_list::UffdList

source ·
pub struct UffdList<'a, T: Token, D: DeadUffdChecker> {
    list: Vec<Userfaultfd>,
    dead_uffd_checker: &'a D,
    wait_ctx: &'a WaitContext<T>,
    num_static_uffd: Option<usize>,
}
Expand description

The list of Userfaultfd.

Fields§

§list: Vec<Userfaultfd>§dead_uffd_checker: &'a D§wait_ctx: &'a WaitContext<T>§num_static_uffd: Option<usize>

Implementations§

source§

impl<'a, T: Token, D: DeadUffdChecker> UffdList<'a, T, D>

source

const ID_MAIN_UFFD: u32 = 0u32

source

pub fn new( main_uffd: Userfaultfd, dead_uffd_checker: &'a D, wait_ctx: &'a WaitContext<T> ) -> Result<Self>

Creates UffdList.

The Userfaultfd for the main process is required.

source

pub fn set_num_static_devices(&mut self, num_static_devices: u32) -> bool

Set the count of static devices.

Devices attached after guest booting are treated as dynamic device which can be detached (e.g. hotplug devices)

source

pub fn register(&mut self, uffd: Userfaultfd) -> Result<bool>

Registers a new Userfaultfd to this list and [WaitContext].

source

pub fn gc_dead_uffds(&mut self) -> Result<()>

Remove all dead Userfaultfd in the list.

source

pub fn get(&self, id: u32) -> Option<&Userfaultfd>

Returns the reference of Userfaultfd if exists.

source

pub fn main_uffd(&self) -> &Userfaultfd

Returns the reference of the Userfaultfd of the main process.

source

pub fn clone_main_uffd(&self) -> Result<Userfaultfd>

Returns cloned Userfaultfd of the main process.

source

pub fn get_list(&self) -> &[Userfaultfd]

Returns the all Userfaultfd registered.

Auto Trait Implementations§

§

impl<'a, T, D> RefUnwindSafe for UffdList<'a, T, D>

§

impl<'a, T, D> Send for UffdList<'a, T, D>
where D: Sync, T: Sync,

§

impl<'a, T, D> Sync for UffdList<'a, T, D>
where D: Sync, T: Sync,

§

impl<'a, T, D> Unpin for UffdList<'a, T, D>

§

impl<'a, T, D> UnwindSafe for UffdList<'a, T, D>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.