diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-08 01:50:38 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-08 01:54:48 +0900 |
| commit | acffa76812eb2972f2478b55fe2ba1e0ae8fa41d (patch) | |
| tree | 68b96726d3a2258b7128cfa9763f982c3350037f /container/mount.go | |
| parent | 8da76483e697f0a93577c8d661b6db274213a62c (diff) | |
container/ops: implement overlay op
There are significant limitations to using the overlay mount, and the implementation in the kernel is quite quirky. For now the Op is quite robust, however a higher level interface for it has not been decided yet.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/mount.go')
| -rw-r--r-- | container/mount.go | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/container/mount.go b/container/mount.go index 821cdc0e..873f69c8 100644 --- a/container/mount.go +++ b/container/mount.go @@ -40,6 +40,9 @@ const ( // SourceMqueue is used when mounting mqueue. // Note that any source value is allowed when fstype is [FstypeMqueue]. SourceMqueue = "mqueue" + // SourceOverlay is used when mounting overlay. + // Note that any source value is allowed when fstype is [FstypeOverlay]. + SourceOverlay = "overlay" // SourceTmpfsRootfs is used when mounting the tmpfs instance backing the intermediate root. SourceTmpfsRootfs = "rootfs" @@ -66,6 +69,29 @@ const ( // FstypeMqueue represents the mqueue pseudo-filesystem. // This filesystem type is usually mounted on /dev/mqueue. FstypeMqueue = "mqueue" + // FstypeOverlay represents the overlay pseudo-filesystem. + // This filesystem type can be mounted anywhere in the container filesystem. + FstypeOverlay = "overlay" + + // OptionOverlayLowerdir represents the lowerdir option of the overlay pseudo-filesystem. + // Any filesystem, does not need to be on a writable filesystem. + OptionOverlayLowerdir = "lowerdir" + // OptionOverlayUpperdir represents the upperdir option of the overlay pseudo-filesystem. + // The upperdir is normally on a writable filesystem. + OptionOverlayUpperdir = "upperdir" + // OptionOverlayWorkdir represents the workdir option of the overlay pseudo-filesystem. + // The workdir needs to be an empty directory on the same filesystem as upperdir. + OptionOverlayWorkdir = "workdir" + // OptionOverlayUserxattr represents the userxattr option of the overlay pseudo-filesystem. + // Use the "user.overlay." xattr namespace instead of "trusted.overlay.". + OptionOverlayUserxattr = "userxattr" + + // SpecialOverlayEscape is the escape string for overlay mount options. + SpecialOverlayEscape = `\` + // SpecialOverlayOption is the separator string between overlay mount options. + SpecialOverlayOption = "," + // SpecialOverlayPath is the separator string between overlay paths. + SpecialOverlayPath = ":" ) // bindMount mounts source on target and recursively applies flags if MS_REC is set. @@ -199,8 +225,8 @@ func escapeOverlayDataSegment(s string) string { } return strings.NewReplacer( - `\`, `\\`, - `,`, `\,`, - `:`, `\:`, + SpecialOverlayEscape, SpecialOverlayEscape+SpecialOverlayEscape, + SpecialOverlayOption, SpecialOverlayEscape+SpecialOverlayOption, + SpecialOverlayPath, SpecialOverlayEscape+SpecialOverlayPath, ).Replace(s) } |
