Re: [PATCH v19 4/8] rust: page: convert to `Ownable`

Alice Ryhl <[email protected]>
Newsgroups org.kernel.vger.linux-pwm,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.linux-pm,org.kernel.vger.linux-security-module,org.kernel.vger.rust-for-linux,org.kvack.linux-mm
Message-ID <CAH5fLgguLAQG7mUwD1NPECYSsPdpPD_tLskU3NdwLZhKR1H=aQ@mail.gmail.com>
On Fri, Jun 26, 2026 at 1:56 PM Andreas Hindborg <[email protected]> wrote:
>
> From: Asahi Lina <[email protected]>
>
> This allows Page references to be returned as borrowed references,
> without necessarily owning the struct page.
>
> Remove `BorrowedPage` and update users to use `Owned<Page>`.
>
> Signed-off-by: Asahi Lina <[email protected]>
> [ Andreas: Fix formatting and add a safety comment, update users. ]
> Signed-off-by: Andreas Hindborg <[email protected]>
> Reviewed-by: Gary Guo <[email protected]>

Reviewed-by: Alice Ryhl <[email protected]>

>      /// Returns a raw pointer to the page.
>      pub fn as_ptr(&self) -> *mut bindings::page {
> -        self.page.as_ptr()
> +        Opaque::cast_into(&self.page)

cast_into() is mainly used when you have a raw pointer to opaque. When
you have a reference, you can just do self.page.get()

Alice
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.