github.com/xuyutom/docker@v1.6.0/pkg/mount/mounter_linux.go (about)

     1  package mount
     2  
     3  import (
     4  	"syscall"
     5  )
     6  
     7  func mount(device, target, mType string, flag uintptr, data string) error {
     8  	if err := syscall.Mount(device, target, mType, flag, data); err != nil {
     9  		return err
    10  	}
    11  
    12  	// If we have a bind mount or remount, remount...
    13  	if flag&syscall.MS_BIND == syscall.MS_BIND && flag&syscall.MS_RDONLY == syscall.MS_RDONLY {
    14  		return syscall.Mount(device, target, mType, flag|syscall.MS_REMOUNT, data)
    15  	}
    16  	return nil
    17  }
    18  
    19  func unmount(target string, flag int) error {
    20  	return syscall.Unmount(target, flag)
    21  }