pub struct Zxio { /* private fields */ }
Expand description
A handle to a zxio object.
Note: the underlying storage backing the object is pinned on the heap because it can contain self referential data.
Implementations§
source§impl Zxio
impl Zxio
pub fn new_socket<S: ServiceConnector>( domain: c_int, socket_type: c_int, protocol: c_int ) -> Result<Result<Self, ZxioErrorCode>, Status>
pub fn create(handle: Handle) -> Result<Zxio, Status>
pub fn create_with_on_open(handle: Handle) -> Result<Zxio, Status>
pub fn release(self) -> Result<Handle, Status>
pub fn open(&self, flags: OpenFlags, path: &str) -> Result<Self, Status>
pub fn open2( &self, path: &str, options: OpenOptions, attributes: Option<&mut zxio_node_attributes_t> ) -> Result<Self, Status>
pub fn create_with_on_representation( handle: Handle, attributes: Option<&mut zxio_node_attributes_t> ) -> Result<Zxio, Status>
sourcepub fn open_node(
&self,
path: &str,
node_flags: NodeProtocolFlags,
attributes: Option<&mut zxio_node_attributes_t>
) -> Result<Self, Status>
pub fn open_node( &self, path: &str, node_flags: NodeProtocolFlags, attributes: Option<&mut zxio_node_attributes_t> ) -> Result<Self, Status>
Opens a limited node connection (similar to O_PATH).
pub fn unlink(&self, name: &str, flags: UnlinkFlags) -> Result<(), Status>
pub fn read(&self, data: &mut [u8]) -> Result<usize, Status>
sourcepub unsafe fn readv(&self, data: &[zx_iovec]) -> Result<usize, Status>
pub unsafe fn readv(&self, data: &[zx_iovec]) -> Result<usize, Status>
Performs a vectorized read, returning the number of bytes read to data
.
§Safety
The caller must check the returned Result
to make sure the buffers
provided are valid. The caller must provide pointers that are compatible
with the backing implementation of zxio.
This call allows writing to arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.
pub fn clone(&self) -> Result<Zxio, Status>
pub fn read_at(&self, offset: u64, data: &mut [u8]) -> Result<usize, Status>
sourcepub unsafe fn readv_at(
&self,
offset: u64,
data: &[zx_iovec]
) -> Result<usize, Status>
pub unsafe fn readv_at( &self, offset: u64, data: &[zx_iovec] ) -> Result<usize, Status>
Performs a vectorized read at an offset, returning the number of bytes
read to data
.
§Safety
The caller must check the returned Result
to make sure the buffers
provided are valid. The caller must provide pointers that are compatible
with the backing implementation of zxio.
This call allows writing to arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.
pub fn write(&self, data: &[u8]) -> Result<usize, Status>
sourcepub unsafe fn writev(&self, data: &[zx_iovec]) -> Result<usize, Status>
pub unsafe fn writev(&self, data: &[zx_iovec]) -> Result<usize, Status>
Performs a vectorized write, returning the number of bytes written from
data
.
§Safety
The caller must check the returned Result
to make sure the buffers
provided are valid. The caller must provide pointers that are compatible
with the backing implementation of zxio.
This call allows reading from arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.
pub fn write_at(&self, offset: u64, data: &[u8]) -> Result<usize, Status>
sourcepub unsafe fn writev_at(
&self,
offset: u64,
data: &[zx_iovec]
) -> Result<usize, Status>
pub unsafe fn writev_at( &self, offset: u64, data: &[zx_iovec] ) -> Result<usize, Status>
Performs a vectorized write at an offset, returning the number of bytes
written from data
.
§Safety
The caller must check the returned Result
to make sure the buffers
provided are valid. The caller must provide pointers that are compatible
with the backing implementation of zxio.
This call allows reading from arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.
pub fn truncate(&self, length: u64) -> Result<(), Status>
pub fn seek( &self, seek_origin: SeekOrigin, offset: i64 ) -> Result<usize, Status>
pub fn vmo_get(&self, flags: VmarFlags) -> Result<Vmo, Status>
pub fn attr_get( &self, query: zxio_node_attr_has_t ) -> Result<zxio_node_attributes_t, Status>
sourcepub fn attr_get_with_root_hash(
&self,
query: zxio_node_attr_has_t,
fsverity_root_hash: &mut [u8; 64]
) -> Result<zxio_node_attributes_t, Status>
pub fn attr_get_with_root_hash( &self, query: zxio_node_attr_has_t, fsverity_root_hash: &mut [u8; 64] ) -> Result<zxio_node_attributes_t, Status>
Assumes that the caller has set query.fsverity_root_hash
to true.