diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-03 18:06:41 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-03 18:06:41 +0900 |
| commit | 15170735badf9c8c8f13840efcb70bf7ba192b4d (patch) | |
| tree | 09ac5185eee6db8d0c20d8872354f6c7c99e84da /container/mount.go | |
| parent | 6a3886e9db3745c50d75f064fd7bf456aaa0ec8c (diff) | |
container/mount: move tmpfs sysroot prefixing to caller
The mountTmpfs helper is a relatively low level function that is not exposed as part of the API. Prefixing sysroot here not only introduces overhead but is also quite error-prone.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/mount.go')
| -rw-r--r-- | container/mount.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/container/mount.go b/container/mount.go index fc0e177f..30ef7008 100644 --- a/container/mount.go +++ b/container/mount.go @@ -160,8 +160,9 @@ func remountWithFlags(n *vfs.MountInfoNode, mf uintptr) error { return nil } -func mountTmpfs(fsname, name string, flags uintptr, size int, perm os.FileMode) error { - target := toSysroot(name) +// mountTmpfs mounts tmpfs on target; +// callers who wish to mount to sysroot must pass the return value of toSysroot. +func mountTmpfs(fsname, target string, flags uintptr, size int, perm os.FileMode) error { if err := os.MkdirAll(target, parentPerm(perm)); err != nil { return wrapErrSelf(err) } @@ -171,7 +172,7 @@ func mountTmpfs(fsname, name string, flags uintptr, size int, perm os.FileMode) } return wrapErrSuffix( Mount(fsname, target, FstypeTmpfs, flags, opt), - fmt.Sprintf("cannot mount tmpfs on %q:", name)) + fmt.Sprintf("cannot mount tmpfs on %q:", target)) } func parentPerm(perm os.FileMode) os.FileMode { |
