Expand description
VFS root directory plumbing.
The interpreter is agnostic about how a VFS came to exist — it only
cares about the directory on disk that backs it. Vfs carries that
path and, when the interpreter allocated it, owns cleanup.
It also carries the capability handle every guest path is opened through. The root is opened once with ambient authority at construction; from then on every host function resolves against that handle, so a symlink pointing out of the root is refused by the kernel rather than checked for.
A VFS may also carry mounts: other directories (named volumes) grafted at
fixed guest paths below the root. Each has its own handle, access mode and
size limit, and a guest path is routed to exactly one of them by
Vfs::locate before anything is opened.
Structs§
- Mount
- A named volume grafted at a guest path below the root.
- Mount
Spec - What the server hands
Vfs::with_mount: a volume it has resolved by name. - Placement
- The volume a resolved guest path lives in: where writes are charged and whether they are allowed at all.
- Vfs
Enums§
- Access
- Whether guest code may change what a volume holds.
- Copy
DirError - Why
copy_host_dirstopped. - Mount
Error - Why a mount could not be added.
- VfsMode
- Which blueprint VFS mode this directory backs. Kept independent of the
submilli-blueprintenum so the interpreter doesn’t depend on that crate; the server maps one onto the other.
Constants§
- MAX_
MEASURED_ DEPTH - How many directories deep below the root [
for_each_regular_file] descends before it gives up, which bounds the directories it holds open at once. - MAX_
MOUNTS - The most mounts one VFS carries; routing a path scans them all. The blueprint
parser caps
vfs.mountsat the same number (submilli_blueprint::MAX_MOUNTS) so a valid blueprint never reaches this; it holds for direct embedders.
Functions§
- copy_
host_ dir - Copies the host directory
fromtoto, adding the bytes copied tobytesand stopping once they passcap. - copy_
host_ subdir - As
copy_host_dir, for the directorysubbelow the volumevolume, copied toto_root/sub.subis walked without following links, so one that is a link, or passes through one, is refused.to_rootis made either way; asubthat is not involumecopies nothing. - measure_
dir - The bytes held by regular files under
root; see [for_each_regular_file]. - measure_
host_ dir - The bytes held by regular files under the host directory
root, as a size limit starting from it counts them. The error carries no host path; a tree with too many entries or nested too deep isio::ErrorKind::InvalidData. - measure_
host_ dir_ skipping_ vanished - As
measure_host_dir, but an entry removed mid-walk is not counted instead of failing the measure: for a tree being copied, never for a size limit’s accounting. - measure_
host_ subdir_ skipping_ vanished - As
measure_host_dir_skipping_vanished, for the directorysubbelow the volumevolume, which is no link all the way down. Asubthat is not there is empty. - open_
host_ subdir - Opens the directory
subbelow the host directoryvolume, one component at a time without following links, so a link anywhere insubis an error.Nonewhen a component is not there.submust be relative with no.or... - regular_
files - Every regular file under
rootand its size, as a removal of the tree frees them; more thanmax_entriesentries is anio::ErrorKind::InvalidDataerror.