pub struct DmaBuf(pub(crate) OwnedFd);
Expand description
A DMA-Buf buffer
Tuple Fields§
§0: OwnedFd
Implementations§
source§impl DmaBuf
impl DmaBuf
pub(crate) fn memory_map(&self) -> Result<(usize, *mut u8), MapError>
sourcepub fn memory_map_ro(&self) -> Result<MappedDmaBufRo<'_>, MapError>
pub fn memory_map_ro(&self) -> Result<MappedDmaBufRo<'_>, MapError>
Maps a DmaBuf
for the CPU to access it read-
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.
§Panics
If the buffer size reported by the kernel (i64
) cannot fit into an usize
.
§Errors
Will return an error if either the Buffer’s length can’t be retrieved, or if the mmap call fails.
sourcepub fn memory_map_rw(&mut self) -> Result<MappedDmaBufRw<'_>, MapError>
pub fn memory_map_rw(&mut self) -> Result<MappedDmaBufRw<'_>, MapError>
Maps a DmaBuf
for the CPU to access it read-write
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.
§Panics
If the buffer size reported by the kernel (i64
) cannot fit into an usize
.
§Errors
Will return an error if either the Buffer’s length can’t be retrieved, or if the mmap call fails.
sourcepub fn memory_map_wo(&mut self) -> Result<MappedDmaBufWo<'_>, MapError>
pub fn memory_map_wo(&mut self) -> Result<MappedDmaBufWo<'_>, MapError>
Maps a DmaBuf
for the CPU to access it write-only
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.
§Panics
If the buffer size reported by the kernel (i64
) cannot fit into an usize
.
§Errors
Will return an error if either the Buffer’s length can’t be retrieved, or if the mmap call fails.