Skip to content

Commit 32eefb1

Browse files
committed
rust: page: Make with_page_mapped() and with_pointer_into_page() public
Lets users do (unsafe) complex page read/write operations without having to repeatedly call into read_raw()/write_raw() (which may be expensive in some cases). Signed-off-by: Asahi Lina <[email protected]>
1 parent 170e28b commit 32eefb1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rust/kernel/page.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl Page {
101101
/// different addresses. However, even if the addresses are different, the underlying memory is
102102
/// still the same for these purposes (e.g., it's still a data race if they both write to the
103103
/// same underlying byte at the same time).
104-
fn with_page_mapped<T>(&self, f: impl FnOnce(*mut u8) -> T) -> T {
104+
pub fn with_page_mapped<T>(&self, f: impl FnOnce(*mut u8) -> T) -> T {
105105
// SAFETY: `page` is valid due to the type invariants on `Page`.
106106
let mapped_addr = unsafe { bindings::kmap_local_page(self.as_ptr()) };
107107

@@ -142,7 +142,7 @@ impl Page {
142142
/// different addresses. However, even if the addresses are different, the underlying memory is
143143
/// still the same for these purposes (e.g., it's still a data race if they both write to the
144144
/// same underlying byte at the same time).
145-
fn with_pointer_into_page<T>(
145+
pub fn with_pointer_into_page<T>(
146146
&self,
147147
off: usize,
148148
len: usize,

0 commit comments

Comments
 (0)