diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-01 23:32:38 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-01 23:32:38 +0900 |
| commit | 1dc780bca737610196ed58644b3ba61edc8acc48 (patch) | |
| tree | 3768d928282b5aa8a98e920bfce8a07b1a098568 /container/mount.go | |
| parent | ec33061c925f0f02897158db2b21a7ebfee71cc6 (diff) | |
container/mount: separate remount from bind
Remount turns out to be useful in other places.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/mount.go')
| -rw-r--r-- | container/mount.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/container/mount.go b/container/mount.go index 12093d47..024b9829 100644 --- a/container/mount.go +++ b/container/mount.go @@ -10,6 +10,7 @@ import ( "hakurei.app/container/vfs" ) +// bindMount mounts source on target and recursively applies flags if MS_REC is set. func (p *procPaths) bindMount(source, target string, flags uintptr, eq bool) error { if eq { msg.Verbosef("resolved %q flags %#x", target, flags) @@ -22,6 +23,11 @@ func (p *procPaths) bindMount(source, target string, flags uintptr, eq bool) err fmt.Sprintf("cannot mount %q on %q:", source, target)) } + return p.remount(target, flags) +} + +// remount applies flags on target, recursively if MS_REC is set. +func (p *procPaths) remount(target string, flags uintptr) error { var targetFinal string if v, err := filepath.EvalSymlinks(target); err != nil { return wrapErrSelf(err) @@ -83,6 +89,7 @@ func (p *procPaths) bindMount(source, target string, flags uintptr, eq bool) err }) } +// remountWithFlags remounts mount point described by [vfs.MountInfoNode]. func remountWithFlags(n *vfs.MountInfoNode, mf uintptr) error { kf, unmatched := n.Flags() if len(unmatched) != 0 { |
