mounts

package
v0.1.0-proto2g Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mounts bootstraps the virtual filesystem hierarchy during Phase 0 of a PID-1 boot (GAPI-DIV-027), before cgroups or the event bus exist. Ordering is load-bearing: cgroups v2 assumes the hierarchy at /sys/fs/cgroup. Container environments where the OCI runtime owns the mounts skip the phase via --no-early-mounts; the executor is also idempotent over premounted targets.

Index

Constants

This section is empty.

Variables

View Source
var EarlyMounts = []MountSpec{
	{"devtmpfs", "/dev", "devtmpfs", flagNoSuid, ""},
	{"proc", "/proc", "proc", flagNoSuid | flagNoDev | flagNoExec, ""},
	{"sysfs", "/sys", "sysfs", flagNoSuid | flagNoDev | flagNoExec, ""},
	{"cgroup2", "/sys/fs/cgroup", "cgroup2", flagNoSuid | flagNoDev | flagNoExec | flagRelatime, ""},
	{"tmpfs", "/run", "tmpfs", flagNoSuid | flagNoDev, "mode=0755"},
	{"tmpfs", "/tmp", "tmpfs", flagNoSuid | flagNoDev, ""},
}

EarlyMounts is the Phase-0 mount table (gapi-architecture.md).

Functions

func MountEarly

func MountEarly(m Mounter, specs []MountSpec) error

MountEarly executes specs in declared order, skipping targets that are already mounted and failing closed on the first error - continuing past a missing /proc corrupts everything after it.

Types

type MountSpec

type MountSpec struct {
	Source  string
	Target  string
	FSType  string
	Flags   uintptr
	Options string
}

MountSpec is one early mount.

type Mounter

type Mounter interface {
	Mount(source, target, fstype string, flags uintptr, data string) error
	IsMounted(target string) (bool, error)
	MkdirAll(path string) error
}

Mounter is the syscall surface, injectable so ordering and idempotence are unit-testable unprivileged.

type SysMounter

type SysMounter struct{}

SysMounter is the real mount(2) surface.

func (SysMounter) IsMounted

func (SysMounter) IsMounted(target string) (bool, error)

IsMounted scans /proc/self/mountinfo for the target; when /proc is not yet mounted (the true cold-boot case) nothing is mounted, and the scan failing with not-exist reports exactly that.

func (SysMounter) MkdirAll

func (SysMounter) MkdirAll(path string) error

func (SysMounter) Mount

func (SysMounter) Mount(source, target, fstype string, flags uintptr, data string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL