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>
impl<'a, T: Token, D: DeadUffdChecker> UffdList<'a, T, D>
const ID_MAIN_UFFD: u32 = 0u32
sourcepub fn new(
main_uffd: Userfaultfd,
dead_uffd_checker: &'a D,
wait_ctx: &'a WaitContext<T>
) -> Result<Self>
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.
sourcepub fn set_num_static_devices(&mut self, num_static_devices: u32) -> bool
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)
sourcepub fn register(&mut self, uffd: Userfaultfd) -> Result<bool>
pub fn register(&mut self, uffd: Userfaultfd) -> Result<bool>
Registers a new Userfaultfd to this list and [WaitContext].
sourcepub fn gc_dead_uffds(&mut self) -> Result<()>
pub fn gc_dead_uffds(&mut self) -> Result<()>
Remove all dead Userfaultfd in the list.
sourcepub fn get(&self, id: u32) -> Option<&Userfaultfd>
pub fn get(&self, id: u32) -> Option<&Userfaultfd>
Returns the reference of Userfaultfd if exists.
sourcepub fn main_uffd(&self) -> &Userfaultfd
pub fn main_uffd(&self) -> &Userfaultfd
Returns the reference of the Userfaultfd of the main process.
sourcepub fn clone_main_uffd(&self) -> Result<Userfaultfd>
pub fn clone_main_uffd(&self) -> Result<Userfaultfd>
Returns cloned Userfaultfd of the main process.
sourcepub fn get_list(&self) -> &[Userfaultfd]
pub fn get_list(&self) -> &[Userfaultfd]
Returns the all Userfaultfd registered.
Auto Trait Implementations§
impl<'a, T, D> RefUnwindSafe for UffdList<'a, T, D>where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, D> Send for UffdList<'a, T, D>
impl<'a, T, D> Sync for UffdList<'a, T, D>
impl<'a, T, D> Unpin for UffdList<'a, T, D>
impl<'a, T, D> UnwindSafe for UffdList<'a, T, D>where
D: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more