Crate axfs_vfs

Source
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:

OperationDescriptionfile/directory
open()Do something when the node is openedboth
release()Do something when the node is closedboth
get_attr()Get the attributes of the nodeboth
read_at()Read data from the filefile
write_at()Write data to the filefile
fsync()Synchronize the file data to diskfile
truncate()Truncate the filefile
parent()Get the parent directorydirectory
lookup()Lookup the node with the given pathdirectory
create()Create a new node with the given pathdirectory
remove()Remove the node with the given pathdirectory
read_dir()Read directory entriesdirectory

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§

FileSystemInfo
Filesystem attributes.
VfsDirEntry
Directory entry.
VfsNodeAttr
Node (file/directory) attributes.
VfsNodePerm
Node (file/directory) permission mode.

Enums§

VfsNodeType
Node (file/directory) type.

Traits§

VfsNodeOps
Node (file/directory) operations.
VfsOps
Filesystem operations.

Type Aliases§

VfsError
Alias of [AxError].
VfsNodeRef
A wrapper of Arc<dyn VfsNodeOps>.
VfsResult
Alias of [AxResult].