Skip to content

Commit 7d3bc68

Browse files
hoshinolinajannau
authored andcommitted
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 <lina@asahilina.net>
1 parent 6d5c94d commit 7d3bc68

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
@@ -99,7 +99,7 @@ impl Page {
9999
/// different addresses. However, even if the addresses are different, the underlying memory is
100100
/// still the same for these purposes (e.g., it's still a data race if they both write to the
101101
/// same underlying byte at the same time).
102-
fn with_page_mapped<T>(&self, f: impl FnOnce(*mut u8) -> T) -> T {
102+
pub fn with_page_mapped<T>(&self, f: impl FnOnce(*mut u8) -> T) -> T {
103103
// SAFETY: `page` is valid due to the type invariants on `Page`.
104104
let mapped_addr = unsafe { bindings::kmap_local_page(self.as_ptr()) };
105105

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

0 commit comments

Comments
 (0)