mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 07:06:47 +00:00
将 io 移动至 vfs 目录,并修正引用路径 (#339)
* 将 io 移动至 vfs 目录,并修正引用路径 * fix bug in makefile
This commit is contained in:
parent
e92d022810
commit
ddb9d91712
@ -17,7 +17,7 @@ export ASFLAGS := --64
|
||||
LD_LIST := head.o
|
||||
|
||||
|
||||
kernel_subdirs := common driver process debug arch exception smp sched syscall ktest libs ipc io time
|
||||
kernel_subdirs := common driver process debug arch exception smp sched syscall ktest libs ipc time
|
||||
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::filesystem::devfs::{DevFS, DeviceINode};
|
||||
use crate::filesystem::vfs::file::FileMode;
|
||||
use crate::filesystem::vfs::io::device::BlockDevice;
|
||||
use crate::filesystem::vfs::{
|
||||
core::generate_inode_id, make_rawdev, FilePrivateData, FileSystem, FileType, IndexNode,
|
||||
Metadata, PollStatus,
|
||||
};
|
||||
use crate::io::device::BlockDevice;
|
||||
use crate::syscall::SystemError;
|
||||
use crate::{libs::spinlock::SpinLock, time::TimeSpec};
|
||||
use alloc::{
|
||||
|
@ -1,8 +1,8 @@
|
||||
use super::{_port, hba::HbaCmdTable, virt_2_phys};
|
||||
use crate::driver::disk::ahci::HBA_PxIS_TFES;
|
||||
use crate::filesystem::mbr::MbrDiskPartionTable;
|
||||
use crate::filesystem::vfs::io::{device::BlockDevice, disk_info::Partition, SeekFrom};
|
||||
use crate::include::bindings::bindings::verify_area;
|
||||
use crate::io::{device::BlockDevice, disk_info::Partition, SeekFrom};
|
||||
|
||||
use crate::libs::{spinlock::SpinLock, vec_cursor::VecCursor};
|
||||
use crate::mm::phys_2_virt;
|
||||
@ -52,8 +52,8 @@ impl Debug for AhciDisk {
|
||||
impl AhciDisk {
|
||||
fn read_at(
|
||||
&self,
|
||||
lba_id_start: crate::io::device::BlockId, // 起始lba编号
|
||||
count: usize, // 读取lba的数量
|
||||
lba_id_start: crate::filesystem::vfs::io::device::BlockId, // 起始lba编号
|
||||
count: usize, // 读取lba的数量
|
||||
buf: &mut [u8],
|
||||
) -> Result<usize, SystemError> {
|
||||
compiler_fence(core::sync::atomic::Ordering::SeqCst);
|
||||
@ -211,7 +211,7 @@ impl AhciDisk {
|
||||
|
||||
fn write_at(
|
||||
&self,
|
||||
lba_id_start: crate::io::device::BlockId,
|
||||
lba_id_start: crate::filesystem::vfs::io::device::BlockId,
|
||||
count: usize,
|
||||
buf: &[u8],
|
||||
) -> Result<usize, SystemError> {
|
||||
@ -449,7 +449,7 @@ impl BlockDevice for LockedAhciDisk {
|
||||
#[inline]
|
||||
fn read_at(
|
||||
&self,
|
||||
lba_id_start: crate::io::device::BlockId,
|
||||
lba_id_start: crate::filesystem::vfs::io::device::BlockId,
|
||||
count: usize,
|
||||
buf: &mut [u8],
|
||||
) -> Result<usize, SystemError> {
|
||||
@ -463,7 +463,7 @@ impl BlockDevice for LockedAhciDisk {
|
||||
#[inline]
|
||||
fn write_at(
|
||||
&self,
|
||||
lba_id_start: crate::io::device::BlockId,
|
||||
lba_id_start: crate::filesystem::vfs::io::device::BlockId,
|
||||
count: usize,
|
||||
buf: &[u8],
|
||||
) -> Result<usize, SystemError> {
|
||||
@ -475,7 +475,7 @@ impl BlockDevice for LockedAhciDisk {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn device(&self) -> Arc<dyn crate::io::device::Device> {
|
||||
fn device(&self) -> Arc<dyn crate::filesystem::vfs::io::device::Device> {
|
||||
return self.0.lock().self_ref.upgrade().unwrap();
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,10 @@ pub mod ahci_inode;
|
||||
pub mod ahcidisk;
|
||||
pub mod hba;
|
||||
|
||||
use crate::io::device::BlockDevice;
|
||||
use crate::filesystem::vfs::io::device::BlockDevice;
|
||||
// 依赖的rust工具包
|
||||
use crate::filesystem::devfs::devfs_register;
|
||||
use crate::io::disk_info::BLK_GF_AHCI;
|
||||
use crate::filesystem::vfs::io::disk_info::BLK_GF_AHCI;
|
||||
use crate::kerror;
|
||||
use crate::libs::spinlock::{SpinLock, SpinLockGuard};
|
||||
use crate::mm::virt_2_phys;
|
||||
|
@ -2,7 +2,7 @@
|
||||
use alloc::{sync::Arc, vec::Vec};
|
||||
|
||||
use crate::{
|
||||
io::{device::LBA_SIZE, disk_info::Partition, SeekFrom},
|
||||
filesystem::vfs::io::{device::LBA_SIZE, disk_info::Partition, SeekFrom},
|
||||
kerror,
|
||||
libs::vec_cursor::VecCursor,
|
||||
syscall::SystemError,
|
||||
|
@ -2,7 +2,7 @@
|
||||
use core::{cmp::min, intrinsics::unlikely};
|
||||
|
||||
use crate::{
|
||||
io::{device::LBA_SIZE, SeekFrom},
|
||||
filesystem::vfs::io::{device::LBA_SIZE, SeekFrom},
|
||||
kwarn,
|
||||
libs::vec_cursor::VecCursor,
|
||||
syscall::SystemError,
|
||||
|
@ -9,12 +9,12 @@ use alloc::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
filesystem::vfs::io::{device::LBA_SIZE, disk_info::Partition, SeekFrom},
|
||||
filesystem::vfs::{
|
||||
core::generate_inode_id,
|
||||
file::{FileMode, FilePrivateData},
|
||||
FileSystem, FileType, IndexNode, InodeId, Metadata, PollStatus,
|
||||
},
|
||||
io::{device::LBA_SIZE, disk_info::Partition, SeekFrom},
|
||||
kerror,
|
||||
libs::{
|
||||
spinlock::{SpinLock, SpinLockGuard},
|
||||
|
@ -168,7 +168,7 @@ fn migrate_virtual_filesystem(new_fs: Arc<dyn FileSystem>) -> Result<(), SystemE
|
||||
#[no_mangle]
|
||||
pub extern "C" fn mount_root_fs() -> i32 {
|
||||
kinfo!("Try to mount FAT32 as root fs...");
|
||||
let partiton: Arc<crate::io::disk_info::Partition> =
|
||||
let partiton: Arc<crate::filesystem::vfs::io::disk_info::Partition> =
|
||||
ahci::get_disks_by_name("ahci_disk_0".to_string())
|
||||
.unwrap()
|
||||
.0
|
||||
|
@ -4,8 +4,8 @@ use alloc::{boxed::Box, string::String, sync::Arc, vec::Vec};
|
||||
|
||||
use crate::{
|
||||
arch::asm::current::current_pcb, driver::tty::TtyFilePrivateData,
|
||||
filesystem::procfs::ProcfsFilePrivateData, include::bindings::bindings::process_control_block,
|
||||
io::SeekFrom, kerror, syscall::SystemError,
|
||||
filesystem::procfs::ProcfsFilePrivateData, filesystem::vfs::io::SeekFrom,
|
||||
include::bindings::bindings::process_control_block, kerror, syscall::SystemError,
|
||||
};
|
||||
|
||||
use super::{Dirent, FileType, IndexNode, Metadata};
|
||||
|
@ -3,6 +3,7 @@
|
||||
pub mod core;
|
||||
pub mod fcntl;
|
||||
pub mod file;
|
||||
pub mod io;
|
||||
pub mod mount;
|
||||
pub mod syscall;
|
||||
mod utils;
|
||||
|
@ -3,8 +3,8 @@ use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use crate::{
|
||||
arch::asm::current::current_pcb,
|
||||
filesystem::vfs::file::FileDescriptorVec,
|
||||
filesystem::vfs::io::SeekFrom,
|
||||
include::bindings::bindings::{verify_area, AT_REMOVEDIR, PAGE_4K_SIZE, PROC_MAX_FD_NUM},
|
||||
io::SeekFrom,
|
||||
kerror,
|
||||
syscall::{Syscall, SystemError},
|
||||
time::TimeSpec,
|
||||
|
@ -29,7 +29,6 @@ mod include;
|
||||
mod driver; // 如果driver依赖了libs,应该在libs后面导出
|
||||
mod exception;
|
||||
mod filesystem;
|
||||
mod io;
|
||||
mod ipc;
|
||||
mod mm;
|
||||
mod net;
|
||||
|
@ -10,7 +10,7 @@ use elf::{endian::AnyEndian, file::FileHeader, segment::ProgramHeader};
|
||||
use crate::{
|
||||
arch::MMArch,
|
||||
current_pcb,
|
||||
io::SeekFrom,
|
||||
filesystem::vfs::io::SeekFrom,
|
||||
kerror,
|
||||
libs::align::page_align_up,
|
||||
mm::{
|
||||
|
@ -4,7 +4,7 @@ use core::mem::size_of;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use crate::{io::SeekFrom, syscall::SystemError};
|
||||
use crate::{filesystem::vfs::io::SeekFrom, syscall::SystemError};
|
||||
|
||||
/// @brief 本模块用于为数组提供游标的功能,以简化其操作。
|
||||
#[derive(Debug)]
|
||||
|
@ -3,11 +3,11 @@ use core::{fmt::Debug, ptr::null};
|
||||
use alloc::{collections::BTreeMap, string::String, sync::Arc, vec::Vec};
|
||||
|
||||
use crate::{
|
||||
filesystem::vfs::io::SeekFrom,
|
||||
filesystem::vfs::{
|
||||
file::{File, FileMode},
|
||||
ROOT_INODE,
|
||||
},
|
||||
io::SeekFrom,
|
||||
libs::elf::ELF_LOADER,
|
||||
mm::{
|
||||
ucontext::{AddressSpace, UserStack},
|
||||
|
@ -7,6 +7,7 @@ use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use crate::{
|
||||
arch::{cpu::cpu_reset, MMArch},
|
||||
filesystem::vfs::io::SeekFrom,
|
||||
filesystem::vfs::{
|
||||
fcntl::FcntlCommand,
|
||||
file::FileMode,
|
||||
@ -14,7 +15,6 @@ use crate::{
|
||||
MAX_PATHLEN,
|
||||
},
|
||||
include::bindings::bindings::{pid_t, PAGE_2M_SIZE, PAGE_4K_SIZE},
|
||||
io::SeekFrom,
|
||||
kinfo,
|
||||
libs::align::page_align_up,
|
||||
mm::{verify_area, MemoryManagementArch, VirtAddr},
|
||||
|
Loading…
x
Reference in New Issue
Block a user