Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
e4f67d1
fix: getdents
Oct 10, 2024
5baf6cb
test: add test harness
Oct 10, 2024
e01d516
fix: openat directory flag
Oct 16, 2024
8a18da3
fix: open with absolute path
Oct 16, 2024
d99b6c9
refactor: define AbsPath and RelPath type
Oct 16, 2024
ec5095e
refactor: devfs use new path defs
Oct 16, 2024
86a14b3
refactor: ramfs use new path defs
Oct 24, 2024
fc064b8
fix: ruxfs api and posix api
Oct 28, 2024
90128f8
refactor: implement simple ruxfs operations
Oct 29, 2024
f90c2ea
refacotr: fs posix api
Oct 31, 2024
07e55ce
fix: root directory lookup path
Oct 31, 2024
ff00a8b
feat: rmdir mkdirat unlink unlinkat api
Oct 31, 2024
8265722
fix: unlinkat with removedir
Nov 6, 2024
50977bb
test: use specific test dir
Nov 7, 2024
f5d3a63
feat: support fatfs and ext4 fs
Nov 14, 2024
d51a242
feat: make ext4 fs scripts
Nov 14, 2024
ed5d31c
fix: path canonicalization
Nov 18, 2024
840dbdd
feat: vfs add link and setattr fn
Nov 18, 2024
6acc1c3
fix: ramfs and devfs support new vfs trait
Nov 18, 2024
c9c8ee6
refactor: ruxfs and posix_api compats with new vfs
Nov 21, 2024
c392acc
feat: add inode number in vfsattr
Nov 21, 2024
8af1c3e
refactor: remove fops with relative path
Nov 25, 2024
e3e07e3
fix: path lifetime
Nov 27, 2024
abf3a6c
refactor: filelike path method
Nov 27, 2024
0e806a0
refactor: fs posix api with absolute path
Nov 27, 2024
0b37197
fix: FileLike stat
Nov 28, 2024
8cf6918
feat: directory check empty
Nov 28, 2024
2bef77f
fix: unlinkat
Nov 28, 2024
41879f9
Update ruxfs dependencies
Nov 28, 2024
0e58f4e
fix: blkfs features
Nov 28, 2024
52247a2
feat: ruxfs high-level api
Nov 28, 2024
b80d765
feat: fs arceos api
Nov 28, 2024
c9c0963
feat: axstd fs api
Nov 28, 2024
a98c3e7
fix: devfs and ramfs lookup
Nov 28, 2024
454bb3d
doc: axfs_vfs and ruxfs doc comments
Nov 28, 2024
01e9eee
fix: remove harness from workspace
Nov 28, 2024
4a99179
refactor: remove test harness
Feb 15, 2025
18bc4a9
fix: incompatible interfaces
Feb 19, 2025
3e55f9e
style: ruxos_posix_api fs syscalls
Feb 20, 2025
c99c128
fix: make fs img
Feb 26, 2025
e8d90f6
fix: ruxruntime fs test
Feb 26, 2025
aa5895a
fix: unit test
Feb 27, 2025
790e423
fix: clippy
Feb 27, 2025
ee46070
fix: aarch64 & riscv64 openat
Feb 27, 2025
8c699bc
fix: build fs shell
Feb 27, 2025
9c9b775
fix: build iperf & redis
Feb 27, 2025
e3fdd09
fix: log dep version
Feb 27, 2025
e14b5fb
fix: temporarily remove lwext4_rust
Mar 4, 2025
287ed72
fix: update another_ext4 dep
Mar 4, 2025
c20a832
style: cargo format all
Mar 4, 2025
0f85878
fix: docs
Mar 4, 2025
f883f12
Merge branch 'dev'
Mar 4, 2025
b18325e
fix: getdents
Mar 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: support fatfs and ext4 fs
  • Loading branch information
liujingx committed Feb 19, 2025
commit f5d3a63b0e0bf517df058a009f09016f56d68c63
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/ruxfeat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ fs = ["alloc", "dep:ruxfs", "ruxruntime/fs"]
blkfs = ["ruxdriver/virtio-blk", "ruxruntime/blkfs"]
myfs = ["ruxfs?/myfs"]
9pfs = []
fatfs = ["ruxfs?/fatfs"]
lwext4_rust = ["ruxfs?/lwext4_rust"]
ext4_rs = ["ruxfs?/ext4_rs"]
another_ext4 = ["ruxfs?/another_ext4"]

# Networking
net = ["alloc", "ruxdriver/virtio-net", "dep:ruxnet", "ruxruntime/net"]
Expand Down
11 changes: 5 additions & 6 deletions apps/custom/harness/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#![no_std]
#![no_main]

use axstd::println;
use core::{clone::Clone, format_args, panic};
use core::{clone::Clone, panic};
use core::{ffi::c_void, mem::size_of};
use km_command::{fs::LibcDirent, FromBytes};
use km_harness::{executor, harness_command, Command, Harness, MemPort};
use ruxos_posix_api::{
ctypes::dirent, sys_chdir, sys_close, sys_dup, sys_fstat, sys_getcwd, sys_getdents64,
sys_mkdirat, sys_openat, sys_unlinkat,
sys_mkdirat, sys_openat, sys_unlinkat
};

/// Size of harness buffer.
Expand Down Expand Up @@ -126,9 +125,9 @@ executor!(

#[no_mangle]
fn main() {
println!("CMD_BUF at {:p}", unsafe { CMD_BUF.as_ptr() });
println!("RETV_BUF at {:p}", unsafe { RETV_BUF.as_ptr() });
println!("OUTPUT_BUF at {:p}", unsafe { OUTPUT_BUF.as_ptr() });
log::warn!("CMD_BUF at {:p}", unsafe { CMD_BUF.as_ptr() });
log::warn!("RETV_BUF at {:p}", unsafe { RETV_BUF.as_ptr() });
log::warn!("OUTPUT_BUF at {:p}", unsafe { OUTPUT_BUF.as_ptr() });

// Make test directory.
let test_dir = b"test\0" as *const _ as *const i8;
Expand Down
8 changes: 8 additions & 0 deletions modules/ruxfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ procfs = ["dep:axfs_ramfs"]
sysfs = ["dep:axfs_ramfs"]
etcfs = ["dep:axfs_ramfs"]
fatfs = ["dep:fatfs"]
lwext4_rust = ["dep:lwext4_rust"]
ext4_rs = ["dep:ext4_rs"]
another_ext4 = ["dep:another_ext4"]
# myfs = ["dep:crate_interface"]
myfs = []
use-ramdisk = []
Expand All @@ -43,6 +46,11 @@ memory_addr = "0.1.0"

ruxdriver = { path = "../ruxdriver", features = ["block"] }
axalloc = { path = "../axalloc", optional = true }
memory_addr = "0.1.0"
lwext4_rust = { path = "../../crates/lwext4_rust", optional = true }
ext4_rs = { git = "https://github.com/yuoo655/ext4_rs.git", rev= "6bcc7f5", optional = true }
another_ext4 = { git = "https://github.com/LJxTHUCS/another_ext4.git", optional = true }

[dependencies.fatfs]
git = "https://github.com/syswonder/rust-fatfs.git"
rev = "bf8ad02"
Expand Down
24 changes: 24 additions & 0 deletions modules/ruxfs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,30 @@ impl Disk {
Ok(write_size)
}

/// Read a single block starting from the specified offset.
#[allow(unused)]
pub fn read_offset(&mut self, offset: usize) -> [u8; BLOCK_SIZE] {
let block_id = offset / BLOCK_SIZE;
let mut block_data = [0u8; BLOCK_SIZE];
self.dev
.read_block(block_id as u64, &mut block_data)
.unwrap();
block_data
}

/// Write single block starting from the specified offset.
#[allow(unused)]
pub fn write_offset(&mut self, offset: usize, buf: &[u8]) -> DevResult<usize> {
assert!(
buf.len() == BLOCK_SIZE,
"Buffer length must be equal to BLOCK_SIZE"
);
assert!(offset % BLOCK_SIZE == 0);
let block_id = offset / BLOCK_SIZE;
self.dev.write_block(block_id as u64, buf).unwrap();
Ok(buf.len())
}

///flush device cache
pub fn do_flush(&mut self) -> DevResult {
self.dev.flush()
Expand Down
Loading