linux/rust/kernel/sync
Lyude Paul fbd7a5a035 rust: sync: Add lock::Backend::assert_is_held()
Since we've exposed Lock::from_raw() and Guard::new() publically, we
want to be able to make sure that we assert that a lock is actually held
when constructing a Guard for it to handle instances of unsafe
Guard::new() calls outside of our lock module.

Hence add a new method assert_is_held() to Backend, which uses lockdep
to check whether or not a lock has been acquired. When lockdep is
disabled, this has no overhead.

[Boqun: Resolve the conflicts with exposing Guard::new(), reword the
 commit log a bit and format "unsafe { <statement>; }" into "unsafe {
 <statement> }" for the consistency. ]

Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20241125204139.656801-1-lyude@redhat.com
2024-12-19 14:04:42 -08:00
..
arc rust: provide proper code documentation titles 2024-10-07 21:39:57 +02:00
lock rust: sync: Add lock::Backend::assert_is_held() 2024-12-19 14:04:42 -08:00
arc.rs rust: use custom FFI integer types 2024-11-10 23:58:00 +01:00
condvar.rs rust: use custom FFI integer types 2024-11-10 23:58:00 +01:00
lock.rs rust: sync: Add lock::Backend::assert_is_held() 2024-12-19 14:04:42 -08:00
locked_by.rs rust: treewide: switch to the kernel Vec type 2024-10-15 23:10:32 +02:00
poll.rs rust: file: add abstraction for poll_table 2024-09-30 13:02:29 +02:00