rust: init: add `Zeroable` trait and `init::zeroed` function
authorBenno Lossin <benno.lossin@proton.me>
Sat, 8 Apr 2023 12:26:12 +0000 (12:26 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 12 Apr 2023 16:41:05 +0000 (18:41 +0200)
commit38cde0bd7b6772003a37b9aa6822568409556ee9
treeff98bf79b564584914cefda0c9eedf1dd7cee218
parent6841d45a303029c54d6ad1ebb5dc72f7b2a74700
rust: init: add `Zeroable` trait and `init::zeroed` function

Add the `Zeroable` trait which marks types that can be initialized by
writing `0x00` to every byte of the type. Also add the `init::zeroed`
function that creates an initializer for a `Zeroable` type that writes
`0x00` to every byte.

Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20230408122429.1103522-12-y86-dev@protonmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/init.rs