Replace from/into with get/new when necessary.
This commit is contained in:
@@ -415,8 +415,8 @@ impl Context {
|
||||
/// Get a file
|
||||
pub fn get_file(&self, i: FileHandle) -> Option<FileDescriptor> {
|
||||
let files = self.files.read();
|
||||
if i.into() < files.len() {
|
||||
files[i.into()].clone()
|
||||
if i.get() < files.len() {
|
||||
files[i.get()].clone()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -426,12 +426,12 @@ impl Context {
|
||||
/// Return the file descriptor number or None if the slot was not empty, or i was invalid
|
||||
pub fn insert_file(&self, i: FileHandle, file: FileDescriptor) -> Option<FileHandle> {
|
||||
let mut files = self.files.write();
|
||||
if i.into() < super::CONTEXT_MAX_FILES {
|
||||
while i.into() >= files.len() {
|
||||
if i.get() < super::CONTEXT_MAX_FILES {
|
||||
while i.get() >= files.len() {
|
||||
files.push(None);
|
||||
}
|
||||
if files[i.into()].is_none() {
|
||||
files[i.into()] = Some(file);
|
||||
if files[i.get()].is_none() {
|
||||
files[i.get()] = Some(file);
|
||||
Some(i)
|
||||
} else {
|
||||
None
|
||||
@@ -445,8 +445,8 @@ impl Context {
|
||||
// TODO: adjust files vector to smaller size if possible
|
||||
pub fn remove_file(&self, i: FileHandle) -> Option<FileDescriptor> {
|
||||
let mut files = self.files.write();
|
||||
if i.into() < files.len() {
|
||||
files[i.into()].take()
|
||||
if i.get() < files.len() {
|
||||
files[i.get()].take()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -1631,8 +1631,6 @@ fn correct_inner<'l>(addr_space_lock: &'l Arc<RwLock<AddrSpace>>, mut addr_space
|
||||
|
||||
let mut allow_writable = true;
|
||||
|
||||
let mut debug = false;
|
||||
|
||||
let frame = match grant_info.provider {
|
||||
Provider::Allocated { .. } | Provider::AllocatedShared { .. } if access == AccessMode::Write => {
|
||||
match faulting_pageinfo_opt {
|
||||
@@ -1673,8 +1671,6 @@ fn correct_inner<'l>(addr_space_lock: &'l Arc<RwLock<AddrSpace>>, mut addr_space
|
||||
base.next_by(pages_from_grant_start)
|
||||
}
|
||||
Provider::External { address_space: ref foreign_address_space, src_base, .. } => {
|
||||
debug = true;
|
||||
|
||||
let foreign_address_space = Arc::clone(foreign_address_space);
|
||||
|
||||
if Arc::ptr_eq(addr_space_lock, &foreign_address_space) {
|
||||
@@ -1773,9 +1769,6 @@ fn correct_inner<'l>(addr_space_lock: &'l Arc<RwLock<AddrSpace>>, mut addr_space
|
||||
}
|
||||
};
|
||||
|
||||
if super::context_id().into() == 3 && debug {
|
||||
//log::info!("Correcting {:?} => {:?} (base {:?} info {:?})", faulting_page, frame, grant_base, grant_info);
|
||||
}
|
||||
let new_flags = grant_flags.write(grant_flags.has_write() && allow_writable);
|
||||
let Some(flush) = (unsafe { addr_space.table.utable.map_phys(faulting_page.start_address(), frame.start_address(), new_flags) }) else {
|
||||
// TODO
|
||||
|
||||
@@ -62,7 +62,7 @@ pub extern "C" fn signal_handler(sig: usize) {
|
||||
pgid: Some(pgid)
|
||||
}, (pid, 0xFFFF));
|
||||
} else {
|
||||
println!("{}: {} not found for continue", pid.into(), ppid.into());
|
||||
println!("{}: {} not found for continue", pid.get(), ppid.get());
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -90,7 +90,7 @@ pub extern "C" fn signal_handler(sig: usize) {
|
||||
pgid: Some(pgid)
|
||||
}, (pid, (sig << 8) | 0x7F));
|
||||
} else {
|
||||
println!("{}: {} not found for stop", pid.into(), ppid.into());
|
||||
println!("{}: {} not found for stop", pid.get(), ppid.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user