Extract mount into pkg.
Mount is self contained and generic, it should be in pkg, to allow other pkg modules to use it. Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
This commit is contained in:
parent
c23d7367a7
commit
3c878aefe8
9 changed files with 798 additions and 0 deletions
21
mount/mounter_linux.go
Normal file
21
mount/mounter_linux.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package mount
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func mount(device, target, mType string, flag uintptr, data string) error {
|
||||
if err := syscall.Mount(device, target, mType, flag, data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// If we have a bind mount or remount, remount...
|
||||
if flag&syscall.MS_BIND == syscall.MS_BIND && flag&syscall.MS_RDONLY == syscall.MS_RDONLY {
|
||||
return syscall.Mount(device, target, mType, flag|syscall.MS_REMOUNT, data)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func unmount(target string, flag int) error {
|
||||
return syscall.Unmount(target, flag)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue