Skip to content

rust: introduce DropGuard

Mohamed Osama linux-block linux-serial lkml rust-for-linux 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 4 repliesIn review
  2. v3 posting 2/25 patches 1 replySuperseded
  3. v2 posting 2/25 patches 0 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v3 posting 1/21 patch0 repliesSuperseded
v2 posting 1/21 patch0 repliesSuperseded
v11 patch0 repliesSuperseded

Changes in v4 from the cover letter

- Vendor DropGuard in rust/kernel/std_vendor.rs and re-export it from kernel::mem, following Gary Guo's review.
- Remove the DropGuard KUnit tests and Kconfig option since the implementation is vendored from the standard library.
- Keep the existing ScopeGuard API unchanged.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4rust: mem: add DropGuardrust/kernel/mem.rs rust/kernel/std_vendor.rs+89 -00 replies
2/4rust: block: gen_disk: use DropGuardrust/kernel/block/mq/gen_disk.rs+6 -50 replies
3/4rust: serdev: use DropGuardrust/kernel/serdev.rs+4 -61 reply
4/4rust: sync: lock: use DropGuardrust/kernel/sync/lock.rs+3 -21 reply

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchBoqun Feng
1/4
2/4
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/4] rust: introduce DropGuard

This series adds the Rust kernel DropGuard API and migrates existing cleanup guards in the block, serdev, and locking code to use it.

DropGuard is vendored from the Rust standard library and re-exported through kernel::mem.

Changes since v3:
- Vendor DropGuard in rust/kernel/std_vendor.rs and re-export it from kernel::mem, following Gary Guo's review.
- Remove the DropGuard KUnit tests and Kconfig option since the implementation is vendored from the standard library.
- Keep the existing ScopeGuard API unchanged.

Testing:
- make LLVM=1 rustfmtcheck
- make LLVM=1 -j$(nproc)

Mohamed Osama (4):
rust: mem: add DropGuard
rust: block: gen_disk: use DropGuard
rust: serdev: use DropGuard
rust: sync: lock: use DropGuard

 rust/kernel/block/mq/gen_disk.rs | 11 ++--
 rust/kernel/mem.rs               |  2 +
 rust/kernel/serdev.rs            | 10 ++--
 rust/kernel/std_vendor.rs        | 87 ++++++++++++++++++++++++++++++++
 rust/kernel/sync/lock.rs         |  5 +-
 5 files changed, 102 insertions(+), 13 deletions(-)
Signature · 1 line
2.43.0