Opaque in kernel::types
Opaque is the kernel crate's wrapper for a C structure that Rust must hold but must never look inside. It reserves memory of the right size for the C type, treats the contents as a black box, and han…
Rust wants to know the exact contents and invariants of every value it holds, but a C kernel structure is something only C may interpret, may be modified behind your back, and often must not move. Opaque is the wrapper that says: here is a piece of memory of the right size and alignment holding a C structure, treat it as a black box, and here is the raw pointer to hand back to C. Nearly every Rust type that represents a kernel object is an Opaque with safe methods bolted onto it. Without such a wrapper, Rust would assume it may copy or reorder a structure that C is still pointing at.
Opaque is the kernel crate's wrapper for a C structure that Rust must hold but must never look inside. It reserves memory of the right size for the C type, treats the contents as a black box, and han…