Switch to 2018 edition
Most of this was generated by the absolutely extraordinary `cargo fix` subcommand. There were still 2 errors and a few warnings to patch up, but compared to the normal 600+ errors, I'd say the fixer did a damn good job! I'm also amazed that I could still start the VM after this, I half expected some kinds of runtime failure...
This commit is contained in:
+12
-12
@@ -7,15 +7,15 @@ use core::cmp::Ordering;
|
||||
use core::mem;
|
||||
use spin::Mutex;
|
||||
|
||||
use arch::paging::PAGE_SIZE;
|
||||
use context::arch;
|
||||
use context::file::FileDescriptor;
|
||||
use context::memory::{Grant, Memory, SharedMemory, Tls};
|
||||
use ipi::{ipi, IpiKind, IpiTarget};
|
||||
use scheme::{SchemeNamespace, FileHandle};
|
||||
use syscall::data::SigAction;
|
||||
use syscall::flag::SIG_DFL;
|
||||
use sync::WaitMap;
|
||||
use crate::arch::paging::PAGE_SIZE;
|
||||
use crate::context::arch;
|
||||
use crate::context::file::FileDescriptor;
|
||||
use crate::context::memory::{Grant, Memory, SharedMemory, Tls};
|
||||
use crate::ipi::{ipi, IpiKind, IpiTarget};
|
||||
use crate::scheme::{SchemeNamespace, FileHandle};
|
||||
use crate::syscall::data::SigAction;
|
||||
use crate::syscall::flag::SIG_DFL;
|
||||
use crate::sync::WaitMap;
|
||||
|
||||
/// Unique identifier for a context (i.e. `pid`).
|
||||
use ::core::sync::atomic::AtomicUsize;
|
||||
@@ -169,8 +169,8 @@ pub struct Context {
|
||||
|
||||
impl Context {
|
||||
pub fn new(id: ContextId) -> Context {
|
||||
let syscall_head = unsafe { Box::from_raw(::ALLOCATOR.alloc(Layout::from_size_align_unchecked(PAGE_SIZE, PAGE_SIZE)) as *mut [u8; PAGE_SIZE]) };
|
||||
let syscall_tail = unsafe { Box::from_raw(::ALLOCATOR.alloc(Layout::from_size_align_unchecked(PAGE_SIZE, PAGE_SIZE)) as *mut [u8; PAGE_SIZE]) };
|
||||
let syscall_head = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(PAGE_SIZE, PAGE_SIZE)) as *mut [u8; PAGE_SIZE]) };
|
||||
let syscall_tail = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(PAGE_SIZE, PAGE_SIZE)) as *mut [u8; PAGE_SIZE]) };
|
||||
|
||||
Context {
|
||||
id: id,
|
||||
@@ -304,7 +304,7 @@ impl Context {
|
||||
self.status = Status::Runnable;
|
||||
|
||||
if let Some(cpu_id) = self.cpu_id {
|
||||
if cpu_id != ::cpu_id() {
|
||||
if cpu_id != crate::cpu_id() {
|
||||
// Send IPI if not on current CPU
|
||||
ipi(IpiKind::Wakeup, IpiTarget::Other);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
//! File structs
|
||||
|
||||
use alloc::sync::Arc;
|
||||
use event;
|
||||
use crate::event;
|
||||
use spin::RwLock;
|
||||
use scheme::{self, SchemeId};
|
||||
use syscall::error::{Result, Error, EBADF};
|
||||
use crate::scheme::{self, SchemeId};
|
||||
use crate::syscall::error::{Result, Error, EBADF};
|
||||
|
||||
/// A file description
|
||||
#[derive(Debug)]
|
||||
|
||||
+3
-3
@@ -4,10 +4,10 @@ use alloc::collections::BTreeMap;
|
||||
use core::alloc::{GlobalAlloc, Layout};
|
||||
use core::mem;
|
||||
use core::sync::atomic::Ordering;
|
||||
use paging;
|
||||
use crate::paging;
|
||||
use spin::RwLock;
|
||||
|
||||
use syscall::error::{Result, Error, EAGAIN};
|
||||
use crate::syscall::error::{Result, Error, EAGAIN};
|
||||
use super::context::{Context, ContextId};
|
||||
|
||||
/// Context list type
|
||||
@@ -66,7 +66,7 @@ impl ContextList {
|
||||
let context_lock = self.new_context()?;
|
||||
{
|
||||
let mut context = context_lock.write();
|
||||
let mut fx = unsafe { Box::from_raw(::ALLOCATOR.alloc(Layout::from_size_align_unchecked(512, 16)) as *mut [u8; 512]) };
|
||||
let mut fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(512, 16)) as *mut [u8; 512]) };
|
||||
for b in fx.iter_mut() {
|
||||
*b = 0;
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ use alloc::collections::VecDeque;
|
||||
use core::intrinsics;
|
||||
use spin::Mutex;
|
||||
|
||||
use arch::paging::PAGE_SIZE;
|
||||
use context::file::FileDescriptor;
|
||||
use ipi::{ipi, IpiKind, IpiTarget};
|
||||
use memory::Frame;
|
||||
use paging::{ActivePageTable, InactivePageTable, Page, PageIter, PhysicalAddress, VirtualAddress};
|
||||
use paging::entry::EntryFlags;
|
||||
use paging::mapper::MapperFlushAll;
|
||||
use paging::temporary_page::TemporaryPage;
|
||||
use crate::arch::paging::PAGE_SIZE;
|
||||
use crate::context::file::FileDescriptor;
|
||||
use crate::ipi::{ipi, IpiKind, IpiTarget};
|
||||
use crate::memory::Frame;
|
||||
use crate::paging::{ActivePageTable, InactivePageTable, Page, PageIter, PhysicalAddress, VirtualAddress};
|
||||
use crate::paging::entry::EntryFlags;
|
||||
use crate::paging::mapper::MapperFlushAll;
|
||||
use crate::paging::temporary_page::TemporaryPage;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Grant {
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ pub fn init() {
|
||||
let mut contexts = contexts_mut();
|
||||
let context_lock = contexts.new_context().expect("could not initialize first context");
|
||||
let mut context = context_lock.write();
|
||||
let mut fx = unsafe { Box::from_raw(::ALLOCATOR.alloc(Layout::from_size_align_unchecked(512, 16)) as *mut [u8; 512]) };
|
||||
let mut fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(512, 16)) as *mut [u8; 512]) };
|
||||
for b in fx.iter_mut() {
|
||||
*b = 0;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ pub fn init() {
|
||||
context.kfx = Some(fx);
|
||||
context.status = Status::Runnable;
|
||||
context.running = true;
|
||||
context.cpu_id = Some(::cpu_id());
|
||||
context.cpu_id = Some(crate::cpu_id());
|
||||
CONTEXT_ID.store(context.id, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use alloc::sync::Arc;
|
||||
use core::mem;
|
||||
|
||||
use context::{contexts, switch, Status, WaitpidKey};
|
||||
use start::usermode;
|
||||
use syscall;
|
||||
use syscall::flag::{SIG_DFL, SIG_IGN, SIGCHLD, SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU};
|
||||
use crate::context::{contexts, switch, Status, WaitpidKey};
|
||||
use crate::start::usermode;
|
||||
use crate::syscall;
|
||||
use crate::syscall::flag::{SIG_DFL, SIG_IGN, SIGCHLD, SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU};
|
||||
|
||||
pub extern "C" fn signal_handler(sig: usize) {
|
||||
let (action, restorer) = {
|
||||
@@ -36,7 +36,7 @@ pub extern "C" fn signal_handler(sig: usize) {
|
||||
|
||||
if let Some(parent_lock) = contexts.get(ppid) {
|
||||
let waitpid = {
|
||||
let mut parent = parent_lock.write();
|
||||
let parent = parent_lock.write();
|
||||
Arc::clone(&parent.waitpid)
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@ pub extern "C" fn signal_handler(sig: usize) {
|
||||
|
||||
if let Some(parent_lock) = contexts.get(ppid) {
|
||||
let waitpid = {
|
||||
let mut parent = parent_lock.write();
|
||||
let parent = parent_lock.write();
|
||||
Arc::clone(&parent.waitpid)
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ pub extern "C" fn signal_handler(sig: usize) {
|
||||
// println!("Call {:X}", handler);
|
||||
|
||||
unsafe {
|
||||
let mut sp = ::USER_SIGSTACK_OFFSET + ::USER_SIGSTACK_SIZE - 256;
|
||||
let mut sp = crate::USER_SIGSTACK_OFFSET + crate::USER_SIGSTACK_SIZE - 256;
|
||||
|
||||
sp = (sp / 16) * 16;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use core::sync::atomic::Ordering;
|
||||
|
||||
use context::{arch, contexts, Context, Status, CONTEXT_ID};
|
||||
use context::signal::signal_handler;
|
||||
use gdt;
|
||||
use interrupt;
|
||||
use interrupt::irq::PIT_TICKS;
|
||||
use time;
|
||||
use crate::context::{arch, contexts, Context, Status, CONTEXT_ID};
|
||||
use crate::context::signal::signal_handler;
|
||||
use crate::gdt;
|
||||
use crate::interrupt;
|
||||
use crate::interrupt::irq::PIT_TICKS;
|
||||
use crate::time;
|
||||
|
||||
unsafe fn update(context: &mut Context, cpu_id: usize) {
|
||||
// Take ownership if not already owned
|
||||
@@ -74,7 +74,7 @@ pub unsafe fn switch() -> bool {
|
||||
interrupt::pause();
|
||||
}
|
||||
|
||||
let cpu_id = ::cpu_id();
|
||||
let cpu_id = crate::cpu_id();
|
||||
|
||||
let from_ptr;
|
||||
let mut to_ptr = 0 as *mut Context;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use alloc::collections::VecDeque;
|
||||
use spin::{Once, Mutex, MutexGuard};
|
||||
|
||||
use event;
|
||||
use scheme::SchemeId;
|
||||
use syscall::data::TimeSpec;
|
||||
use syscall::flag::{CLOCK_MONOTONIC, CLOCK_REALTIME, EVENT_READ};
|
||||
use time;
|
||||
use crate::event;
|
||||
use crate::scheme::SchemeId;
|
||||
use crate::syscall::data::TimeSpec;
|
||||
use crate::syscall::flag::{CLOCK_MONOTONIC, CLOCK_REALTIME, EVENT_READ};
|
||||
use crate::time;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Timeout {
|
||||
|
||||
Reference in New Issue
Block a user