mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 09:53:24 +00:00
Removed unused vmo type
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
38a78cc3ce
commit
2c33f5dae1
@ -127,23 +127,11 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum VmoType {
|
||||
/// This vmo_ is created as a copy on write child
|
||||
CopyOnWriteChild,
|
||||
/// This vmo_ is created as a slice child
|
||||
SliceChild,
|
||||
/// This vmo_ is not created as a child of a parent vmo
|
||||
NotChild,
|
||||
}
|
||||
|
||||
pub(super) struct Vmo_ {
|
||||
/// Flags
|
||||
flags: VmoFlags,
|
||||
/// VmoInner
|
||||
inner: Mutex<VmoInner>,
|
||||
/// vmo type
|
||||
vmo_type: VmoType,
|
||||
}
|
||||
|
||||
struct VmoInner {
|
||||
@ -321,6 +309,14 @@ impl VmoInner {
|
||||
|
||||
Ok(frame)
|
||||
}
|
||||
|
||||
fn is_cow_child(&self) -> bool {
|
||||
if let Some(inherited_pages) = &self.inherited_pages {
|
||||
inherited_pages.is_copy_on_write
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Vmo_ {
|
||||
@ -474,7 +470,7 @@ impl<R> Vmo<R> {
|
||||
}
|
||||
|
||||
pub fn is_cow_child(&self) -> bool {
|
||||
self.0.vmo_type == VmoType::CopyOnWriteChild
|
||||
self.0.inner.lock().is_cow_child()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ use typeflags_util::{SetExtend, SetExtendOp};
|
||||
use crate::prelude::*;
|
||||
|
||||
use crate::vm::vmo::InheritedPages;
|
||||
use crate::vm::vmo::VmoType;
|
||||
use crate::vm::vmo::{VmoInner, Vmo_};
|
||||
use jinux_rights::{Dup, Rights, TRightSet, TRights, Write};
|
||||
|
||||
@ -136,7 +135,6 @@ fn alloc_vmo_(size: usize, flags: VmoFlags, pager: Option<Arc<dyn Pager>>) -> Re
|
||||
Ok(Vmo_ {
|
||||
flags,
|
||||
inner: Mutex::new(vmo_inner),
|
||||
vmo_type: VmoType::NotChild,
|
||||
})
|
||||
}
|
||||
|
||||
@ -499,14 +497,9 @@ fn alloc_child_vmo_(
|
||||
committed_pages: BTreeMap::new(),
|
||||
inherited_pages: Some(inherited_pages),
|
||||
};
|
||||
let vmo_type = match child_type {
|
||||
ChildType::Cow => VmoType::CopyOnWriteChild,
|
||||
ChildType::Slice => VmoType::SliceChild,
|
||||
};
|
||||
Ok(Vmo_ {
|
||||
flags: child_flags,
|
||||
inner: Mutex::new(vmo_inner),
|
||||
vmo_type,
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user