Skip to main content

serve_local

Function serve_local 

Source
pub fn serve_local(fs: VfsFileSystem, mountpoint: &Path) -> Result<()>
Expand description

Mount fs at mountpoint as a real host directory via the kernel fusedev transport (/dev/fuse), blocking until the mount is torn down (unmounted, or the kernel closes the FUSE device).

This is the non-VM counterpart to serve: the same transport-agnostic VfsFileSystem down-adapter (SandboxFs::into_filesystem), served as a plain POSIX directory instead of a vhost-user-fs virtio-fs share. It exists so backends that cannot attach a virtio-fs device — `podman run –rootfs

` (#617) and `systemd-nspawn --directory=` — can consume the same composed per-sandbox namespace the kata/CH path uses, instead of side-channeling their own image provisioning (spine violation, epic #508).

mountpoint must already exist as a directory; this function does not create it. The mount is torn down when [FuseSession] is dropped (which happens when this function returns, on any exit path) or when the kernel unmounts it out from under us (e.g. fusermount3 -u, or the guest killing the process).

Open question (tracked by #653, resolution deferred to #617): rootless FUSE (unprivileged /dev/fuse access via fusermount3) combined with podman’s --userns=keep-id has not been validated here — this function mounts via the same kernel /dev/fuse + fusermount3 path fuse-backend-rs uses for any fusedev consumer, but whether that composition works unprivileged under keep-id user-namespace remapping is unresolved and out of scope for this change.

Run this on a dedicated thread; like serve, it blocks until the session ends.