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
fix: root directory lookup path
  • Loading branch information
liujingx committed Feb 19, 2025
commit 07e55ce200598201a356eaed47771d0736f2f0a3
13 changes: 9 additions & 4 deletions crates/axfs_vfs/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<'a> AbsPath<'a> {
}

/// Simply wrap a string into a `AbsPath`.
pub fn new_owned(path: String) -> Self {
pub const fn new_owned(path: String) -> Self {
Self(Cow::Owned(path))
}

Expand Down Expand Up @@ -128,14 +128,19 @@ impl core::fmt::Display for AbsPath<'_> {
pub struct RelPath<'a>(Cow<'a, str>);

impl<'a> RelPath<'a> {
/// Wrap a string into a `RelPath`.
pub fn new(path: &'a str) -> Self {
/// Simply wrap a string into a `RelPath`.
pub const fn new(path: &'a str) -> Self {
Self(Cow::Borrowed(path))
}

/// Wrap a string into a `RelPath` with possibly leading '/' trimmed.
pub fn new_trimmed(path: &'a str) -> Self {
Self(Cow::Borrowed(path.trim_start_matches('/')))
}

/// Parse and canonicalize a relative path from a string.
pub fn new_canonicalized(path: &str) -> Self {
Self(Cow::Owned(canonicalize(path.trim_start_matches("/"))))
Self(Cow::Owned(canonicalize(path.trim_start_matches('/'))))
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/ruxfs/src/fops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use axerrno::{ax_err, ax_err_type, AxResult};
use axfs_vfs::path::{AbsPath, RelPath};
use axfs_vfs::{VfsNodeRef, VfsNodeType, VfsNodeOps};
use axfs_vfs::{VfsError, VfsNodeOps, VfsNodeRef, VfsNodeType};
use axio::SeekFrom;
use capability::{Cap, WithCap};

Expand Down Expand Up @@ -212,7 +212,7 @@ impl File {
impl Directory {
/// Access the underlying `VfsNode`
fn access_node(&self) -> AxResult<&VfsNodeRef> {
self.node.access(Cap::EXECUTE).or(ax_err!(PermissionDenied))
self.node.access(Cap::EXECUTE).map_err(|_| VfsError::PermissionDenied)
}

/// Creates an opened directory.
Expand Down
2 changes: 1 addition & 1 deletion modules/ruxfs/src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl RootDirectory {
if max_len == 0 {
f(self.main_fs.clone(), path) // not matched any mount point
} else {
f(self.mounts[idx].fs.clone(), &RelPath::new(&path[max_len..])) // matched at `idx`
f(self.mounts[idx].fs.clone(), &RelPath::new_trimmed(&path[max_len..])) // matched at `idx`
}
}
}
Expand Down