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
- Utilities for path manipulation.
Macros
- When implement
VfsNodeOpson a directory node, add dummy file operations that just return an error. - When implement
VfsNodeOpson a non-directory node, add dummy directory operations that just return an error.
Structs
- Filesystem attributes.
- Directory entry.
- Node (file/directory) attributes.
- Node (file/directory) permission mode.
Enums
- Node (file/directory) type.
Traits
- Node (file/directory) operations.
- Filesystem operations.
Type Aliases
- Alias of
AxError. - A wrapper of
Arc<dyn VfsNodeOps>. - Alias of
AxResult.