aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/container.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-11 02:52:32 +0900
committerOphestra <cat@gensokyo.uk>2025-08-11 04:56:42 +0900
commite99d7affb0c128fa82722f9b3d79c99b5e5918cd (patch)
tree387e08d6c4363d8b9e0462f069c140fbdb15c917 /hst/container.go
parent41ac2be9658b49c68cb793f3a6f0c5932d82e1c2 (diff)
container: use absolute for pathname
This is simultaneously more efficient and less error-prone. This change caused minor API changes in multiple other packages. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/container.go')
-rw-r--r--hst/container.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/hst/container.go b/hst/container.go
index ebce07b9..0b51e101 100644
--- a/hst/container.go
+++ b/hst/container.go
@@ -3,14 +3,11 @@ package hst
import (
"time"
+ "hakurei.app/container"
"hakurei.app/container/seccomp"
)
const (
- // SourceTmpfs causes tmpfs to be mounted on [FilesystemConfig.Dst]
- // when assigned to [FilesystemConfig.Src].
- SourceTmpfs = "tmpfs"
-
// TmpfsPerm is the permission bits for tmpfs mount points
// configured through [FilesystemConfig].
TmpfsPerm = 0755
@@ -55,18 +52,18 @@ type (
// pass through all devices
Device bool `json:"device,omitempty"`
// container host filesystem bind mounts
- Filesystem []*FilesystemConfig `json:"filesystem"`
+ Filesystem []FilesystemConfig `json:"filesystem"`
// create symlinks inside container filesystem
- Link [][2]string `json:"symlink"`
+ Link []LinkConfig `json:"symlink"`
// automatically bind mount top-level directories to container root;
// the zero value disables this behaviour
- AutoRoot string `json:"auto_root,omitempty"`
+ AutoRoot *container.Absolute `json:"auto_root,omitempty"`
// extra flags for AutoRoot
RootFlags int `json:"root_flags,omitempty"`
// read-only /etc directory
- Etc string `json:"etc,omitempty"`
+ Etc *container.Absolute `json:"etc,omitempty"`
// automatically set up /etc symlinks
AutoEtc bool `json:"auto_etc"`
}
@@ -74,9 +71,9 @@ type (
// FilesystemConfig is an abstract representation of a bind mount.
FilesystemConfig struct {
// mount point in container, same as src if empty
- Dst string `json:"dst,omitempty"`
+ Dst *container.Absolute `json:"dst,omitempty"`
// host filesystem path to make available to the container
- Src string `json:"src"`
+ Src *container.Absolute `json:"src"`
// do not mount filesystem read-only
Write bool `json:"write,omitempty"`
// do not disable device files
@@ -84,4 +81,12 @@ type (
// fail if the bind mount cannot be established for any reason
Must bool `json:"require,omitempty"`
}
+
+ LinkConfig struct {
+ // symlink target in container
+ Target *container.Absolute `json:"target"`
+ // linkname the symlink points to;
+ // prepend '*' to dereference an absolute pathname on host
+ Linkname string `json:"linkname"`
+ }
)