aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-14 02:11:38 +0900
committerOphestra <cat@gensokyo.uk>2025-03-14 02:11:38 +0900
commita092b042abca15ce3ba9def9b502d8a7cb889c1b (patch)
treed08ce3dcae3707992050a2f98fc92382af854c6e
parente94b09d3372d9034c0da2142adb6293d2f6162eb (diff)
sandbox: pass params to setup ops
Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/sandbox/container.go2
-rw-r--r--internal/sandbox/init.go2
-rw-r--r--internal/sandbox/sequential.go6
3 files changed, 5 insertions, 5 deletions
diff --git a/internal/sandbox/container.go b/internal/sandbox/container.go
index 91db06ef..4f8be1df 100644
--- a/internal/sandbox/container.go
+++ b/internal/sandbox/container.go
@@ -90,7 +90,7 @@ type (
Ops []Op
Op interface {
- apply() error
+ apply(params *InitParams) error
Is(op Op) bool
fmt.Stringer
diff --git a/internal/sandbox/init.go b/internal/sandbox/init.go
index 1b9bbf8e..83bb1686 100644
--- a/internal/sandbox/init.go
+++ b/internal/sandbox/init.go
@@ -126,7 +126,7 @@ func Init(exit func(code int)) {
for i, op := range *params.Ops {
fmsg.Verbosef("mounting %s", op)
- if err := op.apply(); err != nil {
+ if err := op.apply(&params.InitParams); err != nil {
fmsg.PrintBaseError(err,
fmt.Sprintf("cannot apply op %d:", i))
exit(1)
diff --git a/internal/sandbox/sequential.go b/internal/sandbox/sequential.go
index 445ae8f8..75d62685 100644
--- a/internal/sandbox/sequential.go
+++ b/internal/sandbox/sequential.go
@@ -20,7 +20,7 @@ type BindMount struct {
Flags int
}
-func (b *BindMount) apply() error {
+func (b *BindMount) apply(*InitParams) error {
if !path.IsAbs(b.Source) || !path.IsAbs(b.Target) {
return fmsg.WrapError(syscall.EBADE,
"path is not absolute")
@@ -47,7 +47,7 @@ type MountProc struct {
Path string
}
-func (p *MountProc) apply() error {
+func (p *MountProc) apply(*InitParams) error {
if !path.IsAbs(p.Path) {
return fmsg.WrapError(syscall.EBADE,
fmt.Sprintf("path %q is not absolute", p.Path))
@@ -78,7 +78,7 @@ type MountTmpfs struct {
Perm os.FileMode
}
-func (t *MountTmpfs) apply() error {
+func (t *MountTmpfs) apply(*InitParams) error {
if !path.IsAbs(t.Path) {
return fmsg.WrapError(syscall.EBADE,
fmt.Sprintf("path %q is not absolute", t.Path))