pub struct Mapping { /* private fields */ }Expand description
A safe wrapper around a mapped region of memory.
Note: this type implements Deref/DerefMut to the SharedBuffer
type, which allows reading/writing from the underlying memory.
Aside from creation and the Drop impl, all of the interesting
functionality of this type is offered via SharedBuffer.
Implementations§
Source§impl Mapping
impl Mapping
Sourcepub fn allocate(size: usize) -> Result<(Self, Vmo), Status>
pub fn allocate(size: usize) -> Result<(Self, Vmo), Status>
Create a Mapping and map it in the root address space.
Returns the VMO that was mapped.
The resulting VMO will not be resizeable.
Sourcepub fn allocate_with_name(
size: usize,
name: &str,
) -> Result<(Self, Vmo), Status>
pub fn allocate_with_name( size: usize, name: &str, ) -> Result<(Self, Vmo), Status>
Create a Mapping and map it in the root address space.
Returns the VMO that was mapped.
The resulting VMO will not be resizeable.
Sourcepub fn create_from_vmo(
vmo: &Vmo,
size: usize,
flags: VmarFlags,
) -> Result<Self, Status>
pub fn create_from_vmo( vmo: &Vmo, size: usize, flags: VmarFlags, ) -> Result<Self, Status>
Create a Mapping from an existing VMO.
Requires that the VMO was not created with the RESIZABLE
option, and returns ZX_ERR_NOT_SUPPORTED otherwise.
Sourcepub fn create_from_vmo_with_offset(
vmo: &Vmo,
vmo_offset: u64,
size: usize,
flags: VmarFlags,
) -> Result<Self, Status>
pub fn create_from_vmo_with_offset( vmo: &Vmo, vmo_offset: u64, size: usize, flags: VmarFlags, ) -> Result<Self, Status>
Create a Mapping from an existing VMO at vmo_offset.
vmo_offset must be page-aligned. Requires that the VMO was not created
with the RESIZABLE option, and returns ZX_ERR_NOT_SUPPORTED otherwise.
Sourcepub fn create_from_vmo_with_vmar(
vmo: &Vmo,
vmar: &Vmar,
size: usize,
flags: VmarFlags,
) -> Result<Self, Status>
pub fn create_from_vmo_with_vmar( vmo: &Vmo, vmar: &Vmar, size: usize, flags: VmarFlags, ) -> Result<Self, Status>
Create a Mapping from an existing VMO in the specified vmar.
Requires that the VMO was not created with the RESIZABLE
option, and returns ZX_ERR_NOT_SUPPORTED otherwise.
Sourcepub fn create_from_vmo_with_vmar_and_offset(
vmo: &Vmo,
vmar: &Vmar,
vmo_offset: u64,
size: usize,
flags: VmarFlags,
) -> Result<Self, Status>
pub fn create_from_vmo_with_vmar_and_offset( vmo: &Vmo, vmar: &Vmar, vmo_offset: u64, size: usize, flags: VmarFlags, ) -> Result<Self, Status>
Create a Mapping from an existing VMO in the specified vmar at vmo_offset.
vmo_offset must be page-aligned. Requires that the VMO was not created
with the RESIZABLE option, and returns ZX_ERR_NOT_SUPPORTED otherwise.