Skip to content

Commit

Permalink
fix: optimize dep source code
Browse files Browse the repository at this point in the history
  • Loading branch information
yfblock committed Apr 16, 2024
1 parent dab03db commit 55aa3fc
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 25 deletions.
5 changes: 4 additions & 1 deletion drivers/general-plic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ mod plic;

use alloc::sync::Arc;
use devices::{
device::{DeviceType, Driver, IntDriver}, driver_define, fdt::node::FdtNode, VIRT_ADDR_START
device::{DeviceType, Driver, IntDriver},
driver_define,
fdt::node::FdtNode,
VIRT_ADDR_START,
};

pub struct PLIC {
Expand Down
3 changes: 2 additions & 1 deletion drivers/k210-sdcard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ extern crate alloc;
use alloc::sync::Arc;
use core::{cell::RefCell, convert::TryInto};
use devices::{
device::{BlkDriver, DeviceType, Driver}, driver_define, Mutex, DRIVERS_INIT
device::{BlkDriver, DeviceType, Driver},
driver_define, Mutex, DRIVERS_INIT,
};
use k210_hal::prelude::*;
use k210_pac::{Peripherals, SPI0};
Expand Down
3 changes: 2 additions & 1 deletion drivers/kcvitek-sd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use alloc::sync::Arc;
use cv1811_sd::clk_en;
use devices::{
device::{BlkDriver, DeviceType, Driver},
driver_define, fdt::node::FdtNode,
driver_define,
fdt::node::FdtNode,
};

pub struct CvSd;
Expand Down
5 changes: 4 additions & 1 deletion drivers/kgoldfish-rtc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ extern crate log;
use alloc::sync::Arc;
use core::ptr::read_volatile;
use devices::{
device::{DeviceType, Driver, RtcDriver}, driver_define, fdt::node::FdtNode, VIRT_ADDR_START
device::{DeviceType, Driver, RtcDriver},
driver_define,
fdt::node::FdtNode,
VIRT_ADDR_START,
};
use timestamp::DateTime;

Expand Down
3 changes: 2 additions & 1 deletion drivers/knvme/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ extern crate log;

use alloc::{sync::Arc, vec::Vec};
use devices::{
device::{BlkDriver, DeviceType, Driver}, driver_define, frame_alloc_much, FrameTracker, Mutex, PAGE_SIZE, VIRT_ADDR_START
device::{BlkDriver, DeviceType, Driver},
driver_define, frame_alloc_much, FrameTracker, Mutex, PAGE_SIZE, VIRT_ADDR_START,
};
use nvme_driver::{DmaAllocator, IrqController, NvmeInterface};

Expand Down
5 changes: 4 additions & 1 deletion drivers/kvirtio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ use core::ptr::NonNull;

use alloc::{sync::Arc, vec::Vec};
use devices::{
device::{Driver, UnsupportedDriver}, driver_define, fdt::node::FdtNode, node_to_interrupts, VIRT_ADDR_START
device::{Driver, UnsupportedDriver},
driver_define,
fdt::node::FdtNode,
node_to_interrupts, VIRT_ADDR_START,
};
use virtio_drivers::transport::{
mmio::{MmioTransport, VirtIOHeader},
Expand Down
2 changes: 1 addition & 1 deletion drivers/kvirtio/src/virtio_impl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::vec::Vec;
use devices::{frame_alloc_much, FrameTracker, Mutex, VIRT_ADDR_START};
use core::ptr::NonNull;
use devices::{frame_alloc_much, FrameTracker, Mutex, VIRT_ADDR_START};
use log::trace;
use virtio_drivers::{BufferDirection, Hal, PhysAddr};

Expand Down
5 changes: 4 additions & 1 deletion drivers/ns16550a/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ extern crate alloc;

use alloc::{sync::Arc, vec::Vec};
use devices::{
device::{DeviceType, Driver, UartDriver}, driver_define, fdt::node::FdtNode, node_to_interrupts, register_device_irqs, VIRT_ADDR_START
device::{DeviceType, Driver, UartDriver},
driver_define,
fdt::node::FdtNode,
node_to_interrupts, register_device_irqs, VIRT_ADDR_START,
};
use log::info;
use ns16550a::{
Expand Down
34 changes: 20 additions & 14 deletions kernel/src/syscall/task.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
use crate::syscall::consts::{from_vfs, CloneFlags, Rusage};
use crate::syscall::time::WaitUntilsec;
use crate::tasks::elf::{init_task_stack, ElfExtra};
use crate::tasks::{futex_requeue, futex_wake, WaitFutex, WaitPid};
use crate::user::entry::user_entry;
use crate::user::UserTaskContainer;
use alloc::string::{String, ToString};
use alloc::sync::Weak;
use alloc::vec::Vec;
use alloc::{boxed::Box, sync::Arc};
use arch::addr::VirtPage;
use arch::pagetable::MappingFlags;
use arch::time::Time;
use arch::{TrapFrameArgs, PAGE_SIZE};
use crate::{
syscall::consts::{from_vfs, CloneFlags, Rusage},
syscall::time::WaitUntilsec,
tasks::elf::{init_task_stack, ElfExtra},
tasks::{futex_requeue, futex_wake, WaitFutex, WaitPid},
user::entry::user_entry,
user::UserTaskContainer,
};
use alloc::{
string::{String, ToString},
sync::Weak,
vec::Vec,
{boxed::Box, sync::Arc},
};
use arch::{
addr::VirtPage,
pagetable::MappingFlags,
time::Time,
{TrapFrameArgs, PAGE_SIZE},
};
use async_recursion::async_recursion;
use core::cmp;
use executor::{
Expand Down
2 changes: 1 addition & 1 deletion modules/devices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub mod device;

pub use arch::{PAGE_SIZE, VIRT_ADDR_START};
pub use fdt;
pub use frame_allocator::{frame_alloc, FrameTracker, frame_alloc_much};
pub use frame_allocator::{frame_alloc, frame_alloc_much, FrameTracker};
pub use linkme::{self, distributed_slice as linker_use};
pub use sync::{LazyInit, Mutex, MutexGuard};
// pub mod virtio;
Expand Down
4 changes: 2 additions & 2 deletions modules/executor/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use alloc::{
use arch::{
addr::{PhysPage, VirtAddr, VirtPage},
pagetable::{MappingFlags, MappingSize, PageTableWrapper},
{TrapFrame, TrapFrameArgs, PAGE_SIZE}
{TrapFrame, TrapFrameArgs, PAGE_SIZE},
};
use frame_allocator::{ceil_div, frame_alloc_much, FrameTracker};
use fs::File;
use log::{debug, warn};
use signal::{REAL_TIME_SIGNAL_NUM, SigAction, SigProcMask, SignalFlags};
use signal::{SigAction, SigProcMask, SignalFlags, REAL_TIME_SIGNAL_NUM};
use sync::{Mutex, MutexGuard, RwLock};
use vfscore::OpenFlags;

Expand Down

0 comments on commit 55aa3fc

Please sign in to comment.