mirror_ubuntu-kernels/rust/helpers
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
..
blk.c rust: kbuild: auto generate helper exports 2024-08-19 11:09:02 +02:00
bug.c rust: kbuild: auto generate helper exports 2024-08-19 11:09:02 +02:00
build_assert.c
build_bug.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
cred.c rust: cred: add Rust abstraction for struct cred 2024-09-30 13:02:28 +02:00
err.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
fs.c rust: file: add Rust abstraction for struct file 2024-09-30 13:02:28 +02:00
helpers.c Rust changes for v6.13 2024-11-26 14:00:26 -08:00
jump_label.c rust: add static_branch_unlikely for static_key_false 2024-11-04 16:21:44 -05:00
kunit.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
mutex.c rust: sync: Add lock::Backend::assert_is_held() 2024-12-19 14:04:42 -08:00
page.c rust: kbuild: auto generate helper exports 2024-08-19 11:09:02 +02:00
pid_namespace.c rust: add PidNamespace 2024-10-08 15:44:36 +02:00
rbtree.c rust: rbtree: add red-black tree implementation backed by the C version 2024-08-31 17:35:08 +02:00
refcount.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
security.c rust: security: add abstraction for secctx 2024-09-30 13:02:28 +02:00
signal.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
slab.c rust: alloc: implement KVmalloc allocator 2024-10-15 22:56:59 +02:00
spinlock.c rust: sync: Add lock::Backend::assert_is_held() 2024-12-19 14:04:42 -08:00
task.c Rust changes for v6.13 2024-11-26 14:00:26 -08:00
uaccess.c rust: kbuild: auto generate helper exports 2024-08-19 11:09:02 +02:00
vmalloc.c rust: alloc: implement Vmalloc allocator 2024-10-15 22:56:59 +02:00
wait.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
workqueue.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00