Skip to content

Commit e966feb

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 6c4b546 commit e966feb

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

@@ -236,7 +236,7 @@ impl Page {
236236
/// different addresses. However, even if the addresses are different, the underlying memory is
237237
/// still the same for these purposes (e.g., it's still a data race if they both write to the
238238
/// same underlying byte at the same time).
239-
fn with_pointer_into_page<T>(
239+
pub fn with_pointer_into_page<T>(
240240
&self,
241241
off: usize,
242242
len: usize,

0 commit comments

Comments
 (0)