Trait fuse::server::Mapper

source ·
pub trait Mapper {
    // Required methods
    fn map(
        &self,
        mem_offset: u64,
        size: usize,
        fd: &dyn AsRawFd,
        file_offset: u64,
        prot: Protection
    ) -> Result<()>;
    fn unmap(&self, offset: u64, size: u64) -> Result<()>;
}
Expand description

A trait for memory mapping for DAX.

For some transports (like virtio) it may be possible to share a region of memory with the FUSE kernel driver so that it can access file contents directly without issuing read or write requests. In this case the driver will instead send requests to map a section of a file into the shared memory region.

Required Methods§

source

fn map( &self, mem_offset: u64, size: usize, fd: &dyn AsRawFd, file_offset: u64, prot: Protection ) -> Result<()>

Maps size bytes starting at file_offset bytes from within the given fd at mem_offset bytes from the start of the memory region with prot protections. mem_offset must be page aligned.

§Arguments
  • mem_offset - Page aligned offset into the memory region in bytes.
  • size - Size of memory region in bytes.
  • fd - File descriptor to mmap from.
  • file_offset - Offset in bytes from the beginning of fd to start the mmap.
  • prot - Protection of the memory region.
source

fn unmap(&self, offset: u64, size: u64) -> Result<()>

Unmaps size bytes at offset bytes from the start of the memory region. offset must be page aligned.

§Arguments
  • offset - Page aligned offset into the arena in bytes.
  • size - Size of memory region in bytes.

Implementations on Foreign Types§

source§

impl<'a, M: Mapper> Mapper for &'a M

source§

fn map( &self, mem_offset: u64, size: usize, fd: &dyn AsRawFd, file_offset: u64, prot: Protection ) -> Result<()>

source§

fn unmap(&self, offset: u64, size: u64) -> Result<()>

Implementors§