Skip to main content

Module vfs

Module vfs 

Source
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.
MountSpec
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.
CopyDirError
Why copy_host_dir stopped.
MountError
Why a mount could not be added.
VfsMode
Which blueprint VFS mode this directory backs. Kept independent of the submilli-blueprint enum 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.mounts at 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 from to to, adding the bytes copied to bytes and stopping once they pass cap.
copy_host_subdir
As copy_host_dir, for the directory sub below the volume volume, copied to to_root/sub. sub is walked without following links, so one that is a link, or passes through one, is refused. to_root is made either way; a sub that is not in volume copies 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 is io::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 directory sub below the volume volume, which is no link all the way down. A sub that is not there is empty.
open_host_subdir
Opens the directory sub below the host directory volume, one component at a time without following links, so a link anywhere in sub is an error. None when a component is not there. sub must be relative with no . or ...
regular_files
Every regular file under root and its size, as a removal of the tree frees them; more than max_entries entries is an io::ErrorKind::InvalidData error.