2 releases
0.1.1 | Jul 18, 2024 |
---|---|
0.1.0 | Jul 18, 2024 |
#374 in Operating systems
1,256 downloads per month
Used in 2 crates
22KB
404 lines
axfs_crates
Crates for building filesystems:
- axfs_vfs: Virtual filesystem interfaces.
- axfs_devfs: Device filesystem.
- axfs_ramfs: RAM filesystem.
lib.rs
:
Virtual filesystem interfaces used by ArceOS.
A filesystem is a set of files and directories (symbol links are not
supported currently), collectively referred to as nodes, which are
conceptually similar to inodes in Linux. A file system needs to implement
the VfsOps
trait, its files and directories need to implement the
VfsNodeOps
trait.
The VfsOps
trait provides the following operations on a filesystem:
mount()
: Do something when the filesystem is mounted.umount()
: Do something when the filesystem is unmounted.format()
: Format the filesystem.statfs()
: Get the attributes of the filesystem.root_dir()
: Get root directory of the filesystem.
The VfsNodeOps
trait provides the following operations on a file or a
directory:
Operation | Description | file/directory |
---|---|---|
open() |
Do something when the node is opened | both |
release() |
Do something when the node is closed | both |
get_attr() |
Get the attributes of the node | both |
read_at() |
Read data from the file | file |
write_at() |
Write data to the file | file |
fsync() |
Synchronize the file data to disk | file |
truncate() |
Truncate the file | file |
parent() |
Get the parent directory | directory |
lookup() |
Lookup the node with the given path | directory |
create() |
Create a new node with the given path | directory |
remove() |
Remove the node with the given path | directory |
read_dir() |
Read directory entries | directory |
Dependencies
~205KB