Type Alias VBox

Source
pub type VBox<T> = Box<T, Vmalloc>;
Expand description

Type alias for Box with a Vmalloc allocator.

§Examples

let b = VBox::new(24_u64, GFP_KERNEL)?;

assert_eq!(*b, 24_u64);

Aliased Type§

pub struct VBox<T>(/* private fields */);

Trait Implementations§

Source§

impl<T> AsPageIter for VBox<T>

§Examples

use kernel::alloc::allocator::VmallocPageIter;
use kernel::page::{AsPageIter, PAGE_SIZE};

let mut vbox = VBox::new((), GFP_KERNEL)?;

assert!(vbox.page_iter().next().is_none());

let mut vbox = VBox::<[u8; PAGE_SIZE]>::new_uninit(GFP_KERNEL)?;

let page = vbox.page_iter().next().expect("At least one page should be available.\n");

// SAFETY: There is no concurrent read or write to the same page.
unsafe { page.fill_zero_raw(0, PAGE_SIZE)? };
Source§

type Iter<'a> = VmallocPageIter<'a> where T: 'a

The Iterator type, e.g. VmallocPageIter.
Source§

fn page_iter(&mut self) -> Self::Iter<'_>

Returns an Iterator of BorrowedPage items over all pages owned by self.