pub struct Vmo(/* private fields */);
Expand description
An object representing a Zircon virtual memory object.
As essentially a subtype of Handle
, it can be freely interconverted.
Implementations§
Source§impl Vmo
impl Vmo
Sourcepub fn create(size: u64) -> Result<Vmo, Status>
pub fn create(size: u64) -> Result<Vmo, Status>
Create a virtual memory object.
Wraps the
zx_vmo_create
syscall. See the
Shared Memory: Virtual Memory Objects (VMOs)
for more information.
Sourcepub fn read(&self, data: &mut [u8], offset: u64) -> Result<usize, Status>
pub fn read(&self, data: &mut [u8], offset: u64) -> Result<usize, Status>
Read from a virtual memory object.
Wraps the zx_vmo_read
syscall.
Sourcepub fn write(&self, data: &[u8], offset: u64) -> Result<usize, Status>
pub fn write(&self, data: &[u8], offset: u64) -> Result<usize, Status>
Write to a virtual memory object.
Wraps the zx_vmo_write
syscall.
Sourcepub fn get_size(&self) -> Result<u64, Status>
pub fn get_size(&self) -> Result<u64, Status>
Get the size of a virtual memory object.
Wraps the zx_vmo_get_size
syscall.
Sourcepub fn set_size(&self, size: u64) -> Result<(), Status>
pub fn set_size(&self, size: u64) -> Result<(), Status>
Attempt to change the size of a virtual memory object.
Wraps the zx_vmo_set_size
syscall.
Sourcepub fn op_range(&self, op: VmoOp, offset: u64, size: u64) -> Result<(), Status>
pub fn op_range(&self, op: VmoOp, offset: u64, size: u64) -> Result<(), Status>
Perform an operation on a range of a virtual memory object.
Wraps the zx_vmo_op_range syscall.
Sourcepub fn lookup(
&self,
offset: u64,
size: u64,
buffer: &mut [zx_paddr_t],
) -> Result<(), Status>
pub fn lookup( &self, offset: u64, size: u64, buffer: &mut [zx_paddr_t], ) -> Result<(), Status>
Look up a list of physical addresses corresponding to the pages held by the VMO from
offset
to offset
+size
, and store them in buffer
.
Wraps the zx_vmo_op_range syscall with ZX_VMO_OP_LOOKUP.
Trait Implementations§
Source§impl AsHandleRef for Vmo
impl AsHandleRef for Vmo
Source§fn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
object_wait_many
.