aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/inittmpfs.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-21 21:59:07 +0900
committerOphestra <cat@gensokyo.uk>2025-08-22 19:27:31 +0900
commit09d284498109b847da0da1e2c5f883268a7f2d46 (patch)
tree3784dee4b4e4ec97a95cb222c70d05463ae640ef /container/inittmpfs.go
parentd500d6e55917e12a3f98b39cf0d29b6c96de9667 (diff)
container/init: wrap syscall helper functions
This allows tests to stub all kernel behaviour, enabling measurement of all function call arguments and error injection. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/inittmpfs.go')
-rw-r--r--container/inittmpfs.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/container/inittmpfs.go b/container/inittmpfs.go
index d313a111..0d50e463 100644
--- a/container/inittmpfs.go
+++ b/container/inittmpfs.go
@@ -3,6 +3,7 @@ package container
import (
"encoding/gob"
"fmt"
+ "io/fs"
"math"
"os"
. "syscall"
@@ -31,13 +32,13 @@ type MountTmpfsOp struct {
Perm os.FileMode
}
-func (t *MountTmpfsOp) Valid() bool { return t != nil && t.Path != nil && t.FSName != zeroString }
-func (t *MountTmpfsOp) early(*setupState) error { return nil }
-func (t *MountTmpfsOp) apply(*setupState) error {
+func (t *MountTmpfsOp) Valid() bool { return t != nil && t.Path != nil && t.FSName != zeroString }
+func (t *MountTmpfsOp) early(*setupState, syscallDispatcher) error { return nil }
+func (t *MountTmpfsOp) apply(_ *setupState, k syscallDispatcher) error {
if t.Size < 0 || t.Size > math.MaxUint>>1 {
- return msg.WrapErr(EBADE, fmt.Sprintf("size %d out of bounds", t.Size))
+ return msg.WrapErr(fs.ErrInvalid, fmt.Sprintf("size %d out of bounds", t.Size))
}
- return mountTmpfs(t.FSName, toSysroot(t.Path.String()), t.Flags, t.Size, t.Perm)
+ return k.mountTmpfs(t.FSName, toSysroot(t.Path.String()), t.Flags, t.Size, t.Perm)
}
func (t *MountTmpfsOp) Is(op Op) bool {