rust: move ARef and AlwaysRefCounted to sync::aref
PATCH 1/1 rust: move ARef and AlwaysRefCounted to sync::aref
Move the definitions of ARef and AlwaysRefCounted from types.rs to a new file sync/aref.rs.
Define the corresponding aref module under rust/kernel/sync.rs. These types are better grouped in sync with other synchronization primitives.
To avoid breaking existing imports, they are re-exported from types.rs. Drop unused imports mem::ManuallyDrop, ptr::NonNull from types.rs, they are now only used in sync/aref.rs, where they are already imported.
---
The moving patch and updating patch are split as discussed in https://github.com/Rust-for-Linux/linux/issues/1173
A follow-up patch will update all the call sites to import ARef and AlwaysRefCounted directly from sync::aref instead of types.
Fixes were also made to intra-doc links: unresolved references to inc_ref and dec_ref were updated to use AlwaysRefCounted::inc_ref and AlwaysRefCounted::dec_ref.
--- rust/kernel/sync.rs | 1 + rust/kernel/sync/aref.rs | 170 +++++++++++++++++++++++++++++++++++++++ rust/kernel/types.rs | 156 ++--------------------------------- 3 files changed, 176 insertions(+), 151 deletions(-) create mode 100644 rust/kernel/sync/aref.rs
rust/kernel/sync.rs +1 -0
@@ -10,6 +10,7 @@use pin_init;mod arc; +pub mod aref;mod condvar;pub mod lock;mod locked_by;
rust/kernel/sync/aref.rs new file +170 -0
170 lines not on this page · raw message
rust/kernel/types.rs +3 -151
170 lines not on this page · raw message
Signature · 1 line
2.34.1
Benno Lossin
reviewerQuoted 9 lines · Shankari Anand
Move the definitions of
ARefandAlwaysRefCountedfromtypes.rsto a new filesync/aref.rs.
Define the correspondingarefmodule underrust/kernel/sync.rs. These types are better grouped insyncwith other synchronization primitives.To avoid breaking existing imports, they are re-exported from
types.rs. Drop unused importsmem::ManuallyDrop,ptr::NonNullfromtypes.rs, they are now only used insync/aref.rs, where they are already imported.
Quoted 8 lines
Suggested-by Benno Lossin <[email protected]>Signed-off-by Shankari Anand <[email protected]>---
The moving patch and updating patch are split as discussed in https://github.com/Rust-for-Linux/linux/issues/1173
A follow-up patch will update all the call sites to importARefandAlwaysRefCounteddirectly fromsync::arefinstead oftypes.
Ah, I meant that you can just send the two patches in a single series. No need to wait for anything (it's easier to review the two distinct changes, that's why I thought it's a good idea to split them).
Quoted 9 lines
Fixes were also made to intra-doc links: unresolved references to
inc_refanddec_refwere updated to useAlwaysRefCounted::inc_refandAlwaysRefCounted::dec_ref.--- rust/kernel/sync.rs | 1 + rust/kernel/sync/aref.rs | 170 +++++++++++++++++++++++++++++++++++++++ rust/kernel/types.rs | 156 ++--------------------------------- 3 files changed, 176 insertions(+), 151 deletions(-) create mode 100644 rust/kernel/sync/aref.rs
This doesn't apply to rust-next or v6.16-rc3, what base did you use? When creating .patch files for sending, please use --base to make git add your base at the bottom.
---
Cheers,
Benno
Quoted 3 lines
Ah, I meant that you can just send the two patches in a single series. No need to wait for anything (it's easier to review the two distinct changes, that's why I thought it's a good idea to split them).
Apologies for the misunderstanding on my part regarding the split. I now understand that both patches should be sent as a single series for ease of review. Thanks for the clarification!
Quoted 3 lines
This doesn't apply to
rust-nextorv6.16-rc3, what base did you use? When creating.patchfiles for sending, please use--baseto make git add your base at the bottom.
Regarding the patch not applying cleanly: I had tested it on rust-next at the time, but it’s possible that a new commit has landed upstream since then which is causing the conflict. I’ll rebase both patches on the latest rust-next, re-test, and resend them together as a patch series with --base included as well.
Thanks again for your feedback!
Quoted 41 lines · Benno Lossin
Quoted 9 lines · Shankari Anand
Move the definitions of
ARefandAlwaysRefCountedfromtypes.rsto a new filesync/aref.rs.
Define the correspondingarefmodule underrust/kernel/sync.rs. These types are better grouped insyncwith other synchronization primitives.To avoid breaking existing imports, they are re-exported from
types.rs. Drop unused importsmem::ManuallyDrop,ptr::NonNullfromtypes.rs, they are now only used insync/aref.rs, where they are already imported.Quoted 8 lines
Suggested-by Benno Lossin <[email protected]>Signed-off-by Shankari Anand <[email protected]>---
The moving patch and updating patch are split as discussed in https://github.com/Rust-for-Linux/linux/issues/1173
A follow-up patch will update all the call sites to importARefandAlwaysRefCounteddirectly fromsync::arefinstead oftypes.Ah, I meant that you can just send the two patches in a single series. No need to wait for anything (it's easier to review the two distinct changes, that's why I thought it's a good idea to split them).
Quoted 9 lines
Fixes were also made to intra-doc links: unresolved references to
inc_refanddec_refwere updated to useAlwaysRefCounted::inc_refandAlwaysRefCounted::dec_ref.--- rust/kernel/sync.rs | 1 + rust/kernel/sync/aref.rs | 170 +++++++++++++++++++++++++++++++++++++++ rust/kernel/types.rs | 156 ++--------------------------------- 3 files changed, 176 insertions(+), 151 deletions(-) create mode 100644 rust/kernel/sync/aref.rsThis doesn't apply to
rust-nextorv6.16-rc3, what base did you use? When creating.patchfiles for sending, please use--baseto make git add your base at the bottom.---
Cheers,
Benno