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 |
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
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) }
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(-)