diff options
author | Tamir Duberstein <tamird@gmail.com> | 2025-07-09 15:31:16 -0400 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2025-07-19 23:18:18 +0200 |
commit | c77f85b347dd506ab6ef047031e75c2d03101187 (patch) | |
tree | 3439c5282153131f96f3671bb4bd4ca8528d4ea5 /rust/kernel/lib.rs | |
parent | 5d840b4c4935cd5100be97b6df565b4b159970a5 (diff) |
rust: list: remove OFFSET constants
Replace `ListLinksSelfPtr::LIST_LINKS_SELF_PTR_OFFSET` with `unsafe fn
raw_get_self_ptr` which returns a pointer to the field rather than
requiring the caller to do pointer arithmetic.
Implement `HasListLinks::raw_get_list_links` in `impl_has_list_links!`,
narrowing the interface of `HasListLinks` and replacing pointer
arithmetic with `container_of!`.
Modify `impl_list_item` to also invoke `impl_has_list_links!` or
`impl_has_list_links_self_ptr!`. This is necessary to allow
`impl_list_item` to see more of the tokens used by
`impl_has_list_links{,_self_ptr}!`.
A similar API change was discussed on the hrtimer series[1].
Link: https://lore.kernel.org/all/20250224-hrtimer-v3-v6-12-rc2-v9-1-5bd3bf0ce6cc@kernel.org/ [1]
Tested-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://lore.kernel.org/r/20250709-list-no-offset-v4-6-a429e75840a9@gmail.com
[ Fixed broken intra-doc links. Used the renamed
`Opaque::cast_into`. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/lib.rs')
0 files changed, 0 insertions, 0 deletions