]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: sync: atomic: Add atomic bool support via i8 representation
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Thu, 1 Jan 2026 03:49:21 +0000 (12:49 +0900)
committerBoqun Feng <boqun.feng@gmail.com>
Fri, 9 Jan 2026 11:01:41 +0000 (19:01 +0800)
commit06bd0e52bfd78eae1c7dd5db163ce64161b495e7
tree68a613821344088db66c43055c2e2dc28960a9b7
parent584f286f822afecc1a6521a27b3caf3e2f515d41
rust: sync: atomic: Add atomic bool support via i8 representation

Add `bool` support, `Atomic<bool>` by using `i8` as its underlying
representation.

Rust specifies that `bool` has size 1 and alignment 1 [1], so it
matches `i8` on layout; keep `static_assert!()` checks to enforce this
assumption at build time.

[boqun: Remove the unnecessary impl AtomicImpl for bool]

Link: https://doc.rust-lang.org/reference/types/boolean.html
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20260101034922.2020334-2-fujita.tomonori@gmail.com
rust/kernel/sync/atomic/predefine.rs