Struct fidl::handle::fuchsia_handles::Vmo
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§
§impl Vmo
impl Vmo
pub 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.
pub fn create_with_opts(opts: VmoOptions, size: u64) -> Result<Vmo, Status>
pub fn create_with_opts(opts: VmoOptions, size: u64) -> Result<Vmo, Status>
Create a virtual memory object with options.
Wraps the
zx_vmo_create
syscall, allowing options to be passed.
pub fn create_contiguous(
bti: &Bti,
size: usize,
alignment_log2: u32
) -> Result<Vmo, Status>
pub fn create_contiguous( bti: &Bti, size: usize, alignment_log2: u32 ) -> Result<Vmo, Status>
Create a physically contiguous virtual memory object.
Wraps the
zx_vmo_create_contiguous
syscall.
pub fn read(&self, data: &mut [u8], offset: u64) -> Result<(), Status>
pub fn read(&self, data: &mut [u8], offset: u64) -> Result<(), Status>
Read from a virtual memory object.
Wraps the zx_vmo_read
syscall.
pub fn read_uninit<'a>(
&self,
data: &'a mut [MaybeUninit<u8>],
offset: u64
) -> Result<&'a mut [u8], Status>
pub fn read_uninit<'a>( &self, data: &'a mut [MaybeUninit<u8>], offset: u64 ) -> Result<&'a mut [u8], Status>
Same as read, but reads into memory that might not be initialized, returning an initialized slice of bytes on success.
pub fn read_to_vec(&self, offset: u64, length: u64) -> Result<Vec<u8>, Status>
pub fn read_to_vec(&self, offset: u64, length: u64) -> Result<Vec<u8>, Status>
Same as read, but returns a Vec.
pub fn read_to_array<T, const N: usize>(
&self,
offset: u64
) -> Result<[T; N], Status>where
T: FromBytes,
pub fn read_to_array<T, const N: usize>(
&self,
offset: u64
) -> Result<[T; N], Status>where
T: FromBytes,
Same as read, but returns an array.
pub fn read_to_object<T>(&self, offset: u64) -> Result<T, Status>where
T: FromBytes,
pub fn read_to_object<T>(&self, offset: u64) -> Result<T, Status>where
T: FromBytes,
Same as read, but returns a T
.
pub fn write(&self, data: &[u8], offset: u64) -> Result<(), Status>
pub fn write(&self, data: &[u8], offset: u64) -> Result<(), Status>
Write to a virtual memory object.
Wraps the zx_vmo_write
syscall.
pub fn transfer_data(
&self,
options: TransferDataOptions,
offset: u64,
length: u64,
src_vmo: &Vmo,
src_offset: u64
) -> Result<(), Status>
pub fn transfer_data( &self, options: TransferDataOptions, offset: u64, length: u64, src_vmo: &Vmo, src_offset: u64 ) -> Result<(), Status>
Efficiently transfers data from one VMO to another.
pub 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.
pub 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.
pub fn set_cache_policy(&self, cache_policy: CachePolicy) -> Result<(), Status>
pub fn set_cache_policy(&self, cache_policy: CachePolicy) -> Result<(), Status>
Attempt to change the cache policy of a virtual memory object.
Wraps the zx_vmo_set_cache_policy
syscall.
pub 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.
pub fn info(&self) -> Result<VmoInfo, Status>
pub fn info(&self) -> Result<VmoInfo, Status>
Wraps the zx_object_get_info syscall for the ZX_INFO_VMO topic.
pub fn create_child(
&self,
opts: VmoChildOptions,
offset: u64,
size: u64
) -> Result<Vmo, Status>
pub fn create_child( &self, opts: VmoChildOptions, offset: u64, size: u64 ) -> Result<Vmo, Status>
Create a new virtual memory object that clones a range of this one.
Wraps the zx_vmo_create_child syscall.
pub fn replace_as_executable(self, vmex: &Resource) -> Result<Vmo, Status>
pub fn replace_as_executable(self, vmex: &Resource) -> Result<Vmo, Status>
Replace a VMO, adding execute rights.
Wraps the zx_vmo_replace_as_executable syscall.
Trait Implementations§
§impl AsHandleRef for Vmo
impl AsHandleRef for Vmo
§fn as_handle_ref(&self) -> Unowned<'_, Handle>
fn as_handle_ref(&self) -> Unowned<'_, Handle>
object_wait_many
.§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals ) -> Result<(), Status>
§fn wait_handle(
&self,
signals: Signals,
deadline: Time
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: Time ) -> Result<Signals, Status>
§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts
) -> Result<(), Status>
fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts ) -> Result<(), Status>
§fn get_name(&self) -> Result<CString, Status>
fn get_name(&self) -> Result<CString, Status>
§fn set_name(&self, name: &CStr) -> Result<(), Status>
fn set_name(&self, name: &CStr) -> Result<(), Status>
§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
§impl HandleBased for Vmo
impl HandleBased for Vmo
§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
§fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn is_invalid_handle(&self) -> bool
§impl Ord for Vmo
impl Ord for Vmo
§impl PartialOrd for Vmo
impl PartialOrd for Vmo
§fn partial_cmp(&self, other: &Vmo) -> Option<Ordering>
fn partial_cmp(&self, other: &Vmo) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more