Skip to content

Conversation

@blktests-ci
Copy link

@blktests-ci blktests-ci bot commented Nov 17, 2025

Pull request for series with
subject: New trait OwnableRefCounted for ARef<->Owned conversion.
version: 13
url: https://patchwork.kernel.org/project/linux-block/list/?series=1024189

@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 17, 2025

Upstream branch: f824272
series: https://patchwork.kernel.org/project/linux-block/list/?series=1024189
version: 13

@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 17, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1024189
version: 13

@blktests-ci blktests-ci bot force-pushed the series/1024189=>linus-master branch from 5b3b0ed to 195123f Compare November 17, 2025 23:52
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 6099a4d to 5121c4d Compare November 18, 2025 02:19
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 18, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1024189
version: 13

@blktests-ci blktests-ci bot force-pushed the series/1024189=>linus-master branch from 195123f to 12ab472 Compare November 18, 2025 02:26
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 5121c4d to 4458758 Compare November 19, 2025 00:24
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 19, 2025

Upstream branch: 8b69055
series: https://patchwork.kernel.org/project/linux-block/list/?series=1024189
version: 13

@blktests-ci blktests-ci bot force-pushed the series/1024189=>linus-master branch from 12ab472 to 9b983be Compare November 19, 2025 00:29
@kawasaki kawasaki closed this Nov 20, 2025
Asahi Lina and others added 4 commits November 21, 2025 18:51
By analogy to `AlwaysRefCounted` and `ARef`, an `Ownable` type is a
(typically C FFI) type that *may* be owned by Rust, but need not be. Unlike
`AlwaysRefCounted`, this mechanism expects the reference to be unique
within Rust, and does not allow cloning.

Conceptually, this is similar to a `KBox<T>`, except that it delegates
resource management to the `T` instead of using a generic allocator.

[ om:
  - Split code into separate file and `pub use` it from types.rs.
  - Make from_raw() and into_raw() public.
  - Remove OwnableMut, and make DerefMut dependent on Unpin instead.
  - Usage example/doctest for Ownable/Owned.
  - Fixes to documentation and commit message.
]

Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Asahi Lina <[email protected]>
Co-developed-by: Oliver Mangold <[email protected]>
Signed-off-by: Oliver Mangold <[email protected]>
Co-developed-by: Andreas Hindborg <[email protected]>
Signed-off-by: Andreas Hindborg <[email protected]>
Reviewed-by: Boqun Feng <[email protected]>
`AlwaysRefCounted` will become a marker trait to indicate that it is
allowed to obtain an `ARef<T>` from a `&T`, which cannot be allowed for
types which are also Ownable.

Signed-off-by: Oliver Mangold <[email protected]>
Co-developed-by: Andreas Hindborg <[email protected]>
Signed-off-by: Andreas Hindborg <[email protected]>
Suggested-by: Alice Ryhl <[email protected]>
SAFETY comment in rustdoc example was just 'TODO'. Fixed.

Signed-off-by: Oliver Mangold <[email protected]>
Co-developed-by: Andreas Hindborg <[email protected]>
Signed-off-by: Andreas Hindborg <[email protected]>
Types implementing one of these traits can safely convert between an
`ARef<T>` and an `Owned<T>`.

This is useful for types which generally are accessed through an `ARef`
but have methods which can only safely be called when the reference is
unique, like e.g. `block::mq::Request::end_ok()`.

Signed-off-by: Oliver Mangold <[email protected]>
Co-developed-by: Andreas Hindborg <[email protected]>
Signed-off-by: Andreas Hindborg <[email protected]>
Reviewed-by: Andreas Hindborg <[email protected]>
@blktests-ci blktests-ci bot reopened this Nov 21, 2025
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 21, 2025

Upstream branch: fd95357
series: https://patchwork.kernel.org/project/linux-block/list/?series=1024189
version: 13

@blktests-ci blktests-ci bot force-pushed the series/1024189=>linus-master branch from 9b983be to 5ce4d2a Compare November 21, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants