pub struct UserMut<'a, T: Sized, R: Copy + ReprMut<T> = *mut T> { /* private fields */ }
Expand description
A pointer to mutable userspace memory with a defined in-memory representation.
This exists primarily for use in defining safe ioctl
/etc request types,
to ensure that only valid addresses can be assigned to a field from
safe Rust. Using this is important for any pointer that the kernel might
write through, to ensure that safe Rust cannot assign an address that
might cause the kernel to corrupt memory.
If a struct type used with an ioctl request has a field containing an
address that the kernel might write to then defining that field as
a UserPtr
ensures that it can only have a valid address assigned
to it unless the caller uses the unsafe Self::from_ptr
.
The in-memory representation of this type is guaranteed to match
that of type parameter R
, which defaults to being a pointer to T
.