diff mbox series

[6/6] rust: page: Make Page::as_ptr() pub(crate)

Message ID 20250202-rust-page-v1-6-e3170d7fe55e@asahilina.net (mailing list archive)
State New
Headers show
Series rust: page: Support borrowing `struct page` and physaddr conversion | expand

Commit Message

Asahi Lina Feb. 2, 2025, 1:05 p.m. UTC
There's no good reason for drivers to need access to the raw `struct
page` pointer, since that should be handled by Rust abstractions. Make
this method pub(crate) so it is only visible to the kernel crate.

Signed-off-by: Asahi Lina <lina@asahilina.net>
---
 rust/kernel/page.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alice Ryhl Feb. 3, 2025, 9:08 a.m. UTC | #1
On Sun, Feb 2, 2025 at 2:06 PM Asahi Lina <lina@asahilina.net> wrote:
>
> There's no good reason for drivers to need access to the raw `struct
> page` pointer, since that should be handled by Rust abstractions. Make
> this method pub(crate) so it is only visible to the kernel crate.
>
> Signed-off-by: Asahi Lina <lina@asahilina.net>

The Rust Binder driver has a C component, so it needs various as_ptr()
methods to be public.

Alice
Andreas Hindborg Feb. 19, 2025, 9:08 a.m. UTC | #2
"Asahi Lina" <lina@asahilina.net> writes:

> There's no good reason for drivers to need access to the raw `struct
> page` pointer, since that should be handled by Rust abstractions. Make
> this method pub(crate) so it is only visible to the kernel crate.
>

As I mentioned on another patch, we are planning to split the kernel
crate per subsystem, and this would need to be pub again then.


Best regards,
Andreas Hindborg
diff mbox series

Patch

diff --git a/rust/kernel/page.rs b/rust/kernel/page.rs
index 67cd7006fa63ab5aed4c4de2be639ed8e1fbc2ba..b7bce033b53682eca6e61f47e4fd3aa902da7900 100644
--- a/rust/kernel/page.rs
+++ b/rust/kernel/page.rs
@@ -83,7 +83,7 @@  pub fn alloc_page(flags: Flags) -> Result<Owned<Self>, AllocError> {
     }
 
     /// Returns a raw pointer to the page.
-    pub fn as_ptr(&self) -> *mut bindings::page {
+    pub(crate) fn as_ptr(&self) -> *mut bindings::page {
         Opaque::raw_get(&self.page)
     }