Expand description
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 |
Modules§
- path
- Utilities for path manipulation.
Macros§
- impl_
vfs_ dir_ default - When implement
VfsNodeOps
on a directory node, add dummy file operations that just return an error. - impl_
vfs_ non_ dir_ default - When implement
VfsNodeOps
on a non-directory node, add dummy directory operations that just return an error.
Structs§
- File
System Info - Filesystem attributes.
- VfsDir
Entry - Directory entry.
- VfsNode
Attr - Node (file/directory) attributes.
- VfsNode
Perm - Node (file/directory) permission mode.
Enums§
- VfsNode
Type - Node (file/directory) type.
Traits§
- VfsNode
Ops - Node (file/directory) operations.
- VfsOps
- Filesystem operations.
Type Aliases§
- VfsError
- Alias of [
AxError
]. - VfsNode
Ref - A wrapper of
Arc<dyn VfsNodeOps>
. - VfsResult
- Alias of [
AxResult
].