mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/5] rust: add DropGuard
@ 2026-09-26 17:33 Mohamed Osama
  2026-09-26 17:33 ` [PATCH v3 1/5] rust: add DropGuard KUnit test configuration Mohamed Osama
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Mohamed Osama @ 2026-09-26 17:33 UTC (permalink / raw)
  To: ojeda
  Cc: boqun, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross,
	dakr, daniel.almeida, tamird, acourbot, work, longman, lyude,
	linux-block, linux-serial, rust-for-linux, linux-kernel

Add the Rust kernel DropGuard API and migrate the existing ScopeGuard
users in the block, serdev, and locking code.

DropGuard runs a FnOnce callback when dropped and provides dismiss() to
take ownership of the wrapped value without running the cleanup callback.

Changes since v2:
- Clarified why DropGuard is added alongside the existing ScopeGuard.
- Fixed the core imports in mem.rs to follow the Rust kernel import style.

The series was previously tested with:
- make LLVM=1 rustfmtcheck
- make LLVM=1 rustdoc
- make LLVM=1 -j$(nproc)
- git diff --check
- scripts/checkpatch.pl

The changes in v3 are limited to the import style and commit-message
clarification.

Mohamed Osama (5):
  rust: add DropGuard KUnit test configuration
  rust: mem: add DropGuard
  rust: block: gen_disk: use DropGuard
  rust: serdev: use DropGuard
  rust: sync: lock: use DropGuard

 rust/kernel/Kconfig.test         |  10 +++
 rust/kernel/block/mq/gen_disk.rs |  11 +--
 rust/kernel/mem.rs               | 121 +++++++++++++++++++++++++++++++
 rust/kernel/serdev.rs            |  10 +--
 rust/kernel/sync/lock.rs         |   5 +-
 5 files changed, 144 insertions(+), 13 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-26 23:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-26 17:33 [PATCH v3 0/5] rust: add DropGuard Mohamed Osama
2026-09-26 17:33 ` [PATCH v3 1/5] rust: add DropGuard KUnit test configuration Mohamed Osama
2026-09-26 17:33 ` [PATCH v3 2/5] rust: mem: add DropGuard Mohamed Osama
2026-09-26 23:53   ` Gary Guo
2026-09-26 17:33 ` [PATCH v3 3/5] rust: block: gen_disk: use DropGuard Mohamed Osama
2026-09-26 17:33 ` [PATCH v3 4/5] rust: serdev: " Mohamed Osama
2026-09-26 17:33 ` [PATCH v3 5/5] rust: sync: lock: " Mohamed Osama

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®