Skip to content

Commit

Permalink
feat(mapper): expose MapperFlush(All)?::new
Browse files Browse the repository at this point in the history
It looks like there is no way to create an instance of these types.

Fixes: rust-osdev#295
  • Loading branch information
toku-sa-n committed Aug 29, 2021
1 parent a9cbf14 commit 278e1fe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/structures/paging/mapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,11 @@ pub struct MapperFlush<S: PageSize>(Page<S>);

impl<S: PageSize> MapperFlush<S> {
/// Create a new flush promise
///
/// Note that this method is intended for implementing the [`Mapper`] trait and no other uses
/// are expected.
#[inline]
fn new(page: Page<S>) -> Self {
pub fn new(page: Page<S>) -> Self {
MapperFlush(page)
}

Expand All @@ -403,14 +406,17 @@ impl<S: PageSize> MapperFlush<S> {
/// The old mapping might be still cached in the translation lookaside buffer (TLB), so it needs
/// to be flushed from the TLB before it's accessed. This type is returned from a function that
/// made the change to ensure that the TLB flush is not forgotten.
#[derive(Debug)]
#[derive(Debug, Default)]
#[must_use = "Page Table changes must be flushed or ignored."]
pub struct MapperFlushAll(());

impl MapperFlushAll {
/// Create a new flush promise
///
/// Note that this method is intended for implementing the [`Mapper`] trait and no other uses
/// are expected.
#[inline]
fn new() -> Self {
pub fn new() -> Self {
MapperFlushAll(())
}

Expand Down

0 comments on commit 278e1fe

Please sign in to comment.