Skip to content

rust: sync: Add Lock::is_locked()

Lyude Paul lkml rust-for-linux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3rust: sync: Add Lock::is_locked()rust/helpers/spinlock.c rust/kernel/sync/lock.rs rust/kernel/sync/lock/mutex.rs +1 more+33 -01 reply
2/3rust: sync: Assert Lock::is_locked in Guard::new for debug buildsrust/kernel/sync/lock.rs+7 -03 replies
3/3rust: sync: Add Guard::new_unchecked()rust/kernel/sync/lock.rs+15 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] rust: sync: Add Lock::is_locked()

Now that we expose Guard::new() outside of the lock module, I figured it would be a good idea for us to actually add some debug assertions to ensure that callers outside of this module don't call Guard::new() for locks they don't actually hold.

This series adds the ability to do so, while also making sure that we don't needlessly run these debug assertions for the more common usecase of acquiring a lock in safe rust code.

Lyude Paul (3):
rust: sync: Add Lock::is_locked()
rust: sync: Assert Lock::is_locked in Guard::new for debug builds
rust: sync: Add Guard::new_unchecked()

 rust/helpers/spinlock.c           |  5 ++++
 rust/kernel/sync/lock.rs          | 42 +++++++++++++++++++++++++++++--
 rust/kernel/sync/lock/mutex.rs    |  5 ++++
 rust/kernel/sync/lock/spinlock.rs |  5 ++++
 4 files changed, 55 insertions(+), 2 deletions(-)

base-commit: b2603f8ac8217bc59f5c7f248ac248423b9b99cb
prerequisite-patch-id: 8c65a39abe47832d0c98c9c266b4b9348fb3526a
prerequisite-patch-id: 211faf8533feec77907b0a1b9b2f788e72c5ac58

Signature · 1 line
2.47.0