Struct os::mm::page_table::UserBuffer
source · [−]pub struct UserBuffer {
pub buffers: Vec<&'static mut [u8]>,
pub len: usize,
}
Expand description
A buffer in user space. Kernel space code may use this struct to copy to/ read from user space. This struct is meaningless in case that the kernel page is present in the user side MemorySet.
Fields
buffers: Vec<&'static mut [u8]>
The segmented array, or, a “vector of vectors”.
Design Information
In Rust, reference lifetime is a must for this template.
The lifetime of buffers is static
because the buffer ‘USES A’ instead of ‘HAS A’
len: usize
The total size of the Userbuffer.
Implementations
Write to self
starting at offset
, and return written bytes.
This funtion will try to write as much as possible data
in the limit of self.len()
and src.len()
.
It guarantees that won’t read/write out of bound.