[PATCH 11/11] rust: page: remove `Page::copy_from_user_slice_raw`
From: Andreas Hindborg
Date: Fri Nov 20 2026 - 05:28:54 EST
The last user of `Page::copy_from_user_slice_raw()` now copies from user
space through a `SysMemLocal` view, see `UserSliceReader::read_sysmem()`.
Remove the unused method.
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
rust/kernel/page.rs | 32 +-------------------------------
1 file changed, 1 insertion(+), 31 deletions(-)
diff --git a/rust/kernel/page.rs b/rust/kernel/page.rs
index 7fa037f5938b..adb131fb94dc 100644
--- a/rust/kernel/page.rs
+++ b/rust/kernel/page.rs
@@ -32,8 +32,7 @@
Opaque,
Ownable,
Owned, //
- },
- uaccess::UserSliceReader, //
+ }, //
};
use core::{
marker::PhantomData,
@@ -631,35 +630,6 @@ pub unsafe fn fill_zero_raw(&self, offset: usize, len: usize) -> Result {
// written are initialized. `fill` only uses the view on the current task.
unsafe { self.with_page_as_sysmem(offset, len, fill) }
}
-
- /// Copies data from userspace into this page.
- ///
- /// This method will perform bounds checks on the page offset. If `offset .. offset+len` goes
- /// outside of the page, then this call returns [`EINVAL`].
- ///
- /// Like the other `UserSliceReader` methods, data races are allowed on the userspace address.
- /// However, they are not allowed on the page you are copying into.
- ///
- /// # Safety
- ///
- /// * Callers must ensure that this call does not race with a read or write to the same page
- /// that overlaps with this write.
- /// * Callers must ensure that no reference to the data of the page that overlaps with this
- /// write exists during this call. Such references can be obtained from a
- /// [`Page<Exclusive>`], see [`Page::as_slice`].
- pub unsafe fn copy_from_user_slice_raw(
- &self,
- reader: &mut UserSliceReader,
- offset: usize,
- len: usize,
- ) -> Result {
- self.with_pointer_into_page(offset, len, move |dst| {
- // SAFETY: If `with_pointer_into_page` calls into this closure, then it has performed a
- // bounds check and guarantees that `dst` is valid for `len` bytes. The caller
- // guarantees that there are no races, so `dst` is valid for atomic writes.
- unsafe { reader.read_raw(dst, len) }
- })
- }
}
impl Page<Shared> {
--
2.54.0