diff options
author | Alice Ryhl <aliceryhl@google.com> | 2024-08-14 08:05:29 +0000 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2024-08-23 06:26:57 +0200 |
commit | b204bbc53f958fc3119d63bf2cda5a526e7267a4 (patch) | |
tree | 4c1e3a17d1439f484b3abc71ef537d1bb1d1120f /rust/kernel/list.rs | |
parent | 2003c04b059759b0ec3bff108f24ded9de86a726 (diff) | |
download | linux-b204bbc53f958fc3119d63bf2cda5a526e7267a4.tar.gz linux-b204bbc53f958fc3119d63bf2cda5a526e7267a4.tar.bz2 linux-b204bbc53f958fc3119d63bf2cda5a526e7267a4.zip |
rust: list: add ListArcField
One way to explain what `ListArc` does is that it controls exclusive
access to the prev/next pointer field in a refcounted object. The
feature of having a special reference to a refcounted object with
exclusive access to specific fields is useful for other things, so
provide a general utility for that.
This is used by Rust Binder to keep track of which processes have a
reference to a given node. This involves an object for each process/node
pair, that is referenced by both the process and the node. For some
fields in this object, only the process's reference needs to access
them (and it needs mutable access), so Binder uses a ListArc to give the
process's reference exclusive access.
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20240814-linked-list-v5-10-f5f5e8075da0@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/list.rs')
-rw-r--r-- | rust/kernel/list.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/rust/kernel/list.rs b/rust/kernel/list.rs index 432a75a58d02..5b4aec29eb67 100644 --- a/rust/kernel/list.rs +++ b/rust/kernel/list.rs @@ -19,6 +19,9 @@ pub use self::impl_list_item_mod::{ mod arc; pub use self::arc::{impl_list_arc_safe, AtomicTracker, ListArc, ListArcSafe, TryNewListArc}; +mod arc_field; +pub use self::arc_field::{define_list_arc_field_getter, ListArcField}; + /// A linked list. /// /// All elements in this linked list will be [`ListArc`] references to the value. Since a value can |