Struct dma_buf::MappedDmaBuf
source · pub struct MappedDmaBuf {
pub(crate) buf: DmaBuf,
pub(crate) len: usize,
pub(crate) mmap: *mut u8,
}
Expand description
A DmaBuf
mapped in memory
Fields§
§buf: DmaBuf
§len: usize
§mmap: *mut u8
Implementations§
source§impl MappedDmaBuf
impl MappedDmaBuf
pub(crate) fn as_slice(&self) -> &[u8] ⓘ
pub(crate) fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
sourcepub fn read<A, F, R>(&self, f: F, arg: Option<A>) -> Result<R, BufferError>
pub fn read<A, F, R>(&self, f: F, arg: Option<A>) -> Result<R, BufferError>
Calls a closure to read the buffer content
DMA-Buf requires the user-space to call the DMA_BUF_IOCTL_SYNC
ioctl before and after any
CPU access to a buffer in order to maintain the cache coherency. The closure will be run
with those primitives called for a read access from the CPU.
The result of the closure will be returned.
§Errors
Will return [Error] if the underlying ioctl or the closure fails
sourcepub fn readwrite<A, F, R>(
&mut self,
f: F,
arg: Option<A>,
) -> Result<R, BufferError>
pub fn readwrite<A, F, R>( &mut self, f: F, arg: Option<A>, ) -> Result<R, BufferError>
Calls a closure to read from and write to the buffer content
DMA-Buf requires the user-space to call the DMA_BUF_IOCTL_SYNC
ioctl before and after any
CPU access to a buffer in order to maintain the cache coherency. The closure will be run
with those primitives called for a read and write access from the CPU.
The result of the closure will be returned on success. On failure, the closure must return
Error::Closure
§Errors
Will return [Error] if the underlying ioctl or the closure fails
sourcepub fn write<A, F>(&mut self, f: F, arg: Option<A>) -> Result<(), BufferError>
pub fn write<A, F>(&mut self, f: F, arg: Option<A>) -> Result<(), BufferError>
Calls a closure to read from and write to the buffer content
DMA-Buf requires the user-space to call the DMA_BUF_IOCTL_SYNC
ioctl before and after any
CPU access to a buffer in order to maintain the cache coherency. The closure will be run
with those primitives called for a read and write access from the CPU.
The closure must return () on success. On failure, the closure must return Error::Closure
.
§Errors
Will return [Error] if the underlying ioctl or the closure fails