From d524198d1c80c38b2cd3d137b3f28141454b9105 Mon Sep 17 00:00:00 2001 From: ChenRuiwei <1982833213@qq.com> Date: Sun, 28 Jul 2024 16:45:13 +0800 Subject: [PATCH] refactor(device): make name more consistent --- driver/src/lib.rs | 4 ++-- driver/src/manager.rs | 10 +++++----- driver/src/serial/mod.rs | 4 ++-- driver/src/virtio/loopback.rs | 4 ++-- driver/src/virtio/mod.rs | 4 ++-- driver/src/virtio/virtio_blk.rs | 8 ++++---- driver/src/virtio/virtio_net.rs | 6 +++--- modules/device-core/src/lib.rs | 12 ++++++------ modules/ext4/src/disk.rs | 6 +++--- modules/ext4/src/fs.rs | 4 ++-- modules/fat32/src/fs.rs | 4 ++-- modules/fat32/src/lib.rs | 4 ++-- modules/net/src/lib.rs | 14 +++++++------- modules/page/src/buffer_cache.rs | 8 ++++---- modules/page/src/page.rs | 8 ++++---- modules/vfs-core/src/file_system_type.rs | 6 +++--- modules/vfs-core/src/super_block.rs | 8 ++++---- modules/vfs/src/devfs/mod.rs | 6 +++--- modules/vfs/src/procfs/mod.rs | 6 +++--- modules/vfs/src/sockfs/mod.rs | 6 +++--- modules/vfs/src/tmpfs/mod.rs | 6 +++--- 21 files changed, 69 insertions(+), 69 deletions(-) diff --git a/driver/src/lib.rs b/driver/src/lib.rs index 42ffe8da..c2d1e34e 100644 --- a/driver/src/lib.rs +++ b/driver/src/lib.rs @@ -16,7 +16,7 @@ use core::fmt::{self, Write}; use async_utils::block_on; use crate_interface::call_interface; -use device_core::{BlockDriverOps, CharDevice, DeviceMajor}; +use device_core::{BlockDevice, CharDevice, DeviceMajor}; use manager::DeviceManager; use memory::PageTable; use sbi_print::SbiStdout; @@ -59,7 +59,7 @@ pub fn init() { // CHAR_DEVICE.call_once(|| manager.char_device[0].clone()); } -pub static BLOCK_DEVICE: Once> = Once::new(); +pub static BLOCK_DEVICE: Once> = Once::new(); // fn init_block_device() { // BLOCK_DEVICE.call_once(|| VirtIOBlkDev::new()); diff --git a/driver/src/manager.rs b/driver/src/manager.rs index 4206893a..71494a93 100644 --- a/driver/src/manager.rs +++ b/driver/src/manager.rs @@ -4,7 +4,7 @@ use alloc::{collections::BTreeMap, sync::Arc, vec::Vec}; use arch::interrupts::{disable_interrupt, enable_external_interrupt}; use config::{board, mm::K_SEG_DTB_BEG}; -use device_core::{BaseDriverOps, DevId}; +use device_core::{Device, DevId}; use log::{info, warn}; use crate::{cpu::CPU, plic::PLIC, println}; @@ -14,9 +14,9 @@ pub struct DeviceManager { pub cpus: Vec, /// net device is excluded from `device`. It is owned by `InterfaceWrapper` /// in `net` module - pub devices: BTreeMap>, + pub devices: BTreeMap>, /// irq_no -> device. - pub irq_map: BTreeMap>, + pub irq_map: BTreeMap>, } impl DeviceManager { @@ -66,11 +66,11 @@ impl DeviceManager { self.plic.as_ref().unwrap() } - pub fn get(&self, dev_id: &DevId) -> Option<&Arc> { + pub fn get(&self, dev_id: &DevId) -> Option<&Arc> { self.devices.get(dev_id) } - pub fn devices(&self) -> &BTreeMap> { + pub fn devices(&self) -> &BTreeMap> { &self.devices } diff --git a/driver/src/serial/mod.rs b/driver/src/serial/mod.rs index 3adee2f8..dcaf8d34 100644 --- a/driver/src/serial/mod.rs +++ b/driver/src/serial/mod.rs @@ -11,7 +11,7 @@ use core::{ use async_trait::async_trait; use async_utils::{block_on, get_waker}; use config::{board::UART_BUF_LEN, mm::VIRT_RAM_OFFSET}; -use device_core::{BaseDriverOps, DevId, DeviceMajor, DeviceMeta, DeviceType}; +use device_core::{Device, DevId, DeviceMajor, DeviceMeta, DeviceType}; use fdt::Fdt; use macro_utils::with_methods; use memory::pte::PTEFlags; @@ -83,7 +83,7 @@ impl fmt::Debug for Serial { } } -impl BaseDriverOps for Serial { +impl Device for Serial { fn meta(&self) -> &DeviceMeta { &self.meta } diff --git a/driver/src/virtio/loopback.rs b/driver/src/virtio/loopback.rs index 36bf42d3..dbb50080 100644 --- a/driver/src/virtio/loopback.rs +++ b/driver/src/virtio/loopback.rs @@ -2,7 +2,7 @@ use alloc::{boxed::Box, collections::VecDeque, vec, vec::Vec}; use device_core::{ error::{DevError, DevResult}, - DeviceCapabilities, EthernetAddress, Medium, NetBufPtrOps, NetDriverOps, + DeviceCapabilities, EthernetAddress, Medium, NetBufPtrOps, NetDevice, }; /// The loopback interface operates at the network layer and handles the packets @@ -21,7 +21,7 @@ impl LoopbackDev { } } -impl NetDriverOps for LoopbackDev { +impl NetDevice for LoopbackDev { #[inline] fn capabilities(&self) -> DeviceCapabilities { let mut cap = DeviceCapabilities::default(); diff --git a/driver/src/virtio/mod.rs b/driver/src/virtio/mod.rs index e81bef65..b8da8761 100644 --- a/driver/src/virtio/mod.rs +++ b/driver/src/virtio/mod.rs @@ -5,7 +5,7 @@ pub mod virtio_net; use core::ptr::NonNull; use config::mm::VIRT_RAM_OFFSET; -use device_core::{error::DevError, BaseDriverOps}; +use device_core::{error::DevError, Device}; use fdt::Fdt; use log::{error, warn}; use loopback::LoopbackDev; @@ -19,7 +19,7 @@ use virtio_drivers::{ }, BufferDirection, }; -use virtio_net::NetDevice; +use virtio_net::NetDeviceImpl; use crate::{kernel_page_table_mut, manager::DeviceManager, BLOCK_DEVICE}; diff --git a/driver/src/virtio/virtio_blk.rs b/driver/src/virtio/virtio_blk.rs index c4597ae1..135468cb 100644 --- a/driver/src/virtio/virtio_blk.rs +++ b/driver/src/virtio/virtio_blk.rs @@ -1,7 +1,7 @@ use alloc::{string::ToString, sync::Arc}; use config::board::BLOCK_SIZE; -use device_core::{BaseDriverOps, BlockDriverOps, DevId, DeviceMajor, DeviceMeta, DeviceType}; +use device_core::{BlockDevice, DevId, Device, DeviceMajor, DeviceMeta, DeviceType}; use log::error; use page::BufferCache; use sync::mutex::SpinNoIrqLock; @@ -9,7 +9,7 @@ use virtio_drivers::{device::blk::VirtIOBlk, transport::mmio::MmioTransport}; use super::VirtioHalImpl; -pub type BlockDevice = VirtIoBlkDev; +pub type BlockDeviceImpl = VirtIoBlkDev; pub struct VirtIoBlkDev { meta: DeviceMeta, @@ -20,7 +20,7 @@ pub struct VirtIoBlkDev { unsafe impl Send for VirtIoBlkDev {} unsafe impl Sync for VirtIoBlkDev {} -impl BlockDriverOps for VirtIoBlkDev { +impl BlockDevice for VirtIoBlkDev { // TODO: cached size value fn size(&self) -> u64 { self.device.lock().capacity() * (BLOCK_SIZE as u64) @@ -106,7 +106,7 @@ impl VirtIoBlkDev { } } -impl BaseDriverOps for VirtIoBlkDev { +impl Device for VirtIoBlkDev { fn meta(&self) -> &device_core::DeviceMeta { &self.meta } diff --git a/driver/src/virtio/virtio_net.rs b/driver/src/virtio/virtio_net.rs index 9948c9d6..075d07b5 100644 --- a/driver/src/virtio/virtio_net.rs +++ b/driver/src/virtio/virtio_net.rs @@ -3,7 +3,7 @@ use core::{any::Any, ptr::NonNull}; use device_core::{ error::{DevError, DevResult}, - DeviceCapabilities, EthernetAddress, Medium, NetBufPtrOps, NetDriverOps, + DeviceCapabilities, EthernetAddress, Medium, NetBufPtrOps, NetDevice, }; use virtio_drivers::{ device::net::VirtIONetRaw, @@ -13,7 +13,7 @@ use virtio_drivers::{ use super::{as_dev_err, VirtioHalImpl}; use crate::net::{NetBuf, NetBufBox, NetBufPool, NET_BUF_LEN}; -pub type NetDevice = VirtIoNetDev; +pub type NetDeviceImpl = VirtIoNetDev; /// The VirtIO network device driver. /// @@ -79,7 +79,7 @@ impl VirtIoNetDev { } } -impl NetDriverOps for VirtIoNetDev { +impl NetDevice for VirtIoNetDev { #[inline] fn capabilities(&self) -> DeviceCapabilities { let mut cap = DeviceCapabilities::default(); diff --git a/modules/device-core/src/lib.rs b/modules/device-core/src/lib.rs index f33bc135..6e0b3801 100644 --- a/modules/device-core/src/lib.rs +++ b/modules/device-core/src/lib.rs @@ -52,7 +52,7 @@ pub struct DeviceMeta { pub dtype: DeviceType, } -pub trait BaseDriverOps: Sync + Send + DowncastSync { +pub trait Device: Sync + Send + DowncastSync { fn meta(&self) -> &DeviceMeta; fn init(&self); @@ -84,17 +84,17 @@ pub trait BaseDriverOps: Sync + Send + DowncastSync { } } -impl_downcast!(sync BaseDriverOps); +impl_downcast!(sync Device); #[async_trait] -pub trait CharDevice: BaseDriverOps { +pub trait CharDevice: Device { async fn read(&self, buf: &mut [u8]) -> usize; async fn write(&self, buf: &[u8]) -> usize; async fn poll_in(&self) -> bool; async fn poll_out(&self) -> bool; } -pub trait BlockDriverOps: BaseDriverOps { +pub trait BlockDevice: Device { fn size(&self) -> u64; fn block_size(&self) -> usize; @@ -116,13 +116,13 @@ pub trait BlockDriverOps: BaseDriverOps { fn write_block(&self, block_id: usize, buf: &[u8]); } -impl_downcast!(sync BlockDriverOps); +impl_downcast!(sync BlockDevice); /// The ethernet address of the NIC (MAC address). pub struct EthernetAddress(pub [u8; 6]); /// Every Net Device should implement this trait -pub trait NetDriverOps: Sync + Send { +pub trait NetDevice: Sync + Send { fn capabilities(&self) -> DeviceCapabilities; /// The ethernet address of the NIC. fn mac_address(&self) -> EthernetAddress; diff --git a/modules/ext4/src/disk.rs b/modules/ext4/src/disk.rs index 75244ef6..430ce517 100644 --- a/modules/ext4/src/disk.rs +++ b/modules/ext4/src/disk.rs @@ -1,7 +1,7 @@ use alloc::sync::Arc; use config::board::BLOCK_SIZE; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use lwext4_rust::{ bindings::{SEEK_CUR, SEEK_END, SEEK_SET}, KernelDevOp, @@ -12,12 +12,12 @@ use systype::SysResult; pub struct Disk { block_id: usize, offset: usize, - dev: Arc, + dev: Arc, } impl Disk { /// Create a new disk. - pub fn new(dev: Arc) -> Self { + pub fn new(dev: Arc) -> Self { assert_eq!(BLOCK_SIZE, dev.block_size()); Self { block_id: 0, diff --git a/modules/ext4/src/fs.rs b/modules/ext4/src/fs.rs index 4120ca2f..7e3c2379 100644 --- a/modules/ext4/src/fs.rs +++ b/modules/ext4/src/fs.rs @@ -1,6 +1,6 @@ use alloc::sync::Arc; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use lwext4_rust::{Ext4BlockWrapper, InodeTypes}; use systype::SysResult; use vfs_core::{ @@ -31,7 +31,7 @@ impl FileSystemType for Ext4FsType { name: &str, parent: Option>, _flags: MountFlags, - dev: Option>, + dev: Option>, ) -> SysResult> { debug_assert!(dev.is_some()); let sb = Ext4SuperBlock::new(SuperBlockMeta::new(dev, self.clone())); diff --git a/modules/fat32/src/fs.rs b/modules/fat32/src/fs.rs index 8ad8359b..9c09e503 100644 --- a/modules/fat32/src/fs.rs +++ b/modules/fat32/src/fs.rs @@ -1,6 +1,6 @@ use alloc::sync::Arc; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use vfs_core::{Dentry, FileSystemType, FileSystemTypeMeta, StatFs, SuperBlock, SuperBlockMeta}; use crate::{as_sys_err, dentry::FatDentry, inode::dir::FatDirInode, DiskCursor, FatFs}; @@ -27,7 +27,7 @@ impl FileSystemType for FatFsType { name: &str, parent: Option>, _flags: vfs_core::MountFlags, - dev: Option>, + dev: Option>, ) -> systype::SysResult> { debug_assert!(dev.is_some()); let sb = FatSuperBlock::new(SuperBlockMeta::new(dev, self.clone())); diff --git a/modules/fat32/src/lib.rs b/modules/fat32/src/lib.rs index c1c1ed6c..f2f3abd5 100644 --- a/modules/fat32/src/lib.rs +++ b/modules/fat32/src/lib.rs @@ -4,7 +4,7 @@ use alloc::sync::Arc; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use fatfs::{DefaultTimeProvider, Dir, DirIter, Error, File, FileSystem, LossyOemCpConverter}; use sync::mutex::SpinNoIrqLock; use systype::SysError; @@ -42,7 +42,7 @@ pub const fn as_sys_err(err: fatfs::Error<()>) -> systype::SysError { pub struct DiskCursor { sector: u64, offset: usize, - blk_dev: Arc, + blk_dev: Arc, } impl DiskCursor { diff --git a/modules/net/src/lib.rs b/modules/net/src/lib.rs index 091302af..d8ce6cc2 100644 --- a/modules/net/src/lib.rs +++ b/modules/net/src/lib.rs @@ -7,7 +7,7 @@ use core::{cell::RefCell, future::Future, ops::DerefMut, panic}; use arch::time::get_time_us; use crate_interface::call_interface; -use device_core::{error::DevError, NetBufPtrOps, NetDriverOps}; +use device_core::{error::DevError, NetBufPtrOps, NetDevice}; use listen_table::*; use log::*; pub use smoltcp::wire::{IpAddress, IpEndpoint, IpListenEndpoint, Ipv4Address, Ipv6Address}; @@ -65,7 +65,7 @@ static ETH0: Once = Once::new(); struct SocketSetWrapper<'a>(Mutex>); struct DeviceWrapper { - inner: RefCell>, /* use `RefCell` is enough since it's wrapped in + inner: RefCell>, /* use `RefCell` is enough since it's wrapped in * `Mutex` in * `InterfaceWrapper`. */ } @@ -175,7 +175,7 @@ impl<'a> SocketSetWrapper<'a> { } impl InterfaceWrapper { - fn new(name: &'static str, dev: Box, ether_addr: EthernetAddress) -> Self { + fn new(name: &'static str, dev: Box, ether_addr: EthernetAddress) -> Self { // let mut config = Config::new(HardwareAddress::Ethernet(ether_addr)); // let mut config = if ether_addr == EthernetAddress([0, 0, 0, 0, 0, 0]) { // log::error!("[InterfaceWrapper] use HardwareAddress::Ip"); @@ -237,7 +237,7 @@ impl InterfaceWrapper { } impl DeviceWrapper { - fn new(inner: Box) -> Self { + fn new(inner: Box) -> Self { Self { inner: RefCell::new(inner), } @@ -288,8 +288,8 @@ impl Device for DeviceWrapper { } } -struct NetRxToken<'a>(&'a RefCell>, Box); -struct NetTxToken<'a>(&'a RefCell>); +struct NetRxToken<'a>(&'a RefCell>, Box); +struct NetTxToken<'a>(&'a RefCell>); impl<'a> RxToken for NetRxToken<'a> { fn preprocess(&self, sockets: &mut SocketSet<'_>) { @@ -416,7 +416,7 @@ pub const SEND_SHUTDOWN: u8 = 2; /// 表示读和写方向都已关闭(相当于SHUT_RDWR) pub const SHUTDOWN_MASK: u8 = 3; -pub fn init_network(net_dev: Box, is_loopback: bool) { +pub fn init_network(net_dev: Box, is_loopback: bool) { info!("Initialize network subsystem..."); let ether_addr = EthernetAddress(net_dev.mac_address().0); let eth0 = InterfaceWrapper::new("eth0", net_dev, ether_addr); diff --git a/modules/page/src/buffer_cache.rs b/modules/page/src/buffer_cache.rs index 95c8383f..86f86069 100644 --- a/modules/page/src/buffer_cache.rs +++ b/modules/page/src/buffer_cache.rs @@ -8,7 +8,7 @@ use config::{ MAX_BUFFER_PAGES, PAGE_SIZE, }, }; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use intrusive_collections::{intrusive_adapter, LinkedListAtomicLink}; use lru::LruCache; use macro_utils::with_methods; @@ -17,7 +17,7 @@ use sync::mutex::SpinNoIrqLock; use crate::Page; pub struct BufferCache { - device: Option>, + device: Option>, /// Block page id to `Page`. // NOTE: These `Page`s are pages without file, only exist for caching pure // block data. @@ -39,11 +39,11 @@ impl BufferCache { } } - pub fn init_device(&mut self, device: Arc) { + pub fn init_device(&mut self, device: Arc) { self.device = Some(Arc::downgrade(&device)) } - pub fn device(&self) -> Arc { + pub fn device(&self) -> Arc { self.device.as_ref().unwrap().upgrade().unwrap() } diff --git a/modules/page/src/page.rs b/modules/page/src/page.rs index d3796b1c..18d31ede 100644 --- a/modules/page/src/page.rs +++ b/modules/page/src/page.rs @@ -5,7 +5,7 @@ use config::{ board::BLOCK_SIZE, mm::{block_page_offset, PAGE_SIZE}, }; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use enum_as_inner::EnumAsInner; use intrusive_collections::LinkedList; use memory::{alloc_frame_tracker, FrameTracker, PhysPageNum}; @@ -44,7 +44,7 @@ pub struct Page { } pub struct BufferInfo { - pub device: Weak, + pub device: Weak, buffer_heads: LinkedList, buffer_head_cnts: usize, } @@ -96,7 +96,7 @@ impl Page { }) } - pub fn new_file(block_device: &Arc) -> Arc { + pub fn new_file(block_device: &Arc) -> Arc { let frame = alloc_frame_tracker(); Arc::new(Self { frame, @@ -108,7 +108,7 @@ impl Page { }) } - pub fn new_block(block_device: &Arc) -> Arc { + pub fn new_block(block_device: &Arc) -> Arc { let frame = alloc_frame_tracker(); Arc::new(Self { frame, diff --git a/modules/vfs-core/src/file_system_type.rs b/modules/vfs-core/src/file_system_type.rs index b80a8863..02dc365e 100644 --- a/modules/vfs-core/src/file_system_type.rs +++ b/modules/vfs-core/src/file_system_type.rs @@ -4,7 +4,7 @@ use alloc::{ sync::Arc, }; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use systype::{SysError, SysResult}; use crate::{Dentry, MountFlags, Mutex, SuperBlock}; @@ -36,7 +36,7 @@ pub trait FileSystemType: Send + Sync { name: &str, parent: Option>, flags: MountFlags, - dev: Option>, + dev: Option>, ) -> SysResult>; /// Call when an instance of this filesystem should be shut down. @@ -64,7 +64,7 @@ impl dyn FileSystemType { name: &str, parent: Option>, flags: MountFlags, - dev: Option>, + dev: Option>, ) -> SysResult> { self.clone().base_mount(name, parent, flags, dev) } diff --git a/modules/vfs-core/src/super_block.rs b/modules/vfs-core/src/super_block.rs index d19a9d7b..d17e946b 100644 --- a/modules/vfs-core/src/super_block.rs +++ b/modules/vfs-core/src/super_block.rs @@ -4,7 +4,7 @@ use alloc::{ }; use core::mem::MaybeUninit; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use spin::Once; use systype::SysResult; @@ -13,7 +13,7 @@ use crate::{Dentry, FileSystemType, Inode, Mutex, StatFs}; pub struct SuperBlockMeta { /// Block device that hold this file system. // TODO: dyn file for device? - pub device: Option>, + pub device: Option>, /// File system type. pub fs_type: Weak, /// Root dentry points to the mount point. @@ -21,7 +21,7 @@ pub struct SuperBlockMeta { } impl SuperBlockMeta { - pub fn new(device: Option>, fs_type: Arc) -> Self { + pub fn new(device: Option>, fs_type: Arc) -> Self { Self { device, root_dentry: Once::new(), @@ -57,7 +57,7 @@ impl dyn SuperBlock { self.meta().root_dentry.get().unwrap().clone() } - pub fn device(&self) -> Arc { + pub fn device(&self) -> Arc { self.meta().device.as_ref().cloned().unwrap() } } diff --git a/modules/vfs/src/devfs/mod.rs b/modules/vfs/src/devfs/mod.rs index 728e2db6..bf69fce1 100644 --- a/modules/vfs/src/devfs/mod.rs +++ b/modules/vfs/src/devfs/mod.rs @@ -1,6 +1,6 @@ use alloc::sync::Arc; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use systype::SysResult; use vfs_core::{Dentry, FileSystemType, FileSystemTypeMeta, InodeMode, SuperBlock, SuperBlockMeta}; @@ -89,7 +89,7 @@ impl FileSystemType for DevFsType { name: &str, parent: Option>, _flags: vfs_core::MountFlags, - dev: Option>, + dev: Option>, ) -> systype::SysResult> { let sb = DevSuperBlock::new(dev, self.clone()); let mount_dentry = SimpleDentry::new(name, sb.clone(), parent.clone()); @@ -113,7 +113,7 @@ struct DevSuperBlock { impl DevSuperBlock { pub fn new( - device: Option>, + device: Option>, fs_type: Arc, ) -> Arc { Arc::new(Self { diff --git a/modules/vfs/src/procfs/mod.rs b/modules/vfs/src/procfs/mod.rs index b99cadca..b314083b 100644 --- a/modules/vfs/src/procfs/mod.rs +++ b/modules/vfs/src/procfs/mod.rs @@ -4,7 +4,7 @@ mod mounts; use alloc::sync::Arc; use async_utils::block_on; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use systype::SysResult; use vfs_core::{ Dentry, FileSystemType, FileSystemTypeMeta, InodeMode, MountFlags, SuperBlock, SuperBlockMeta, @@ -71,7 +71,7 @@ impl FileSystemType for ProcFsType { name: &str, parent: Option>, _flags: MountFlags, - dev: Option>, + dev: Option>, ) -> SysResult> { let sb = ProcSuperBlock::new(dev, self.clone()); let mount_dentry = SimpleDentry::new(name, sb.clone(), parent.clone()); @@ -95,7 +95,7 @@ pub struct ProcSuperBlock { impl ProcSuperBlock { pub fn new( - device: Option>, + device: Option>, fs_type: Arc, ) -> Arc { Arc::new(Self { diff --git a/modules/vfs/src/sockfs/mod.rs b/modules/vfs/src/sockfs/mod.rs index 10802127..65fee025 100644 --- a/modules/vfs/src/sockfs/mod.rs +++ b/modules/vfs/src/sockfs/mod.rs @@ -1,6 +1,6 @@ use alloc::sync::Arc; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use systype::SysResult; use vfs_core::*; @@ -29,7 +29,7 @@ impl FileSystemType for SockFsType { name: &str, parent: Option>, _flags: MountFlags, - dev: Option>, + dev: Option>, ) -> SysResult> { let sb = SockSuperBlock::new(dev, self.clone()); let mount_dentry = SimpleDentry::new(name, sb.clone(), parent.clone()); @@ -54,7 +54,7 @@ pub struct SockSuperBlock { impl SockSuperBlock { pub fn new( - device: Option>, + device: Option>, fs_type: Arc, ) -> Arc { Arc::new(Self { diff --git a/modules/vfs/src/tmpfs/mod.rs b/modules/vfs/src/tmpfs/mod.rs index b4e7e520..f7afd9a5 100644 --- a/modules/vfs/src/tmpfs/mod.rs +++ b/modules/vfs/src/tmpfs/mod.rs @@ -1,6 +1,6 @@ use alloc::sync::Arc; -use device_core::BlockDriverOps; +use device_core::BlockDevice; use systype::SysResult; use vfs_core::{ Dentry, FileSystemType, FileSystemTypeMeta, InodeMode, MountFlags, StatFs, SuperBlock, @@ -31,7 +31,7 @@ impl FileSystemType for TmpFsType { name: &str, parent: Option>, _flags: MountFlags, - dev: Option>, + dev: Option>, ) -> SysResult> { let sb = TmpSuperBlock::new(dev, self.clone()); let mount_dentry = SimpleDentry::new(name, sb.clone(), parent.clone()); @@ -55,7 +55,7 @@ pub struct TmpSuperBlock { impl TmpSuperBlock { pub fn new( - device: Option>, + device: Option>, fs_type: Arc, ) -> Arc { Arc::new(Self {