container/mount: separate remount from bind
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m5s
Test / Hakurei (push) Successful in 2m52s
Test / Sandbox (race detector) (push) Successful in 3m54s
Test / Hpkg (push) Successful in 3m59s
Test / Hakurei (race detector) (push) Successful in 4m34s
Test / Flake checks (push) Successful in 1m18s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m5s
Test / Hakurei (push) Successful in 2m52s
Test / Sandbox (race detector) (push) Successful in 3m54s
Test / Hpkg (push) Successful in 3m59s
Test / Hakurei (race detector) (push) Successful in 4m34s
Test / Flake checks (push) Successful in 1m18s
Remount turns out to be useful in other places. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
ec33061c92
commit
1dc780bca7
@ -10,6 +10,7 @@ import (
|
|||||||
"hakurei.app/container/vfs"
|
"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 {
|
func (p *procPaths) bindMount(source, target string, flags uintptr, eq bool) error {
|
||||||
if eq {
|
if eq {
|
||||||
msg.Verbosef("resolved %q flags %#x", target, flags)
|
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))
|
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
|
var targetFinal string
|
||||||
if v, err := filepath.EvalSymlinks(target); err != nil {
|
if v, err := filepath.EvalSymlinks(target); err != nil {
|
||||||
return wrapErrSelf(err)
|
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 {
|
func remountWithFlags(n *vfs.MountInfoNode, mf uintptr) error {
|
||||||
kf, unmatched := n.Flags()
|
kf, unmatched := n.Flags()
|
||||||
if len(unmatched) != 0 {
|
if len(unmatched) != 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user